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