00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TSE3_PLT_OSS_H
00018 #define TSE3_PLT_OSS_H
00019
00020 #include "tse3/MidiScheduler.h"
00021
00022 #include <string>
00023 #include <list>
00024
00025 #ifdef HAVE_CONFIG_H
00026 #include "config.h"
00027 #endif
00028
00029 #ifdef TSE3_WITH_OSS
00030 #include <sys/soundcard.h>
00031 #else
00032 struct synth_info;
00033 struct midi_info;
00034 #endif
00035
00036 namespace TSE3
00037 {
00038 namespace Plt
00039 {
00040 class OSSMidiScheduler_SynthDevice;
00041
00063 class OSSMidiScheduler : public MidiScheduler
00064 {
00065 public:
00066
00070 OSSMidiScheduler();
00071 virtual ~OSSMidiScheduler();
00072
00073
00074
00075
00076
00087 static std::string &fmPatchesDirectory();
00088
00095 static void setFmPatchesDirectory(const std::string &dir);
00096
00109 static std::string &gusPatchesDirectory();
00110
00117 static void setGusPatchesDirectory(const std::string &dir);
00118
00119 protected:
00120
00124 virtual const char *impl_implementationName() const;
00128 virtual const char *impl_portName(int port) const;
00132 virtual const char *impl_portType(int port) const;
00136 virtual bool impl_portReadable(int port) const;
00140 virtual bool impl_portWriteable(int port) const;
00144 virtual void impl_start(Clock clock);
00148 virtual void impl_stop(Clock clock);
00152 virtual void impl_moveTo(Clock moveTime, Clock newTime);
00156 virtual Clock impl_clock();
00160 virtual int impl_msecs();
00164 virtual void impl_setTempo(int tempo, Clock changeTime);
00168 virtual bool impl_eventWaiting();
00172 virtual MidiEvent impl_rx();
00176 virtual void impl_tx(MidiCommand mc);
00180 virtual void impl_tx(MidiEvent mc);
00184 virtual void impl_txSysEx(int port,
00185 const unsigned char *data,
00186 size_t size);
00187
00188 private:
00189
00190 OSSMidiScheduler(const OSSMidiScheduler &);
00191 OSSMidiScheduler &operator=(const OSSMidiScheduler &);
00192
00198 void tx(const MidiCommand mc, bool outOfBand);
00199
00200 unsigned char *running;
00201 bool *useRunning;
00202 unsigned int nosynths;
00203 unsigned int nomidis;
00204 unsigned int nodevices;
00205 int rate;
00206 int rateDivisor;
00207 synth_info *synthinfo;
00208 midi_info *midiinfo;
00209
00210
00211
00212
00213
00214 int seqfd;
00215 unsigned char *_seqbuf;
00216 int _seqbuflen;
00217 int _seqbufptr;
00218 void seqbuf_dump();
00219 void seqbuf_clean();
00220
00221
00222
00223 bool isSynth(unsigned int port) const
00224 {
00225 return port < nosynths;
00226 }
00227 bool isMidi(unsigned int port) const
00228 {
00229 return port >= nosynths;
00230 }
00231
00232
00233
00234
00235 OSSMidiScheduler_SynthDevice **devices;
00236
00237
00238 Clock lastTxTime;
00239
00240
00241 bool input;
00242 MidiCommand command;
00243 Clock time;
00244
00251 void readInput();
00252 };
00253 }
00254 }
00255
00256 #endif