comparison src/cdrom/macosx/AudioFilePlayer.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents 71a2648acc75
children d910939febfa
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
62 { 62 {
63 //if (afp->mConnected) throw static_cast<OSStatus>(-1); //can't set dest if already engaged 63 //if (afp->mConnected) throw static_cast<OSStatus>(-1); //can't set dest if already engaged
64 if (afp->mConnected) 64 if (afp->mConnected)
65 return 0 ; 65 return 0 ;
66 66
67 memcpy(&afp->mPlayUnit, inDestUnit, sizeof (afp->mPlayUnit)); 67 SDL_memcpy(&afp->mPlayUnit, inDestUnit, sizeof (afp->mPlayUnit));
68 68
69 OSStatus result = noErr; 69 OSStatus result = noErr;
70 70
71 71
72 //we can "down" cast a component instance to a component 72 //we can "down" cast a component instance to a component
153 153
154 if (afp->mForkRefNum) { 154 if (afp->mForkRefNum) {
155 FSClose (afp->mForkRefNum); 155 FSClose (afp->mForkRefNum);
156 afp->mForkRefNum = 0; 156 afp->mForkRefNum = 0;
157 } 157 }
158 free(afp); 158 SDL_free(afp);
159 } 159 }
160 } 160 }
161 161
162 static int AudioFilePlayer_Connect(AudioFilePlayer *afp) 162 static int AudioFilePlayer_Connect(AudioFilePlayer *afp)
163 { 163 {
302 302
303 AudioFilePlayer *new_AudioFilePlayer (const FSRef *inFileRef) 303 AudioFilePlayer *new_AudioFilePlayer (const FSRef *inFileRef)
304 { 304 {
305 SInt64 fileDataSize = 0; 305 SInt64 fileDataSize = 0;
306 306
307 AudioFilePlayer *afp = (AudioFilePlayer *) malloc(sizeof (AudioFilePlayer)); 307 AudioFilePlayer *afp = (AudioFilePlayer *) SDL_malloc(sizeof (AudioFilePlayer));
308 if (afp == NULL) 308 if (afp == NULL)
309 return NULL; 309 return NULL;
310 memset(afp, '\0', sizeof (*afp)); 310 SDL_memset(afp, '\0', sizeof (*afp));
311 311
312 #define SET_AUDIOFILEPLAYER_METHOD(m) afp->m = AudioFilePlayer_##m 312 #define SET_AUDIOFILEPLAYER_METHOD(m) afp->m = AudioFilePlayer_##m
313 SET_AUDIOFILEPLAYER_METHOD(SetDestination); 313 SET_AUDIOFILEPLAYER_METHOD(SetDestination);
314 SET_AUDIOFILEPLAYER_METHOD(SetNotifier); 314 SET_AUDIOFILEPLAYER_METHOD(SetNotifier);
315 SET_AUDIOFILEPLAYER_METHOD(SetStartFrame); 315 SET_AUDIOFILEPLAYER_METHOD(SetStartFrame);
324 SET_AUDIOFILEPLAYER_METHOD(OpenFile); 324 SET_AUDIOFILEPLAYER_METHOD(OpenFile);
325 #undef SET_AUDIOFILEPLAYER_METHOD 325 #undef SET_AUDIOFILEPLAYER_METHOD
326 326
327 if (!afp->OpenFile (afp, inFileRef, &fileDataSize)) 327 if (!afp->OpenFile (afp, inFileRef, &fileDataSize))
328 { 328 {
329 free(afp); 329 SDL_free(afp);
330 return NULL; 330 return NULL;
331 } 331 }
332 332
333 // we want about 4 seconds worth of data for the buffer 333 // we want about 4 seconds worth of data for the buffer
334 int bytesPerSecond = (UInt32) (4 * afp->mFileDescription.mSampleRate * afp->mFileDescription.mBytesPerFrame); 334 int bytesPerSecond = (UInt32) (4 * afp->mFileDescription.mSampleRate * afp->mFileDescription.mBytesPerFrame);