[Scummvm-cvs-logs] SF.net SVN: scummvm:[55700] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Tue Feb 1 01:08:12 CET 2011


Revision: 55700
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55700&view=rev
Author:   strangerke
Date:     2011-02-01 00:08:12 +0000 (Tue, 01 Feb 2011)

Log Message:
-----------
HUGO: Use a separate thread for honker player and fix ticks per seconds

This fixes the speaker music stopped by message boxes, and the speaker music itself.

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/hugo.cpp
    scummvm/trunk/engines/hugo/sound.cpp
    scummvm/trunk/engines/hugo/sound.h

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2011-01-31 23:19:00 UTC (rev 55699)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2011-02-01 00:08:12 UTC (rev 55700)
@@ -257,7 +257,6 @@
 		_screen->drawHotspots();
 
 		g_system->updateScreen();
-		_sound->pcspkr_player();
 		runMachine();
 		// Handle input
 		Common::Event event;
@@ -298,6 +297,8 @@
 	_object->readObjectImages();                    // Read all object images
 	if (_platform == Common::kPlatformWindows)
 		_file->readUIFImages();                     // Read all uif images (only in Win versions)
+	
+	_sound->initPcspkrPlayer();
 }
 
 /**

Modified: scummvm/trunk/engines/hugo/sound.cpp
===================================================================
--- scummvm/trunk/engines/hugo/sound.cpp	2011-01-31 23:19:00 UTC (rev 55699)
+++ scummvm/trunk/engines/hugo/sound.cpp	2011-02-01 00:08:12 UTC (rev 55700)
@@ -239,6 +239,7 @@
 }
 
 SoundHandler::~SoundHandler() {
+	_vm->getTimerManager()->removeTimerProc(&loopPlayer);
 	_vm->_mixer->stopHandle(_speakerHandle);
 	delete _speakerStream;
 	delete _midiPlayer;
@@ -371,6 +372,10 @@
 	}
 }
 
+void SoundHandler::loopPlayer(void *refCon) {
+	((SoundHandler*)refCon)->pcspkr_player();
+}
+
 /**
 * Decrement last note's timer and see if time to play next note yet.
 * If so, interpret next note in string and play it.  Update ptr to string
@@ -384,6 +389,9 @@
 	static uint16 pcspkrSharps[8] = {1279, 1171, 2150, 1916, 1755, 1611, 1435}; // The sharps, A# to B#
 	static uint16 pcspkrFlats[8] =  {1435, 1279, 2342, 2150, 1916, 1755, 1611}; // The flats, Ab to Bb
 
+	_vm->getTimerManager()->removeTimerProc(&loopPlayer);
+	_vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this);
+
 	uint16 count;                                   // Value to set timer chip to for note
 	bool   cmd_note;
 
@@ -483,4 +491,8 @@
 	}
 }
 
+void SoundHandler::initPcspkrPlayer() {
+	_vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this);
+}
+
 } // End of namespace Hugo

Modified: scummvm/trunk/engines/hugo/sound.h
===================================================================
--- scummvm/trunk/engines/hugo/sound.h	2011-01-31 23:19:00 UTC (rev 55699)
+++ scummvm/trunk/engines/hugo/sound.h	2011-02-01 00:08:12 UTC (rev 55700)
@@ -102,6 +102,7 @@
 	void toggleMusic();
 	void toggleSound();
 	void setMusicVolume();
+	static void loopPlayer(void *refCon);
 	void pcspkr_player();
 	void playMusic(int16 tune);
 	void playSound(int16 sound, byte priority);
@@ -109,7 +110,7 @@
 	void syncVolume();
 	void checkMusic();
 	void loadIntroSong(Common::File &in);
-
+	void initPcspkrPlayer();
 private:
 	HugoEngine *_vm;
 	Audio::SoundHandle _soundHandle;


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