9

I am trying to port audio input to Mac Catalyst. As of now I am using xcode13GM, macOS 10.15 Beta 8 (19A558d), ios13beta8. The following code does not return any input ports.

let audioSession = AVAudioSession.sharedInstance()
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)

var mic : AVAudioSessionPortDescription? = nil
for input in audioSession.availableInputs! {
  if input.portType == AVAudioSession.Port.builtInMic {
    mic = input
  } else {
    print("Not internal mic")
}

// here: 'mic' is nil

I have granted the "Hardend Runtime - Audio Input" entitlement and the app asks for microphone permission which is granted.

When accessing audioSession.availableInputs the following error shows up in the console:

[avas] AVAudioSession_MacOS.mm:258:-[AVAudioSession getChannelsFromAU:PortName:PortID:]: ERROR in getting channel layout for auScope 1768845428 element 1

Is this a bug due to beta status of the whole stuff or am I missing something ?

Thanks

Chris
  • 1,231
  • 2
  • 10
  • 20
  • 1
    Same here. I guess the `AVAudioSession` isn't fully implemented for `Mac Catalyst` yet. For instance, when I call `try audioSession.overrideOutputAudioPort(.speaker)` I get the error `Error Domain=AVAudioSessionErrorDomain Code=-4 "Unimplemented"`, which is pretty self explanatory. Well, let's wait for the next Mac Catalina version then – marcelosalloum Sep 26 '19 at 20:06
  • 3
    Problem still persists under 10.15 beta 10 and Xcode 11.1GM. I have filed a bug report, but as usual no feedback from Apple. – Chris Oct 02 '19 at 06:24
  • 1
    Still the same problem 6 months later. Filed a bug report as well... – pms-pms May 12 '20 at 06:56
  • @pms-pms Could you please provide a link to the bug report? – 0xmtn May 12 '20 at 10:14
  • 1
    This is sad. Just when I thought I could make one app and deploy on iOS and MacOS, here we go again... – akuz May 14 '20 at 17:12
  • @Chris Have you got a chance to get it working with the new version of MacOS and Xcode? – 0xmtn May 15 '20 at 12:30
  • No, but the speech API works for non-Catalyst apps. After bug report, forum chat and some communication with apple stuff who confirmed the problem I finally gave up ;-( They didn't fix it for months and I doubt they intend to fix it in the future... – Chris May 17 '20 at 07:57

0 Answers0