SoundTowns::~SoundTowns() { g_system->getAudioCDManager()->stop(); haltTrack(); delete _driver; delete[] _musicTrackData; delete[] _sfxFileData; }
SoundTowns::~SoundTowns() { g_system->getAudioCDManager()->stop(); haltTrack(); delete _player; delete[] _musicTrackData; delete[] _sfxFileData; for (int i = 0; i < 3; i++) initAudioResourceInfo(i, 0); }
void SoundPC98::beginFadeOut() { if (!_driver->musicPlaying()) return; for (int i = 0; i < 20; i++) { _driver->fadeStep(); _vm->delay(32); } haltTrack(); }
void SoundTowns_Darkmoon::playTrack(uint8 track) { if (track >= 120 || !_sfxEnabled) return; uint8 *pcm = 0; switch (_soundTable[track].type) { case -1: if (track == 0) haltTrack(); else if (track == 2) beginFadeOut(); break; case 0: if (_soundTable[track].para1 == -1 || (uint32)_soundTable[track].para1 > _pcmDataSize) return; pcm = _pcmData + _soundTable[track].para1; WRITE_LE_UINT16(&pcm[24], _soundTable[track].para2 * 98 / 1000); _intf->callback(39, 0x47); _intf->callback(37, 0x47, 60, track == 11 ? 127 : _pcmVol, pcm); break; case 2: resetTrigger(); g_system->getAudioCDManager()->play(_soundTable[track].para1 - 1, 1, 0, 0); break; case 3: _lastSfxChan ^= 3; _intf->callback(39, _lastSfxChan); _intf->callback(4, _lastSfxChan, _soundTable[track].para1); _intf->callback(1, _lastSfxChan, _soundTable[track].para2, 127); break; default: break; } }
void SoundTowns::beginFadeOut() { if (_cdaPlaying) { for (int i = 118; i > 103; i--) { _player->driver()->setOutputVolume(1, i, i); _vm->delay(2 * _vm->tickLength()); } for (int i = 103; i > 83; i -= 2) { _player->driver()->setOutputVolume(1, i, i); _vm->delay(2 * _vm->tickLength()); } for (int i = 83; i > 58; i -= 2) { _player->driver()->setOutputVolume(1, i, i); _vm->delay(_vm->tickLength()); } for (int i = 58; i > 0; i--) { _player->driver()->setOutputVolume(1, i, i); _vm->delay(1); } _player->driver()->setOutputVolume(1, 0, 0); } else { if (_lastTrack == -1) return; uint32 ticks = 2; int tickAdv = 0; uint16 fadeVolCur[12]; uint16 fadeVolStep[12]; for (int i = 0; i < 6; i++) { fadeVolCur[i] = READ_LE_UINT16(&_musicFadeTable[(_lastTrack * 12 + i) * 2]); fadeVolStep[i] = fadeVolCur[i] / 50; fadeVolCur[i + 6] = READ_LE_UINT16(&_musicFadeTable[(_lastTrack * 12 + 6 + i) * 2]); fadeVolStep[i + 6] = fadeVolCur[i + 6] / 30; } for (int i = 0; i < 12; i++) { for (int ii = 0; ii < 6; ii++) _player->driver()->channelVolume(ii, fadeVolCur[ii]); for (int ii = 0x40; ii < 0x46; ii++) _player->driver()->channelVolume(ii, fadeVolCur[ii - 0x3A]); for (int ii = 0; ii < 6; ii++) { fadeVolCur[ii] -= fadeVolStep[ii]; if (fadeVolCur[ii] < 10) fadeVolCur[ii] = 0; fadeVolCur[ii + 6] -= fadeVolStep[ii + 6]; if (fadeVolCur[ii + 6] < 10) fadeVolCur[ii + 6] = 0; } if (++tickAdv == 3) { tickAdv = 0; ticks += 2; } _vm->delay(ticks * _vm->tickLength()); } } haltTrack(); }