mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-16 01:08:56 +00:00
implement special case for playing music with beginning offset where other one stopped
svn-id: r30483
This commit is contained in:
parent
d167ad4066
commit
f15b41596b
@ -141,7 +141,7 @@ private:
|
||||
void callback();
|
||||
void switchToNextRegion(Track *track);
|
||||
int allocSlot(int priority);
|
||||
void startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority);
|
||||
void startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority, Track *otherTrack);
|
||||
void selectVolumeGroup(int soundId, int volGroupId);
|
||||
|
||||
int32 getPosInMs(int soundId);
|
||||
@ -149,6 +149,7 @@ private:
|
||||
|
||||
int getSoundIdByName(const char *soundName);
|
||||
void fadeOutMusic(int fadeDelay);
|
||||
void fadeOutMusicAndStartNew(int fadeDelay, const char *filename, int soundId);
|
||||
void setHookIdForMusic(int hookId);
|
||||
Track *cloneToFadeOutTrack(Track *track, int fadeDelay);
|
||||
|
||||
@ -177,6 +178,7 @@ public:
|
||||
void startVoice(int soundId, const char *soundName);
|
||||
void startMusic(int soundId, int volume);
|
||||
void startMusic(const char *soundName, int soundId, int hookId, int volume);
|
||||
void startMusicWithOtherPos(const char *soundName, int soundId, int hookId, int volume, Track *otherTrack);
|
||||
void startSfx(int soundId, int priority);
|
||||
void startSound(int sound)
|
||||
{ error("IMuseDigital::startSound(int) should be never called"); }
|
||||
|
@ -167,8 +167,10 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table
|
||||
}
|
||||
}
|
||||
|
||||
if (!songName)
|
||||
if (!songName) {
|
||||
fadeOutMusic(120);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (table->transitionType) {
|
||||
case 0:
|
||||
@ -184,8 +186,7 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table
|
||||
_stopingSequence = true;
|
||||
if ((!sequence) && (table->attribPos != 0) &&
|
||||
(table->attribPos == _digStateMusicTable[_curMusicState].attribPos)) {
|
||||
fadeOutMusic(108);
|
||||
startMusic(table->filename, table->soundId, 0, 127);
|
||||
fadeOutMusicAndStartNew(108, table->filename, table->soundId);
|
||||
} else {
|
||||
fadeOutMusic(108);
|
||||
startMusic(table->filename, table->soundId, hookId, 127);
|
||||
@ -291,8 +292,10 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
|
||||
}
|
||||
}
|
||||
|
||||
if (!songName)
|
||||
if (!songName) {
|
||||
fadeOutMusic(120);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (table->transitionType) {
|
||||
case 0:
|
||||
@ -323,8 +326,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
|
||||
_stopingSequence = true;
|
||||
if ((!sequence) && (table->attribPos != 0) &&
|
||||
(table->attribPos == _comiStateMusicTable[_curMusicState].attribPos)) {
|
||||
fadeOutMusic(table->fadeOutDelay);
|
||||
startMusic(table->filename, table->soundId, 0, 127);
|
||||
fadeOutMusicAndStartNew(table->fadeOutDelay, table->filename, table->soundId);
|
||||
} else if (table->transitionType == 12) {
|
||||
fadeOutMusic(table->fadeOutDelay);
|
||||
startMusic(table->filename, table->soundId, table->hookId, 127);
|
||||
|
@ -226,27 +226,32 @@ void IMuseDigital::refreshScripts() {
|
||||
|
||||
void IMuseDigital::startVoice(int soundId, Audio::AudioStream *input) {
|
||||
debug(5, "startVoiceStream(%d)", soundId);
|
||||
startSound(soundId, "", 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127);
|
||||
startSound(soundId, "", 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127, NULL);
|
||||
}
|
||||
|
||||
void IMuseDigital::startVoice(int soundId, const char *soundName) {
|
||||
debug(5, "startVoiceBundle(%s)", soundName);
|
||||
startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_VOICE, NULL, 0, 127, 127);
|
||||
startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_VOICE, NULL, 0, 127, 127, NULL);
|
||||
}
|
||||
|
||||
void IMuseDigital::startMusic(int soundId, int volume) {
|
||||
debug(5, "startMusicResource(%d)", soundId);
|
||||
startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_MUSIC, NULL, 0, volume, 126);
|
||||
startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_MUSIC, NULL, 0, volume, 126, NULL);
|
||||
}
|
||||
|
||||
void IMuseDigital::startMusic(const char *soundName, int soundId, int hookId, int volume) {
|
||||
debug(5, "startMusicBundle(%s)", soundName);
|
||||
startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_MUSIC, NULL, hookId, volume, 126);
|
||||
startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_MUSIC, NULL, hookId, volume, 126, NULL);
|
||||
}
|
||||
|
||||
void IMuseDigital::startMusicWithOtherPos(const char *soundName, int soundId, int hookId, int volume, Track *otherTrack) {
|
||||
debug(5, "startMusicWithOtherPos(%s)", soundName);
|
||||
startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_MUSIC, NULL, hookId, volume, 126, otherTrack);
|
||||
}
|
||||
|
||||
void IMuseDigital::startSfx(int soundId, int priority) {
|
||||
debug(5, "startSfx(%d)", soundId);
|
||||
startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_SFX, NULL, 0, 127, priority);
|
||||
startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_SFX, NULL, 0, 127, priority, NULL);
|
||||
}
|
||||
|
||||
void IMuseDigital::getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height) {
|
||||
|
@ -80,7 +80,7 @@ int IMuseDigital::allocSlot(int priority) {
|
||||
return trackId;
|
||||
}
|
||||
|
||||
void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority) {
|
||||
void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority, Track *otherTrack) {
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::startSound()");
|
||||
debug(5, "IMuseDigital::startSound(%d)", soundId);
|
||||
|
||||
@ -153,6 +153,13 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
|
||||
track->mixerFlags |= kFlagLittleEndian;
|
||||
#endif
|
||||
|
||||
if (otherTrack && otherTrack->used && !otherTrack->toBeRemoved) {
|
||||
track->curRegion = otherTrack->curRegion;
|
||||
track->regionOffset = otherTrack->regionOffset;
|
||||
track->dataOffset = otherTrack->dataOffset;
|
||||
track->dataMod12Bit = otherTrack->dataMod12Bit;
|
||||
}
|
||||
|
||||
track->stream = Audio::makeAppendableAudioStream(freq, makeMixerFlags(track->mixerFlags));
|
||||
_mixer->playInputStream(track->getType(), &track->mixChanHandle, track->stream, -1, track->getVol(), track->getPan());
|
||||
}
|
||||
@ -267,6 +274,20 @@ void IMuseDigital::setFade(int soundId, int destVolume, int delay60HzTicks) {
|
||||
}
|
||||
}
|
||||
|
||||
void IMuseDigital::fadeOutMusicAndStartNew(int fadeDelay, const char *filename, int soundId) {
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::fadeOutMusicAndStartNew()");
|
||||
debug(5, "IMuseDigital::fadeOutMusicAndStartNew");
|
||||
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
Track *track = _track[l];
|
||||
if (track->used && !track->toBeRemoved && (track->volGroupId == IMUSE_VOLGRP_MUSIC)) {
|
||||
startMusicWithOtherPos(filename, soundId, 0, 127, track);
|
||||
cloneToFadeOutTrack(track, fadeDelay);
|
||||
flushTrack(track);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IMuseDigital::fadeOutMusic(int fadeDelay) {
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::fadeOutMusic()");
|
||||
debug(5, "IMuseDigital::fadeOutMusic");
|
||||
@ -276,6 +297,7 @@ void IMuseDigital::fadeOutMusic(int fadeDelay) {
|
||||
if (track->used && !track->toBeRemoved && (track->volGroupId == IMUSE_VOLGRP_MUSIC)) {
|
||||
cloneToFadeOutTrack(track, fadeDelay);
|
||||
flushTrack(track);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user