[Scummvm-cvs-logs] SF.net SVN: scummvm:[46856] scummvm/trunk/engines/sci/sfx
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Fri Jan 1 23:15:52 CET 2010
Revision: 46856
http://scummvm.svn.sourceforge.net/scummvm/?rev=46856&view=rev
Author: m_kiewitz
Date: 2010-01-01 22:15:52 +0000 (Fri, 01 Jan 2010)
Log Message:
-----------
SCI/newmusic: changed setting volume from fade logic, implemented updating loop selector for sound fx
Modified Paths:
--------------
scummvm/trunk/engines/sci/sfx/music.cpp
scummvm/trunk/engines/sci/sfx/music.h
scummvm/trunk/engines/sci/sfx/soundcmd.cpp
Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp 2010-01-01 21:59:11 UTC (rev 46855)
+++ scummvm/trunk/engines/sci/sfx/music.cpp 2010-01-01 22:15:52 UTC (rev 46856)
@@ -359,9 +359,8 @@
void SciMusic::onTimer() {
const MusicList::iterator end = _playList.end();
- for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
+ for (MusicList::iterator i = _playList.begin(); i != end; ++i)
(*i)->onTimer(_soundVersion);
- }
}
void SciMusic::soundPlay(MusicEntry *pSnd) {
@@ -521,11 +520,13 @@
hold = 0;
pauseCounter = 0;
+ sampleLoopCounter = 0;
fadeTo = 0;
fadeStep = 0;
fadeTicker = 0;
fadeTickerStep = 0;
+ fadeVolumeSet = false;
status = kSoundStopped;
@@ -542,6 +543,7 @@
if (status != kSoundPlaying)
return;
+ // Fade MIDI and digital sound effects
if (fadeStep)
doFade();
@@ -569,9 +571,8 @@
// Only process MIDI streams in this thread, not digital sound effects
if (pMidiParser)
pMidiParser->setVolume(volume);
- // TODO: create onTimer within audio.cpp to do the handling there, if we do it in cmdUpdateCues it wont
- // work right, because the last volume set won't get done at all. Also we are fading digital sound effects
- // currently here in any case currently. Fade code should get moved to void SciMusic::onTimer()
+ if (pStreamAud)
+ fadeVolumeSet = true; // set flag so that SoundCommandParser::cmdUpdateCues will set the volume of the stream
}
}
Modified: scummvm/trunk/engines/sci/sfx/music.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.h 2010-01-01 21:59:11 UTC (rev 46855)
+++ scummvm/trunk/engines/sci/sfx/music.h 2010-01-01 22:15:52 UTC (rev 46856)
@@ -87,11 +87,13 @@
byte hold;
int16 pauseCounter;
+ uint sampleLoopCounter;
byte fadeTo;
short fadeStep;
uint32 fadeTicker;
uint32 fadeTickerStep;
+ bool fadeVolumeSet;
SoundStatus status;
Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp 2010-01-01 21:59:11 UTC (rev 46855)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp 2010-01-01 22:15:52 UTC (rev 46856)
@@ -775,7 +775,12 @@
Audio::Mixer *mixer = g_system->getMixer();
if (musicSlot->pStreamAud) {
-
+ uint currentLoopCounter = musicSlot->pStreamAud->getNumPlayedLoops();
+ if (currentLoopCounter != musicSlot->sampleLoopCounter) {
+ // during last time we looped at least one time, update loop accordingly
+ musicSlot->loop -= currentLoopCounter - musicSlot->sampleLoopCounter;
+ musicSlot->sampleLoopCounter = currentLoopCounter;
+ }
// TODO: We need to update loop selector here, when sample is looping
if (!mixer->isSoundHandleActive(musicSlot->hCurrentAud)) {
musicSlot->ticker = SIGNAL_OFFSET;
@@ -784,8 +789,11 @@
} else {
musicSlot->ticker = (uint16)(mixer->getSoundElapsedTime(musicSlot->hCurrentAud) * 0.06);
}
- if (musicSlot->fadeStep)
- mixer->setChannelVolume(musicSlot->hCurrentAud, musicSlot->volume);
+ // We get a flag from MusicEntry::doFade() here to set volume for the stream
+ if (musicSlot->fadeVolumeSet) {
+ mixer->setChannelVolume(musicSlot->hCurrentAud, musicSlot->volume);
+ musicSlot->fadeVolumeSet = false;
+ }
}
_music->_mutex.lock(); // and lock again
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