Removed unneeded audio buffer memset() for consistent behavior on all platforms.
authorSam Lantinga <slouken@libsdl.org>
Thu, 05 Jul 2012 12:16:44 -0400
changeset 6352 a9bcd26e7105
parent 6351 8f5535d05e34
child 6354 17840f487124
Removed unneeded audio buffer memset() for consistent behavior on all platforms.
src/audio/baudio/SDL_beaudio.cc
src/audio/coreaudio/SDL_coreaudio.c
src/audio/qsa/SDL_qsa_audio.c
src/audio/winmm/SDL_winmm.c
src/audio/xaudio2/SDL_xaudio2.c
--- a/src/audio/baudio/SDL_beaudio.cc	Thu Jul 05 07:26:18 2012 -0400
+++ b/src/audio/baudio/SDL_beaudio.cc	Thu Jul 05 12:16:44 2012 -0400
@@ -48,9 +48,6 @@
 {
     SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
 
-    /* Silence the buffer, since it's ours */
-    SDL_memset(stream, audio->spec.silence, len);
-
     /* Only do soemthing if audio is enabled */
     if (!audio->enabled)
         return;
--- a/src/audio/coreaudio/SDL_coreaudio.c	Thu Jul 05 07:26:18 2012 -0400
+++ b/src/audio/coreaudio/SDL_coreaudio.c	Thu Jul 05 12:16:44 2012 -0400
@@ -280,8 +280,6 @@
         while (remaining > 0) {
             if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
                 /* Generate the data */
-                SDL_memset(this->hidden->buffer, this->spec.silence,
-                           this->hidden->bufferSize);
                 SDL_mutexP(this->mixer_lock);
                 (*this->spec.callback)(this->spec.userdata,
                             this->hidden->buffer, this->hidden->bufferSize);
@@ -336,7 +334,7 @@
             result = AudioOutputUnitStop(this->hidden->audioUnit);
 
             /* Remove the input callback */
-            SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct));
+            SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct));
             result = AudioUnitSetProperty(this->hidden->audioUnit,
                                           kAudioUnitProperty_SetRenderCallback,
                                           scope, bus, &callback,
@@ -431,7 +429,7 @@
     CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)");
 
     /* Set the audio callback */
-    SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct));
+    SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct));
     callback.inputProc = ((iscapture) ? inputCallback : outputCallback);
     callback.inputProcRefCon = this;
     result = AudioUnitSetProperty(this->hidden->audioUnit,
--- a/src/audio/qsa/SDL_qsa_audio.c	Thu Jul 05 07:26:18 2012 -0400
+++ b/src/audio/qsa/SDL_qsa_audio.c	Thu Jul 05 12:16:44 2012 -0400
@@ -570,7 +570,7 @@
     }
 
     /* Make sure channel is setup right one last time */
-    SDL_memset(&csetup, '\0', sizeof(csetup));
+    SDL_memset(&csetup, 0, sizeof(csetup));
     if (!this->hidden->iscapture) {
         csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
     } else {
--- a/src/audio/winmm/SDL_winmm.c	Thu Jul 05 07:26:18 2012 -0400
+++ b/src/audio/winmm/SDL_winmm.c	Thu Jul 05 12:16:44 2012 -0400
@@ -369,7 +369,7 @@
         return 0;
     }
     for (i = 0; i < NUM_BUFFERS; ++i) {
-        SDL_memset(&this->hidden->wavebuf[i], '\0',
+        SDL_memset(&this->hidden->wavebuf[i], 0,
                    sizeof(this->hidden->wavebuf[i]));
         this->hidden->wavebuf[i].dwBufferLength = this->spec.size;
         this->hidden->wavebuf[i].dwFlags = WHDR_DONE;
--- a/src/audio/xaudio2/SDL_xaudio2.c	Thu Jul 05 07:26:18 2012 -0400
+++ b/src/audio/xaudio2/SDL_xaudio2.c	Thu Jul 05 12:16:44 2012 -0400
@@ -332,7 +332,7 @@
         return 0;
     }
     this->hidden->nextbuf = this->hidden->mixbuf;
-    SDL_memset(this->hidden->mixbuf, '\0', 2 * this->hidden->mixlen);
+    SDL_memset(this->hidden->mixbuf, 0, 2 * this->hidden->mixlen);
 
     /* We use XAUDIO2_DEFAULT_CHANNELS instead of this->spec.channels. On
        Xbox360, this means 5.1 output, but on Windows, it means "figure out