syedhali / EZAudio

An iOS and macOS audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
Other
4.94k stars 822 forks source link

Error when instantiating microphone on simulator #212

Open picciano opened 9 years ago

picciano commented 9 years ago

Error when calling self.microphone = [EZMicrophone microphoneWithDelegate:self];

When running on the iOS simulator, I get the error below. However, the recording still functions correctly. I do not get the error when running on a physical device.

Error setting input device port ((null)), reason: The operation couldn’t be completed. (OSStatus error -50.)

Can this error be safely ignored? Or am I doing something wrong?

Thanks!

syedhali commented 9 years ago

Hi @picciano, are you setting the AVAudioSession?

picciano commented 9 years ago

Yes, I do this as the app launches.

    //configure audio session
    NSError *setCategoryError = nil;
    BOOL setCategorySuccess = [[AVAudioSession sharedInstance]
                               setCategory:AVAudioSessionCategoryPlayAndRecord
                               withOptions:AVAudioSessionCategoryOptionDuckOthers|AVAudioSessionCategoryOptionDefaultToSpeaker|AVAudioSessionCategoryOptionAllowBluetooth
                               error:&setCategoryError];

    if (setCategorySuccess) {
        NSLog(@"Audio Session options set.");
    } else {
        NSLog(@"WARNING: Could not set audio session options.");
    }
imownbey commented 9 years ago

I think this might be related to this bug: https://github.com/syedhali/EZAudio/issues/217