[Scummvm-cvs-logs] SF.net SVN: scummvm:[46479] scummvm/trunk/engines/sci/sfx
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Dec 22 13:34:28 CET 2009
Revision: 46479
http://scummvm.svn.sourceforge.net/scummvm/?rev=46479&view=rev
Author: thebluegr
Date: 2009-12-22 12:34:27 +0000 (Tue, 22 Dec 2009)
Log Message:
-----------
Started implementing SCI1.1 digital sound effect playing in the new music code
Modified Paths:
--------------
scummvm/trunk/engines/sci/sfx/audio.h
scummvm/trunk/engines/sci/sfx/music.cpp
Modified: scummvm/trunk/engines/sci/sfx/audio.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/audio.h 2009-12-22 06:02:49 UTC (rev 46478)
+++ scummvm/trunk/engines/sci/sfx/audio.h 2009-12-22 12:34:27 UTC (rev 46479)
@@ -63,6 +63,7 @@
void setAudioRate(uint16 rate) { _audioRate = rate; }
Audio::SoundHandle* getAudioHandle() { return &_audioHandle; }
+ Audio::AudioStream* getAudioStream(uint32 number, uint32 volume, int *sampleLen);
int getAudioPosition();
int startAudio(uint16 module, uint32 tuple);
void stopAudio();
@@ -88,8 +89,6 @@
Resource *_syncResource; /**< Used by kDoSync for speech syncing in CD talkie games */
uint _syncOffset;
uint32 _audioCdStart;
-
- Audio::AudioStream* getAudioStream(uint32 number, uint32 volume, int *sampleLen);
};
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp 2009-12-22 06:02:49 UTC (rev 46478)
+++ scummvm/trunk/engines/sci/sfx/music.cpp 2009-12-22 12:34:27 UTC (rev 46479)
@@ -321,13 +321,42 @@
pSnd->pStreamAud = Audio::makeLinearInputStream(pdata + 8, size, rate,
Audio::Mixer::FLAG_UNSIGNED, 0, 0);
pSnd->hCurrentAud = Audio::SoundHandle();
- } else {// play MIDI track
- if (pSnd->pMidiParser == NULL) {
- pSnd->pMidiParser = new MidiParser_SCI();
- pSnd->pMidiParser->setMidiDriver(_pMidiDrv);
- pSnd->pMidiParser->setTimerRate(_dwTempo);
+ } else {
+ // In SCI1.1 games, sound effects are started from here. If we can find
+ // a relevant audio resource, play it, otherwise switch to synthesized
+ // effects. If the resource exists, play it using map 65535 (sound
+ // effects map)
+ int16 songNumber = GET_SEL32V(_segMan, pSnd->soundObj, number);
+ EngineState *s = ((SciEngine *)g_engine)->getEngineState(); // HACK
+ AudioPlayer *audio = s->_audio;
+ ResourceManager* resMan = s->resMan;
+
+ if (resMan->testResource(ResourceId(kResourceTypeAudio, songNumber)) &&
+ getSciVersion() >= SCI_VERSION_1_1) {
+ // Found a relevant audio resource, play it
+ audio->stopAudio();
+
+ if (pSnd->pStreamAud)
+ delete pSnd->pStreamAud;
+ int sampleLen;
+ pSnd->pStreamAud = audio->getAudioStream(songNumber, 65535, &sampleLen);
+ pSnd->hCurrentAud = Audio::SoundHandle();
+
+ PUT_SEL32V(_segMan, pSnd->soundObj, signal, 0);
+
+ // FIXME: the scripts are signalled that the sound has stopped before it has
+ // actually stopped, observable in the ship flight sequence in the first scene
+ // of SQ4CD, right after the intro
+ soundPlay(pSnd);
+ } else {
+ // play MIDI track
+ if (pSnd->pMidiParser == NULL) {
+ pSnd->pMidiParser = new MidiParser_SCI();
+ pSnd->pMidiParser->setMidiDriver(_pMidiDrv);
+ pSnd->pMidiParser->setTimerRate(_dwTempo);
+ }
+ pSnd->pMidiParser->loadMusic(pTrack, pSnd);
}
- pSnd->pMidiParser->loadMusic(pTrack, pSnd);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list