src/audio/xaudio2/SDL_xaudio2.c
changeset 7038 7f22b9ba218f
parent 6885 700f1b25f77f
child 7191 75360622e65f
child 8460 f483e8bdae3c
--- a/src/audio/xaudio2/SDL_xaudio2.c	Sun Mar 31 12:48:50 2013 -0400
+++ b/src/audio/xaudio2/SDL_xaudio2.c	Sun Mar 31 13:05:40 2013 -0400
@@ -245,11 +245,9 @@
 	static IXAudio2VoiceCallback callbacks = { &callbacks_vtable };
 
     if (iscapture) {
-        SDL_SetError("XAudio2: capture devices unsupported.");
-        return 0;
+        return SDL_SetError("XAudio2: capture devices unsupported.");
     } else if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) {
-        SDL_SetError("XAudio2: XAudio2Create() failed.");
-        return 0;
+        return SDL_SetError("XAudio2: XAudio2Create() failed.");
     }
 
     if (devname != NULL) {
@@ -258,8 +256,7 @@
 
         if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) {
             IXAudio2_Release(ixa2);
-            SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed.");
-            return 0;
+            return SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed.");
         }
         for (i = 0; i < devcount; i++) {
             XAUDIO2_DEVICE_DETAILS details;
@@ -278,8 +275,7 @@
 
         if (i == devcount) {
             IXAudio2_Release(ixa2);
-            SDL_SetError("XAudio2: Requested device not found.");
-            return 0;
+            return SDL_SetError("XAudio2: Requested device not found.");
         }
     }
 
@@ -288,8 +284,7 @@
         SDL_malloc((sizeof *this->hidden));
     if (this->hidden == NULL) {
         IXAudio2_Release(ixa2);
-        SDL_OutOfMemory();
-        return 0;
+        return SDL_OutOfMemory();
     }
     SDL_memset(this->hidden, 0, (sizeof *this->hidden));
 
@@ -297,8 +292,7 @@
     this->hidden->semaphore = CreateSemaphore(NULL, 1, 2, NULL);
     if (this->hidden->semaphore == NULL) {
         XAUDIO2_CloseDevice(this);
-        SDL_SetError("XAudio2: CreateSemaphore() failed!");
-        return 0;
+        return SDL_SetError("XAudio2: CreateSemaphore() failed!");
     }
 
     while ((!valid_format) && (test_format)) {
@@ -316,8 +310,7 @@
 
     if (!valid_format) {
         XAUDIO2_CloseDevice(this);
-        SDL_SetError("XAudio2: Unsupported audio format");
-        return 0;
+        return SDL_SetError("XAudio2: Unsupported audio format");
     }
 
     /* Update the fragment size as size in bytes */
@@ -328,8 +321,7 @@
     this->hidden->mixbuf = (Uint8 *) SDL_malloc(2 * this->hidden->mixlen);
     if (this->hidden->mixbuf == NULL) {
         XAUDIO2_CloseDevice(this);
-        SDL_OutOfMemory();
-        return 0;
+        return SDL_OutOfMemory();
     }
     this->hidden->nextbuf = this->hidden->mixbuf;
     SDL_memset(this->hidden->mixbuf, 0, 2 * this->hidden->mixlen);
@@ -345,8 +337,7 @@
                                            this->spec.freq, 0, devId, NULL);
     if (result != S_OK) {
         XAUDIO2_CloseDevice(this);
-        SDL_SetError("XAudio2: Couldn't create mastering voice");
-        return 0;
+        return SDL_SetError("XAudio2: Couldn't create mastering voice");
     }
 
     SDL_zero(waveformat);
@@ -369,8 +360,7 @@
                                         1.0f, &callbacks, NULL, NULL);
     if (result != S_OK) {
         XAUDIO2_CloseDevice(this);
-        SDL_SetError("XAudio2: Couldn't create source voice");
-        return 0;
+        return SDL_SetError("XAudio2: Couldn't create source voice");
     }
     this->hidden->source = source;
 
@@ -378,18 +368,16 @@
     result = IXAudio2_StartEngine(ixa2);
     if (result != S_OK) {
         XAUDIO2_CloseDevice(this);
-        SDL_SetError("XAudio2: Couldn't start engine");
-        return 0;
+        return SDL_SetError("XAudio2: Couldn't start engine");
     }
 
     result = IXAudio2SourceVoice_Start(source, 0, XAUDIO2_COMMIT_NOW);
     if (result != S_OK) {
         XAUDIO2_CloseDevice(this);
-        SDL_SetError("XAudio2: Couldn't start source voice");
-        return 0;
+        return SDL_SetError("XAudio2: Couldn't start source voice");
     }
 
-    return 1; /* good to go. */
+    return 0; /* good to go. */
 }
 
 static void