jpsim / ZenTuner

A minimal chromatic tuner for iOS & macOS.

Home Page:https://apps.apple.com/us/app/zen-tuner/id1550640624

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using double precision audio format .pcmFormatFloat64, throws error

willswinson opened this issue · comments

I need the audio to be double precision. I tried updating...

private extension AVAudioFormat {
    static var stereo: AVAudioFormat {
        AVAudioFormat(standardFormatWithSampleRate: 44_100, channels: 2) ?? AVAudioFormat()
    }
}

to

private extension AVAudioFormat {
    static var stereo: AVAudioFormat {
        AVAudioFormat(commonFormat: .pcmFormatFloat64,
                      sampleRate: 44_100,
                      channels: AVAudioChannelCount(2),
                      interleaved: false) ??
        AVAudioFormat()
    }
}

But it throws this error no matter what I do on line 98 in AudioEngine

Line of error:

avEngine.connect(mixer.avAudioNode, to: avEngine.outputNode, format: .stereo)

Error:

2023-03-20 12:31:27.372153+0700 App[7710:87518] [avae]            AVAEInternal.h:130   [AUInterface.mm:539:SetFormat: ([[busArray objectAtIndexedSubscript:(NSUInteger)element] setFormat:format error:&nsErr])] returned false, error Error Domain=NSOSStatusErrorDomain Code=-10868 "(null)"
2023-03-20 12:31:27.375080+0700 App[7710:87518] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: '[[busArray objectAtIndexedSubscript:(NSUInteger)element] setFormat:format error:&nsErr]: returned false, error Error Domain=NSOSStatusErrorDomain Code=-10868 "(null)"'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000018040e7c8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180051144 objc_exception_throw + 56
	2   CoreFoundation                      0x000000018040e66c +[NSException raise:format:] + 0
	3   AVFAudio                            0x00000001a1e4e0e0 _Z19AVAE_RaiseExceptionP8NSStringz + 48
	4   AVFAudio                            0x00000001a1f30334 _Z30_AVAE_CheckSuccessAndNoNSErrorPKciS0_S0_bP7NSError + 328
	5   AVFAudio                            0x00000001a1f2efd4 _ZN17AUInterfaceBaseV39SetFormatEbjP13AVAudioFormat + 116
	6   AVFAudio                            0x00000001a1e97dc0 _ZN18AVAudioEngineGraph8_ConnectEP19AVAudioNodeImplBaseS1_jjP13AVAudioFormat + 4556
	7   AVFAudio                            0x00000001a1f2d5f4 _ZN17AVAudioEngineImpl7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 1436
	8   AVFAudio                            0x00000001a1f22edc -[AVAudioEngine connect:to:format:] + 124
	9   App                         0x00000001007897ec $s11App11AudioEngineC06createD5Mixer33_BF4FC786C8E6896A8E43796B650784B2LLyyF + 420
	10  App                         0x0000000100789114 $s11App11AudioEngineC18createSilentOutput33_BF4FC786C8E6896A8E43796B650784B2LLyyF + 156
	11  App                         0x000000010078904c $s11App11AudioEngineC5inputAC9InputNodeCvg + 188
	12  App                         0x00000001008cd5f0 $s11App23MicrophonePitchDetectorC05setUpD8TrackingyyFyyYaYbScMYccfU_TY0_ + 116
	13  App                         0x00000001008cd76d $s11App23MicrophonePitchDetectorC05setUpD8TrackingyyFyyYaYbScMYccfU_TATQ0_ + 1
	14  App                         0x00000001008cdabd $sIeghH_ytIeghHr_TRTQ0_ + 1
	15  App                         0x00000001008cdc05 $sIeghH_ytIeghHr_TRTATQ0_ + 1
	16  App                         0x00000001008ce979 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRTQ0_ + 1
	17  App                         0x00000001008cead9 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRTATQ0_ + 1
	18  libswift_Concurrency.dylib          0x00000001b03bedcd _ZL23completeTaskWithClosurePN5swift12AsyncContextEPNS_10SwiftErrorE + 1
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: '[[busArray objectAtIndexedSubscript:(NSUInteger)element] setFormat:format error:&nsErr]: returned false, error Error Domain=NSOSStatusErrorDomain Code=-10868 "(null)"'