(svn r2730) -Fix: Fail if the sequencer can't play audio
authortron
Wed, 27 Jul 2005 21:45:34 +0000
changeset 2212 7e53bdecc115
parent 2211 07a209c31e4f
child 2213 cb78ae22fe58
(svn r2730) -Fix: Fail if the sequencer can't play audio
Also check the return value of CreateThread()
music/win32_m.c
--- a/music/win32_m.c	Wed Jul 27 20:08:52 2005 +0000
+++ b/music/win32_m.c	Wed Jul 27 21:45:34 2005 +0000
@@ -126,11 +126,18 @@
 static const char *Win32MidiStart(const char * const *parm)
 {
 	DWORD threadId;
+	char buf[16];
+
+	mciSendStringA("capability sequencer has audio", buf, lengthof(buf), 0);
+	if (strcmp(buf, "true") != 0) return "MCI sequencer can't play audio";
 
 	memset(&_midi, 0, sizeof(_midi));
 	_midi.new_vol = -1;
-	CreateThread(NULL, 8192, MidiThread, 0, 0, &threadId);
-	return 0;
+
+	if (CreateThread(NULL, 8192, MidiThread, 0, 0, &threadId) == NULL)
+		return "Failed to create thread";
+
+	return NULL;
 }
 
 static void Win32MidiStop(void)