mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
AUDIO: Add periodScaleDivisor to Paula and SoundFx
Add support for dividing the playing rate of Paula and SoundFx audio by integers other than 1. This is going to be used in the Cine engine for dividing the playing rate of music in the Amiga version of Operation Stealth by 2 to get it to sound right. Otherwise it sounds too high pitched. This is groundwork for fixing bug #11676.
This commit is contained in:
parent
0bedec1304
commit
d206dbcdae
@ -40,8 +40,8 @@
|
||||
|
||||
namespace Audio {
|
||||
|
||||
Paula::Paula(bool stereo, int rate, uint interruptFreq, FilterMode filterMode) :
|
||||
_stereo(stereo), _rate(rate), _periodScale((double)kPalPaulaClock / rate), _intFreq(interruptFreq) {
|
||||
Paula::Paula(bool stereo, int rate, uint interruptFreq, FilterMode filterMode, int periodScaleDivisor) :
|
||||
_stereo(stereo), _rate(rate), _periodScale((double)kPalPaulaClock / (rate * periodScaleDivisor)), _intFreq(interruptFreq) {
|
||||
|
||||
_filterState.mode = filterMode;
|
||||
_filterState.ledFilter = false;
|
||||
|
@ -69,9 +69,10 @@ public:
|
||||
};
|
||||
|
||||
Paula(bool stereo = false, int rate = 44100, uint interruptFreq = 0,
|
||||
FilterMode filterMode = kFilterModeA1200);
|
||||
FilterMode filterMode = Paula::defaultFilterMode(), int periodScaleDivisor = 1);
|
||||
~Paula();
|
||||
|
||||
static FilterMode defaultFilterMode() { return kFilterModeA1200; }
|
||||
bool playing() const { return _playing; }
|
||||
void setTimerBaseValue( uint32 ticksPerSecond ) { _timerBase = ticksPerSecond; }
|
||||
uint32 getTimerBaseValue() { return _timerBase; }
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
NUM_INSTRUMENTS = 15
|
||||
};
|
||||
|
||||
SoundFx(int rate, bool stereo);
|
||||
SoundFx(int rate, bool stereo, int periodScaleDivisor = 1);
|
||||
virtual ~SoundFx();
|
||||
|
||||
bool load(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb);
|
||||
@ -75,8 +75,8 @@ protected:
|
||||
uint16 _effects[NUM_CHANNELS];
|
||||
};
|
||||
|
||||
SoundFx::SoundFx(int rate, bool stereo)
|
||||
: Paula(stereo, rate) {
|
||||
SoundFx::SoundFx(int rate, bool stereo, int periodScaleDivisor)
|
||||
: Paula(stereo, rate, 0, Paula::defaultFilterMode(), periodScaleDivisor) {
|
||||
setTimerBaseValue(kPalCiaClock);
|
||||
_ticks = 0;
|
||||
_delay = 0;
|
||||
@ -264,8 +264,8 @@ void SoundFx::interrupt() {
|
||||
handleTick();
|
||||
}
|
||||
|
||||
AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo) {
|
||||
SoundFx *stream = new SoundFx(rate, stereo);
|
||||
AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo, int periodScaleDivisor) {
|
||||
SoundFx *stream = new SoundFx(rate, stereo, 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);
|
||||
AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate = 44100, bool stereo = true, int periodScaleDivisor = 1);
|
||||
|
||||
} // End of namespace Audio
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user