aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/player_v3m.h
diff options
context:
space:
mode:
authorTorbjörn Andersson2012-11-14 01:27:53 +0100
committerTorbjörn Andersson2012-11-14 01:27:53 +0100
commit148a6d334770d992d306e7b399d42259c8efc649 (patch)
tree0695dfdf0a0571b0806392f901451d6cc3e74c16 /engines/scumm/player_v3m.h
parentb1d10e6a62ef49994e78b3e2c86b27050f2f0938 (diff)
downloadscummvm-rg350-148a6d334770d992d306e7b399d42259c8efc649.tar.gz
scummvm-rg350-148a6d334770d992d306e7b399d42259c8efc649.tar.bz2
scummvm-rg350-148a6d334770d992d306e7b399d42259c8efc649.zip
SCUMM: Move most of the Macintosh player code into its own class
The Monkey Island and Loom mac music is really quite similar. The data layout is a bit different, but most of the code was easy to separate into its own class. The Loom player doesn't do looped music but I don't remember off-hand if it ever should.
Diffstat (limited to 'engines/scumm/player_v3m.h')
-rw-r--r--engines/scumm/player_v3m.h69
1 files changed, 5 insertions, 64 deletions
diff --git a/engines/scumm/player_v3m.h b/engines/scumm/player_v3m.h
index 3465621ca3..0bbb52221d 100644
--- a/engines/scumm/player_v3m.h
+++ b/engines/scumm/player_v3m.h
@@ -27,6 +27,7 @@
#include "common/util.h"
#include "common/mutex.h"
#include "scumm/music.h"
+#include "scumm/player_mac.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
@@ -39,73 +40,13 @@ class ScummEngine;
/**
* Scumm V3 Macintosh music driver.
*/
- class Player_V3M : public Audio::AudioStream, public MusicEngine {
+ class Player_V3M : public Player_Mac {
public:
Player_V3M(ScummEngine *scumm, Audio::Mixer *mixer);
- virtual ~Player_V3M();
- // MusicEngine API
- virtual void setMusicVolume(int vol);
- virtual void startSound(int sound);
- virtual void stopSound(int sound);
- virtual void stopAllSounds();
- virtual int getMusicTimer();
- virtual int getSoundStatus(int sound) const;
-
- // AudioStream API
- virtual int readBuffer(int16 *buffer, const int numSamples);
- virtual bool isStereo() const { return false; }
- virtual bool endOfData() const { return false; }
- virtual int getRate() const { return _sampleRate; }
-
-private:
- ScummEngine *const _vm;
- Common::Mutex _mutex;
- Audio::Mixer *const _mixer;
- Audio::SoundHandle _soundHandle;
- const uint32 _sampleRate;
- int _soundPlaying;
-
- void stopAllSounds_Internal();
-
- struct Instrument {
- byte *_data;
- uint32 _size;
- uint32 _rate;
- uint32 _loopStart;
- uint32 _loopEnd;
- byte _baseFreq;
-
- uint _pos;
- uint _subPos;
-
- void newNote() {
- _pos = 0;
- _subPos = 0;
- }
-
- void generateSamples(int16 *data, int pitchModifier, int volume, int numSamples);
- };
-
- struct Channel {
- Instrument _instrument;
- bool _looped;
- uint32 _length;
- const byte *_data;
-
- uint _pos;
- int _pitchModifier;
- byte _velocity;
- uint32 _remaining;
-
- bool _notesLeft;
-
- bool loadInstrument(Common::SeekableReadStream *stream);
- bool getNextNote(uint16 &duration, byte &value, byte &velocity);
- };
-
- Channel _channel[5];
- int _pitchTable[128];
+ virtual bool checkMusicAvailable();
+ virtual bool loadMusic(const byte *ptr);
+ virtual bool getNextNote(int ch, uint16 &duration, byte &note, byte &velocity);
};
} // End of namespace Scumm