Re: AUGraph reconfiguration in response to route change
Re: AUGraph reconfiguration in response to route change
- Subject: Re: AUGraph reconfiguration in response to route change
- From: Arshia Cont <email@hidden>
- Date: Tue, 10 Jul 2018 22:17:22 +0200
Bortosz,
Looking at your example and comparing it to mine (which dates now), I would try
two things:
(1) I believe that AUGraphUninitialize alters (or unloads) the SoundFonts and
hence your new Note On calls end up nowhere.
(2) In my setup for updating Sample Rate (as a result of RouteChange), I stop
the AUGraph, Update Stream Formats, Make Connections, Initialize AUGraph, and
run AUGraphUpdate and then re-start the graph. I guess the ordering here is
also important.
This said, we are both in the danger zone since AUGraph is doomed for
deprecation. Any updates on this?!
Arshia Cont
www.antescofo.com <http://www.antescofo.com/>
> On 10 Jul 2018, at 20:53, Bartosz Nowotny <email@hidden> wrote:
>
> Yes, I have tried AVAudioSession route change notification as well - same
> result.
>
> Even though the code can handle multiple AUMIDISynths, I have set it up so
> that for testing only 1 is ever created.
>
> There is definitely something weird going on: if I respond to the route
> change and then try to play some notes - the app always crashes. If I plug in
> my headphones while some notes are being played, it either continues to play,
> goes to silence or crashes.
>
> I have created a snippet that shows how my set up looks like:
> https://hastebin.com/ugumilofid.m <https://hastebin.com/ugumilofid.m>
> At the top, you can find a brief explaination of what the included code is
> supposed to do, what the test scenario is and what is the app output.
>
> I am out of ideas as to what is wrong here. Is it possible that this is a
> threading issue? Other than the route change handling the set up works great:
> I can load up multiple soundfonts, play notes, unload soundfonts, shut the
> graph down and then start it again later.
>
> Regards,
> Bartosz
>
> On Tue, Jul 10, 2018 at 11:20 AM, Sven Thoennissen <email@hidden
> <mailto:email@hidden>> wrote:
> Hello,
>
> It may have to do something with the property listener. Have you tried using
> AVAudioSession.routeChangeNotification instead?
> Did you connect more than 8 AUMIDISynth to your mixer? (IIRC 8 is the maximum
> possible, at least with AVAudioMixerNode)
>
> In any case it is hard to tell without seeing code. I recommend to set up a
> minimal test project with only 1 AUMIDISynth.
>
> Have you considered using AVFoundation classes instead of the old V2 API? (at
> least to reproduce the problem)
>
> Best regards,
> Sven
>
> > Am 09.07.2018 um 21:32 schrieb Bartosz Nowotny <email@hidden
> > <mailto:email@hidden>>:
> >
> > Hello,
> >
> > I am trying to programmatically reconfigure AUGraph at runtime, in response
> > to a route change.
> >
> > My set up consists of a couple of AUMIDISynth nodes connected to a multi
> > channel mixer node which in turn is connected to RemoteIO node. This set up
> > works fine and I am able to produce audio by sending MIDI note on/off
> > events.
> >
> > I want to avoid audio data resampling at any point in the graph. I can
> > start with a properly set up AUGraph that has all audio units use the same
> > sample rate (starting from midi synths, through mixer to remote IO). Route
> > changes (e.g. plugging in headphones) can change the output sample rate and
> > thus introduce resampling and other side effects.
> >
> > To respond to a route change I set up a property listener for StreamFormat
> > on my IO unit. When the stream format changes, I call a method that
> > reconfigures the AUGraph in the following manner:
> > 1. Stop the AUGraph
> > 2. Uninitialize the AUGraph
> > 3. Clear all graph connections
> > 4. Set mixer output sample rate (propagates to IO input sample rate)
> > 5. Set synth output sample rates (propagates to mixer input sample rates)
> > 6. Connect synth nodes to mixer node
> > 7. Connect mixer node to IO node
> > 8. Update, Initialize and Start the AUGraph
> >
> > None of the above operations returns an error result.
> >
> > The issue occurs when I send some note on/off events - the app crashes.
> > What am I missing?
> >
> > Regards,
> > Bartosz Nowotny
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Coreaudio-api mailing list (email@hidden
> > <mailto:email@hidden>)
> > Help/Unsubscribe/Update your Subscription:
> >
> > This email sent to email@hidden <mailto:email@hidden>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden
> <mailto:email@hidden>)
> Help/Unsubscribe/Update your Subscription:
>
>
> This email sent to email@hidden <mailto:email@hidden>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden