Fixed some things to use SDL C runtime functions. SDL-ryan-multiple-audio-device
authorRyan C. Gordon <icculus@icculus.org>
Sat, 07 Oct 2006 19:56:47 +0000
branchSDL-ryan-multiple-audio-device
changeset 3830 29e83f221c62
parent 3829 d3171647e661
child 3831 7df0d3efe682
Fixed some things to use SDL C runtime functions.
src/audio/baudio/SDL_beaudio.cc
src/audio/macosx/SDL_coreaudio.c
src/audio/macrom/SDL_romaudio.c
src/audio/mme/SDL_mmeaudio.c
--- a/src/audio/baudio/SDL_beaudio.cc	Sat Oct 07 19:53:48 2006 +0000
+++ b/src/audio/baudio/SDL_beaudio.cc	Sat Oct 07 19:56:47 2006 +0000
@@ -117,7 +117,7 @@
     }
 
     /* Parse the audio format and fill the Be raw audio format */
-    memset(&format, '\0', sizeof(media_raw_audio_format));
+    SDL_memset(&format, '\0', sizeof(media_raw_audio_format));
     format.byte_order = B_MEDIA_LITTLE_ENDIAN;
     format.frame_rate = (float) this->spec.freq;
     format.channel_count = this->spec.channels;  /* !!! FIXME: support > 2? */
--- a/src/audio/macosx/SDL_coreaudio.c	Sat Oct 07 19:53:48 2006 +0000
+++ b/src/audio/macosx/SDL_coreaudio.c	Sat Oct 07 19:56:47 2006 +0000
@@ -333,7 +333,7 @@
         result = AudioOutputUnitStop(this->hidden->audioUnit);
 
         /* Remove the input callback */
-        memset(&callback, '\0', sizeof (AURenderCallbackStruct));
+        SDL_memset(&callback, '\0', sizeof (AURenderCallbackStruct));
         result = AudioUnitSetProperty(this->hidden->audioUnit,
                                       kAudioUnitProperty_SetRenderCallback,
                                       scope, bus, &callback, sizeof (callback));
@@ -425,7 +425,7 @@
         return 0;
     }
 
-    memset(&desc, '\0', sizeof(ComponentDescription));
+    SDL_memset(&desc, '\0', sizeof(ComponentDescription));
     desc.componentType = kAudioUnitType_Output;
     desc.componentSubType = kAudioUnitSubType_HALOutput;
     desc.componentManufacturer = kAudioUnitManufacturer_Apple;
@@ -470,7 +470,7 @@
     CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)");
 
     /* Set the audio callback */
-    memset(&callback, '\0', sizeof (AURenderCallbackStruct));
+    SDL_memset(&callback, '\0', sizeof (AURenderCallbackStruct));
     callback.inputProc = ((iscapture) ? inputCallback : outputCallback);
     callback.inputProcRefCon = this;
     result = AudioUnitSetProperty(this->hidden->audioUnit,
@@ -514,7 +514,7 @@
     SDL_memset(this->hidden, 0, (sizeof *this->hidden));
 
     /* Setup a AudioStreamBasicDescription with the requested format */
-    memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription));
+    SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription));
     strdesc.mFormatID = kAudioFormatLinearPCM;
     strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
     strdesc.mChannelsPerFrame = this->spec.channels;
--- a/src/audio/macrom/SDL_romaudio.c	Sat Oct 07 19:53:48 2006 +0000
+++ b/src/audio/macrom/SDL_romaudio.c	Sat Oct 07 19:56:47 2006 +0000
@@ -145,7 +145,7 @@
     cmd.param2 = (long) &header;
     SndDoCommand(chan, &cmd, 0);
 
-    memset(buffer[fill_me], 0, audio->spec.size);
+    SDL_memset(buffer[fill_me], 0, audio->spec.size);
 
     /*
      * if audio device isn't locked, mix the next buffer to be queued in
@@ -203,7 +203,7 @@
     SDL_CalculateAudioSpec(&this->spec);
 
     /* initialize bufferCmd header */
-    memset(&header, 0, sizeof(header));
+    SDL_memset(&header, 0, sizeof(header));
     callback = (SndCallBackUPP) NewSndCallBackUPP(callBackProc);
     sample_bits = spec->size / spec->samples / spec->channels * 8;
 
@@ -236,13 +236,13 @@
 
     /* allocate 2 buffers */
     for (i = 0; i < 2; i++) {
-        buffer[i] = (UInt8 *) malloc(sizeof(UInt8) * spec->size);
+        buffer[i] = (UInt8 *) SDL_malloc(sizeof(UInt8) * spec->size);
         if (buffer[i] == NULL) {
             SNDMGR_CloseDevice(this);
             SDL_OutOfMemory();
             return 0;
         }
-        memset(buffer[i], 0, spec->size);
+        SDL_memset(buffer[i], 0, spec->size);
     }
 
     /* Create the sound manager channel */
--- a/src/audio/mme/SDL_mmeaudio.c	Sat Oct 07 19:53:48 2006 +0000
+++ b/src/audio/mme/SDL_mmeaudio.c	Sat Oct 07 19:56:47 2006 +0000
@@ -84,7 +84,7 @@
         return 0;
     }
 
-    memset(this->hidden->shm, '\0', sizeof (*this->hidden->shm));
+    SDL_memset(this->hidden->shm, '\0', sizeof (*this->hidden->shm));
     this->hidden->shm->sound = 0;
     this->hidden->shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM;