SCI/new music code:

- sounds are no longer stopped in cmdUpdateCues if their signal is set
- cmdSetSoundVolume no longer throws a warning if it can't find the associated sound (in some games, it's called before the actual sound is loaded)
- removed unused parameters to the SciMusic() class and to MusicEntry::onTimer()
- removed a hack to get the sound loop selector

svn-id: r46923
This commit is contained in:
Filippos Karapetis 2010-01-03 13:28:59 +00:00
parent 2861cab322
commit 72a020320f
3 changed files with 14 additions and 12 deletions

View File

@ -37,7 +37,7 @@
namespace Sci {
SciMusic::SciMusic(ResourceManager *resMan, SegManager *segMan, SciVersion soundVersion)
SciMusic::SciMusic(SciVersion soundVersion)
: _soundVersion(soundVersion), _soundOn(true) {
// Reserve some space in the playlist, to avoid expensive insertion
@ -365,7 +365,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
void SciMusic::onTimer() {
const MusicList::iterator end = _playList.end();
for (MusicList::iterator i = _playList.begin(); i != end; ++i)
(*i)->onTimer(_soundVersion);
(*i)->onTimer();
}
void SciMusic::soundPlay(MusicEntry *pSnd) {
@ -383,11 +383,9 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
_mutex.unlock(); // unlock to perform mixer-related calls
if (pSnd->pStreamAud && !_pMixer->isSoundHandleActive(pSnd->hCurrentAud)) {
SegManager *segMan = ((SciEngine *)g_engine)->getEngineState()->_segMan; // HACK
uint16 loop = GET_SEL32V(segMan, pSnd->soundObj, loop);
// Are we supposed to loop the stream?
if (loop > 1)
pSnd->pStreamAud->setNumLoops(loop);
if (pSnd->loop > 1)
pSnd->pStreamAud->setNumLoops(pSnd->loop);
else
pSnd->pStreamAud->setNumLoops(1);
_pMixer->playInputStream(pSnd->soundType, &pSnd->hCurrentAud,
@ -549,7 +547,7 @@ MusicEntry::MusicEntry() {
MusicEntry::~MusicEntry() {
}
void MusicEntry::onTimer(SciVersion soundVersion) {
void MusicEntry::onTimer() {
if (status != kSoundPlaying)
return;

View File

@ -112,7 +112,7 @@ public:
~MusicEntry();
void doFade();
void onTimer(SciVersion soundVersion);
void onTimer();
#ifndef USE_OLD_MUSIC_FUNCTIONS
virtual void saveLoadWithSerializer(Common::Serializer &ser);
@ -128,7 +128,7 @@ class SciMusic
{
public:
SciMusic(ResourceManager *resMan, SegManager *segMan, SciVersion soundVersion);
SciMusic(SciVersion soundVersion);
~SciMusic();
void init();

View File

@ -134,7 +134,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
#endif
#ifndef USE_OLD_MUSIC_FUNCTIONS
_music = new SciMusic(_resMan, _segMan, _soundVersion);
_music = new SciMusic(_soundVersion);
_music->init();
#endif
@ -796,7 +796,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
}
break;
case SIGNAL_OFFSET:
cmdStopSound(obj, 0);
PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
break;
default:
// Sync the signal of the sound object
@ -885,7 +885,11 @@ void SoundCommandParser::cmdSetSoundVolume(reg_t obj, int16 value) {
#ifndef USE_OLD_MUSIC_FUNCTIONS
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
warning("cmdSetSoundVolume: Slot not found (%04x:%04x)", PRINT_REG(obj));
// Do not throw a warning if the sound can't be found, as in some games
// this is called before the actual sound is loaded (e.g. SQ4CD, with the
// drum sounds of the energizer bunny at the beginning), so this is normal
// behavior
//warning("cmdSetSoundVolume: Slot not found (%04x:%04x)", PRINT_REG(obj));
return;
}