aboutsummaryrefslogtreecommitdiff
path: root/backends/midi
diff options
context:
space:
mode:
authorRuediger Hanke2002-12-25 12:36:29 +0000
committerRuediger Hanke2002-12-25 12:36:29 +0000
commit9e0e918397a6772ae6ab5e9220a797750657973e (patch)
tree8e9b3279eeeee955d3ef91e7305eddefa4c9a4bf /backends/midi
parent4a405b497a99a0608d14c071505440cb3adca90a (diff)
downloadscummvm-rg350-9e0e918397a6772ae6ab5e9220a797750657973e.tar.gz
scummvm-rg350-9e0e918397a6772ae6ab5e9220a797750657973e.tar.bz2
scummvm-rg350-9e0e918397a6772ae6ab5e9220a797750657973e.zip
Fix midi driver thread for MorphOS
svn-id: r6123
Diffstat (limited to 'backends/midi')
-rw-r--r--backends/midi/morphos.cpp42
1 files changed, 42 insertions, 0 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
+