summary refs log tree commit diff stats
path: root/audio/dsound_template.h
diff options
context:
space:
mode:
Diffstat (limited to 'audio/dsound_template.h')
-rw-r--r--audio/dsound_template.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/audio/dsound_template.h b/audio/dsound_template.h
index 0896b04a03..d517c90ce2 100644
--- a/audio/dsound_template.h
+++ b/audio/dsound_template.h
@@ -23,16 +23,20 @@
  */
 #ifdef DSBTYPE_IN
 #define NAME "capture buffer"
+#define NAME2 "DirectSoundCapture"
 #define TYPE in
 #define IFACE IDirectSoundCaptureBuffer
 #define BUFPTR LPDIRECTSOUNDCAPTUREBUFFER
 #define FIELD dsound_capture_buffer
+#define FIELD2 dsound_capture
 #else
 #define NAME "playback buffer"
+#define NAME2 "DirectSound"
 #define TYPE out
 #define IFACE IDirectSoundBuffer
 #define BUFPTR LPDIRECTSOUNDBUFFER
 #define FIELD dsound_buffer
+#define FIELD2 dsound
 #endif
 
 static int glue (dsound_unlock_, TYPE) (
@@ -192,6 +196,11 @@ static int dsound_init_out (HWVoiceOut *hw, audsettings_t *as)
     DSBCAPS bc;
 #endif
 
+    if (!s->FIELD2) {
+        dsound_logerr ("Attempt to initialize voice without " NAME2 " object");
+        return -1;
+    }
+
     err = waveformat_from_audio_settings (&wfx, as);
     if (err) {
         return -1;