I can start and play a file successfully with a simple AUGraph. It wraps a "AUGraphFilePlayer" struct that makes a simple graph like:
FileAUNode -- OutputNode
What I would like to do next is via a user event(press pause) have the AUGraph play silence, then <press play> continue the playback of the file.
So how do I go about that? Should I feed the file node AURenderCallback silence, something like
(void)MyRenderCallback(... ... ...)
{
if paused state
assign 0s to buffers
if not paused state
do normal file rendering
}
I did try and add a render callback to the fileAUNode like this:
AURenderCallbackStruct input;
input.inputProc = FileRenderProc;
input.inputProcRefCon = player_;
CheckError(AudioUnitSetProperty
(player_->fileAU, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(input)), "AudioUnitSetProperty failed");
Which resulted in this: Error: AudioUnitSetProperty failed (-10877), not sure why.
Is there a better way to skin this cat?
I have posted my class on pastebin:
Any suggestions greatly appreciated.