diff options
author | Sven Hesse | 2012-06-09 10:38:55 +0200 |
---|---|---|
committer | Sven Hesse | 2012-06-11 05:18:06 +0200 |
commit | 03ef6689c015742c192d5d92d936e60d638caa1c (patch) | |
tree | 53bf4b9f593296663bf171927591011fc4cd2f2e /engines/gob/sound/adlplayer.h | |
parent | 49fafb48a7f089c97ed3baa9aefe65ec56dce682 (diff) | |
download | scummvm-rg350-03ef6689c015742c192d5d92d936e60d638caa1c.tar.gz scummvm-rg350-03ef6689c015742c192d5d92d936e60d638caa1c.tar.bz2 scummvm-rg350-03ef6689c015742c192d5d92d936e60d638caa1c.zip |
GOB: Rewrite the AdLib players
This is a complete rewrite of the AdLib players for ADL and MDY/TBR
files in the Gob engine.
Major changes
1) The AdLib base class is now completely separated from all file
format code and can theoretically be used by any OPL2-based
format (within reason)
2) The new code is far better documented and more readable
3) The MDY player now actually works. The MDY/TBR format is
in reality the MUS/SND format created by AdLib as a simpler
alternative to the ROL format
4) Since the MAME emulator is quite buggy and leads to noticable
wrong percussion in the Gobliins 2 title music, the new AdLib
player will try to create a DOSBox OPL. If it's not compiled in,
or if the user configured opl_driver to "mame", it will print
out appropriate warnings.
Diffstat (limited to 'engines/gob/sound/adlplayer.h')
-rw-r--r-- | engines/gob/sound/adlplayer.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/engines/gob/sound/adlplayer.h b/engines/gob/sound/adlplayer.h new file mode 100644 index 0000000000..9596447bbc --- /dev/null +++ b/engines/gob/sound/adlplayer.h @@ -0,0 +1,85 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_SOUND_ADLPLAYER_H +#define GOB_SOUND_ADLPLAYER_H + +#include "common/array.h" + +#include "gob/sound/adlib.h" + +namespace Common { + class SeekableReadStream; +} + +namespace Gob { + +/** A player for Coktel Vision's ADL music format. */ +class ADLPlayer : public AdLib { +public: + ADLPlayer(Audio::Mixer &mixer); + ~ADLPlayer(); + + bool load(Common::SeekableReadStream &adl); + bool load(const byte *data, uint32 dataSize, int index = -1); + void unload(); + + int getIndex() const; + +protected: + // AdLib interface + uint32 pollMusic(bool first); + void rewind(); + +private: + struct Timbre { + uint16 startParams[kOperatorsPerVoice * kParamCount]; + uint16 params[kOperatorsPerVoice * kParamCount]; + }; + + uint8 _soundMode; + + Common::Array<Timbre> _timbres; + + byte *_songData; + uint32 _songDataSize; + + const byte *_playPos; + + int _index; + + uint8 _modifyInstrument; + uint16 _currentInstruments[kMaxVoiceCount]; + + + void setInstrument(int voice, int instrument); + + bool readHeader (Common::SeekableReadStream &adl, int &timbreCount); + bool readTimbres (Common::SeekableReadStream &adl, int timbreCount); + bool readSongData(Common::SeekableReadStream &adl); + + uint32 getSampleDelay(uint16 delay) const; +}; + +} // End of namespace Gob + +#endif // GOB_SOUND_ADLPLAYER_H |