I have a sample app in iOS for Audio capture from mic & Play in real time. I am tring to convert this app in macosx but found some error. When i tried to compile my app in macosx then it return error on “kAudioSessionCategory_PlayAndRecord”, “AudioSessionSetActive”
flag = kAudioSessionCategory_PlayAndRecord;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(flag), &flag);
//Float32 fflag = 1.0;
//AudioSessionSetProperty(kAudioSessionProperty_InputGainScalar, sizeof(fflag), &fflag);
flag = kAudioSessionMode_VoiceChat;
AudioSessionSetProperty(kAudioSessionProperty_Mode, sizeof(flag), &flag);
AudioSessionSetActive(true);
What will be equivalent code in macosx for the above line of code.
In short, you don’t need AudioSession on OS X—it’s role is to coordinate shared usage of the audio hardware on devices. On OS X, all apps have access to the audio hardware simultaneously. Indeed, if you check out
AudioToolbox/AudioSession.hyou’ll see__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_2_0);after all the functions—this means that AudioSession isn’t available on OS X.You can simply
#ifdefout any AudioSession code in your project for your OS X build.