00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MIDIDRIVER_H_INCLUDED
00020 #define MIDIDRIVER_H_INCLUDED
00021
00022 class XMidiEventList;
00023 class IDataSource;
00024
00026 class MidiDriver
00027 {
00028 protected:
00029 bool initialized;
00030 MidiDriver() : initialized(false) { }
00031
00032 public:
00034 struct MidiDriverDesc {
00035 MidiDriverDesc(const char * const n, MidiDriver * (*c)()) :
00036 name(n), createInstance(c) { }
00037 const char * const name;
00038 MidiDriver * (*createInstance)();
00039 };
00040
00041 enum TimbreLibraryType {
00042 TIMBRE_LIBRARY_U7VOICE_AD = 0,
00043 TIMBRE_LIBRARY_U7VOICE_MT = 1,
00044 TIMBRE_LIBRARY_XMIDI_AD = 2,
00045 TIMBRE_LIBRARY_XMIDI_MT = 3,
00046 TIMBRE_LIBRARY_SYX_FILE = 4,
00047 TIMBRE_LIBRARY_XMIDI_FILE = 5,
00048 TIMBRE_LIBRARY_FMOPL_SETGM = 6
00049 };
00050
00055 virtual int initMidiDriver(uint32 sample_rate, bool stereo) = 0;
00056
00058 virtual void destroyMidiDriver() = 0;
00059
00060 bool isInitialized() { return initialized; }
00061
00064 virtual int maxSequences() = 0;
00065
00068 virtual void setGlobalVolume(int vol) = 0;
00069
00076 virtual void startSequence(int seq_num, XMidiEventList *list, bool repeat, int vol, int branch = -1) = 0;
00077
00080 virtual void finishSequence(int seq_num) = 0;
00081
00084 virtual void pauseSequence(int seq_num) = 0;
00085
00088 virtual void unpauseSequence(int seq_num) = 0;
00089
00093 virtual void setSequenceVolume(int seq_num, int vol) = 0;
00094
00098 virtual void setSequenceSpeed(int seq_num, int speed) = 0;
00099
00103 virtual bool isSequencePlaying(int seq_num) = 0;
00104
00107 virtual uint32 getSequenceCallbackData(int seq_num) { return 0; }
00108
00110 virtual bool isSampleProducer() { return false; }
00111
00115 virtual void produceSamples(sint16 *samples, uint32 bytes) { }
00116
00118 virtual bool isFMSynth() { return false; }
00119
00121 virtual bool isMT32() { return false; }
00122
00124 virtual bool noTimbreSupport() { return false; }
00125
00127 virtual void loadTimbreLibrary(IDataSource*, TimbreLibraryType type) { };
00128
00130 virtual ~MidiDriver() { };
00131
00132
00133
00134
00135
00137 static int getDriverCount();
00138
00141 static std::string getDriverName(uint32 index);
00142
00146 static MidiDriver *createInstance(std::string driverName,uint32 sample_rate,bool stereo);
00147
00148 protected:
00150 std::string getConfigSetting(std::string name, std::string defaultval);
00151 };
00152
00153 #endif //MIDIDRIVER_H_INCLUDED