Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Removed unneeded audio buffer memset() for consistent behavior on all…
Browse files Browse the repository at this point in the history
… platforms.
  • Loading branch information
slouken committed Jul 5, 2012
1 parent 2c80958 commit 661cd17
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/audio/baudio/SDL_beaudio.cc
Expand Up @@ -48,9 +48,6 @@ FillSound(void *device, void *stream, size_t len,
{
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;
Expand Down
6 changes: 2 additions & 4 deletions src/audio/coreaudio/SDL_coreaudio.c
Expand Up @@ -280,8 +280,6 @@ outputCallback(void *inRefCon,
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);
Expand Down Expand Up @@ -336,7 +334,7 @@ COREAUDIO_CloseDevice(_THIS)
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,
Expand Down Expand Up @@ -431,7 +429,7 @@ prepare_audiounit(_THIS, const char *devname, int iscapture,
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,
Expand Down
2 changes: 1 addition & 1 deletion src/audio/qsa/SDL_qsa_audio.c
Expand Up @@ -570,7 +570,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
}

/* 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 {
Expand Down
2 changes: 1 addition & 1 deletion src/audio/winmm/SDL_winmm.c
Expand Up @@ -369,7 +369,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
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;
Expand Down
2 changes: 1 addition & 1 deletion src/audio/xaudio2/SDL_xaudio2.c
Expand Up @@ -332,7 +332,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
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
Expand Down

0 comments on commit 661cd17

Please sign in to comment.