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 @ 4:ab6db404403a
History | View | Annotate | Download (2.91 KB)
| 1 | 1:b5bcad8e7803 | f | /*
|
|---|---|---|---|
| 2 | Copyright (c) 2015, The Cinder Project
|
||
| 3 | |||
| 4 | This code is intended to be used with the Cinder C++ library, http://libcinder.org
|
||
| 5 | |||
| 6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
|
||
| 7 | the following conditions are met:
|
||
| 8 | |||
| 9 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||
| 10 | the following disclaimer.
|
||
| 11 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||
| 12 | the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||
| 13 | |||
| 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||
| 15 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||
| 16 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||
| 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||
| 18 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
| 19 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||
| 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||
| 21 | POSSIBILITY OF SUCH DAMAGE.
|
||
| 22 | */
|
||
| 23 | |||
| 24 | #pragma once
|
||
| 25 | |||
| 26 | #include "cinder/audio/Device.h" |
||
| 27 | |||
| 28 | namespace cinder { namespace audio { namespace linux {
|
||
| 29 | |||
| 30 | 4:ab6db404403a | f | /**
|
| 31 | * DeviceManager ( as in cinder::audio::DeviceManager ) that handle the hardware device through the jack library.
|
||
| 32 | * Note that this is not suitable for general purpose use. Most of the functionalities are indeed hard coded
|
||
| 33 | * just to suit Collidoscope needs. In particular only two input and two output ports are assumed.
|
||
| 34 | *
|
||
| 35 | */
|
||
| 36 | 1:b5bcad8e7803 | f | class DeviceManagerJack : public DeviceManager {
|
| 37 | public:
|
||
| 38 | |||
| 39 | DeviceManagerJack(); |
||
| 40 | virtual ~DeviceManagerJack(); |
||
| 41 | |||
| 42 | const std::vector<DeviceRef>& getDevices() override;
|
||
| 43 | DeviceRef getDefaultOutput() override; |
||
| 44 | DeviceRef getDefaultInput() override; |
||
| 45 | |||
| 46 | std::string getName( const DeviceRef &device ) override;
|
||
| 47 | size_t getNumInputChannels( const DeviceRef &device ) override;
|
||
| 48 | size_t getNumOutputChannels( const DeviceRef &device ) override;
|
||
| 49 | size_t getSampleRate( const DeviceRef &device ) override;
|
||
| 50 | size_t getFramesPerBlock( const DeviceRef &device ) override;
|
||
| 51 | |||
| 52 | void setSampleRate( const DeviceRef &device, size_t sampleRate ) override; |
||
| 53 | void setFramesPerBlock( const DeviceRef &device, size_t framesPerBlock ) override; |
||
| 54 | |||
| 55 | //! Returns the hardware's actual frames per block, which might not be a power of two.
|
||
| 56 | size_t getFramesPerBlockHardware( const DeviceRef &device );
|
||
| 57 | |||
| 58 | private:
|
||
| 59 | |||
| 60 | std::vector<DeviceRef> mDevices; |
||
| 61 | DeviceRef mDefaultOutDevice; |
||
| 62 | DeviceRef mDefaultInDevice; |
||
| 63 | size_t mSampleRate; |
||
| 64 | size_t mBufferSize; |
||
| 65 | }; |
||
| 66 | |||
| 67 | } } } // namespace cinder::audio::linux |