Merge branch 'master' into newer-midi
[jack2.git] / solaris / oss / JackOSSDriver.h
blobbedd72b771d7e7b5d8e76f3ac25d900b0f1a7212
1 /*
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"
26 namespace Jack
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
40 /*!
41 \brief The OSS driver.
44 class JackOSSDriver : public JackAudioDriver
47 enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
49 private:
51 int fInFD;
52 int fOutFD;
54 int fBits;
55 int fSampleFormat;
56 int fNperiods;
57 unsigned int fSampleSize;
58 int fRWMode;
59 bool fExcl;
60 bool fIgnoreHW;
62 unsigned int fInputBufferSize;
63 unsigned int fOutputBufferSize;
65 void* fInputBuffer;
66 void* fOutputBuffer;
68 bool fFirstCycle;
70 int OpenInput();
71 int OpenOutput();
72 int OpenAux();
73 void CloseAux();
74 void SetSampleFormat();
75 void DisplayDeviceInfo();
77 // Redefining since timing for CPU load is specific
78 int ProcessSync();
80 public:
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,
94 int user_nperiods,
95 jack_nframes_t rate,
96 bool capturing,
97 bool playing,
98 int chan_in,
99 int chan_out,
100 bool vmix,
101 bool monitor,
102 const char* capture_driver_name,
103 const char* playback_driver_name,
104 jack_nframes_t capture_latency,
105 jack_nframes_t playback_latency,
106 int bits,
107 bool ignorehwbuf);
109 int Close();
111 int Read();
112 int Write();
114 // BufferSize can be changed
115 bool IsFixedBufferSize()
117 return false;
120 int SetBufferSize(jack_nframes_t buffer_size);
124 } // end of namespace
126 #endif