mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 23:43:34 +00:00
TRECISION: Some renaming in SoundManager
This commit is contained in:
parent
9954c87b66
commit
0298e0c08b
@ -583,35 +583,35 @@ void LogicManager::endChangeRoom() {
|
||||
// FullMotion
|
||||
if ((_vm->_curRoom == kRoom17) && (_vm->_oldRoom == kRoom16)) {
|
||||
PlayDialog(dF171);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom16) && (_vm->_oldRoom == kRoom17)) {
|
||||
PlayDialog(dF161);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
_vm->removeIcon(iFOGLIO14);
|
||||
} else if ((_vm->_curRoom == kRoom21) && (_vm->_oldRoom == kRoom1C)) {
|
||||
PlayDialog(dF1C1);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom23B) && (_vm->_oldRoom == kRoom23A)) {
|
||||
PlayDialog(dF231);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
_vm->removeIcon(iMAPPA17);
|
||||
} else if ((_vm->_curRoom == kRoom29L) && (_vm->_oldRoom == kRoom29)) {
|
||||
PlayDialog(dF291);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom2GV) && (_vm->_oldRoom == kRoom2G)) {
|
||||
PlayDialog(dF2G2);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom31) && (_vm->_oldRoom == kRoom32) && (_vm->_room[kRoom32]._flag & kObjFlagExtra)) {
|
||||
PlayDialog(dF321);
|
||||
_vm->_flagShowCharacter = false;
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
_vm->_room[kRoom32]._flag &= ~kObjFlagExtra;
|
||||
} else if ((_vm->_curRoom == kRoom19) && !(_vm->_room[kRoom19]._flag & kObjFlagDone)) {
|
||||
_vm->playScript(s19EVA);
|
||||
_vm->_flagNoPaintScreen = false;
|
||||
_vm->clearText();
|
||||
_vm->redrawString();
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
}
|
||||
// CHECKME: This check is identical to the 3rd one, thus it's always false
|
||||
else if ((_vm->_curRoom == kRoom21) && (/*!( _room[_vm->_curRoom]._flag & OBJFLAG_DONE ) || */ (_vm->_oldRoom == kRoom1C))) {
|
||||
@ -622,28 +622,28 @@ void LogicManager::endChangeRoom() {
|
||||
_vm->redrawString();
|
||||
} else if ((_vm->_curRoom == kRoom46) && (_vm->_oldRoom == kRoom43) && !(_vm->_inventoryObj[iDISLOCATORE]._flag & kObjFlagExtra)) {
|
||||
PlayDialog(dF431);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom45S) && (_vm->_oldRoom == kRoom45) && !(_vm->_inventoryObj[iDISLOCATORE]._flag & kObjFlagExtra)) {
|
||||
PlayDialog(dF451);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom4A) && (_vm->_oldRoom == kRoom49) && !(_vm->_inventoryObj[iDISLOCATORE]._flag & kObjFlagExtra)) {
|
||||
PlayDialog(dF491);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom4A) && (_vm->_oldRoom == kRoom41D) && (_vm->_inventoryObj[iDISLOCATORE]._flag & kObjFlagExtra) && (_vm->_obj[ocHELLEN4A]._mode & OBJMODE_OBJSTATUS)) {
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
PlayDialog(dC4A1);
|
||||
} else if ((_vm->_curRoom == kRoom4P) && (_vm->_oldRoom == kRoom4O) && !(_vm->_room[kRoom4P]._flag & kObjFlagDone)) {
|
||||
PlayDialog(dF4PI);
|
||||
_vm->_flagShowCharacter = false;
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom51) && (_vm->_oldRoom == kRoom4CT)) {
|
||||
PlayDialog(dF4C1);
|
||||
_vm->_flagShowCharacter = false;
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
} else if ((_vm->_curRoom == kRoom1A) && (_vm->_oldRoom == kRoom18)) {
|
||||
if (!(_vm->_room[kRoom1A]._flag & kObjFlagDone)) {
|
||||
PlayDialog(dF1A1);
|
||||
_vm->_soundMgr->WaitSoundFadEnd();
|
||||
_vm->_soundMgr->waitEndFading();
|
||||
_vm->_obj[oTOPO1C]._flag |= kObjFlagTake;
|
||||
_vm->_obj[oTOPO1C]._anim = a1C3RACCOGLIETOPO;
|
||||
} else {
|
||||
@ -1375,7 +1375,7 @@ void LogicManager::useInventoryWithScreen(bool *updateInventory, bool *printSent
|
||||
doEvent(MC_CHARACTER, ME_CHARACTERACTION, MP_DEFAULT, a213, 0, 0, _vm->_useWith[WITH]);
|
||||
*printSentence = false;
|
||||
} else if (_vm->_useWith[WITH] == oCOPERCHIOC31) {
|
||||
_vm->_soundMgr->NLPlaySound(wCOVER31);
|
||||
_vm->_soundMgr->play(wCOVER31);
|
||||
_vm->_obj[oCOPERCHIOC31]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_vm->_obj[oCOPERCHIOA31]._mode |= OBJMODE_OBJSTATUS;
|
||||
RegenRoom();
|
||||
@ -1391,7 +1391,7 @@ void LogicManager::useInventoryWithScreen(bool *updateInventory, bool *printSent
|
||||
_vm->_obj[oPANNELLOM31]._action = 716;
|
||||
_vm->_obj[oPANNELLOM31]._flag &= ~kObjFlagRoomOut;
|
||||
}
|
||||
_vm->_soundMgr->NLPlaySound(wCOVER31);
|
||||
_vm->_soundMgr->play(wCOVER31);
|
||||
RegenRoom();
|
||||
*printSentence = false;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, kRoom31, a3118CHIUDEPANNELLO, 3, _vm->_curObj);
|
||||
@ -2914,7 +2914,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
|
||||
case oCOPERCHIOA31:
|
||||
if (_vm->_obj[oFILOTC31]._mode & OBJMODE_OBJSTATUS) {
|
||||
_vm->_soundMgr->NLPlaySound(wCOVER31);
|
||||
_vm->_soundMgr->play(wCOVER31);
|
||||
_vm->_obj[oPANNELLOM31]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_vm->_obj[oPANNELLOMA31]._mode |= OBJMODE_OBJSTATUS;
|
||||
_vm->_obj[oPANNELLOM31]._anim = 0;
|
||||
@ -2978,7 +2978,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_vm->_obj[curObj]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_vm->_obj[curObj + 7]._mode |= OBJMODE_OBJSTATUS;
|
||||
_comb35[_count35++] = curObj;
|
||||
_vm->_soundMgr->NLPlaySound(wPAD5);
|
||||
_vm->_soundMgr->play(wPAD5);
|
||||
if (_count35 == 7) {
|
||||
if (((_comb35[0] == oPULSANTEF35) && (_comb35[1] == oPULSANTED35) && (_comb35[2] == oPULSANTEC35) &&
|
||||
(_comb35[3] == oPULSANTEG35) && (_comb35[4] == oPULSANTEB35) && (_comb35[5] == oPULSANTEA35) &&
|
||||
@ -3010,7 +3010,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_vm->_obj[oSCANNERMA36]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_vm->_obj[oSCANNERMS36]._mode |= OBJMODE_OBJSTATUS;
|
||||
|
||||
_vm->_soundMgr->NLPlaySound(wWIN35);
|
||||
_vm->_soundMgr->play(wWIN35);
|
||||
} else {
|
||||
_vm->_obj[oPULSANTEA35]._mode |= OBJMODE_OBJSTATUS;
|
||||
_vm->_obj[oPULSANTEB35]._mode |= OBJMODE_OBJSTATUS;
|
||||
@ -3084,7 +3084,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_comb49[2] = _comb49[1];
|
||||
_comb49[1] = _comb49[0];
|
||||
_comb49[0] = curObj;
|
||||
_vm->_soundMgr->NLPlaySound(wASTA49);
|
||||
_vm->_soundMgr->play(wASTA49);
|
||||
RegenRoom();
|
||||
if ((_comb49[3] == oFORO749) && (_comb49[2] == oFORO849) && (_comb49[1] == oFORO449) && (_comb49[0] == oFORO549)) {
|
||||
PaintScreen(0);
|
||||
@ -3140,7 +3140,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
_vm->_soundMgr->NLPlaySound(wPAD1 + curObj - oNUMERO14C);
|
||||
_vm->_soundMgr->play(wPAD1 + curObj - oNUMERO14C);
|
||||
RegenRoom();
|
||||
if (a < 5)
|
||||
break;
|
||||
@ -3311,7 +3311,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_comb58[1] = _comb58[0];
|
||||
_comb58[0] = curObj;
|
||||
|
||||
_vm->_soundMgr->NLPlaySound(wPAD1 + curObj - oTASTO158);
|
||||
_vm->_soundMgr->play(wPAD1 + curObj - oTASTO158);
|
||||
_vm->_obj[oLED158 + _count58]._mode |= OBJMODE_OBJSTATUS;
|
||||
_count58++;
|
||||
RegenRoom();
|
||||
@ -3326,7 +3326,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
|
||||
if ((_comb58[0] == oTASTO058) && (_comb58[1] == oTASTO258) && (_comb58[2] == oTASTO358) &&
|
||||
(_comb58[3] == oTASTO858) && (_comb58[4] == oTASTO558) && (_comb58[5] == oTASTO958)) {
|
||||
_vm->_soundMgr->SoundFadOut();
|
||||
_vm->_soundMgr->fadeOut();
|
||||
PlayDialog(dF582);
|
||||
} else
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, kRoom58, 0, 2, curObj);
|
||||
@ -3957,7 +3957,7 @@ void LogicManager::doMouseLeftRight() {
|
||||
if (_vm->_curMessage->_event == ME_MRIGHT)
|
||||
_wheelPos[_wheel] = (_wheelPos[_wheel] < 1) ? 11 : _wheelPos[_wheel] - 1;
|
||||
|
||||
_vm->_soundMgr->NLPlaySound(wWHEELS2C);
|
||||
_vm->_soundMgr->play(wWHEELS2C);
|
||||
_vm->_obj[_vm->_curObj]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_vm->_obj[_wheelPos[_wheel] * 3 + _wheel + oWHEEL1A2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
RegenRoom();
|
||||
|
@ -313,11 +313,11 @@ void doScript() {
|
||||
break;
|
||||
|
||||
case ME_PLAYSOUND:
|
||||
g_vm->_soundMgr->NLPlaySound(index);
|
||||
g_vm->_soundMgr->play(index);
|
||||
break;
|
||||
|
||||
case ME_STOPSOUND:
|
||||
g_vm->_soundMgr->NLStopSound(index);
|
||||
g_vm->_soundMgr->stop(index);
|
||||
break;
|
||||
|
||||
case ME_REGENROOM:
|
||||
|
@ -407,7 +407,7 @@ void ReadLoc() {
|
||||
if (g_vm->_curRoom == kRoom11 && !(g_vm->_room[kRoom11]._flag & kObjFlagDone))
|
||||
g_vm->_flagShowCharacter = true;
|
||||
|
||||
g_vm->_soundMgr->SoundFadOut();
|
||||
g_vm->_soundMgr->fadeOut();
|
||||
|
||||
memset(g_vm->_screenBuffer, 0, MAXX * MAXY * 2);
|
||||
|
||||
@ -419,10 +419,10 @@ void ReadLoc() {
|
||||
g_vm->_graphicsMgr->loadBackground(picFile, BmInfo.dx, BmInfo.dy);
|
||||
ReadObj(picFile);
|
||||
|
||||
g_vm->_soundMgr->SoundStopAll();
|
||||
g_vm->_soundMgr->stopAll();
|
||||
|
||||
if (g_vm->_room[g_vm->_curRoom]._sounds[0] != 0)
|
||||
g_vm->_soundMgr->ReadSounds();
|
||||
g_vm->_soundMgr->loadRoomSounds();
|
||||
|
||||
Common::String fname = Common::String::format("%s.3d", g_vm->_room[g_vm->_curRoom]._baseName);
|
||||
read3D(fname);
|
||||
@ -457,7 +457,7 @@ void TendIn() {
|
||||
}
|
||||
|
||||
g_vm->_flagPaintCharacter = true;
|
||||
g_vm->_soundMgr->WaitSoundFadEnd();
|
||||
g_vm->_soundMgr->waitEndFading();
|
||||
PaintScreen(1);
|
||||
|
||||
g_vm->_graphicsMgr->copyToScreen(0, 0, MAXX, MAXY);
|
||||
|
@ -289,7 +289,7 @@ void CharacterContinueTalk() {
|
||||
sprintf(sn, "s%04d.wav", CurS);
|
||||
}
|
||||
|
||||
TalkTime = g_vm->_soundMgr->Talk(sn);
|
||||
TalkTime = g_vm->_soundMgr->talkStart(sn);
|
||||
if (!TalkTime)
|
||||
TalkTime = (strlen(SubString[CurSubString]) * 5) / 2 + 50;
|
||||
|
||||
@ -312,7 +312,7 @@ void CharacterMute() {
|
||||
g_vm->_lastInv = 0;
|
||||
|
||||
g_vm->redrawString();
|
||||
g_vm->_soundMgr->StopTalk();
|
||||
g_vm->_soundMgr->talkStop();
|
||||
|
||||
if ((g_vm->_curRoom == kRoom12CU) || (g_vm->_curRoom == kRoom13CU))
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, g_vm->_oldRoom, 0, 0, g_vm->_curObj);
|
||||
@ -368,7 +368,7 @@ void SomeoneContinueTalk() {
|
||||
else
|
||||
sprintf(sn, "s%04d.wav", CurS);
|
||||
|
||||
TalkTime = g_vm->_soundMgr->Talk(sn);
|
||||
TalkTime = g_vm->_soundMgr->talkStart(sn);
|
||||
if (!TalkTime)
|
||||
TalkTime = (strlen(SubString[CurSubString]) * 5) / 2 + 50;
|
||||
|
||||
@ -390,7 +390,7 @@ void someoneMute() {
|
||||
g_vm->_lastInv = 0;
|
||||
|
||||
g_vm->redrawString();
|
||||
g_vm->_soundMgr->StopTalk();
|
||||
g_vm->_soundMgr->talkStop();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
@ -38,188 +38,188 @@ namespace Trecision {
|
||||
|
||||
SoundManager::SoundManager(TrecisionEngine *vm) : _vm(vm) {
|
||||
for (int i = 0; i < NUMSAMPLES; ++i)
|
||||
sfxStream[i] = nullptr;
|
||||
_sfxStream[i] = nullptr;
|
||||
|
||||
nltime = 0;
|
||||
_timer = 0;
|
||||
|
||||
for (int i = 0; i < SAMPLEVOICES; ++i) {
|
||||
playing[i] = 0;
|
||||
smpvol[i] = 0;
|
||||
_samplePlaying[i] = 0;
|
||||
_sampleVolume[i] = 0;
|
||||
}
|
||||
|
||||
StepChannel = kSoundChannelStep;
|
||||
BackChannel = kSoundChannelBack;
|
||||
SoundFadStatus = SFADNONE;
|
||||
_stepChannel = kSoundChannelStep;
|
||||
_backChannel = kSoundChannelBack;
|
||||
_soundFadeStatus = SFADNONE;
|
||||
|
||||
SoundFadInVal = 0;
|
||||
SoundFadOutVal = 0;
|
||||
_soundFadeInVal = 0;
|
||||
_soundFadeOutVal = 0;
|
||||
}
|
||||
|
||||
SoundManager::~SoundManager() {
|
||||
}
|
||||
|
||||
/* -----------------05/08/97 16.36-------------------
|
||||
soundtimefunct
|
||||
soundTimer
|
||||
--------------------------------------------------*/
|
||||
void SoundManager::soundtimefunct() {
|
||||
void SoundManager::soundTimer() {
|
||||
uint32 ctime = g_system->getMillis() / 8; // entra una volta ogni otto
|
||||
|
||||
if (ctime > nltime)
|
||||
nltime = ctime;
|
||||
if (ctime > _timer)
|
||||
_timer = ctime;
|
||||
else
|
||||
return;
|
||||
|
||||
if (SoundFadStatus) { // solo se sono in un fad
|
||||
if (SoundFadStatus & SFADOUT) {
|
||||
if (!g_system->getMixer()->isSoundHandleActive(soundHandle[BackChannel])) {
|
||||
SoundFadStatus &= (~SFADOUT);
|
||||
if (_soundFadeStatus) { // solo se sono in un fad
|
||||
if (_soundFadeStatus & SFADOUT) {
|
||||
if (!g_system->getMixer()->isSoundHandleActive(_soundHandle[_backChannel])) {
|
||||
_soundFadeStatus &= (~SFADOUT);
|
||||
}
|
||||
else {
|
||||
SoundFadOutVal -= FADMULT;
|
||||
_soundFadeOutVal -= FADMULT;
|
||||
|
||||
if (SoundFadOutVal > 0)
|
||||
g_system->getMixer()->setChannelVolume(soundHandle[BackChannel], VOLUME(SoundFadOutVal / FADMULT));
|
||||
if (_soundFadeOutVal > 0)
|
||||
g_system->getMixer()->setChannelVolume(_soundHandle[_backChannel], VOLUME(_soundFadeOutVal / FADMULT));
|
||||
else {
|
||||
SoundFadOutVal = 0;
|
||||
g_system->getMixer()->setChannelVolume(soundHandle[BackChannel], VOLUME(SoundFadOutVal));
|
||||
_soundFadeOutVal = 0;
|
||||
g_system->getMixer()->setChannelVolume(_soundHandle[_backChannel], VOLUME(_soundFadeOutVal));
|
||||
|
||||
SoundFadStatus &= (~SFADOUT);
|
||||
_soundFadeStatus &= (~SFADOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SoundFadStatus & SFADIN) {
|
||||
SoundFadInVal += FADMULT;
|
||||
if (_soundFadeStatus & SFADIN) {
|
||||
_soundFadeInVal += FADMULT;
|
||||
|
||||
if (SoundFadInVal > GSample[playing[StepChannel]]._volume * FADMULT)
|
||||
SoundFadInVal = GSample[playing[StepChannel]]._volume * FADMULT;
|
||||
if (_soundFadeInVal > _gSample[_samplePlaying[_stepChannel]]._volume * FADMULT)
|
||||
_soundFadeInVal = _gSample[_samplePlaying[_stepChannel]]._volume * FADMULT;
|
||||
|
||||
g_system->getMixer()->setChannelVolume(soundHandle[StepChannel], VOLUME(SoundFadInVal / FADMULT));
|
||||
g_system->getMixer()->setChannelVolume(_soundHandle[_stepChannel], VOLUME(_soundFadeInVal / FADMULT));
|
||||
|
||||
for (int a = 2; a < SAMPLEVOICES; a++) {
|
||||
if (playing[a] != 0) {
|
||||
smpvol[a] += FADMULT;
|
||||
if (_samplePlaying[a] != 0) {
|
||||
_sampleVolume[a] += FADMULT;
|
||||
|
||||
if (smpvol[a] > GSample[playing[a]]._volume * FADMULT)
|
||||
smpvol[a] = GSample[playing[a]]._volume * FADMULT;
|
||||
if (_sampleVolume[a] > _gSample[_samplePlaying[a]]._volume * FADMULT)
|
||||
_sampleVolume[a] = _gSample[_samplePlaying[a]]._volume * FADMULT;
|
||||
|
||||
g_system->getMixer()->setChannelVolume(soundHandle[a], VOLUME(smpvol[a] / FADMULT));
|
||||
g_system->getMixer()->setChannelVolume(_soundHandle[a], VOLUME(_sampleVolume[a] / FADMULT));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoundManager::StopSoundSystem() {
|
||||
void SoundManager::stopSoundSystem() {
|
||||
g_system->getMixer()->stopAll();
|
||||
}
|
||||
|
||||
void SoundManager::LoadAudioWav(int num, Common::String fileName) {
|
||||
void SoundManager::loadAudioWav(int num, Common::String fileName) {
|
||||
assert(num != 0xFFFF);
|
||||
Common::SeekableReadStream *stream = _vm->_dataFile.createReadStreamForMember(fileName);
|
||||
byte *buf = new byte[stream->size()];
|
||||
int size = stream->size();
|
||||
stream->read(buf, size);
|
||||
delete stream;
|
||||
sfxStream[num] = Audio::makeWAVStream(new Common::MemoryReadStream(buf, size), DisposeAfterUse::YES);
|
||||
_sfxStream[num] = Audio::makeWAVStream(new Common::MemoryReadStream(buf, size), DisposeAfterUse::YES);
|
||||
}
|
||||
|
||||
void SoundManager::NLPlaySound(int num) {
|
||||
void SoundManager::play(int num) {
|
||||
int channel = 2;
|
||||
if (g_system->getMixer()->isSoundHandleActive(soundHandle[channel])) {
|
||||
g_system->getMixer()->stopHandle(soundHandle[channel]);
|
||||
playing[channel] = 0;
|
||||
if (g_system->getMixer()->isSoundHandleActive(_soundHandle[channel])) {
|
||||
g_system->getMixer()->stopHandle(_soundHandle[channel]);
|
||||
_samplePlaying[channel] = 0;
|
||||
}
|
||||
|
||||
int volume = VOLUME(GSample[num]._volume);
|
||||
int volume = VOLUME(_gSample[num]._volume);
|
||||
|
||||
if (GSample[num]._flag & kSoundFlagSoundOn) {
|
||||
if (_gSample[num]._flag & kSoundFlagSoundOn) {
|
||||
volume = 0;
|
||||
smpvol[channel] = 0;
|
||||
_sampleVolume[channel] = 0;
|
||||
}
|
||||
|
||||
Audio::AudioStream *stream = sfxStream[num];
|
||||
Audio::Mixer::SoundType type = GSample[num]._flag & kSoundFlagBgMusic ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
|
||||
if (stream != nullptr && GSample[num]._flag & kSoundFlagSoundLoop)
|
||||
stream = Audio::makeLoopingAudioStream(sfxStream[num], 0);
|
||||
Audio::AudioStream *stream = _sfxStream[num];
|
||||
Audio::Mixer::SoundType type = _gSample[num]._flag & kSoundFlagBgMusic ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
|
||||
if (stream != nullptr && _gSample[num]._flag & kSoundFlagSoundLoop)
|
||||
stream = Audio::makeLoopingAudioStream(_sfxStream[num], 0);
|
||||
|
||||
g_system->getMixer()->playStream(type, &soundHandle[channel], stream, -1, volume, 0, DisposeAfterUse::NO);
|
||||
g_system->getMixer()->playStream(type, &_soundHandle[channel], stream, -1, volume, 0, DisposeAfterUse::NO);
|
||||
|
||||
playing[channel] = num;
|
||||
_samplePlaying[channel] = num;
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.30-------------------
|
||||
NLStopSound
|
||||
stop
|
||||
--------------------------------------------------*/
|
||||
void SoundManager::NLStopSound(int num) {
|
||||
void SoundManager::stop(int num) {
|
||||
for (int a = 2; a < kSoundChannelSpeech; a++) {
|
||||
if (playing[a] == num) {
|
||||
g_system->getMixer()->stopHandle(soundHandle[a]);
|
||||
playing[a] = 0;
|
||||
if (_samplePlaying[a] == num) {
|
||||
g_system->getMixer()->stopHandle(_soundHandle[a]);
|
||||
_samplePlaying[a] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoundManager::SoundStopAll() {
|
||||
void SoundManager::stopAll() {
|
||||
for (int a = 0; a < SAMPLEVOICES; a++) {
|
||||
g_system->getMixer()->stopHandle(soundHandle[a]);
|
||||
playing[a] = 0;
|
||||
g_system->getMixer()->stopHandle(_soundHandle[a]);
|
||||
_samplePlaying[a] = 0;
|
||||
}
|
||||
|
||||
SoundFadOutVal = SFADNONE;
|
||||
SoundFadStatus = 0;
|
||||
_soundFadeOutVal = SFADNONE;
|
||||
_soundFadeStatus = 0;
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.30-------------------
|
||||
SoundFadOut
|
||||
fadeOut
|
||||
--------------------------------------------------*/
|
||||
void SoundManager::SoundFadOut() {
|
||||
void SoundManager::fadeOut() {
|
||||
for (int a = 0; a < SAMPLEVOICES; a++) { // Turns off all channels except background
|
||||
if (a != BackChannel) {
|
||||
g_system->getMixer()->stopHandle(soundHandle[a]);
|
||||
playing[a] = 0;
|
||||
if (a != _backChannel) {
|
||||
g_system->getMixer()->stopHandle(_soundHandle[a]);
|
||||
_samplePlaying[a] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SoundFadOutVal = g_system->getMixer()->getChannelVolume(soundHandle[BackChannel]) * FADMULT;
|
||||
SoundFadStatus = SFADOUT;
|
||||
_soundFadeOutVal = g_system->getMixer()->getChannelVolume(_soundHandle[_backChannel]) * FADMULT;
|
||||
_soundFadeStatus = SFADOUT;
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.30-------------------
|
||||
SoundFadIn
|
||||
fadeIn
|
||||
--------------------------------------------------*/
|
||||
void SoundManager::SoundFadIn(int num) {
|
||||
Audio::AudioStream *stream = sfxStream[num];
|
||||
Audio::Mixer::SoundType type = GSample[num]._flag & kSoundFlagBgMusic ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
|
||||
if (stream != nullptr && GSample[num]._flag & kSoundFlagSoundLoop)
|
||||
stream = Audio::makeLoopingAudioStream(sfxStream[num], 0);
|
||||
void SoundManager::fadeIn(int num) {
|
||||
Audio::AudioStream *stream = _sfxStream[num];
|
||||
Audio::Mixer::SoundType type = _gSample[num]._flag & kSoundFlagBgMusic ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
|
||||
if (stream != nullptr && _gSample[num]._flag & kSoundFlagSoundLoop)
|
||||
stream = Audio::makeLoopingAudioStream(_sfxStream[num], 0);
|
||||
|
||||
g_system->getMixer()->playStream(type, &soundHandle[StepChannel], stream, -1, 0, 0, DisposeAfterUse::NO);
|
||||
g_system->getMixer()->playStream(type, &_soundHandle[_stepChannel], stream, -1, 0, 0, DisposeAfterUse::NO);
|
||||
|
||||
playing[StepChannel] = num;
|
||||
_samplePlaying[_stepChannel] = num;
|
||||
|
||||
SoundFadInVal = 0;
|
||||
SoundFadStatus |= SFADIN;
|
||||
_soundFadeInVal = 0;
|
||||
_soundFadeStatus |= SFADIN;
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.31-------------------
|
||||
WaitSoundFadEnd
|
||||
waitEndFading
|
||||
--------------------------------------------------*/
|
||||
void SoundManager::WaitSoundFadEnd() {
|
||||
while ((SoundFadInVal != (GSample[playing[StepChannel]]._volume * FADMULT)) && (playing[StepChannel] != 0) && (SoundFadOutVal != 0))
|
||||
void SoundManager::waitEndFading() {
|
||||
while ((_soundFadeInVal != (_gSample[_samplePlaying[_stepChannel]]._volume * FADMULT)) && (_samplePlaying[_stepChannel] != 0) && (_soundFadeOutVal != 0))
|
||||
_vm->checkSystem();
|
||||
SoundFadStatus = SFADNONE;
|
||||
_soundFadeStatus = SFADNONE;
|
||||
|
||||
g_system->getMixer()->stopHandle(soundHandle[BackChannel]);
|
||||
g_system->getMixer()->stopHandle(_soundHandle[_backChannel]);
|
||||
|
||||
g_system->getMixer()->setChannelVolume(soundHandle[StepChannel], VOLUME(GSample[playing[StepChannel]]._volume));
|
||||
playing[BackChannel] = 0;
|
||||
g_system->getMixer()->setChannelVolume(_soundHandle[_stepChannel], VOLUME(_gSample[_samplePlaying[_stepChannel]]._volume));
|
||||
_samplePlaying[_backChannel] = 0;
|
||||
|
||||
for (uint8 a = 2; a < kSoundChannelSpeech; a++) {
|
||||
if (playing[a] != 0)
|
||||
g_system->getMixer()->setChannelVolume(soundHandle[a], VOLUME(GSample[playing[a]]._volume));
|
||||
if (_samplePlaying[a] != 0)
|
||||
g_system->getMixer()->setChannelVolume(_soundHandle[a], VOLUME(_gSample[_samplePlaying[a]]._volume));
|
||||
}
|
||||
|
||||
SWAP(StepChannel, BackChannel);
|
||||
SWAP(_stepChannel, _backChannel);
|
||||
|
||||
if (_vm->_curRoom == kRoom41D)
|
||||
ReadExtraObj41D();
|
||||
@ -282,33 +282,33 @@ void SoundManager::SoundPasso(int midx, int midz, int act, int frame, uint16 *li
|
||||
for (int a = 0; a < MAXSOUNDSINROOM; a++) {
|
||||
b = list[a];
|
||||
|
||||
if (stepRight && (GSample[b]._flag & kSoundFlagStepRight))
|
||||
if (stepRight && (_gSample[b]._flag & kSoundFlagStepRight))
|
||||
break;
|
||||
if (stepLeft && (GSample[b]._flag & kSoundFlagStepLeft))
|
||||
if (stepLeft && (_gSample[b]._flag & kSoundFlagStepLeft))
|
||||
break;
|
||||
if (b == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
midz = ((int)(GSample[b]._volume) * 1000) / ABS(midz);
|
||||
midz = ((int)(_gSample[b]._volume) * 1000) / ABS(midz);
|
||||
|
||||
if (midz > 255)
|
||||
midz = 255;
|
||||
|
||||
g_system->getMixer()->stopHandle(soundHandle[StepChannel]);
|
||||
sfxStream[b]->rewind();
|
||||
g_system->getMixer()->stopHandle(_soundHandle[_stepChannel]);
|
||||
_sfxStream[b]->rewind();
|
||||
|
||||
int panpos = ((midx - 320) * 127 / 320) / 2;
|
||||
Audio::Mixer::SoundType type = GSample[b]._flag & kSoundFlagBgMusic ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
|
||||
Audio::Mixer::SoundType type = _gSample[b]._flag & kSoundFlagBgMusic ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
|
||||
|
||||
g_system->getMixer()->playStream(type, &soundHandle[StepChannel], sfxStream[b], -1, VOLUME(midz), panpos, DisposeAfterUse::NO);
|
||||
g_system->getMixer()->playStream(type, &_soundHandle[_stepChannel], _sfxStream[b], -1, VOLUME(midz), panpos, DisposeAfterUse::NO);
|
||||
}
|
||||
|
||||
int32 SoundManager::Talk(const char *name) {
|
||||
int32 SoundManager::talkStart(const char *name) {
|
||||
if (!_vm->_speechFile.isOpen())
|
||||
return 0;
|
||||
|
||||
StopTalk();
|
||||
talkStop();
|
||||
|
||||
Common::SeekableReadStream *stream = _vm->_speechFile.createReadStreamForMember(name);
|
||||
if (!stream)
|
||||
@ -316,51 +316,51 @@ int32 SoundManager::Talk(const char *name) {
|
||||
|
||||
Audio::SeekableAudioStream *speechStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
|
||||
|
||||
g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &soundHandle[kSoundChannelSpeech], speechStream);
|
||||
g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle[kSoundChannelSpeech], speechStream);
|
||||
_characterSpeakTime = _vm->ReadTime();
|
||||
|
||||
return TIME(speechStream->getLength().msecs());
|
||||
}
|
||||
|
||||
void SoundManager::StopTalk() {
|
||||
g_system->getMixer()->stopHandle(soundHandle[kSoundChannelSpeech]);
|
||||
void SoundManager::talkStop() {
|
||||
g_system->getMixer()->stopHandle(_soundHandle[kSoundChannelSpeech]);
|
||||
}
|
||||
|
||||
/*-----------------12/12/95 11.39-------------------
|
||||
ReadSounds
|
||||
loadRoomSounds
|
||||
--------------------------------------------------*/
|
||||
void SoundManager::ReadSounds() {
|
||||
void SoundManager::loadRoomSounds() {
|
||||
for (uint16 a = 0; a < MAXSOUNDSINROOM; a++) {
|
||||
uint16 b = _vm->_room[_vm->_curRoom]._sounds[a];
|
||||
|
||||
if (b == 0)
|
||||
break;
|
||||
|
||||
if (!scumm_stricmp(GSample[b]._name, "RUOTE2C.WAV"))
|
||||
if (!scumm_stricmp(_gSample[b]._name, "RUOTE2C.WAV"))
|
||||
break;
|
||||
|
||||
LoadAudioWav(b, GSample[b]._name);
|
||||
loadAudioWav(b, _gSample[b]._name);
|
||||
|
||||
if (GSample[b]._flag & kSoundFlagBgMusic)
|
||||
SoundFadIn(b);
|
||||
else if (GSample[b]._flag & kSoundFlagSoundOn)
|
||||
NLPlaySound(b);
|
||||
if (_gSample[b]._flag & kSoundFlagBgMusic)
|
||||
fadeIn(b);
|
||||
else if (_gSample[b]._flag & kSoundFlagSoundOn)
|
||||
play(b);
|
||||
}
|
||||
}
|
||||
|
||||
void SoundManager::syncGameStream(Common::Serializer &ser) {
|
||||
for (int a = 0; a < MAXSAMPLE; a++) {
|
||||
ser.syncAsByte(GSample[a]._volume);
|
||||
ser.syncAsByte(GSample[a]._flag);
|
||||
ser.syncAsByte(_gSample[a]._volume);
|
||||
ser.syncAsByte(_gSample[a]._flag);
|
||||
}
|
||||
}
|
||||
|
||||
void SoundManager::loadSamples(Common::File *file) {
|
||||
for (int i = 0; i < MAXSAMPLE; ++i) {
|
||||
file->read(&GSample[i]._name, ARRAYSIZE(GSample[i]._name));
|
||||
GSample[i]._volume = file->readByte();
|
||||
GSample[i]._flag = file->readByte();
|
||||
GSample[i]._panning = file->readSByte();
|
||||
file->read(&_gSample[i]._name, ARRAYSIZE(_gSample[i]._name));
|
||||
_gSample[i]._volume = file->readByte();
|
||||
_gSample[i]._flag = file->readByte();
|
||||
_gSample[i]._panning = file->readSByte();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,36 +62,36 @@ public:
|
||||
|
||||
private:
|
||||
TrecisionEngine *_vm;
|
||||
Audio::SeekableAudioStream *sfxStream[NUMSAMPLES];
|
||||
Audio::SoundHandle soundHandle[SAMPLEVOICES]; // Sample handles for each mixer channel
|
||||
Audio::SeekableAudioStream *_sfxStream[NUMSAMPLES];
|
||||
Audio::SoundHandle _soundHandle[SAMPLEVOICES]; // Sample handles for each mixer channel
|
||||
|
||||
SSound GSample[MAXSAMPLE];
|
||||
SSound _gSample[MAXSAMPLE];
|
||||
|
||||
uint32 nltime; // timer variable
|
||||
int16 playing[SAMPLEVOICES]; // sample currently playing
|
||||
int16 smpvol[SAMPLEVOICES];
|
||||
uint32 _timer;
|
||||
int16 _samplePlaying[SAMPLEVOICES]; // sample currently playing
|
||||
int16 _sampleVolume[SAMPLEVOICES];
|
||||
|
||||
uint8 StepChannel;
|
||||
uint8 BackChannel;
|
||||
uint8 SoundFadStatus;
|
||||
uint8 _stepChannel;
|
||||
uint8 _backChannel;
|
||||
uint8 _soundFadeStatus;
|
||||
|
||||
int16 SoundFadInVal;
|
||||
int16 SoundFadOutVal;
|
||||
int16 _soundFadeInVal;
|
||||
int16 _soundFadeOutVal;
|
||||
|
||||
public:
|
||||
void soundtimefunct();
|
||||
void StopSoundSystem();
|
||||
void LoadAudioWav(int num, Common::String fileName);
|
||||
void NLPlaySound(int num);
|
||||
void NLStopSound(int num);
|
||||
void SoundStopAll();
|
||||
void SoundFadOut();
|
||||
void SoundFadIn(int num);
|
||||
void WaitSoundFadEnd();
|
||||
void soundTimer();
|
||||
void stopSoundSystem();
|
||||
void loadAudioWav(int num, Common::String fileName);
|
||||
void play(int num);
|
||||
void stop(int num);
|
||||
void stopAll();
|
||||
void fadeOut();
|
||||
void fadeIn(int num);
|
||||
void waitEndFading();
|
||||
void SoundPasso(int midx, int midz, int act, int frame, uint16 *list);
|
||||
int32 Talk(const char *name);
|
||||
void StopTalk();
|
||||
void ReadSounds();
|
||||
int32 talkStart(const char *name);
|
||||
void talkStop();
|
||||
void loadRoomSounds();
|
||||
|
||||
void syncGameStream(Common::Serializer &ser);
|
||||
void loadSamples(Common::File *file);
|
||||
|
@ -183,7 +183,7 @@ TrecisionEngine::~TrecisionEngine() {
|
||||
|
||||
_dataFile.close();
|
||||
_speechFile.close();
|
||||
_soundMgr->StopSoundSystem();
|
||||
_soundMgr->stopSoundSystem();
|
||||
|
||||
delete _extraRoomObject;
|
||||
delete _animMgr;
|
||||
|
@ -409,7 +409,7 @@ void AnimManager::stopFullMotion() {
|
||||
RedrawRoom();
|
||||
|
||||
if (_curDialog == dF582)
|
||||
_vm->_soundMgr->SoundFadOut();
|
||||
_vm->_soundMgr->fadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,7 +424,7 @@ void AnimManager::refreshAnim(int box) {
|
||||
}
|
||||
|
||||
void AnimManager::refreshAllAnimations() {
|
||||
_vm->_soundMgr->soundtimefunct();
|
||||
_vm->_soundMgr->soundTimer();
|
||||
}
|
||||
|
||||
void AnimManager::refreshSmkAnim(int animation) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user