annotate JackDevice/DeviceManagerJack.h @ 18:f1ff1a81be20 tip

Changed licenses names. Fixed one comment and usage text in CollidoscopeApp.cpp.
author Fiore Martin <f.martin@qmul.ac.uk>
date Thu, 25 Aug 2016 12:07:50 +0200
parents 75b744078d66
children
rev   line source
f@1 1 /*
f@1 2
f@5 3 Copyright (C) 2016 Queen Mary University of London
f@5 4 Author: Fiore Martin
f@1 5
f@5 6 This file is part of Collidoscope.
f@5 7
f@5 8 Collidoscope is free software: you can redistribute it and/or modify
f@5 9 it under the terms of the GNU General Public License as published by
f@5 10 the Free Software Foundation, either version 3 of the License, or
f@5 11 (at your option) any later version.
f@5 12
f@5 13 This program is distributed in the hope that it will be useful,
f@5 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
f@5 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f@5 16 GNU General Public License for more details.
f@5 17
f@5 18 You should have received a copy of the GNU General Public License
f@5 19 along with this program. If not, see <http://www.gnu.org/licenses/>.
f@5 20
f@5 21 This file incorporates work covered by the following copyright and permission notice:
f@5 22
f@5 23 Copyright (c) 2014, The Cinder Project
f@5 24
f@5 25 This code is intended to be used with the Cinder C++ library, http://libcinder.org
f@5 26
f@5 27 Redistribution and use in source and binary forms, with or without modification, are permitted provided that
f@5 28 the following conditions are met:
f@1 29
f@1 30 * Redistributions of source code must retain the above copyright notice, this list of conditions and
f@5 31 the following disclaimer.
f@1 32 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
f@5 33 the following disclaimer in the documentation and/or other materials provided with the distribution.
f@1 34
f@5 35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
f@5 36 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
f@5 37 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
f@5 38 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
f@5 39 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
f@5 40 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
f@5 41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
f@5 42 POSSIBILITY OF SUCH DAMAGE.
f@5 43
f@1 44 */
f@1 45
f@1 46 #pragma once
f@1 47
f@1 48 #include "cinder/audio/Device.h"
f@1 49
f@1 50 namespace cinder { namespace audio { namespace linux {
f@1 51
f@4 52 /**
f@4 53 * DeviceManager ( as in cinder::audio::DeviceManager ) that handle the hardware device through the jack library.
f@4 54 * Note that this is not suitable for general purpose use. Most of the functionalities are indeed hard coded
f@4 55 * just to suit Collidoscope needs. In particular only two input and two output ports are assumed.
f@4 56 *
f@4 57 */
f@1 58 class DeviceManagerJack : public DeviceManager {
f@1 59 public:
f@1 60
f@5 61 DeviceManagerJack();
f@5 62 virtual ~DeviceManagerJack();
f@1 63
f@5 64 const std::vector<DeviceRef>& getDevices() override;
f@5 65 DeviceRef getDefaultOutput() override;
f@5 66 DeviceRef getDefaultInput() override;
f@1 67
f@5 68 std::string getName( const DeviceRef &device ) override;
f@5 69 size_t getNumInputChannels( const DeviceRef &device ) override;
f@5 70 size_t getNumOutputChannels( const DeviceRef &device ) override;
f@5 71 size_t getSampleRate( const DeviceRef &device ) override;
f@5 72 size_t getFramesPerBlock( const DeviceRef &device ) override;
f@1 73
f@5 74 void setSampleRate( const DeviceRef &device, size_t sampleRate ) override;
f@5 75 void setFramesPerBlock( const DeviceRef &device, size_t framesPerBlock ) override;
f@1 76
f@5 77 //! Returns the hardware's actual frames per block, which might not be a power of two.
f@5 78 size_t getFramesPerBlockHardware( const DeviceRef &device );
f@1 79
f@1 80 private:
f@1 81
f@5 82 std::vector<DeviceRef> mDevices;
f@5 83 DeviceRef mDefaultOutDevice;
f@5 84 DeviceRef mDefaultInDevice;
f@1 85 size_t mSampleRate;
f@1 86 size_t mBufferSize;
f@5 87 };
f@1 88
f@5 89 } } } // namespace cinder::audio::linux