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_N_PARAMS 13
32 #define OSS_DRIVER_DEF_DEV "/dev/dsp"
33 #define OSS_DRIVER_DEF_FS 48000
34 #define OSS_DRIVER_DEF_BLKSIZE 1024
35 #define OSS_DRIVER_DEF_NPERIODS 1
36 #define OSS_DRIVER_DEF_BITS 16
37 #define OSS_DRIVER_DEF_INS 2
38 #define OSS_DRIVER_DEF_OUTS 2
41 \brief The OSS driver.
44 class JackOSSDriver
: public JackAudioDriver
47 enum { kRead
= 1, kWrite
= 2, kReadWrite
= 3 };
57 unsigned int fSampleSize
;
62 unsigned int fInputBufferSize
;
63 unsigned int fOutputBufferSize
;
74 void SetSampleFormat();
75 void DisplayDeviceInfo();
77 // Redefining since timing for CPU load is specific
82 JackOSSDriver(const char* name
, const char* alias
, JackLockedEngine
* engine
, JackSynchro
* table
)
83 : JackAudioDriver(name
, alias
, engine
, table
),
84 fInFD(-1), fOutFD(-1), fBits(0),
85 fSampleFormat(0), fNperiods(0), fRWMode(0), fExcl(false), fIgnoreHW(true),
86 fInputBufferSize(0), fOutputBufferSize(0),
87 fInputBuffer(NULL
), fOutputBuffer(NULL
), fFirstCycle(true)
90 virtual ~JackOSSDriver()
93 int Open(jack_nframes_t frames_per_cycle
,
102 const char* capture_driver_name
,
103 const char* playback_driver_name
,
104 jack_nframes_t capture_latency
,
105 jack_nframes_t playback_latency
,
114 // BufferSize can be changed
115 bool IsFixedBufferSize()
120 int SetBufferSize(jack_nframes_t buffer_size
);
124 } // end of namespace