aboutsummaryrefslogtreecommitdiff
path: root/engines/hugo
diff options
context:
space:
mode:
authorArnaud Boutonné2011-02-01 00:08:12 +0000
committerArnaud Boutonné2011-02-01 00:08:12 +0000
commit088b5f774382b6fe66fcfdeb78461d0053969a00 (patch)
tree03d9930ea03d56da12c018455c1332dd3b357e9d /engines/hugo
parentc0ce8a839e20a2bcce6009aef492e5959d9c6b5f (diff)
downloadscummvm-rg350-088b5f774382b6fe66fcfdeb78461d0053969a00.tar.gz
scummvm-rg350-088b5f774382b6fe66fcfdeb78461d0053969a00.tar.bz2
scummvm-rg350-088b5f774382b6fe66fcfdeb78461d0053969a00.zip
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. svn-id: r55700
Diffstat (limited to 'engines/hugo')
-rw-r--r--engines/hugo/hugo.cpp3
-rw-r--r--engines/hugo/sound.cpp12
-rw-r--r--engines/hugo/sound.h3
3 files changed, 16 insertions, 2 deletions
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index eeeb915401..4ec6d4b42d 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -257,7 +257,6 @@ Common::Error HugoEngine::run() {
_screen->drawHotspots();
g_system->updateScreen();
- _sound->pcspkr_player();
runMachine();
// Handle input
Common::Event event;
@@ -298,6 +297,8 @@ void HugoEngine::initMachine() {
_object->readObjectImages(); // Read all object images
if (_platform == Common::kPlatformWindows)
_file->readUIFImages(); // Read all uif images (only in Win versions)
+
+ _sound->initPcspkrPlayer();
}
/**
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 190145b0f5..99a10dd9fe 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -239,6 +239,7 @@ SoundHandler::SoundHandler(HugoEngine *vm) : _vm(vm) {
}
SoundHandler::~SoundHandler() {
+ _vm->getTimerManager()->removeTimerProc(&loopPlayer);
_vm->_mixer->stopHandle(_speakerHandle);
delete _speakerStream;
delete _midiPlayer;
@@ -371,6 +372,10 @@ void SoundHandler::checkMusic() {
}
}
+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 @@ void SoundHandler::pcspkr_player() {
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::loadIntroSong(Common::File &in) {
}
}
+void SoundHandler::initPcspkrPlayer() {
+ _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this);
+}
+
} // End of namespace Hugo
diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h
index 249ea2e6e9..52e93d65de 100644
--- a/engines/hugo/sound.h
+++ b/engines/hugo/sound.h
@@ -102,6 +102,7 @@ public:
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 @@ public:
void syncVolume();
void checkMusic();
void loadIntroSong(Common::File &in);
-
+ void initPcspkrPlayer();
private:
HugoEngine *_vm;
Audio::SoundHandle _soundHandle;