2 Copyright (C) 2009 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackBoomerDriver__
21 #define __JackBoomerDriver__
23 #include "JackAudioDriver.h"
24 #include "JackPlatformPlug.h"
25 #include "ringbuffer.h"
26 #include <semaphore.h>
31 typedef jack_default_audio_sample_t jack_sample_t
;
33 #define OSS_DRIVER_DEF_DEV "/dev/dsp"
34 #define OSS_DRIVER_DEF_FS 48000
35 #define OSS_DRIVER_DEF_BLKSIZE 1024
36 #define OSS_DRIVER_DEF_NPERIODS 1
37 #define OSS_DRIVER_DEF_BITS 16
38 #define OSS_DRIVER_DEF_INS 2
39 #define OSS_DRIVER_DEF_OUTS 2
42 \brief The Boomer driver.
45 class JackBoomerDriver
: public JackAudioDriver
48 enum { kRead
= 1, kWrite
= 2, kReadWrite
= 3 };
52 class JackBoomerDriverInput
: public JackRunnableInterface
{
56 JackBoomerDriver
* fDriver
;
60 JackBoomerDriverInput(JackBoomerDriver
* driver
): fDriver(driver
)
62 ~JackBoomerDriverInput()
69 class JackBoomerDriverOutput
: public JackRunnableInterface
{
73 JackBoomerDriver
* fDriver
;
77 JackBoomerDriverOutput(JackBoomerDriver
* driver
): fDriver(driver
)
79 ~JackBoomerDriverOutput()
92 unsigned int fSampleSize
;
93 unsigned int fFragmentSize
;
98 unsigned int fInputBufferSize
;
99 unsigned int fOutputBufferSize
;
107 JackThread fInputThread
;
108 JackThread fOutputThread
;
110 JackBoomerDriverInput fInputHandler
;
111 JackBoomerDriverOutput fOutputHandler
;
117 void SetSampleFormat();
118 void DisplayDeviceInfo();
119 void SynchronizeRead();
120 void SynchronizeWrite();
124 JackBoomerDriver(const char* name
, const char* alias
, JackLockedEngine
* engine
, JackSynchro
* table
);
125 virtual ~JackBoomerDriver();
127 int Open(jack_nframes_t frames_per_cycle
,
136 const char* capture_driver_name
,
137 const char* playback_driver_name
,
138 jack_nframes_t capture_latency
,
139 jack_nframes_t playback_latency
,
140 int bits
, bool syncio
);
147 // BufferSize can be changed
148 bool IsFixedBufferSize()
153 int SetBufferSize(jack_nframes_t buffer_size
);
157 } // end of namespace