[Scummvm-cvs-logs] SF.net SVN: scummvm:[41693] scummvm/branches/gsoc2009-mods

nolange at users.sourceforge.net nolange at users.sourceforge.net
Sat Jun 20 00:13:43 CEST 2009


Revision: 41693
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41693&view=rev
Author:   nolange
Date:     2009-06-19 22:13:43 +0000 (Fri, 19 Jun 2009)

Log Message:
-----------
modified doSong so you can start a new Song without killing running macros

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h

Modified: scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp	2009-06-19 21:42:14 UTC (rev 41692)
+++ scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp	2009-06-19 22:13:43 UTC (rev 41693)
@@ -82,7 +82,8 @@
 
 void Player_V4A::stopSound(int nr) {
 	if (nr == _musicId) {
-		_mixer->stopHandle(_musicHandle);
+		_tfmxPlay->stopSong();
+		//_mixer->stopHandle(_musicHandle);
 		_musicId = 0;
 	} else
 		warning("player_v4a: stop Sound %d", nr);
@@ -133,7 +134,7 @@
 		_musicId = nr;
 
 		if (!_mixer->isSoundHandleActive(_musicHandle))
-			_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _tfmxPlay, -1, Audio::Mixer::kMaxChannelVolume, 0, false, false);
+			_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _tfmxPlay, -1, Audio::Mixer::kMaxChannelVolume, 0, true, false);
 	}
 }
 

Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-06-19 21:42:14 UTC (rev 41692)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-06-19 22:13:43 UTC (rev 41693)
@@ -890,32 +890,39 @@
 	startPaula();
 }
 
-void Tfmx::doSong(int songPos) {
+void Tfmx::stopSong(bool stopAudio) {
+	Common::StackLock lock(_mutex);
+	_playerCtx.song = -1;
+	if (stopAudio)
+		stopMacroChannels();
+}
+
+void Tfmx::doSong(int songPos, bool stopAudio) {
 	assert(0 <= songPos && songPos < kNumSubsongs);
 	Common::StackLock lock(_mutex);
-	// bool stopCurSong = false;
-	int prevSong = _playerCtx.song;
 
+	stopPatternChannels();
+	if (stopAudio)
+		stopMacroChannels();
+
 	_playerCtx.song = (int8)songPos;
 
 	_trackCtx.loopCount = -1;
 	_trackCtx.startInd = _trackCtx.posInd = _subsong[songPos].songstart;
 	_trackCtx.stopInd = _subsong[songPos].songend;
 
+	const bool palFlag = (_resource.headerFlags & 2);
 	const uint16 tempo = _subsong[songPos].tempo;
 	uint16 ciaIntervall;
 	if (tempo >= 0x10) {
 		ciaIntervall = (uint16)(kCiaBaseInterval / tempo);
 		_playerCtx.patternSkip = 0;
 	} else {
-		ciaIntervall = kPalDefaultCiaVal;
+		ciaIntervall = palFlag ? kPalDefaultCiaVal : kNtscDefaultCiaVal;
 		_playerCtx.patternSkip = tempo;
 	}
-	setTimerBaseValue(kPalCiaClock);
 	setInterruptFreqUnscaled(ciaIntervall);
 
-	stopPatternChannels();
-	stopMacroChannels();
 	_playerCtx.patternCount = 0;
 	while (trackStep())
 		;

Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h	2009-06-19 21:42:14 UTC (rev 41692)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h	2009-06-19 22:13:43 UTC (rev 41693)
@@ -46,7 +46,8 @@
 	virtual ~Tfmx();
 
 	void interrupt();
-	void doSong(int songPos);
+	void stopSong(bool stopAudio = true);
+	void doSong(int songPos, bool stopAudio = false);
 	void doSfx(int sfxIndex);
 	void doMacro(int note, int macro, int relVol = 0, int finetune = 0, int channelNo = 0);
 	bool load(Common::SeekableReadStream &musicData, Common::SeekableReadStream &sampleData);
@@ -261,6 +262,7 @@
 			unlockMacroChannel(_channelCtx[i]);
 			clearMacroProgramm(_channelCtx[i]);
 			_channelCtx[i].note = 0;
+			_channelCtx[i].volume = 0;
 		}
 	}
 


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