I just started learning Core Audio and faced with an issue.
I have a simple iOS sound app with one button which plays some sound when pressed.
For sound playback I am using AudioUnits.
Everything is OK when the button is tapped with low frequency
But when I start to press it faster, so previous playback is interrupted on high amplitude - I hear clicking noise.
Here is the code samples:
Assigning file region:
AudioUnitSetProperty(audioUnit, kAudioUnitProperty_ScheduledFileRegion, kAudioUnitScope_Global, 0, ®ion, sizeof(region))
region is instance of ScheduledAudioFileRegion based on AudioFileID.
Starting playback:
AudioUnitSetProperty(audioUnit, kAudioUnitProperty_ScheduleStartTimeStamp, kAudioUnitScope_Global, 0, &startTime, sizeof(startTime))
startTime is instance of AudioTimeStamp, which configured to play right away with mSampleTime = -1
Is there some useful technique to handle this issue? How can I fade out previous playback to remove this click sound?