f@1: /* f@1: f@5: Copyright (C) 2016 Queen Mary University of London f@5: Author: Fiore Martin f@1: f@5: This file is part of Collidoscope. f@5: f@5: Collidoscope is free software: you can redistribute it and/or modify f@5: it under the terms of the GNU General Public License as published by f@5: the Free Software Foundation, either version 3 of the License, or f@5: (at your option) any later version. f@5: f@5: This program is distributed in the hope that it will be useful, f@5: but WITHOUT ANY WARRANTY; without even the implied warranty of f@5: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the f@5: GNU General Public License for more details. f@5: f@5: You should have received a copy of the GNU General Public License f@5: along with this program. If not, see . f@5: f@5: This file incorporates work covered by the following copyright and permission notice: f@5: f@5: Copyright (c) 2014, The Cinder Project f@5: f@5: This code is intended to be used with the Cinder C++ library, http://libcinder.org f@5: f@5: Redistribution and use in source and binary forms, with or without modification, are permitted provided that f@5: the following conditions are met: f@1: f@1: * Redistributions of source code must retain the above copyright notice, this list of conditions and f@5: the following disclaimer. f@1: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and f@5: the following disclaimer in the documentation and/or other materials provided with the distribution. f@1: f@5: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED f@5: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A f@5: PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR f@5: ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED f@5: TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) f@5: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING f@5: NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE f@5: POSSIBILITY OF SUCH DAMAGE. f@5: f@1: */ f@1: f@1: #pragma once f@1: f@1: #include "cinder/audio/Device.h" f@1: f@1: namespace cinder { namespace audio { namespace linux { f@1: f@4: /** f@4: * DeviceManager ( as in cinder::audio::DeviceManager ) that handle the hardware device through the jack library. f@4: * Note that this is not suitable for general purpose use. Most of the functionalities are indeed hard coded f@4: * just to suit Collidoscope needs. In particular only two input and two output ports are assumed. f@4: * f@4: */ f@1: class DeviceManagerJack : public DeviceManager { f@1: public: f@1: f@5: DeviceManagerJack(); f@5: virtual ~DeviceManagerJack(); f@1: f@5: const std::vector& getDevices() override; f@5: DeviceRef getDefaultOutput() override; f@5: DeviceRef getDefaultInput() override; f@1: f@5: std::string getName( const DeviceRef &device ) override; f@5: size_t getNumInputChannels( const DeviceRef &device ) override; f@5: size_t getNumOutputChannels( const DeviceRef &device ) override; f@5: size_t getSampleRate( const DeviceRef &device ) override; f@5: size_t getFramesPerBlock( const DeviceRef &device ) override; f@1: f@5: void setSampleRate( const DeviceRef &device, size_t sampleRate ) override; f@5: void setFramesPerBlock( const DeviceRef &device, size_t framesPerBlock ) override; f@1: f@5: //! Returns the hardware's actual frames per block, which might not be a power of two. f@5: size_t getFramesPerBlockHardware( const DeviceRef &device ); f@1: f@1: private: f@1: f@5: std::vector mDevices; f@5: DeviceRef mDefaultOutDevice; f@5: DeviceRef mDefaultInDevice; f@1: size_t mSampleRate; f@1: size_t mBufferSize; f@5: }; f@1: f@5: } } } // namespace cinder::audio::linux