changeset 2212:80c1a53c081e draft

(svn r2730) -Fix: Fail if the sequencer can't play audio Also check the return value of CreateThread()
author tron <tron@openttd.org>
date Wed, 27 Jul 2005 21:45:34 +0000
parents 26ff76957e64
children 12c3f2f7c949
files music/win32_m.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/music/win32_m.c
+++ b/music/win32_m.c
@@ -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)