diff options
-rw-r--r-- | backends/midi/morphos.cpp | 42 | ||||
-rw-r--r-- | scumm/imuse.cpp | 45 | ||||
-rw-r--r-- | sound/mpu401.cpp | 2 |
3 files changed, 44 insertions, 45 deletions
diff --git a/backends/midi/morphos.cpp b/backends/midi/morphos.cpp index 6fba4a76bf..b0d200574e 100644 --- a/backends/midi/morphos.cpp +++ b/backends/midi/morphos.cpp @@ -26,11 +26,13 @@ #include <clib/alib_protos.h> #include <proto/exec.h> +#include <proto/dos.h> #include <proto/etude.h> #include "stdafx.h" #include "sound/mpu401.h" #include "common/engine.h" // For warning/error/debug +#include "morphos.h" #include "morphos_sound.h" /* @@ -90,4 +92,44 @@ MidiDriver *MidiDriver_ETUDE_create() return EtudeMidiDriver; } +int MidiDriver_MPU401::midi_driver_thread(void *param) +{ + MidiDriver_MPU401 *mid = (MidiDriver_MPU401 *)param; + int old_time, cur_time; + MsgPort *music_timer_port = NULL; + timerequest *music_timer_request = NULL; + + ObtainSemaphore(&ScummMusicThreadRunning); + + if (!OSystem_MorphOS::OpenATimer(&music_timer_port, (IORequest **) &music_timer_request, UNIT_MICROHZ, false)) { + warning("Could not open a timer - music will not play"); + Wait(SIGBREAKF_CTRL_C); + } + else { + old_time = g_system->get_msecs(); + + for (;;) { + music_timer_request->tr_node.io_Command = TR_ADDREQUEST; + music_timer_request->tr_time.tv_secs = 0; + music_timer_request->tr_time.tv_micro = 10000; + DoIO((struct IORequest *)music_timer_request); + + if (CheckSignal(SIGBREAKF_CTRL_C)) + break; + + cur_time = g_system->get_msecs(); + while (old_time < cur_time) { + old_time += 10; + if (mid->_timer_proc) + (*(mid->_timer_proc)) (mid->_timer_param); + } + } + } + + ReleaseSemaphore(&ScummMusicThreadRunning); + RemTask(NULL); + return 0; +} + #endif + diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 9a0d6f9f20..16247d7fe4 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -3525,51 +3525,6 @@ void IMuseDriver::part_key_off(Part *part, byte note) } } -#if !defined(__MORPHOS__) -#else -#include <proto/exec.h> -#include <proto/dos.h> -#include "morphos.h" -#include "morphos_sound.h" -int IMuseDriver::midi_driver_thread(void *param) -{ - IMuseDriver *mid = (IMuseDriver *) param; - int old_time, cur_time; - MsgPort *music_timer_port = NULL; - timerequest *music_timer_request = NULL; - - ObtainSemaphore(&ScummMusicThreadRunning); - - if (!OSystem_MorphOS::OpenATimer(&music_timer_port, (IORequest **) &music_timer_request, UNIT_MICROHZ, false)) { - warning("Could not open a timer - music will not play"); - Wait(SIGBREAKF_CTRL_C); - } - else { - old_time = mid->_system->get_msecs(); - - for (;;) { - music_timer_request->tr_node.io_Command = TR_ADDREQUEST; - music_timer_request->tr_time.tv_secs = 0; - music_timer_request->tr_time.tv_micro = 10000; - DoIO((struct IORequest *)music_timer_request); - - if (CheckSignal(SIGBREAKF_CTRL_C)) - break; - - cur_time = mid->_system->get_msecs(); - while (old_time < cur_time) { - old_time += 10; - mid->_se->on_timer(); - } - } - } - - ReleaseSemaphore(&ScummMusicThreadRunning); - RemTask(NULL); - return 0; -} -#endif - void IMuseDriver::init(IMuseInternal *eng, OSystem *syst) { int i; diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp index c3c7d1a2b9..001c28f204 100644 --- a/sound/mpu401.cpp +++ b/sound/mpu401.cpp @@ -79,6 +79,7 @@ void MidiDriver_MPU401::setTimerCallback (void *timer_param, void (*timer_proc) } } +#if !defined(__MORPHOS__) int MidiDriver_MPU401::midi_driver_thread(void *param) { MidiDriver_MPU401 *mid = (MidiDriver_MPU401 *)param; @@ -102,4 +103,5 @@ int MidiDriver_MPU401::midi_driver_thread(void *param) return 0; } +#endif |