2 Copyright (C) 2003-2007 Jussi Laako <jussi@sonarnerd.net>
3 Copyright (C) 2008 Grame & RTL 2008
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __JackOSSDriver__
22 #define __JackOSSDriver__
24 #include "JackAudioDriver.h"
29 typedef jack_default_audio_sample_t jack_sample_t
;
31 #define OSS_DRIVER_DEF_DEV "/dev/dsp"
32 #define OSS_DRIVER_DEF_FS 48000
33 #define OSS_DRIVER_DEF_BLKSIZE 1024
34 #define OSS_DRIVER_DEF_NPERIODS 1
35 #define OSS_DRIVER_DEF_BITS 16
36 #define OSS_DRIVER_DEF_INS 2
37 #define OSS_DRIVER_DEF_OUTS 2
40 \brief The OSS driver.
43 class JackOSSDriver
: public JackAudioDriver
46 enum { kRead
= 1, kWrite
= 2, kReadWrite
= 3 };
56 unsigned int fSampleSize
;
61 unsigned int fInputBufferSize
;
62 unsigned int fOutputBufferSize
;
73 void SetSampleFormat();
74 void DisplayDeviceInfo();
76 // Redefining since timing for CPU load is specific
81 JackOSSDriver(const char* name
, const char* alias
, JackLockedEngine
* engine
, JackSynchro
* table
)
82 : JackAudioDriver(name
, alias
, engine
, table
),
83 fInFD(-1), fOutFD(-1), fBits(0),
84 fSampleFormat(0), fNperiods(0), fRWMode(0), fExcl(false), fIgnoreHW(true),
85 fInputBufferSize(0), fOutputBufferSize(0),
86 fInputBuffer(NULL
), fOutputBuffer(NULL
), fFirstCycle(true)
89 virtual ~JackOSSDriver()
92 int Open(jack_nframes_t frames_per_cycle
,
101 const char* capture_driver_name
,
102 const char* playback_driver_name
,
103 jack_nframes_t capture_latency
,
104 jack_nframes_t playback_latency
,
113 // BufferSize can be changed
114 bool IsFixedBufferSize()
119 int SetBufferSize(jack_nframes_t buffer_size
);
123 } // end of namespace