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

nolange at users.sourceforge.net nolange at users.sourceforge.net
Sun Jul 19 02:44:54 CEST 2009


Revision: 42600
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42600&view=rev
Author:   nolange
Date:     2009-07-19 00:44:54 +0000 (Sun, 19 Jul 2009)

Log Message:
-----------
some more tables included, for tempo and volume values

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/engines/kyra/sound_amiga.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h

Modified: scummvm/branches/gsoc2009-mods/engines/kyra/sound_amiga.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/kyra/sound_amiga.cpp	2009-07-18 22:46:07 UTC (rev 42599)
+++ scummvm/branches/gsoc2009-mods/engines/kyra/sound_amiga.cpp	2009-07-19 00:44:54 UTC (rev 42600)
@@ -81,13 +81,55 @@
 }
 
 void SoundAmiga::playTrack(uint8 track) {
-	_driver->doSong(track - 2);
-	if (!_mixer->isSoundHandleActive(_soundChannels[0]))
+	static const byte tempoIntro[6] = { 0x46, 0x55, 0x3C, 0x41, 0x78, 0x50 };
+	static const byte tempoIngame[23] = {
+		0x64, 0x64, 0x64, 0x64, 0x64, 0x73, 0x4B, 0x64,
+		0x64, 0x64, 0x55, 0x9C, 0x6E, 0x91, 0x78, 0x84,
+		0x32, 0x64, 0x64, 0x6E, 0x3C, 0xD8, 0xAF
+	};
+	static const byte loopIngame[23] = {
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01,
+		0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
+	};
+
+	// intro
+	if (track >= 2) {
+		track -= 2;
+		_driver->setVolume(0x40);
+		_driver->doSong(track);
+		_driver->setTempo(tempoIntro[track] << 4);
+		if (!_mixer->isSoundHandleActive(_soundChannels[0]))
 			_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
+	} else if (track == 0){
+		_driver->stopMusic();
+	} else { // track == 1
+		beginFadeOut();
+	}
+
+	// ingame
+	if (false && track < 0x80 && track != 3) {
+		if (track >= 2) {
+			track -= 0xB;
+			_driver->setVolume(0x40);
+			if (loopIngame)
+				; // TODO: enable looping
+			_driver->doSong(track);
+			_driver->setTempo(tempoIngame[track] << 4);
+			if (!_mixer->isSoundHandleActive(_soundChannels[0]))
+				_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
+		} else if (track == 0){
+			_driver->stopMusic();
+		} else { // track == 1
+			beginFadeOut();
+	}
+
+	}
 }
 
 void SoundAmiga::haltTrack() {
 
+
 }
 
 void SoundAmiga::beginFadeOut() {
@@ -105,22 +147,26 @@
 		_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
 
 
-	/* // ingame? 
+	// ingame
+	if (0) {
 	uint16 extVar = 1; // maybe indicates music playing or enabled
 	uint16 extVar2 = 1; // sound loaded ?
-	if (0x61 <= track && track <= 0x63 && extVar) {
-		assert(false);//some music-commands
-	}
-	assert(track < ARRAYSIZE(kEffectsTable));
-	const EffectEntry &entry = kEffectsTable[track];
+	if (0x61 <= track && track <= 0x63 && extVar)
+		playTrack(track - 0x4F);
+
+	assert(track < ARRAYSIZE(tableEffectsGame));
+	const EffectEntry &entry = tableEffectsGame[track];
 	if (extVar2 && entry.note) {
 		byte pan = (entry.pan == 2) ? 0 : entry.pan;
 		_driver->playNote(entry.note, entry.patch, entry.duration, entry.volume, pan != 0);
 		if (!_mixer->isSoundHandleActive(_soundChannels[0]))
 			_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
-	}*/
+
+	}
+	}
 }
 
+
 const SoundAmiga::EffectEntry SoundAmiga::tableEffectsIntro[40] = {
 	{ 0x0000, 0x00, 0x00,   0,  0 },
 	{ 0x0000, 0x00, 0x00,   0,  0 },

Modified: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-18 22:46:07 UTC (rev 42599)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-19 00:44:54 UTC (rev 42600)
@@ -314,8 +314,7 @@
 	_playerCtx.musicLoop = false;
 
 	setTempo(_playerCtx.tempoInitial << 4);
-	_playerCtx.nextEvent = _scores[songIndex].events;
-	_playerCtx.nextEventTime = _playerCtx.nextEvent->startTime;
+	_playerCtx.tempoTime = 0;
 	_playerCtx.scoreIndex = songIndex;
 	_playerCtx.ticks = 0;
 
@@ -324,6 +323,16 @@
 	for (int i = 0; i < kNumChannels; ++i)
 		resetChannel(_channelCtx[i], (i & 1) != 0);
 
+	const Event *cev = _scores[songIndex].events;
+	// Songs are special markers in the score
+	for (; advance > 0; --advance) {
+		// TODO - check for boundaries
+		for(; cev->command != 0xFF && (cev->command != 0xA0 || (cev->stopTime >> 8) != 0x00); ++cev)
+			;
+	}
+	_playerCtx.nextEvent = cev;
+	_playerCtx.nextEventTime = cev->startTime;
+
 	_playerCtx.musicPlaying = true;
 	Paula::startPaula();
 	return true;

Modified: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-18 22:46:07 UTC (rev 42599)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-19 00:44:54 UTC (rev 42600)
@@ -210,6 +210,9 @@
 	void killVoice(byte num);
 	int playNote(byte note, byte patch, uint16 duration, uint16 volume, bool rightSide);
 
+	void setVolume(const byte volume) {
+		_playerCtx.volume = volume;
+	}
 	void setTempo(const uint16 tempo) {
 		_playerCtx.tickUnit = (int32)(((uint32)(tempo & 0xFFF0) << 8) / (uint16)(5 * _playerCtx.vBlankFreq));
 	}


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