CINE: Loop Amiga music instead of playing it once
Make Amiga music loop until fade out when changing scene. This is based on watching a video of Future Wars Amiga walkthrough, not on playing the Amiga version or reading its disassembly. But it does seem that the music loops instead of just playing once.
This commit is contained in:
parent
9d03fbdd4c
commit
0f27168b39
3 changed files with 12 additions and 7 deletions
|
@ -47,7 +47,7 @@ public:
|
|||
NUM_INSTRUMENTS = 15
|
||||
};
|
||||
|
||||
SoundFx(int rate, bool stereo, int periodScaleDivisor = 1);
|
||||
SoundFx(int rate, bool stereo, bool repeat, int periodScaleDivisor = 1);
|
||||
virtual ~SoundFx();
|
||||
|
||||
bool load(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb);
|
||||
|
@ -73,9 +73,10 @@ protected:
|
|||
uint8 _ordersTable[128];
|
||||
uint8 *_patternData;
|
||||
uint16 _effects[NUM_CHANNELS];
|
||||
bool _repeat;
|
||||
};
|
||||
|
||||
SoundFx::SoundFx(int rate, bool stereo, int periodScaleDivisor)
|
||||
SoundFx::SoundFx(int rate, bool stereo, bool repeat, int periodScaleDivisor)
|
||||
: Paula(stereo, rate, 0, Paula::defaultFilterMode(), periodScaleDivisor) {
|
||||
setTimerBaseValue(kPalCiaClock);
|
||||
_ticks = 0;
|
||||
|
@ -87,6 +88,7 @@ SoundFx::SoundFx(int rate, bool stereo, int periodScaleDivisor)
|
|||
memset(_ordersTable, 0, sizeof(_ordersTable));
|
||||
_patternData = 0;
|
||||
memset(_effects, 0, sizeof(_effects));
|
||||
_repeat = repeat;
|
||||
}
|
||||
|
||||
SoundFx::~SoundFx() {
|
||||
|
@ -244,7 +246,10 @@ void SoundFx::handleTick() {
|
|||
_curPos = 0;
|
||||
++_curOrder;
|
||||
if (_curOrder == _numOrders) {
|
||||
stopPaula();
|
||||
if (_repeat)
|
||||
_curOrder = 0;
|
||||
else
|
||||
stopPaula();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,8 +269,8 @@ void SoundFx::interrupt() {
|
|||
handleTick();
|
||||
}
|
||||
|
||||
AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo, int periodScaleDivisor) {
|
||||
SoundFx *stream = new SoundFx(rate, stereo, periodScaleDivisor);
|
||||
AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo, bool repeat, int periodScaleDivisor) {
|
||||
SoundFx *stream = new SoundFx(rate, stereo, repeat, periodScaleDivisor);
|
||||
if (stream->load(data, loadCb)) {
|
||||
stream->play();
|
||||
return stream;
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef byte *(*LoadSoundFxInstrumentCallback)(const char *name, uint32 *size);
|
|||
* stream object is kept). If loadCb is non 0, then instruments are loaded using
|
||||
* it, buffers returned are free'd at the end of playback.
|
||||
*/
|
||||
AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate = 44100, bool stereo = true, int periodScaleDivisor = 1);
|
||||
AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate = 44100, bool stereo = true, bool repeat = true, int periodScaleDivisor = 1);
|
||||
|
||||
} // End of namespace Audio
|
||||
|
||||
|
|
|
@ -1405,7 +1405,7 @@ void PaulaSound::loadMusic(const char *name) {
|
|||
// Operation Stealth for Amiga has to have its music frequency halved
|
||||
// or otherwise the music sounds too high pitched.
|
||||
const int periodScaleDivisor = 2;
|
||||
_moduleStream = Audio::makeSoundFxStream(&s, readBundleSoundFile, _mixer->getOutputRate(), true, periodScaleDivisor);
|
||||
_moduleStream = Audio::makeSoundFxStream(&s, readBundleSoundFile, _mixer->getOutputRate(), true, true, periodScaleDivisor);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue