aboutsummaryrefslogtreecommitdiff
path: root/backends/morphos/morphos_sound.cpp
diff options
context:
space:
mode:
authorRuediger Hanke2002-08-22 12:09:06 +0000
committerRuediger Hanke2002-08-22 12:09:06 +0000
commit3b090517279b66254f5fba7bc6a3299405763295 (patch)
treeaa8f0ddd5fb5c5ee5cc8d5c35064aa8eb6273267 /backends/morphos/morphos_sound.cpp
parent31f6833f87da3af3c480d0b6e605c3565efef1d0 (diff)
downloadscummvm-rg350-3b090517279b66254f5fba7bc6a3299405763295.tar.gz
scummvm-rg350-3b090517279b66254f5fba7bc6a3299405763295.tar.bz2
scummvm-rg350-3b090517279b66254f5fba7bc6a3299405763295.zip
Changed MorphOS MIDI code so that data sent from different threads are no longer a problem. Ensure Midi driver is closed, otherwise no other MIDI application will run after ScummVM has exited.
svn-id: r4801
Diffstat (limited to 'backends/morphos/morphos_sound.cpp')
-rw-r--r--backends/morphos/morphos_sound.cpp41
1 files changed, 5 insertions, 36 deletions
diff --git a/backends/morphos/morphos_sound.cpp b/backends/morphos/morphos_sound.cpp
index f2df81d789..fd908a31b9 100644
--- a/backends/morphos/morphos_sound.cpp
+++ b/backends/morphos/morphos_sound.cpp
@@ -35,6 +35,7 @@
#include <proto/ahi.h>
#include "morphos.h"
+#include "morphos_sound.h"
#define AHI_BUF_SIZE (8*1024)
@@ -51,8 +52,8 @@ static char *ahiBuf[2] = { NULL, NULL };
static MsgPort *ScummMidiPort = NULL;
IOMidiRequest *ScummMidiRequest = NULL;
-static MsgPort *MusicTimerMsgPort = NULL;
- timerequest *MusicTimerIORequest = NULL;
+
+ Device *AMidiBase = NULL;
bool init_morphos_music(ULONG MidiUnit)
{
@@ -73,6 +74,7 @@ bool init_morphos_music(ULONG MidiUnit)
ScummMidiRequest = NULL;
ScummMidiPort = NULL;
}
+ AMidiBase = ScummMidiRequest->amr_Std.io_Device;
}
else
{
@@ -88,33 +90,6 @@ bool init_morphos_music(ULONG MidiUnit)
}
}
- MusicTimerMsgPort = CreateMsgPort();
- if (MusicTimerMsgPort)
- {
- MusicTimerIORequest = (timerequest *) CreateIORequest(MusicTimerMsgPort, sizeof (timerequest));
- if (MusicTimerIORequest)
- {
- if (OpenDevice("timer.device", UNIT_MICROHZ, (IORequest *) MusicTimerIORequest, 0))
- {
- DeleteIORequest((IORequest *) MusicTimerIORequest);
- DeleteMsgPort(MusicTimerMsgPort);
- MusicTimerIORequest = NULL;
- MusicTimerMsgPort = NULL;
- }
- }
- else
- {
- DeleteMsgPort(MusicTimerMsgPort);
- MusicTimerMsgPort = NULL;
- }
- }
-
- if (!MusicTimerIORequest)
- {
- warning("Could not open timer device - music will not play");
- return false;
- }
-
return true;
}
@@ -126,13 +101,7 @@ void exit_morphos_music()
CloseDevice((IORequest *) ScummMidiRequest);
DeleteIORequest((IORequest *) ScummMidiRequest);
DeleteMsgPort(ScummMidiPort);
- }
-
- if (MusicTimerIORequest)
- {
- CloseDevice((IORequest *) MusicTimerIORequest);
- DeleteIORequest((IORequest *) MusicTimerIORequest);
- DeleteMsgPort(MusicTimerMsgPort);
+ AMidiBase = NULL;
}
}