aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2010-06-29 20:50:52 +0000
committerMax Horn2010-06-29 20:50:52 +0000
commitb09996cb5cea63482c16faafb55d83bd50c04c90 (patch)
treef2d62ffe97f0674beb9a9fe88c3f15ba6cddfaad /engines
parent7951e3ddcf1053686882b6fe4881a4607bcbea05 (diff)
downloadscummvm-rg350-b09996cb5cea63482c16faafb55d83bd50c04c90.tar.gz
scummvm-rg350-b09996cb5cea63482c16faafb55d83bd50c04c90.tar.bz2
scummvm-rg350-b09996cb5cea63482c16faafb55d83bd50c04c90.zip
SCI: Rewrap yet more comments
svn-id: r50505
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sound/audio.cpp16
-rw-r--r--engines/sci/sound/music.cpp43
-rw-r--r--engines/sci/sound/soundcmd.cpp60
3 files changed, 69 insertions, 50 deletions
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index 336218eaec..ed9061ab81 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -77,9 +77,10 @@ int AudioPlayer::startAudio(uint16 module, uint32 number) {
}
int AudioPlayer::wPlayAudio(uint16 module, uint32 tuple) {
- // Get the audio sample length and set the wPlay flag so we return 0 on position.
- // SSCI pre-loads the audio here, but it's much easier for us to just get the
- // sample length and return that. wPlayAudio should *not* actually start the sample.
+ // Get the audio sample length and set the wPlay flag so we return 0 on
+ // position. SSCI pre-loads the audio here, but it's much easier for us to
+ // just get the sample length and return that. wPlayAudio should *not*
+ // actually start the sample.
int sampleLen = 0;
Audio::AudioStream *audioStream = getAudioStream(tuple, module, &sampleLen);
@@ -272,8 +273,8 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
byte *compressedData = (byte *)malloc(audioRes->size);
assert(compressedData);
// We copy over the compressed data in our own buffer. We have to do
- // this, because ResourceManager may free the original data late.
- // All other compression types already decompress completely into an
+ // this, because ResourceManager may free the original data late. All
+ // other compression types already decompress completely into an
// additional buffer here. MP3/OGG/FLAC decompression works on-the-fly
// instead.
memcpy(compressedData, audioRes->data, audioRes->size);
@@ -367,8 +368,9 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
*sampleLen = (audioSeekStream->getLength().msecs() * 60) / 1000; // we translate msecs to ticks
audioStream = audioSeekStream;
}
- // We have to make sure that we don't depend on resource manager pointers after this point, because the actual
- // audio resource may get unloaded by resource manager at any time
+ // We have to make sure that we don't depend on resource manager pointers
+ // after this point, because the actual audio resource may get unloaded by
+ // resource manager at any time.
if (audioStream)
return audioStream;
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index ba103ee746..874f0a381e 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -64,11 +64,16 @@ void SciMusic::init() {
_dwTempo = 0;
// Default to MIDI in SCI32 games, as many don't have AdLib support.
- // WORKAROUND: Default to MIDI in Amiga SCI1_EGA+ games as we don't support those patches yet.
- // We also don't yet support the 7.pat file of SCI1+ Mac games or SCI0 Mac patches, so we
- // default to MIDI in those games to let them run.
+ // WORKAROUND: Default to MIDI in Amiga SCI1_EGA+ games as we don't support
+ // those patches yet. We also don't yet support the 7.pat file of SCI1+ Mac
+ // games or SCI0 Mac patches, so we default to MIDI in those games to let
+ // them run.
Common::Platform platform = g_sci->getPlatform();
- uint32 dev = MidiDriver::detectDevice((getSciVersion() >= SCI_VERSION_2 || platform == Common::kPlatformMacintosh || (platform == Common::kPlatformAmiga && getSciVersion() >= SCI_VERSION_1_EGA)) ? (MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM) : (MDT_PCSPK | MDT_ADLIB | MDT_MIDI));
+ uint32 dev = MidiDriver::detectDevice(
+ (getSciVersion() >= SCI_VERSION_2 || platform == Common::kPlatformMacintosh ||
+ (platform == Common::kPlatformAmiga && getSciVersion() >= SCI_VERSION_1_EGA))
+ ? (MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM)
+ : (MDT_PCSPK | MDT_ADLIB | MDT_MIDI));
switch (MidiDriver::getMusicType(dev)) {
case MT_ADLIB:
@@ -100,7 +105,8 @@ void SciMusic::init() {
_bMultiMidi = ConfMan.getBool("multi_midi");
- // Find out what the first possible channel is (used, when doing channel remapping)
+ // Find out what the first possible channel is (used, when doing channel
+ // remapping).
_driverFirstChannel = _pMidiDrv->getFirstChannel();
}
@@ -128,9 +134,10 @@ void SciMusic::putMidiCommandInQueue(uint32 midi) {
_queuedCommands.push_back(midi);
}
-// This sends the stored commands from queue to driver (is supposed to get called only during onTimer())
-// at least mt32 emulation doesn't like getting note-on commands from main thread (if we directly send, we would get
-// a crash during piano scene in lsl5)
+// This sends the stored commands from queue to driver (is supposed to get
+// called only during onTimer()). At least mt32 emulation doesn't like getting
+// note-on commands from main thread (if we directly send, we would get a crash
+// during piano scene in lsl5).
void SciMusic::sendMidiCommandsFromQueue() {
uint curCommand = 0;
uint commandCount = _queuedCommands.size();
@@ -210,10 +217,10 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
int channelFilterMask = 0;
SoundResource::Track *track = pSnd->soundRes->getTrackByType(_pMidiDrv->getPlayId());
- // If MIDI device is selected but there is no digital track in sound resource
- // try to use adlib's digital sample if possible
- // Also, if the track couldn't be found, load the digital track, as some games
- // depend on this (e.g. the Longbow demo)
+ // If MIDI device is selected but there is no digital track in sound
+ // resource try to use adlib's digital sample if possible. Also, if the
+ // track couldn't be found, load the digital track, as some games depend on
+ // this (e.g. the Longbow demo).
if (!track || (_bMultiMidi && track->digitalChannelNr == -1)) {
SoundResource::Track *digital = pSnd->soundRes->getDigitalTrack();
if (digital)
@@ -260,8 +267,8 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
}
}
-// This one checks, if requested channel is available -> in that case give caller that channel
-// Otherwise look for an unused one
+// This one checks, if requested channel is available -> in that case give
+// caller that channel. Otherwise look for an unused one
int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) {
// Don't even try this for SCI0
if (_soundVersion <= SCI_VERSION_0_LATE)
@@ -316,7 +323,7 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
if ((_soundVersion <= SCI_VERSION_0_LATE) && (alreadyPlaying)) {
// Music already playing in SCI0?
if (pSnd->priority > alreadyPlaying->priority) {
- // And new priority higher? pause previous music and play new one immediately
+ // And new priority higher? pause previous music and play new one immediately.
// Example of such case: lsl3, when getting points (jingle is played then)
soundPause(alreadyPlaying);
alreadyPlaying->isQueued = true;
@@ -339,7 +346,8 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
pSnd->pLoopStream, -1, pSnd->volume, 0,
DisposeAfterUse::NO);
} else {
- // Rewind in case we play the same sample multiple times (non-looped) like in pharkas right at the start
+ // Rewind in case we play the same sample multiple times
+ // (non-looped) like in pharkas right at the start
pSnd->pStreamAud->rewind();
_pMixer->playStream(pSnd->soundType, &pSnd->hCurrentAud,
pSnd->pStreamAud, -1, pSnd->volume, 0,
@@ -377,7 +385,8 @@ void SciMusic::soundStop(MusicEntry *pSnd) {
if (pSnd->pMidiParser) {
_mutex.lock();
pSnd->pMidiParser->mainThreadBegin();
- // We shouldn't call stop in case it's paused, otherwise we would send allNotesOff() again
+ // We shouldn't call stop in case it's paused, otherwise we would send
+ // allNotesOff() again
if (previousStatus == kSoundPlaying)
pSnd->pMidiParser->stop();
freeChannels(pSnd);
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 5e0f45e166..7cdb3e08bf 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -134,7 +134,8 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
_resMan(resMan), _segMan(segMan), _kernel(kernel), _audio(audio), _soundVersion(soundVersion) {
#ifdef USE_OLD_MUSIC_FUNCTIONS
- // The following hack is needed to ease the change from old to new sound code (because the new sound code does not use SfxState)
+ // The following hack is needed to ease the change from old to new sound
+ // code (because the new sound code does not use SfxState)
_state = &g_sci->getEngineState()->_sound; // HACK
#endif
@@ -378,22 +379,24 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
}
if (!readSelectorValue(_segMan, obj, SELECTOR(nodePtr)) && obj.segment) {
- // 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)
+ // 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).
if (_resMan->testResource(ResourceId(kResourceTypeAudio, songNumber)) &&
getSciVersion() >= SCI_VERSION_1_1) {
// Found a relevant audio resource, play it
_audio->stopAudio();
warning("Initializing audio resource instead of requested sound resource %d", songNumber);
sampleLen = _audio->startAudio(65535, songNumber);
- // Also create iterator, that will fire SI_FINISHED event, when the sound is done playing
+ // Also create iterator, that will fire SI_FINISHED event, when
+ // the sound is done playing.
_state->sfx_add_song(new_timer_iterator(sampleLen), 0, handle, songNumber);
} else {
if (!_resMan->testResource(ResourceId(kResourceTypeSound, songNumber))) {
warning("Could not open song number %d", songNumber);
- // Send a "stop handle" event so that the engine won't wait forever here
+ // Send a "stop handle" event so that the engine won't wait
+ // forever here.
_state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
return;
@@ -533,12 +536,13 @@ void SoundCommandParser::processStopSound(reg_t obj, int16 value, bool sampleFin
writeSelectorValue(_segMan, obj, SELECTOR(handle), 0);
}
- // Set signal selector in sound SCI0 games only, when the sample has finished playing
- // If we don't set it at all, we get a problem when using vaporizer on the 2 guys
- // If we set it all the time, we get no music in sq3new and kq1
- // FIXME: this *may* be wrong, it's impossible to find out in sierra DOS sci, because SCI0 under DOS didn't have
- // sfx drivers included
- // We need to set signal in sound SCI1+ games all the time
+ // Set signal selector in sound SCI0 games only, when the sample has
+ // finished playing. If we don't set it at all, we get a problem when using
+ // vaporizer on the 2 guys. If we set it all the time, we get no music in
+ // sq3new and kq1.
+ // FIXME: This *may* be wrong, it's impossible to find out in Sierra DOS
+ // SCI, because SCI0 under DOS didn't have sfx drivers included.
+ // We need to set signal in sound SCI1+ games all the time.
if ((_soundVersion > SCI_VERSION_0_LATE) || sampleFinishedPlaying)
writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
@@ -560,8 +564,8 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) {
#else
if (!obj.segment) { // pause the whole playlist
- // Pausing/Resuming the whole playlist was introduced
- // in the SCI1 late sound scheme
+ // Pausing/Resuming the whole playlist was introduced in the SCI1 late
+ // sound scheme.
if (_soundVersion <= SCI_VERSION_1_EARLY)
return;
@@ -685,7 +689,8 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) {
switch (_argc) {
case 2: // SCI0
- // SCI0 fades out all the time and when fadeout is done it will also stop the music from playing
+ // SCI0 fades out all the time and when fadeout is done it will also
+ // stop the music from playing
musicSlot->fadeTo = 0;
musicSlot->fadeStep = -5;
musicSlot->fadeTickerStep = 10 * 16667 / _music->soundGetTempo();
@@ -864,10 +869,12 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
cmdStopSound(obj, 0);
}
} else {
- // Slot actually has no data (which would mean that a sound-resource w/ unsupported data is used
+ // Slot actually has no data (which would mean that a sound-resource w/
+ // unsupported data is used.
// (example lsl5 - sound resource 744 - it's roland exclusive
writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
- // If we don't set signal here, at least the switch to the mud wrestling room in lsl5 will not work
+ // If we don't set signal here, at least the switch to the mud wrestling
+ // room in lsl5 will not work.
}
if (musicSlot->fadeCompleted) {
@@ -968,9 +975,9 @@ void SoundCommandParser::cmdSetSoundVolume(reg_t obj, int16 value) {
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
// 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
+ // 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;
}
@@ -1036,7 +1043,7 @@ void SoundCommandParser::cmdSetSoundLoop(reg_t obj, int16 value) {
// before actually initializing the sound and adding it to the playlist
// with cmdInitSound. Usually, it doesn't matter if the game doesn't
// request to loop the sound, so in this case, don't throw any warning,
- // otherwise do, because the sound won't be looped
+ // otherwise do, because the sound won't be looped.
if (value == -1) {
warning("cmdSetSoundLoop: Slot not found (%04x:%04x) and the song was requested to be looped", PRINT_REG(obj));
} else {
@@ -1070,12 +1077,13 @@ void SoundCommandParser::updateSci0Cues() {
const MusicList::iterator end = _music->getPlayListEnd();
for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) {
// Is the sound stopped, and the sound object updated too? If yes, skip
- // this sound, as SCI0 only allows one active song
+ // this sound, as SCI0 only allows one active song.
if ((*i)->isQueued) {
pWaitingForPlay = (*i);
- // FIXME (?) - in iceman 2 songs are queued when playing the door sound - if we use the first song for resuming
- // then it's the wrong one. Both songs have same priority. Maybe the new sound function in sci0
- // is somehow responsible
+ // FIXME(?): In iceman 2 songs are queued when playing the door
+ // sound - if we use the first song for resuming then it's the wrong
+ // one. Both songs have same priority. Maybe the new sound function
+ // in sci0 is somehow responsible.
continue;
}
if ((*i)->signal == 0 && (*i)->status != kSoundPlaying)