aboutsummaryrefslogtreecommitdiff
path: root/backends
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
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')
-rw-r--r--backends/morphos/morphos.cpp1
-rw-r--r--backends/morphos/morphos.h13
-rw-r--r--backends/morphos/morphos_sound.cpp41
-rw-r--r--backends/morphos/morphos_start.cpp1
4 files changed, 7 insertions, 49 deletions
diff --git a/backends/morphos/morphos.cpp b/backends/morphos/morphos.cpp
index a949cbfd2f..0c2e9a7fce 100644
--- a/backends/morphos/morphos.cpp
+++ b/backends/morphos/morphos.cpp
@@ -50,6 +50,7 @@
#include <time.h>
#include "morphos.h"
+#include "morphos_sound.h"
#include "morphos_scaler.h"
static TagItem FindCDTags[] = { { CDFA_VolumeName, 0 },
diff --git a/backends/morphos/morphos.h b/backends/morphos/morphos.h
index 75d2c79f7b..d89c2e7371 100644
--- a/backends/morphos/morphos.h
+++ b/backends/morphos/morphos.h
@@ -24,8 +24,6 @@
#ifndef MORPHOS_MORPHOS_H
#define MORPHOS_MORPHOS_H
-#include <exec/semaphores.h>
-#include <devices/amidi.h>
#include <graphics/regions.h>
#include <intuition/intuition.h>
#include <intuition/screens.h>
@@ -187,20 +185,9 @@ class OSystem_MorphOS : public OSystem
int GameID;
};
-int morphos_sound_thread(OSystem_MorphOS *syst, ULONG SampleType);
-bool init_morphos_music(ULONG MidiUnit);
-void exit_morphos_music();
-
int morphos_main(int argc, char *argv[]);
extern OSystem_MorphOS *TheSystem;
-extern SignalSemaphore ScummMusicThreadRunning;
-extern SignalSemaphore ScummSoundThreadRunning;
-
-extern STRPTR ScummMusicDriver;
-extern LONG ScummMidiUnit;
-extern IOMidiRequest *ScummMidiRequest;
-extern timerequest *MusicTimerIORequest;
#endif
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;
}
}
diff --git a/backends/morphos/morphos_start.cpp b/backends/morphos/morphos_start.cpp
index d3305cbe14..16cd76bf00 100644
--- a/backends/morphos/morphos_start.cpp
+++ b/backends/morphos/morphos_start.cpp
@@ -38,6 +38,7 @@
#include "scumm.h"
#include "morphos.h"
#include "morphos_scaler.h"
+#include "morphos_sound.h"
extern "C" WBStartup *_WBenchMsg;