summaryrefslogtreecommitdiff
path: root/music
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-07-27 21:45:34 +0000
committertron <tron@openttd.org>2005-07-27 21:45:34 +0000
commite2ce1f997a818c968969cddee40c8524a63d541d (patch)
tree65d047b9815f93c925b8965fe3488e05d0548615 /music
parent2ff85cdc56d6982430c9d399f278603b0d488234 (diff)
downloadopenttd-e2ce1f997a818c968969cddee40c8524a63d541d.tar.xz
(svn r2730) -Fix: Fail if the sequencer can't play audio
Also check the return value of CreateThread()
Diffstat (limited to 'music')
-rw-r--r--music/win32_m.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/music/win32_m.c b/music/win32_m.c
index 3ec1d5ec2..c0be6e246 100644
--- a/music/win32_m.c
+++ b/music/win32_m.c
@@ -126,11 +126,18 @@ static DWORD WINAPI MidiThread(LPVOID arg)
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)