aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/sound/adlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/sound/adlib.h')
-rw-r--r--engines/gob/sound/adlib.h84
1 files changed, 76 insertions, 8 deletions
diff --git a/engines/gob/sound/adlib.h b/engines/gob/sound/adlib.h
index 4cd83d5883..3f7b46643f 100644
--- a/engines/gob/sound/adlib.h
+++ b/engines/gob/sound/adlib.h
@@ -38,7 +38,7 @@ class GobEngine;
class AdLib : public Audio::AudioStream {
public:
AdLib(Audio::Mixer &mixer);
- ~AdLib();
+ virtual ~AdLib();
bool isPlaying() const;
int getIndex() const;
@@ -49,9 +49,7 @@ public:
void startPlay();
void stopPlay();
- bool load(const char *fileName);
- bool load(byte *data, uint32 size, int index = -1);
- void unload();
+ virtual void unload();
// AudioStream API
int readBuffer(int16 *buffer, const int numSamples);
@@ -89,18 +87,88 @@ protected:
bool _playing;
bool _first;
bool _ended;
- bool _needFree;
+
+ bool _freeData;
int _index;
+ unsigned char _wait;
+ uint8 _tickBeat;
+ uint8 _beatMeasure;
+ uint32 _totalTick;
+ uint32 _nrCommand;
+ uint16 _pitchBendRangeStep;
+ uint16 _basicTempo, _tempo;
+
void writeOPL(byte reg, byte val);
void setFreqs();
- void reset();
- void setVoices();
- void setVoice(byte voice, byte instr, bool set);
void setKey(byte voice, byte note, bool on, bool spec);
void setVolume(byte voice, byte volume);
void pollMusic();
+
+ virtual void interpret() = 0;
+
+ virtual void reset();
+ virtual void rewind() = 0;
+ virtual void setVoices() = 0;
+
+private:
+ void init();
+};
+
+class ADLPlayer : public AdLib {
+public:
+ ADLPlayer(Audio::Mixer &mixer);
+ ~ADLPlayer();
+
+ bool load(const char *fileName);
+ bool load(byte *data, uint32 size, int index = -1);
+
+ void unload();
+
+protected:
+ void interpret();
+
+ void reset();
+ void rewind();
+
+ void setVoices();
+ void setVoice(byte voice, byte instr, bool set);
+};
+
+class MDYPlayer : public AdLib {
+public:
+ MDYPlayer(Audio::Mixer &mixer);
+ ~MDYPlayer();
+
+ bool loadMDY(const char *fileName);
+ bool loadMDY(Common::SeekableReadStream &stream);
+ bool loadTBR(const char *fileName);
+ bool loadTBR(Common::SeekableReadStream &stream);
+
+ void unload();
+
+protected:
+ byte _soundMode;
+
+ byte *_timbres;
+ uint16 _tbrCount;
+ uint16 _tbrStart;
+ uint32 _timbresSize;
+
+ void interpret();
+
+ void reset();
+ void rewind();
+
+ void setVoices();
+ void setVoice(byte voice, byte instr, bool set);
+
+ void unloadTBR();
+ void unloadMDY();
+
+private:
+ void init();
};
} // End of namespace Gob