Skip to content

Commit

Permalink
Renamed internal callbacks to use "AS" prefix instead of "My".
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Sep 18, 2014
1 parent 5b9ce7e commit 66f65b9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions AudioStreamer/AudioStreamer.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ @implementation AudioStreamer
@synthesize playbackRate;

/* AudioFileStream callback when properties are available */
static void MyPropertyListenerProc(void *inClientData,
static void ASPropertyListenerProc(void *inClientData,
AudioFileStreamID inAudioFileStream,
AudioFileStreamPropertyID inPropertyID,
UInt32 *ioFlags) {
Expand All @@ -102,7 +102,7 @@ static void MyPropertyListenerProc(void *inClientData,
}

/* AudioFileStream callback when packets are available */
static void MyPacketsProc(void *inClientData, UInt32 inNumberBytes, UInt32
static void ASPacketsProc(void *inClientData, UInt32 inNumberBytes, UInt32
inNumberPackets, const void *inInputData,
AudioStreamPacketDescription *inPacketDescriptions) {
AudioStreamer* streamer = (__bridge AudioStreamer *)inClientData;
Expand All @@ -114,15 +114,15 @@ static void MyPacketsProc(void *inClientData, UInt32 inNumberBytes, UInt32

/* AudioQueue callback notifying that a buffer is done, invoked on AudioQueue's
* own personal threads, not the main thread */
static void MyAudioQueueOutputCallback(void *inClientData, AudioQueueRef inAQ,
static void ASAudioQueueOutputCallback(void *inClientData, AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer) {
AudioStreamer* streamer = (__bridge AudioStreamer*)inClientData;
[streamer handleBufferCompleteForQueue:inAQ buffer:inBuffer];
}

/* AudioQueue callback that a property has changed, invoked on AudioQueue's own
* personal threads like above */
static void MyAudioQueueIsRunningCallback(void *inUserData, AudioQueueRef inAQ,
static void ASAudioQueueIsRunningCallback(void *inUserData, AudioQueueRef inAQ,
AudioQueuePropertyID inID) {
AudioStreamer* streamer = (__bridge AudioStreamer *)inUserData;
[streamer handlePropertyChangeForQueue:inAQ propertyID:inID];
Expand Down Expand Up @@ -841,8 +841,8 @@ - (void)handleReadFromStream:(CFReadStreamRef)aStream
}

// create an audio file stream parser
err = AudioFileStreamOpen((__bridge void*) self, MyPropertyListenerProc,
MyPacketsProc, fileType, &audioFileStream);
err = AudioFileStreamOpen((__bridge void*) self, ASPropertyListenerProc,
ASPacketsProc, fileType, &audioFileStream);
CHECK_ERR(err, AS_FILE_STREAM_OPEN_FAILED);
}

Expand Down Expand Up @@ -898,8 +898,8 @@ - (void)handleReadFromStream:(CFReadStreamRef)aStream
}
defaultFileTypeUsed = NO;

err = AudioFileStreamOpen((__bridge void*) self, MyPropertyListenerProc,
MyPacketsProc, fileType, &audioFileStream);
err = AudioFileStreamOpen((__bridge void*) self, ASPropertyListenerProc,
ASPacketsProc, fileType, &audioFileStream);
CHECK_ERR(err, AS_FILE_STREAM_OPEN_FAILED);

break; // We're not interested in any other metadata here.
Expand Down Expand Up @@ -935,8 +935,8 @@ - (void)handleReadFromStream:(CFReadStreamRef)aStream
//
// enqueueBuffer
//
// Called from MyPacketsProc and connectionDidFinishLoading to pass filled audio
// buffers (filled by MyPacketsProc) to the AudioQueue for playback. This
// Called from ASPacketsProc and connectionDidFinishLoading to pass filled audio
// buffers (filled by ASPacketsProc) to the AudioQueue for playback. This
// function does not return until a buffer is idle for further filling or
// the AudioQueue is stopped.
//
Expand Down Expand Up @@ -1038,15 +1038,15 @@ - (void)createQueue {
assert(audioQueue == NULL);

// create the audio queue
err = AudioQueueNewOutput(&asbd, MyAudioQueueOutputCallback,
err = AudioQueueNewOutput(&asbd, ASAudioQueueOutputCallback,
(__bridge void*) self, CFRunLoopGetMain(), NULL,
0, &audioQueue);
CHECK_ERR(err, AS_AUDIO_QUEUE_CREATION_FAILED);

// start the queue if it has not been started already
// listen to the "isRunning" property
err = AudioQueueAddPropertyListener(audioQueue, kAudioQueueProperty_IsRunning,
MyAudioQueueIsRunningCallback,
ASAudioQueueIsRunningCallback,
(__bridge void*) self);
CHECK_ERR(err, AS_AUDIO_QUEUE_ADD_LISTENER_FAILED);

Expand Down Expand Up @@ -1118,7 +1118,7 @@ - (void)createQueue {
//
// handlePropertyChangeForFileStream:fileStreamPropertyID:ioFlags:
//
// Object method which handles implementation of MyPropertyListenerProc
// Object method which handles implementation of ASPropertyListenerProc
//
// Parameters:
// inAudioFileStream - should be the same as self->audioFileStream
Expand Down Expand Up @@ -1212,7 +1212,7 @@ - (void)handlePropertyChangeForFileStream:(AudioFileStreamID)inAudioFileStream
//
// handleAudioPackets:numberBytes:numberPackets:packetDescriptions:
//
// Object method which handles the implementation of MyPacketsProc
// Object method which handles the implementation of ASPacketsProc
//
// Parameters:
// inInputData - the packet data
Expand Down Expand Up @@ -1518,7 +1518,7 @@ - (void)handleBufferCompleteForQueue:(AudioQueueRef)inAQ
//
// handlePropertyChangeForQueue:propertyID:
//
// Implementation for MyAudioQueueIsRunningCallback
// Implementation for ASAudioQueueIsRunningCallback
//
// Parameters:
// inAQ - the audio queue
Expand Down

0 comments on commit 66f65b9

Please sign in to comment.