aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorRuediger Hanke2002-04-18 21:40:24 +0000
committerRuediger Hanke2002-04-18 21:40:24 +0000
commit8a7ca8133c0d9a73609ef29b8f5caefc0f19b707 (patch)
treece508e74f800d2fd21c2bfcadcbee512ab9afeb9 /sound
parentdf31144cc7b42bf04127566de1b7127ba0d75c09 (diff)
downloadscummvm-rg350-8a7ca8133c0d9a73609ef29b8f5caefc0f19b707.tar.gz
scummvm-rg350-8a7ca8133c0d9a73609ef29b8f5caefc0f19b707.tar.bz2
scummvm-rg350-8a7ca8133c0d9a73609ef29b8f5caefc0f19b707.zip
Reenable MorphOS Midi driver, small updates to CD open code (only when CD audio is requested) and start options
svn-id: r3997
Diffstat (limited to 'sound')
-rw-r--r--sound/imuse.cpp48
-rw-r--r--sound/mididrv.cpp86
2 files changed, 130 insertions, 4 deletions
diff --git a/sound/imuse.cpp b/sound/imuse.cpp
index 4a1099b429..be566d4122 100644
--- a/sound/imuse.cpp
+++ b/sound/imuse.cpp
@@ -4219,6 +4219,7 @@ void IMuseGM::part_key_off(Part *part, byte note)
}
}
+#if !defined(__MORPHOS__)
int IMuseGM::midi_driver_thread(void *param) {
IMuseGM *mid = (IMuseGM*) param;
int old_time, cur_time;
@@ -4235,6 +4236,53 @@ int IMuseGM::midi_driver_thread(void *param) {
}
}
}
+#else
+#include <exec/semaphores.h>
+#include <proto/exec.h>
+#include <proto/dos.h>
+#include "../morphos/morphos.h"
+int IMuseGM::midi_driver_thread( void *param )
+{
+ IMuseGM *mid = (IMuseGM*) param;
+ int old_time, cur_time;
+ bool initialized;
+
+ ObtainSemaphore( &ScummMusicThreadRunning );
+
+ initialized = init_morphos_music( 0 );
+
+ old_time = mid->_system->get_msecs();
+
+ if( !initialized )
+ Wait( SIGBREAKF_CTRL_C );
+ else
+ {
+ for(;;)
+ {
+ MusicTimerIORequest->tr_time.tv_micro = 10000;
+ MusicTimerIORequest->tr_node.io_Command = TR_ADDREQUEST;
+ MusicTimerIORequest->tr_time.tv_secs = 0;
+ DoIO( (struct IORequest *)MusicTimerIORequest );
+
+ if( CheckSignal( SIGBREAKF_CTRL_C ) )
+ break;
+
+ cur_time = mid->_system->get_msecs();
+ while (old_time < cur_time)
+ {
+ old_time += 10;
+ mid->_se->on_timer();
+ }
+ }
+ }
+
+ exit_morphos_music();
+
+ ReleaseSemaphore( &ScummMusicThreadRunning );
+ RemTask( NULL );
+ return 0;
+}
+#endif
void IMuseGM::init(IMuse *eng, OSystem *syst)
{
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index 39ab656775..405242f50c 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -26,10 +26,6 @@
* MorphOS support by Ruediger Hanke
*/
-#ifdef __MORPHOS__
-#include <devices/timer.h>
-#endif
-
#include "stdafx.h"
#include "scumm.h"
#include "mididrv.h"
@@ -269,6 +265,88 @@ MidiDriver *MidiDriver_WIN_create() {
#endif // WIN32
+#ifdef __MORPHOS__
+#include <exec/types.h>
+#include <devices/amidi.h>
+
+#include <clib/alib_protos.h>
+#include <proto/exec.h>
+
+extern struct IOMidiRequest *ScummMidiRequest;
+
+/* MorphOS MIDI driver */
+class MidiDriver_AMIDI : public MidiDriver {
+public:
+ void destroy();
+ int open(int mode);
+ void close();
+ void send(uint32 b);
+ void pause(bool pause);
+ void set_stream_callback(void *param, StreamCallback *sc);
+
+private:
+ StreamCallback *_stream_proc;
+ void *_stream_param;
+ int _mode;
+ uint16 _time_div;
+
+ uint32 property(int prop, uint32 param);
+};
+
+void MidiDriver_AMIDI::set_stream_callback(void *param, StreamCallback *sc) {
+ _stream_param = param;
+ _stream_proc = sc;
+}
+
+void MidiDriver_AMIDI::destroy() {
+ close();
+ delete this;
+}
+
+int MidiDriver_AMIDI::open(int mode) {
+ _mode = mode;
+ return 0;
+}
+
+void MidiDriver_AMIDI::close() {
+ _mode = 0;
+}
+
+void MidiDriver_AMIDI::send(uint32 b) {
+ if (_mode != MO_SIMPLE)
+ error("MidiDriver_AMIDI:send called but driver is not in simple mode");
+
+ if (ScummMidiRequest) {
+ ULONG midi_data = b; // you never know about an int's size ;-)
+ ScummMidiRequest->amr_Std.io_Command = CMD_WRITE;
+ ScummMidiRequest->amr_Std.io_Data = &midi_data;
+ ScummMidiRequest->amr_Std.io_Length = 4;
+ DoIO((struct IORequest *)ScummMidiRequest);
+ }
+}
+
+void MidiDriver_AMIDI::pause(bool pause) {
+ if (_mode == MO_STREAMING) {
+ }
+}
+
+uint32 MidiDriver_AMIDI::property(int prop, uint32 param) {
+ switch(prop) {
+ /* 16-bit time division according to standard midi specification */
+ case PROP_TIMEDIV:
+ _time_div = (uint16)param;
+ return 1;
+ }
+
+ return 0;
+}
+
+MidiDriver *MidiDriver_AMIDI_create() {
+ return new MidiDriver_AMIDI();
+}
+
+#endif // __MORPHOS__
+
/* NULL driver */
class MidiDriver_NULL : public MidiDriver {