diff options
Diffstat (limited to 'engines/mads/nebular/sound_nebular.h')
-rw-r--r-- | engines/mads/nebular/sound_nebular.h | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index ccfd40ad52..2b80b08d89 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -8,12 +8,12 @@ * 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. @@ -28,20 +28,27 @@ #include "common/mutex.h" #include "common/queue.h" #include "audio/audiostream.h" -#include "audio/fmopl.h" #include "audio/mixer.h" +namespace OPL { +class OPL; +} + namespace MADS { class SoundManager; namespace Nebular { +class ASound; + /** * Represents the data for a channel on the Adlib */ class AdlibChannel { public: + ASound *_owner; + int _activeCount; int _field1; int _field2; @@ -61,11 +68,12 @@ public: byte *_pSrc; byte *_ptr3; byte *_ptr4; + byte *_ptrEnd; int _field17; int _field19; byte *_soundData; int _field1D; - int _field1E; + int _volumeOffset; int _field1F; // TODO: Only used by asound.003. Figure out usage @@ -128,17 +136,20 @@ struct RegisterValue { #define ADLIB_CHANNEL_MIDWAY 5 #define CALLBACKS_PER_SECOND 60 +struct CachedDataEntry { + int _offset; + byte *_data; + byte *_dataEnd; +}; + /** * Base class for the sound player resource files */ -class ASound : public Audio::AudioStream { +class ASound { private: - struct CachedDataEntry { - int _offset; - byte *_data; - }; Common::List<CachedDataEntry> _dataCache; uint16 _randomSeed; + int _masterVolume; /** * Does the initial Adlib initialisation @@ -184,6 +195,11 @@ private: void processSample(); void updateFNumber(); + + /** + * Timer function for OPL + */ + void onTimer(); protected: int _commandParam; @@ -265,8 +281,7 @@ protected: int nullCommand() { return 0; } public: Audio::Mixer *_mixer; - FM_OPL *_opl; - Audio::SoundHandle _soundHandle; + OPL::OPL *_opl; AdlibChannel _channels[ADLIB_CHANNEL_COUNT]; AdlibChannel *_activeChannelPtr; AdlibChannelData _channelData[11]; @@ -298,10 +313,6 @@ public: int _activeChannelReg; int _v11; bool _amDep, _vibDep, _splitPoint; - int _samplesPerCallback; - int _samplesPerCallbackRemainder; - int _samplesTillCallback; - int _samplesTillCallbackRemainder; public: /** * Constructor @@ -310,7 +321,7 @@ public: * @param filename Specifies the adlib sound player file to use * @param dataOffset Offset in the file of the data segment */ - ASound(Audio::Mixer *mixer, FM_OPL *opl, const Common::String &filename, int dataOffset); + ASound(Audio::Mixer *mixer, OPL::OPL *opl, const Common::String &filename, int dataOffset); /** * Destructor @@ -350,26 +361,15 @@ public: */ int getFrameCounter() { return _frameCounter; } - // AudioStream interface - /** - * Main buffer read - */ - virtual int readBuffer(int16 *buffer, const int numSamples); - - /** - * Mono sound only - */ - virtual bool isStereo() const { return false; } - /** - * Data is continuously pushed, so definitive end + * Return the cached data block record for previously loaded sound data */ - virtual bool endOfData() const { return false; } + CachedDataEntry &getCachedData(byte *pData); /** - * Return sample rate + * Set the volume */ - virtual int getRate() const { return 11025; } + void setVolume(int volume); }; class ASound1 : public ASound { @@ -415,7 +415,7 @@ private: void command111213(); int command2627293032(); public: - ASound1(Audio::Mixer *mixer, FM_OPL *opl); + ASound1(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -467,7 +467,7 @@ private: void command9Randomize(); void command9Apply(byte *data, int val, int incr); public: - ASound2(Audio::Mixer *mixer, FM_OPL *opl); + ASound2(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -527,7 +527,7 @@ private: void command9Randomize(); void command9Apply(byte *data, int val, int incr); public: - ASound3(Audio::Mixer *mixer, FM_OPL *opl); + ASound3(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -565,7 +565,7 @@ private: void method1(); public: - ASound4(Audio::Mixer *mixer, FM_OPL *opl); + ASound4(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -611,7 +611,7 @@ private: int command42(); int command43(); public: - ASound5(Audio::Mixer *mixer, FM_OPL *opl); + ASound5(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -640,7 +640,7 @@ private: int command25(); int command29(); public: - ASound6(Audio::Mixer *mixer, FM_OPL *opl); + ASound6(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -672,7 +672,7 @@ private: int command36(); int command37(); public: - ASound7(Audio::Mixer *mixer, FM_OPL *opl); + ASound7(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -715,7 +715,7 @@ private: void method1(byte *pData); void adjustRange(byte *pData, byte v, int incr); public: - ASound8(Audio::Mixer *mixer, FM_OPL *opl); + ASound8(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -774,7 +774,7 @@ private: int command59(); int command60(); public: - ASound9(Audio::Mixer *mixer, FM_OPL *opl); + ASound9(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; |