Hello Guest

Non responding main thread when trying to load CAInterAppAudioSwitcherView

  • 2 Replies
  • 530 Views
Hey!
I was trying to add the IAA Switcher view as described in this post: http://lijon.github.io/iaa_node_panel.html
When the app gets connected to an IAA Host (I only tried with AUM)  the CPU goes to 100+% and the UI becomes unresponsive.
CAInterAppAudioTransportView works fine. Browsing around I found this thread: http://forum.theamazingaudioengine.com/discussion/816/open-source-iaa-transport-control-panel-for-taae I downloaded the code posted in the second to last message (http://forum.theamazingaudioengine.com/uploads/FileUpload/fe/15f85967a71804e4bea071d6f38ac2.zip), modified it to add the IAA Switcher and I got the same results as with my app.

I made the following changes to TheEngineSample/ViewController.m
Line 78: added the switcher
Code: [Select]
@implementation ViewController {
    CAInterAppAudioTransportView *transportView;
    CAInterAppAudioSwitcherView *switcher;
    ...

Modified the initIAATransport method to this
Code: [Select]
-(void)initIAATransport {
    if (connectedIAA && !_audiobusController.memberOfActiveAudiobusSession) {
        if (!transportView) {
            CGRect _viewrect;
            _viewrect = CGRectMake(0, 0, 300, 20);
            transportView = [[CAInterAppAudioTransportView alloc] initWithFrame:_viewrect];
            transportView.rewindButtonColor = transportView.playButtonColor =
            transportView.pauseButtonColor = [UIColor blackColor];
            transportView.labelColor = [UIColor darkTextColor];
            transportView.backgroundColor = [UIColor colorWithWhite:0.27f alpha:0];
            [transportView setOutputAudioUnit: _audioController.audioUnit];
            [transportView setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin];
            switcher = [[CAInterAppAudioSwitcherView alloc] initWithFrame:CGRectMake(400, 0, 100, 20)];
            [switcher setBackgroundColor:[UIColor greenColor]];
            [switcher setOutputAudioUnit:_audioController.audioUnit];
        }
        [transportHolder addSubview: transportView];
        [transportHolder addSubview: switcher];
    } else {
        if (transportView) {
            [transportView removeFromSuperview];
            [switcher removeFromSuperview];
        }
    }
}

I don't know what might be happening

Any help is appreciated

Cheers!

Re: Non responding main thread when trying to load CAInterAppAudioSwitcherView
« Reply #1 on: November 06, 2017, 11:45:34 AM »
In my apps, I create and show a CAInterAppAudioSwitcherView only when the user taps a button. Sounds like maybe you're trying to show it upon IAA connection, and maybe that's the problem?

Also, I don't use CAInterAppAudioTransportView (which you *would* show when becoming connected to IAA host) but a custom transport panel. Not sure if that matters, though.

Re: Non responding main thread when trying to load CAInterAppAudioSwitcherView
« Reply #2 on: November 08, 2017, 05:56:23 PM »
You are right.

Thank you for taking the time to reply!