-1

I would like to port an iOS app to macOS using Mac Catalyst. The app is an audio host for the AUv3 plugins.

The problem is that I can't get the plugin icon using the AudioComponentGetIcon API since is unavailable on macOS.

How can I get the plugin icon?

    while (true) {
        comp = AudioComponentFindNext(comp, &rau->_desc);
        if (comp == NULL) break;
        
        AudioComponentDescription desc = { 0, 0, 0, 0, 0 };
        if (AudioComponentGetDescription(comp, &desc) != noErr) continue;
        
#if !TARGET_OS_MACCATALYST
        rau->_image = AudioComponentGetIcon(comp, 76);
        rau->_lastActiveTime = AudioComponentGetLastActiveTime(comp);
#else

#warning CATALYST WHAT I SHOULD DO here?
        //rau->_image = AudioComponentGetIcon(comp);
#endif
        if (rau->_image == nil) {
            rau->_image = [UIImage imageNamed:DEFAULT_AU_IMAGE];
        }        
    }
HangarRash
  • 7,314
  • 5
  • 5
  • 32
  • 1
    Hello, Welcome to S.O, have you researched anything about your question, please provide what efforts you have done. – Prateik Darji Jan 27 '20 at 13:45
  • I've contacted Apple and said that the “AudioComponentGetIcon” is deprecated API on iOS. So it is possible in macOS to get the AUv3 icon, from an AudioComponent ? – Alessandro Petrolati Jan 28 '20 at 18:49
  • So what about AVAudioUnitComponent's `icon` property? https://developer.apple.com/documentation/avfoundation/avaudiounitcomponent/1385647-icon – matt Jan 28 '20 at 18:59

1 Answers1

0

Apple's official answer: AudioComponentGetIcon was only ever supported on iOS for Inter-App Audio, not for audio unit extensions. Since Inter-App Audio is now deprecated on iOS, the functionality is not available in Catalyst, including AudioComponentGetIcon. So, yes, in a Mac Catalyst app, it is not possible to get the AU icon. In a macOS app (non-Catalyst), the AudioComponentGetIcon function is still available, but that doesn’t provide a solution to a Catalyst app. There is no “bridging” mechanism that allows your Catalyst app to cross over to the macOS function.

I’ve also figure out this workaround but __comp.icon and __comp.iconURL still unavailable in Catalyst.

AVAudioUnitComponentManager* av = [AVAudioUnitComponentManager sharedAudioUnitComponentManager];
NSArray<AVAudioUnitComponent *>* comps = [av componentsMatchingDescription:desc];
AVAudioUnitComponent* __comp = [comps objectAtIndex:0];
NSImage *iconIMG = __comp.icon; //not available on Catalyst
NSURL *iconURL = __comp.iconURL; //not available on Catalyst