Removed unneeded audio buffer memset() for consistent behavior on all platforms.

This commit is contained in:
Sam Lantinga 2012-07-05 12:16:44 -04:00
parent 8533068f54
commit 7b6f9ccd63
5 changed files with 5 additions and 10 deletions

View file

@ -48,9 +48,6 @@ FillSound(void *device, void *stream, size_t len,
{ {
SDL_AudioDevice *audio = (SDL_AudioDevice *) device; 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 */ /* Only do soemthing if audio is enabled */
if (!audio->enabled) if (!audio->enabled)
return; return;

View file

@ -280,8 +280,6 @@ outputCallback(void *inRefCon,
while (remaining > 0) { while (remaining > 0) {
if (this->hidden->bufferOffset >= this->hidden->bufferSize) { if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
/* Generate the data */ /* Generate the data */
SDL_memset(this->hidden->buffer, this->spec.silence,
this->hidden->bufferSize);
SDL_mutexP(this->mixer_lock); SDL_mutexP(this->mixer_lock);
(*this->spec.callback)(this->spec.userdata, (*this->spec.callback)(this->spec.userdata,
this->hidden->buffer, this->hidden->bufferSize); this->hidden->buffer, this->hidden->bufferSize);
@ -336,7 +334,7 @@ COREAUDIO_CloseDevice(_THIS)
result = AudioOutputUnitStop(this->hidden->audioUnit); result = AudioOutputUnitStop(this->hidden->audioUnit);
/* Remove the input callback */ /* Remove the input callback */
SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct)); SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct));
result = AudioUnitSetProperty(this->hidden->audioUnit, result = AudioUnitSetProperty(this->hidden->audioUnit,
kAudioUnitProperty_SetRenderCallback, kAudioUnitProperty_SetRenderCallback,
scope, bus, &callback, scope, bus, &callback,
@ -431,7 +429,7 @@ prepare_audiounit(_THIS, const char *devname, int iscapture,
CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)"); CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)");
/* Set the audio callback */ /* Set the audio callback */
SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct)); SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct));
callback.inputProc = ((iscapture) ? inputCallback : outputCallback); callback.inputProc = ((iscapture) ? inputCallback : outputCallback);
callback.inputProcRefCon = this; callback.inputProcRefCon = this;
result = AudioUnitSetProperty(this->hidden->audioUnit, result = AudioUnitSetProperty(this->hidden->audioUnit,

View file

@ -570,7 +570,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
} }
/* Make sure channel is setup right one last time */ /* 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) { if (!this->hidden->iscapture) {
csetup.channel = SND_PCM_CHANNEL_PLAYBACK; csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
} else { } else {

View file

@ -369,7 +369,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
return 0; return 0;
} }
for (i = 0; i < NUM_BUFFERS; ++i) { 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])); sizeof(this->hidden->wavebuf[i]));
this->hidden->wavebuf[i].dwBufferLength = this->spec.size; this->hidden->wavebuf[i].dwBufferLength = this->spec.size;
this->hidden->wavebuf[i].dwFlags = WHDR_DONE; this->hidden->wavebuf[i].dwFlags = WHDR_DONE;

View file

@ -332,7 +332,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
return 0; return 0;
} }
this->hidden->nextbuf = this->hidden->mixbuf; 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 /* We use XAUDIO2_DEFAULT_CHANNELS instead of this->spec.channels. On
Xbox360, this means 5.1 output, but on Windows, it means "figure out Xbox360, this means 5.1 output, but on Windows, it means "figure out