setupWithAudioController not synchronous?

edited September 2016

I think this structure has been in TAAE for a while, but I just upgraded to the latest and am running into various issues related to it.

In older versions (V1.4.6, I think), I could do this:

AudioComponentDescription component = AEAudioComponentDescriptionMake(kAudioUnitManufacturer_Apple,
                                      kAudioUnitType_FormatConverter,
                                      kAudioUnitSubType_NewTimePitch);
AEAudioUnitFilter *filter = [[AEAudioUnitFilter alloc] initWithComponentDescription: component];
AudioUnitSetParameter(filter.audioUnit,
                          kNewTimePitchParam_Rate,
                          kAudioUnitScope_Global,
                          0,
                          myPlayRate,
                          0);

But now I have to put my AudioUnitSetParameter statement inside the preinitializeBlock, which gets called at some unspecified time later.

I can work around this, but I'm wondering why it's set up this way since it increases complexity on my side. Thanks.

Comments

  • I'm having trouble remembering exactly the details surrounding the change (which was SHA 4f64c742), but I think it was to remove the dependency on passing the AEAudioController instance when initialising modules. That dependency led to some annoying complexities in my own code, so I refactored to simplify.

  • After having worked on this for a bit, I've ended up with this structure. Curious to hear any tips that could help.

    I have an audio channel A that runs in parallel with channel B and must remain in sync. Channel A has a NewTimePitch filter applied to it that has a latency that is measurable as a property. In order to keep B in sync, I apply an AEDelayFilter to it, and I set the delayTime equal to that latency value.

    Since the audio unit is not set up until the preinitializeBlock, I set this latency value in the delay unit's preinitialize block. I can set breakpoints and see that this value is set correctly.

    Somehow, my channels are not in sync the same way they were in 1.4.X. The amount that they are offset depends on the system buffer duration. For 0.006, 0.012, and 0.023 durations, the two channels are off by one buffer duration. However, that value decreases for 0.046 and higher.

Sign In or Register to comment.