I setup an AUGraph which contains several audio unit.
I know that when I call AUGraphStart()
the graph starts the rendering of all the audio unit. But I would like to be able to start the rendering of one specific AUFilePlayer.
Is it possible?
UPDATE
I saw in comment that my question lacked of details. I have the current setup for my AUGraph:
AUFilePlayer -> AUMixer -> AUOutput
I setup the AUFilePlayer with a specific AudioFileID.
When I start the graph I would like just to "start" the graph without having any sound. And later I would like to do something like: AUFilePlayer.Play() to start making sounds.
I don't know if it's possible...
UPDATE: workaround found
I think I found a workaround for this. See my answer for my details.
I found the following workaround:
When I setup my AUFilePlayer I set the value mFramesToPlay
of the ScheduledAudioFileRegion
struct to:
ScheduledAudioFileRegion audio_file_region;
/*... init values...*/
audio_file_region_.mFramesToPlay = 0;
instead of
audio_file_region_.mFramesToPlay = number_of_frames_for_the_audio_file;
That way when I start the graph, the AUFilePlayer doesn't play any sound.
Then I have a methods Play()
where I set the right frames to play for the mFramesToPlay
field.
I don't know if it's a good way to do this but it does its job.