mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
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
This commit is contained in:
parent
c0ce8a839e
commit
088b5f7743
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user