Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to cleanup AEMixerModule after stopping AEAudioUnitOutput? #41

Open
runeb opened this issue Sep 28, 2016 · 0 comments
Open

How to cleanup AEMixerModule after stopping AEAudioUnitOutput? #41

runeb opened this issue Sep 28, 2016 · 0 comments

Comments

@runeb
Copy link

runeb commented Sep 28, 2016

I have an audio controller that has these properties

  self.renderer = [AERenderer new];
  self.output = [[AEAudioUnitOutput alloc] initWithRenderer:self.renderer];
  self.mixer = [[AEMixerModule alloc] initWithRenderer:self.renderer];

Playing audio consists of adding AEAudioFilePlayerModule objects to the mixer, with different starting timestamps.

// For every sample
AEAudioFilePlayerModule *fp = [[AEAudioFilePlayerModule alloc] initWithRenderer:self.renderer URL:sample error:nil];
// Calculate timestamp
[fp playAtTime:timestamp];
__weak AEAudioFilePlayerModule *weakFp = fp;
[fp setCompletionBlock:^{
  [self.mixer removeModule:weakFp];
}];
[self.mixer addModule:fp];

And then starting playback is simply

[self.output start:error];

While audio is playing, more AEAudioFilePlayerModule might be scheduled.

Stopping audio is done like this:

[self.output stop];
[self.mixer setModules:@[]];

With this setup I can play and stop audio fine. But after playing, stopping and then playing again I get these messages in my console:

0x6000000ef280: AEManagedValueServiceReleaseQueue called from outside realtime thread
AEManagedValueCommitPendingUpdates called from outside realtime thread
0x6000000ef200: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000edc80: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000ef800: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000ef280: AEManagedValueServiceReleaseQueue called from outside realtime thread
AEManagedValueCommitPendingUpdates called from outside realtime thread
0x6000000ef200: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000edc80: AEManagedValueServiceReleaseQueue called from outside realtime thread
2016-09-28 23:57:51.516 TCH[55016:17181235] TAAE: Suppressing some messages
0x6000000ef280: AEManagedValueServiceReleaseQueue called from outside realtime thread
AEManagedValueCommitPendingUpdates called from outside realtime thread
0x6000000ef800: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000ef200: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000edc80: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000ef800: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6080000f2000: AEManagedValueServiceReleaseQueue called from outside realtime thread
0x6000000ef280: AEManagedValueServiceReleaseQueue called from outside realtime thread
AEManagedValueCommitPendingUpdates called from outside realtime thread
2016-09-28 23:57:52.596 TCH[55016:17181253] TAAE: Suppressing some messages

Sometimes the app crashes because of this. So the question is what am I doing wrong and what is the proper way to clean up after stopping audio in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant