Mod code cleanup

svn-id: r27690
This commit is contained in:
Max Horn 2007-06-24 11:40:00 +00:00
parent 71e696094e
commit 61af086e8e
2 changed files with 13 additions and 12 deletions

View File

@ -80,14 +80,6 @@ public:
Instruments *getInstruments(void) const { return _instruments; }
bool getRepeating(void) const { return _repCount != 0; }
void setRepeating (int32 repCount) { _repCount = repCount; }
virtual void startPlay(void) { _playing = true;}
virtual void stopPlay(void)
{
_mutex.lock();
_playing = false;
_mutex.unlock();
}
virtual void pausePlay(bool pause) { _playing = !pause; }
bool load(Common::SeekableReadStream &dum);
bool load(const char *dum) {
@ -98,7 +90,16 @@ public:
return false;
}
void unload(void);
void restart(void) { if (_data) { stopPlay(); init(); startPlay(); } }
void restart(void) {
if (_data) {
// Use the mutex here to ensure we do not call init()
// while data is being read by the mixer thread.
_mutex.lock();
init();
_playing = true;
_mutex.unlock();
}
}
protected:
Instruments *_instruments;

View File

@ -51,9 +51,9 @@ public:
}
void clearVoice(byte voice);
void clearVoices() { for (int i = 0; i < NUM_VOICES; ++i) clearVoice(i); }
virtual void startPlay(void) {}
virtual void stopPlay(void) {}
virtual void pausePlay(bool pause) {}
void startPlay(void) { _playing = true; }
void stopPlay(void) { _playing = false; }
void pausePlay(bool pause) { _playing = !pause; }
// AudioStream API
int readBuffer(int16 *buffer, const int numSamples);