diff options
author | Florian Kagerer | 2010-08-08 17:34:32 +0000 |
---|---|---|
committer | Florian Kagerer | 2010-08-08 17:34:32 +0000 |
commit | 054c586bcc74de047536b5d4f2fdc4540dce24f3 (patch) | |
tree | a2bfb0a774ac125ad40985fafee0b7fb2ea8d95e /sound/softsynth | |
parent | 27c79d51d43b95c72b80c8aa5ccc70a2d29a34b0 (diff) | |
download | scummvm-rg350-054c586bcc74de047536b5d4f2fdc4540dce24f3.tar.gz scummvm-rg350-054c586bcc74de047536b5d4f2fdc4540dce24f3.tar.bz2 scummvm-rg350-054c586bcc74de047536b5d4f2fdc4540dce24f3.zip |
KYRA/TOWNS: some minor sound improvements
(some cleanup to internal driver volume control, minor frequency change for fm-towns)
svn-id: r51930
Diffstat (limited to 'sound/softsynth')
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_audio.cpp | 104 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_audio.h | 16 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_euphony.cpp | 20 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_euphony.h | 12 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp | 49 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h | 1 |
6 files changed, 115 insertions, 87 deletions
diff --git a/sound/softsynth/fmtowns_pc98/towns_audio.cpp b/sound/softsynth/fmtowns_pc98/towns_audio.cpp index 42b9be804e..c9ba03ea27 100644 --- a/sound/softsynth/fmtowns_pc98/towns_audio.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_audio.cpp @@ -104,7 +104,7 @@ TownsAudioInterface::TownsAudioInterface(Audio::Mixer *mixer, TownsAudioInterfac _fmInstruments(0), _pcmInstruments(0), _pcmChan(0), _waveTables(0), _waveTablesTotalDataSize(0), _baserate(55125.0f / (float)mixer->getOutputRate()), _tickLength(0), _timer(0), _drv(driver), _pcmSfxChanMask(0), _musicVolume(Audio::Mixer::kMaxMixerVolume), _sfxVolume(Audio::Mixer::kMaxMixerVolume), - _cdaVolFlags(0), _ready(false) { + _outputVolumeFlags(0), _outputMuteFlags(0), _ready(false) { #define INTCB(x) &TownsAudioInterface::intf_##x static const TownsAudioIntfCallback intfCb[] = { @@ -192,11 +192,11 @@ TownsAudioInterface::TownsAudioInterface(Audio::Mixer *mixer, TownsAudioInterfac INTCB(notImpl), INTCB(notImpl), INTCB(notImpl), - INTCB(cdaSetVolume), + INTCB(setOutputVolume), // 68 - INTCB(cdaReset), - INTCB(notImpl), + INTCB(resetOutputVolume), INTCB(notImpl), + INTCB(updateOutputVolume), INTCB(notImpl), // 72 INTCB(notImpl), @@ -218,6 +218,8 @@ TownsAudioInterface::TownsAudioInterface(Audio::Mixer *mixer, TownsAudioInterfac _intfOpcodes = intfCb; memset(_fmSaveReg, 0, sizeof(_fmSaveReg)); + memset(_outputLevel, 0, sizeof(_outputLevel)); + _timerBase = (uint32)(_baserate * 1000000.0f); _tickLength = 2 * _timerBase; } @@ -286,7 +288,7 @@ void TownsAudioInterface::setSoundEffectVolume(int volume) { setVolumeIntern(_musicVolume, _sfxVolume); } -void TownsAudioInterface::setSoundEffectChanMask(uint32 mask) { +void TownsAudioInterface::setSoundEffectChanMask(int mask) { _pcmSfxChanMask = mask >> 6; mask &= 0x3f; setVolumeChannelMasks(~mask, mask); @@ -298,8 +300,8 @@ void TownsAudioInterface::nextTickEx(int32 *buffer, uint32 bufferSize) { for (uint32 i = 0; i < bufferSize; i++) { _timer += _tickLength; - while (_timer > 0x5B8D80) { - _timer -= 0x5B8D80; + while (_timer > 0x514767) { + _timer -= 0x514767; for (int ii = 0; ii < 8; ii++) { if ((_pcmChanKeyPlaying & _chanFlags[ii]) || (_pcmChanEffectPlaying & _chanFlags[ii])) { @@ -361,7 +363,7 @@ int TownsAudioInterface::intf_reset(va_list &args) { Common::StackLock lock(_mutex); fmReset(); pcmReset(); - cdaReset(); + callback(68); return 0; } @@ -708,56 +710,59 @@ int TownsAudioInterface::intf_fmReset(va_list &args) { return 0; } -int TownsAudioInterface::intf_cdaReset(va_list &args) { - cdaReset(); - return 0; -} - -int TownsAudioInterface::intf_pcmUpdateEnvelopeGenerator(va_list &args) { - for (int i = 0; i < 8; i++) - pcmUpdateEnvelopeGenerator(i); - return 0; -} - -int TownsAudioInterface::intf_cdaSetVolume(va_list &args) { - int mode = va_arg(args, int); +int TownsAudioInterface::intf_setOutputVolume(va_list &args) { + int chanType = va_arg(args, int); int left = va_arg(args, int); int right = va_arg(args, int); - // calculate mixer balance value - int8 balance = right - left; - if (left & 0xff80 || right & 0xff80) return 3; static const uint8 flags[] = { 0x0C, 0x30, 0x40, 0x80 }; - //int a = (mode & 0x40) ? 4 : 0; - int b = mode & 3; + uint8 chan = (chanType & 0x40) ? 8 : 12; + + chanType &= 3; left = (left & 0x7e) >> 1; right = (right & 0x7e) >> 1; - if (mode & 0x40) - _cdaVolFlags |= flags[b]; + if (chan) + _outputVolumeFlags |= flags[chanType]; else - _cdaVolFlags &= ~flags[b]; + _outputVolumeFlags &= ~flags[chanType]; - if (mode > 1) { - // Unknown purpose / TODO + if (chanType > 1) { + _outputLevel[chan + chanType] = left; + } else { + if (chanType == 0) + chan -= 8; + _outputLevel[chan] = left; + _outputLevel[chan + 1] = right; + } - } else if (mode == 1) { - // FM Towns seems to support volumes of 0 - 63 for each channel. - // We recalculate sane values for out 0 to 255 volume range. + updateOutputVolume(); - int vl = (int)(((float)left * 255.0f) / 63.0f); - int vr = (int)(((float)right * 255.0f) / 63.0f); - AudioCD.setVolume((vl + vr) >> 1); - AudioCD.setBalance(balance); + return 0; +} - } else { - // Unknown purpose / TODO - } +int TownsAudioInterface::intf_resetOutputVolume(va_list &args) { + memset(_outputLevel, 0, sizeof(_outputLevel)); + _outputMuteFlags = 0; + _outputVolumeFlags = 0; + updateOutputVolume(); + return 0; +} +int TownsAudioInterface::intf_updateOutputVolume(va_list &args) { + int flags = va_arg(args, int); + _outputMuteFlags = flags & 3; + updateOutputVolume(); + return 0; +} + +int TownsAudioInterface::intf_pcmUpdateEnvelopeGenerator(va_list &args) { + for (int i = 0; i < 8; i++) + pcmUpdateEnvelopeGenerator(i); return 0; } @@ -1382,8 +1387,19 @@ void TownsAudioInterface::pcmCalcPhaseStep(TownsAudio_PcmChannel *p, TownsAudio_ p->step = (s * p->stepPitch) >> 14; } -void TownsAudioInterface::cdaReset() { - +void TownsAudioInterface::updateOutputVolume() { + // FM Towns seems to support volumes of 0 - 63 for each channel. + // We recalculate sane values for our 0 to 255 volume range and + // balance values for our -128 to 127 volume range + + // CD-AUDIO + int vl = (int)(((float)_outputLevel[12] * 127.0f) / 63.0f); + int vr = (int)(((float)_outputLevel[13] * 127.0f) / 63.0f); + int8 balance = vr - vl; + vl = (int)(((float)_outputLevel[12] * 255.0f) / 63.0f); + vr = (int)(((float)_outputLevel[13] * 255.0f) / 63.0f); + AudioCD.setVolume((vl + vr) >> 1); + AudioCD.setBalance(balance); } const uint8 TownsAudioInterface::_chanFlags[] = { @@ -1457,7 +1473,7 @@ void TownsAudio_PcmChannel::clear() { stepNote = 0x4000; stepPitch = 0x4000; - panLeft = panRight = 0; + panLeft = panRight = 7; envTotalLevel = envAttackRate = envDecayRate = envSustainLevel = envSustainRate = envReleaseRate = 0; envStep = envCurrentLevel = 0; diff --git a/sound/softsynth/fmtowns_pc98/towns_audio.h b/sound/softsynth/fmtowns_pc98/towns_audio.h index 212c00c40f..950c016b4e 100644 --- a/sound/softsynth/fmtowns_pc98/towns_audio.h +++ b/sound/softsynth/fmtowns_pc98/towns_audio.h @@ -50,7 +50,7 @@ public: void setSoundEffectVolume(int volume); // Defines the channels used as sound effect channels for the purpose of ScummVM GUI volume control. // The first 6 bits are the 6 fm channels. The next 8 bits are pcm channels. - void setSoundEffectChanMask(uint32 mask); + void setSoundEffectChanMask(int mask); private: void nextTickEx(int32 *buffer, uint32 bufferSize); @@ -92,8 +92,9 @@ private: int intf_fmSetPitch(va_list &args); int intf_fmSetLevel(va_list &args); int intf_fmReset(va_list &args); - int intf_cdaSetVolume(va_list &args); - int intf_cdaReset(va_list &args); + int intf_setOutputVolume(va_list &args); + int intf_resetOutputVolume(va_list &args); + int intf_updateOutputVolume(va_list &args); int intf_pcmUpdateEnvelopeGenerator(va_list &args); int intf_notImpl(va_list &args); @@ -148,9 +149,10 @@ private: void pcmCalcPhaseStep(TownsAudio_PcmChannel *p, TownsAudio_WaveTable *w); - void cdaReset(); - - uint8 _cdaVolFlags; + void updateOutputVolume(); + uint8 _outputVolumeFlags; + uint8 _outputLevel[16]; + uint8 _outputMuteFlags; const float _baserate; uint32 _timerBase; @@ -159,7 +161,7 @@ private: uint16 _musicVolume; uint16 _sfxVolume; - uint32 _pcmSfxChanMask; + int _pcmSfxChanMask; TownsAudioInterfacePluginDriver *_drv; bool _ready; diff --git a/sound/softsynth/fmtowns_pc98/towns_euphony.cpp b/sound/softsynth/fmtowns_pc98/towns_euphony.cpp index e23d5bcb36..0c0c203cc9 100644 --- a/sound/softsynth/fmtowns_pc98/towns_euphony.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_euphony.cpp @@ -180,6 +180,10 @@ void TownsEuphonyDriver::stopParser() { } } +void TownsEuphonyDriver::continueParsing() { + _suspendParsing = false; +} + void TownsEuphonyDriver::playSoundEffect(int chan, int note, int velo, const uint8 *data) { _intf->callback(37, chan, note, velo, data); } @@ -204,7 +208,7 @@ void TownsEuphonyDriver::chanVolume(int chan, int vol) { _intf->callback(8, chan, vol); } -void TownsEuphonyDriver::cdaSetVolume(int mode, int volLeft, int volRight) { +void TownsEuphonyDriver::setOutputVolume(int mode, int volLeft, int volRight) { _intf->callback(67, mode, volLeft, volRight); } @@ -230,7 +234,7 @@ int TownsEuphonyDriver::chanOrdr(int tableEntry, int val) { return 0; } -int TownsEuphonyDriver::chanLevel(int tableEntry, int val) { +int TownsEuphonyDriver::chanVolumeShift(int tableEntry, int val) { if (tableEntry > 31) return 3; if (val <= 40) @@ -238,7 +242,7 @@ int TownsEuphonyDriver::chanLevel(int tableEntry, int val) { return 0; } -int TownsEuphonyDriver::chanTranspose(int tableEntry, int val) { +int TownsEuphonyDriver::chanNoteShift(int tableEntry, int val) { if (tableEntry > 31) return 3; if (val <= 40) @@ -660,8 +664,8 @@ bool TownsEuphonyDriver::evtSetupNote() { uint8 velo = _musicPos[5]; sendEvent(mode, evt); - sendEvent(mode, prepTranspose(note)); - sendEvent(mode, prepVelo(velo)); + sendEvent(mode, applyNoteShift(note)); + sendEvent(mode, applyVolumeShift(velo)); jumpNextLoop(); if (_musicPos[0] == 0xfe || _musicPos[0] == 0xfd) @@ -700,7 +704,7 @@ bool TownsEuphonyDriver::evtPolyphonicAftertouch() { uint8 mode = _tMode[_musicPos[1]]; sendEvent(mode, evt); - sendEvent(mode, prepTranspose(_musicPos[4])); + sendEvent(mode, applyNoteShift(_musicPos[4])); sendEvent(mode, _musicPos[5]); return false; @@ -768,7 +772,7 @@ bool TownsEuphonyDriver::evtModeOrdrChange() { return false; } -uint8 TownsEuphonyDriver::prepTranspose(uint8 in) { +uint8 TownsEuphonyDriver::applyNoteShift(uint8 in) { int out = _tTranspose[_musicPos[1]]; if (!out) return in; @@ -783,7 +787,7 @@ uint8 TownsEuphonyDriver::prepTranspose(uint8 in) { return out & 0xff; } -uint8 TownsEuphonyDriver::prepVelo(uint8 in) { +uint8 TownsEuphonyDriver::applyVolumeShift(uint8 in) { int out = _tLevel[_musicPos[1]]; out += (in & 0x7f); out = CLIP(out, 1, 127); diff --git a/sound/softsynth/fmtowns_pc98/towns_euphony.h b/sound/softsynth/fmtowns_pc98/towns_euphony.h index 2026a299c1..fa1f8ba496 100644 --- a/sound/softsynth/fmtowns_pc98/towns_euphony.h +++ b/sound/softsynth/fmtowns_pc98/towns_euphony.h @@ -45,6 +45,8 @@ public: int startMusicTrack(const uint8 *data, int trackSize, int startTick); void setMusicLoop(bool loop); void stopParser(); + bool parserIsPlaying() {return _playing; } + void continueParsing(); void playSoundEffect(int chan, int note, int velo, const uint8 *data); void stopSoundEffect(int chan); @@ -54,13 +56,13 @@ public: void chanPitch(int chan, int pitch); void chanVolume(int chan, int vol); - void cdaSetVolume(int mode, int volLeft, int volRight); + void setOutputVolume(int chanType, int volLeft, int volRight); int chanEnable(int tableEntry, int val); int chanMode(int tableEntry, int val); int chanOrdr(int tableEntry, int val); - int chanLevel(int tableEntry, int val); - int chanTranspose(int tableEntry, int val); + int chanVolumeShift(int tableEntry, int val); + int chanNoteShift(int tableEntry, int val); int assignChannel(int chan, int tableEntry); @@ -112,8 +114,8 @@ private: return false; } - uint8 prepTranspose(uint8 in); - uint8 prepVelo(uint8 in); + uint8 applyNoteShift(uint8 in); + uint8 applyVolumeShift(uint8 in); void sendNoteOff(); void sendNoteOn(); diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp index 507c8e159a..241b9bde50 100644 --- a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp @@ -28,7 +28,7 @@ class TownsPC98_FmSynthOperator { public: - TownsPC98_FmSynthOperator(const uint32 timerbase, const uint8 *rateTable, + TownsPC98_FmSynthOperator(const uint32 timerbase, const uint32 rtt, const uint8 *rateTable, const uint8 *shiftTable, const uint8 *attackDecayTable, const uint32 *frqTable, const uint32 *sineTable, const int32 *tlevelOut, const int32 *detuneTable); ~TownsPC98_FmSynthOperator() {} @@ -108,6 +108,7 @@ protected: const uint32 _tickLength; uint32 _timer; + const uint32 _rtt; int32 _currentLevel; struct EvpState { @@ -116,10 +117,10 @@ protected: } fs_a, fs_d, fs_s, fs_r; }; -TownsPC98_FmSynthOperator::TownsPC98_FmSynthOperator(const uint32 timerbase, const uint8 *rateTable, - const uint8 *shiftTable, const uint8 *attackDecayTable, const uint32 *frqTable, - const uint32 *sineTable, const int32 *tlevelOut, const int32 *detuneTable) : - _rateTbl(rateTable), _rshiftTbl(shiftTable), _adTbl(attackDecayTable), _fTbl(frqTable), +TownsPC98_FmSynthOperator::TownsPC98_FmSynthOperator(const uint32 timerbase, const uint32 rtt, + const uint8 *rateTable, const uint8 *shiftTable, const uint8 *attackDecayTable, + const uint32 *frqTable, const uint32 *sineTable, const int32 *tlevelOut, const int32 *detuneTable) : + _rtt(rtt), _rateTbl(rateTable), _rshiftTbl(shiftTable), _adTbl(attackDecayTable), _fTbl(frqTable), _sinTbl(sineTable), _tLvlTbl(tlevelOut), _detnTbl(detuneTable), _tickLength(timerbase * 2), _specifiedAttackRate(0), _specifiedDecayRate(0), _specifiedReleaseRate(0), _specifiedSustainRate(0), _phase(0), _state(kEnvReady), _playing(false), _timer(0), _keyScale1(0), @@ -190,8 +191,8 @@ void TownsPC98_FmSynthOperator::generateOutput(int32 phasebuf, int32 *feed, int3 return; _timer += _tickLength; - while (_timer > 0x5B8D80) { - _timer -= 0x5B8D80; + while (_timer > _rtt) { + _timer -= _rtt; ++_tickCount; int32 levelIncrement = 0; @@ -308,7 +309,7 @@ bool TownsPC98_FmSynthOperator::scaleRate(uint8 value) { class TownsPC98_FmSynthSquareSineSource { public: - TownsPC98_FmSynthSquareSineSource(const uint32 timerbase); + TownsPC98_FmSynthSquareSineSource(const uint32 timerbase, const uint32 rtt); ~TownsPC98_FmSynthSquareSineSource(); void init(const int *rsTable, const int *rseTable); @@ -351,6 +352,7 @@ private: const uint32 _tickLength; uint32 _timer; + const uint32 _rtt; struct Channel { int tick; @@ -377,7 +379,7 @@ private: class TownsPC98_FmSynthPercussionSource { public: - TownsPC98_FmSynthPercussionSource(const uint32 timerbase); + TownsPC98_FmSynthPercussionSource(const uint32 timerbase, const uint32 rtt); ~TownsPC98_FmSynthPercussionSource() { delete[] _reg; } @@ -429,6 +431,7 @@ private: const uint32 _tickLength; uint32 _timer; + const uint32 _rtt; uint8 **_reg; @@ -440,8 +443,8 @@ private: bool _ready; }; -TownsPC98_FmSynthSquareSineSource::TownsPC98_FmSynthSquareSineSource(const uint32 timerbase) : _tlTable(0), - _tleTable(0), _updateRequest(-1), _tickLength(timerbase * 27), _ready(0), _reg(0), _rand(1), _outN(1), +TownsPC98_FmSynthSquareSineSource::TownsPC98_FmSynthSquareSineSource(const uint32 timerbase, const uint32 rtt) : _tlTable(0), + _rtt(rtt), _tleTable(0), _updateRequest(-1), _tickLength(timerbase * 27), _ready(0), _reg(0), _rand(1), _outN(1), _nTick(0), _evpUpdateCnt(0), _evpTimer(0x1f), _pReslt(0x1f), _attack(0), _cont(false), _evpUpdate(true), _timer(0), _noiseGenerator(0), _chanEnable(0), _volMaskA(0), _volMaskB(0), _volumeA(Audio::Mixer::kMaxMixerVolume), _volumeB(Audio::Mixer::kMaxMixerVolume) { @@ -558,8 +561,8 @@ void TownsPC98_FmSynthSquareSineSource::nextTick(int32 *buffer, uint32 bufferSiz for (uint32 i = 0; i < bufferSize; i++) { _timer += _tickLength; - while (_timer > 0x5B8D80) { - _timer -= 0x5B8D80; + while (_timer > _rtt) { + _timer -= _rtt; if (++_nTick >= (_noiseGenerator & 0x1f)) { if ((_rand + 1) & 2) @@ -597,7 +600,7 @@ void TownsPC98_FmSynthSquareSineSource::nextTick(int32 *buffer, uint32 bufferSiz int32 finOut = 0; for (int ii = 0; ii < 3; ii++) { -int32 finOutTemp = ((_channels[ii].vol >> 4) & 1) ? _tleTable[_channels[ii].out ? _pReslt : 0] : _tlTable[_channels[ii].out ? (_channels[ii].vol & 0x0f) : 0]; + int32 finOutTemp = ((_channels[ii].vol >> 4) & 1) ? _tleTable[_channels[ii].out ? _pReslt : 0] : _tlTable[_channels[ii].out ? (_channels[ii].vol & 0x0f) : 0]; if ((1 << ii) & _volMaskA) finOutTemp = (finOutTemp * _volumeA) / Audio::Mixer::kMaxMixerVolume; @@ -624,8 +627,8 @@ void TownsPC98_FmSynthSquareSineSource::updateRegs() { _updateRequest = -1; } -TownsPC98_FmSynthPercussionSource::TownsPC98_FmSynthPercussionSource(const uint32 timerbase) : - _tickLength(timerbase * 2), _timer(0), _ready(false), _volMaskA(0), _volMaskB(0), _volumeA(Audio::Mixer::kMaxMixerVolume), _volumeB(Audio::Mixer::kMaxMixerVolume) { +TownsPC98_FmSynthPercussionSource::TownsPC98_FmSynthPercussionSource(const uint32 timerbase, const uint32 rtt) : + _rtt(rtt), _tickLength(timerbase * 2), _timer(0), _ready(false), _volMaskA(0), _volMaskB(0), _volumeA(Audio::Mixer::kMaxMixerVolume), _volumeB(Audio::Mixer::kMaxMixerVolume) { memset(_rhChan, 0, sizeof(RhtChannel) * 6); _reg = new uint8 *[40]; @@ -758,8 +761,8 @@ void TownsPC98_FmSynthPercussionSource::nextTick(int32 *buffer, uint32 bufferSiz for (uint32 i = 0; i < bufferSize; i++) { _timer += _tickLength; - while (_timer > 0x5B8D80) { - _timer -= 0x5B8D80; + while (_timer > _rtt) { + _timer -= _rtt; for (int ii = 0; ii < 6; ii++) { RhtChannel *s = &_rhChan[ii]; @@ -826,7 +829,7 @@ TownsPC98_FmSynth::TownsPC98_FmSynth(Audio::Mixer *mixer, EmuType type) : _chanInternal(0), _ssg(0), _prc(0), _numChan(type == kType26 ? 3 : 6), _numSSG(type == kTypeTowns ? 0 : 3), _hasPercussion(type == kType86 ? true : false), _oprRates(0), _oprRateshift(0), _oprAttackDecay(0), _oprFrq(0), _oprSinTbl(0), _oprLevelOut(0), _oprDetune(0), - _baserate(55125.0f / (float)mixer->getOutputRate()), + _rtt(type == kTypeTowns ? 0x514767 : 0x5B8D80), _baserate(55125.0f / (float)mixer->getOutputRate()), _volMaskA(0), _volMaskB(0), _volumeA(255), _volumeB(255), _regProtectionFlag(false), _ready(false) { @@ -834,7 +837,7 @@ TownsPC98_FmSynth::TownsPC98_FmSynth(Audio::Mixer *mixer, EmuType type) : memset(&_timers[1], 0, sizeof(ChipTimer)); _timers[0].cb = &TownsPC98_FmSynth::timerCallbackA; _timers[1].cb = &TownsPC98_FmSynth::timerCallbackB; - _timerbase = (uint32)(_baserate * 1000000.0f); + _timerbase = (uint32)(_baserate * 1000000.0f); } TownsPC98_FmSynth::~TownsPC98_FmSynth() { @@ -865,16 +868,16 @@ bool TownsPC98_FmSynth::init() { for (int i = 0; i < _numChan; i++) { memset(&_chanInternal[i], 0, sizeof(ChanInternal)); for (int j = 0; j < 4; ++j) - _chanInternal[i].opr[j] = new TownsPC98_FmSynthOperator(_timerbase, _oprRates, _oprRateshift, _oprAttackDecay, _oprFrq, _oprSinTbl, _oprLevelOut, _oprDetune); + _chanInternal[i].opr[j] = new TownsPC98_FmSynthOperator(_timerbase, _rtt, _oprRates, _oprRateshift, _oprAttackDecay, _oprFrq, _oprSinTbl, _oprLevelOut, _oprDetune); } if (_numSSG) { - _ssg = new TownsPC98_FmSynthSquareSineSource(_timerbase); + _ssg = new TownsPC98_FmSynthSquareSineSource(_timerbase, _rtt); _ssg->init(&_ssgTables[0], &_ssgTables[16]); } if (_hasPercussion) { - _prc = new TownsPC98_FmSynthPercussionSource(_timerbase); + _prc = new TownsPC98_FmSynthPercussionSource(_timerbase, _rtt); _prc->init(_percussionData); } diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h index 34ee2ce7b8..3072503610 100644 --- a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h +++ b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h @@ -160,6 +160,7 @@ private: const float _baserate; uint32 _timerbase; + uint32 _rtt; Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; |