Merge branch 'master' into newer-midi
[jack2.git] / solaris / oss / JackOSSAdapter.h
blob6e739f8860085bf33d45dc9c7a58e1f338fc3185
1 /*
2 Copyright (C) 2008 Grame & RTL 2008
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 __JackOSSAdapter__
21 #define __JackOSSAdapter__
23 #include <math.h>
24 #include <limits.h>
25 #include <assert.h>
26 #include "JackAudioAdapterInterface.h"
27 #include "JackPlatformPlug.h"
28 #include "JackError.h"
29 #include "jack.h"
30 #include "jslist.h"
32 namespace Jack
35 typedef jack_default_audio_sample_t jack_sample_t;
37 #define OSS_DRIVER_N_PARAMS 13
38 #define OSS_DRIVER_DEF_DEV "/dev/dsp"
39 #define OSS_DRIVER_DEF_FS 48000
40 #define OSS_DRIVER_DEF_BLKSIZE 1024
41 #define OSS_DRIVER_DEF_NPERIODS 2
42 #define OSS_DRIVER_DEF_BITS 16
43 #define OSS_DRIVER_DEF_INS 2
44 #define OSS_DRIVER_DEF_OUTS 2
46 /*!
47 \brief The OSS adapter.
50 class JackOSSAdapter : public JackAudioAdapterInterface, public JackRunnableInterface
53 enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
55 private:
57 JackThread fThread;
59 char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1];
60 char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1];
62 int fInFD;
63 int fOutFD;
65 int fBits;
66 int fSampleFormat;
67 int fNperiods;
68 unsigned int fSampleSize;
69 int fRWMode;
70 bool fIgnoreHW;
71 bool fExcl;
73 unsigned int fInputBufferSize;
74 unsigned int fOutputBufferSize;
76 void* fInputBuffer;
77 void* fOutputBuffer;
79 float** fInputSampleBuffer;
80 float** fOutputSampleBuffer;
82 bool fFirstCycle;
84 int OpenInput();
85 int OpenOutput();
86 void CloseAux();
87 void SetSampleFormat();
88 void DisplayDeviceInfo();
90 public:
92 JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params);
93 ~JackOSSAdapter()
96 int Open();
97 int Close();
99 int Read();
100 int Write();
102 int SetBufferSize(jack_nframes_t buffer_size);
104 bool Execute();
109 #ifdef __cplusplus
110 extern "C"
112 #endif
114 #include "JackCompilerDeps.h"
115 #include "driver_interface.h"
117 EXPORT jack_driver_desc_t* jack_get_descriptor();
119 #ifdef __cplusplus
121 #endif
123 #endif