Post

Replies

Boosts

Views

Activity

Choose specific input channel as a mono input from external USB device in AVAudioSession/AVAudioEngine
I'm working on an audio recording app which uses an external USB Audio interface (e.g, Focusrite Scarlett Solo) connected to an iPhone. When I run AVAudioSession.sharedInstance().currentRoute.inputs it returns the interface correctly. 1 element - 0 : <AVAudioSessionPortDescription: 0x28307c650, type = USBAudio; name = Scarlett Solo USB; UID = AppleUSBAudioEngine:Focusrite:Scarlett Solo USB:130000:1,2; selectedDataSource = (null)> Channels are returned correctly as well. po AVAudioSession.sharedInstance().currentRoute.inputs.first?.channels ▿ Optional<Array<AVAudioSessionChannelDescription>> ▿ some : 2 elements - 0 : <AVAudioSessionChannelDescription: 0x283070b60, name = Scarlett Solo USB 1; label = 4294967295 (0xffffffff); number = 1; port UID = AppleUSBAudioEngine:Focusrite:Scarlett Solo USB:130000:1,2> - 1 : <AVAudioSessionChannelDescription: 0x283070b70, name = Scarlett Solo USB 2; label = 4294967295 (0xffffffff); number = 2; port UID = AppleUSBAudioEngine:Focusrite:Scarlett Solo USB:130000:1,2> When I connect the inputNode to mainMixerNode in AVAudioEngine it uses multi-channel input so the Line/Instrument input is on the right channel and Microphone input is on the left. How can I make it so that I use only the 2nd Channel (guitar) as a mono to be played back in both speakers? I've been looking through some docs and discussions but could not find the answer. I tried changing channels to 1 in audio format but as expected it plays the first channel in mono but I can't select 2nd channel to be played instead. let input = engine.inputNode let inputFormat = input.inputFormat(forBus: 0) let preferredFormat = AVAudioFormat( commonFormat: inputFormat.commonFormat, sampleRate: inputFormat.sampleRate, channels: 1, interleaved: false )! engine.connect(input, to: engine.mainMixerNode, format: preferredFormat)
3
0
1.3k
Mar ’23
Xcode 16 build fails randomly with
So this error has randomly appeared to the code that was building previously even with Xcode 16 and since it has appeared it started falling always. Even after cleaning derived data, build folder, re-cloning the app, doing all kinds of voodoos. /Users/kakhi/Library/Developer/Xcode/DerivedData/MyApp-eafqhlqmrdvrhudisvbfymvrnwba/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyAppabi.json /Users/kakhi/Library/Developer/Xcode/DerivedData/MyApp-eafqhlqmrdvrhudisvbfymvrnwba/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp.abi.json: No such file or directory I've checked the path and there's indeed no .abi.json file but I've never had anything to do with it. Any ideas what I might be missing? Or is this Xcode 16 bug? Also, it was succeeding to build after first appearance on Xcode 16 beta 6 but now it fails to succeed subsequent builds on beta 6 as well :(
2
2
192
Sep ’24