mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-07 19:36:21 +00:00
SCUMM: DIMUSE: Implement support for higher internal sample rates
This lays the ground for: * Supporting fan dubbings and self-made high quality music replacement; * Reintroduction of support for compressed audio.
This commit is contained in:
parent
92efa503fb
commit
5b18d1aa6b
@ -41,7 +41,7 @@ void IMuseDigital::timer_handler(void *refCon) {
|
||||
diMUSE->callback();
|
||||
}
|
||||
|
||||
IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, Common::Mutex *mutex)
|
||||
IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, int sampleRate, Audio::Mixer *mixer, Common::Mutex *mutex)
|
||||
: _vm(scumm), _mixer(mixer), _mutex(mutex) {
|
||||
assert(_vm);
|
||||
assert(mixer);
|
||||
@ -50,7 +50,7 @@ IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, Common::M
|
||||
_callbackFps = DIMUSE_TIMER_BASE_RATE_HZ;
|
||||
_usecPerInt = DIMUSE_TIMER_BASE_RATE_USEC;
|
||||
|
||||
_internalSampleRate = DIMUSE_BASE_SAMPLERATE;
|
||||
_internalSampleRate = sampleRate;
|
||||
_internalFeedSize = (int)(DIMUSE_BASE_FEEDSIZE * ((float)_internalSampleRate / DIMUSE_BASE_SAMPLERATE));
|
||||
|
||||
_splayer = nullptr;
|
||||
|
@ -307,7 +307,7 @@ private:
|
||||
byte waveOutGetStreamFlags();
|
||||
|
||||
public:
|
||||
IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, Common::Mutex *mutex);
|
||||
IMuseDigital(ScummEngine_v7 *scumm, int sampleRate, Audio::Mixer *mixer, Common::Mutex *mutex);
|
||||
~IMuseDigital() override;
|
||||
|
||||
// Wrapper functions used by the main engine
|
||||
|
@ -1430,7 +1430,20 @@ void ScummEngine_v7::setupScumm(const Common::String &macResourceFile) {
|
||||
filesAreCompressed |= _sound->isSfxFileCompressed();
|
||||
}
|
||||
|
||||
_musicEngine = _imuseDigital = new IMuseDigital(this, _mixer, &_resourceAccessMutex);
|
||||
int sampleRate = DIMUSE_BASE_SAMPLERATE;
|
||||
|
||||
ConfMan.registerDefault("dimuse_sample_rate", DIMUSE_BASE_SAMPLERATE);
|
||||
if (ConfMan.hasKey("dimuse_sample_rate", _targetName)) {
|
||||
// Only accept sample rates which are a multiple or submultiple of 22050, with
|
||||
// lower and upper bounds set to what the internal mixer is currently able to achieve...
|
||||
if ((ConfMan.getInt("dimuse_sample_rate") % (DIMUSE_BASE_SAMPLERATE / 2)) == 0 &&
|
||||
(ConfMan.getInt("dimuse_sample_rate") >= DIMUSE_BASE_SAMPLERATE / 2) &&
|
||||
(ConfMan.getInt("dimuse_sample_rate") <= DIMUSE_BASE_SAMPLERATE * 4)) {
|
||||
sampleRate = ConfMan.getInt("dimuse_sample_rate");
|
||||
}
|
||||
}
|
||||
|
||||
_musicEngine = _imuseDigital = new IMuseDigital(this, sampleRate, _mixer, &_resourceAccessMutex);
|
||||
|
||||
if (filesAreCompressed) {
|
||||
GUI::MessageDialog dialog(_(
|
||||
|
Loading…
x
Reference in New Issue
Block a user