I was instructed to add VOIP to the game (cross-platform, so I cannot use Apple gakit for this).
For 3 or 4 days, I try to wrap my head around an audio unit and remoteIO ... I have missed dozens of examples, etc., but each time it uses a simple algorithm to input PCM and plays it on the speaker. According to Apple documentation, to do VOIP, we have to use kAudioSessionCategory_PlayAndRecord.
UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord;
status = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
sizeof(audioCategory),
&audioCategory);
XThrowIfError(status, "couldn't set audio category");
1) But it seems to me that playAndRecord will always play what comes from the microphone (or, more importantly, the PerformThru // aurioTouch callback ), am I wrong?
I have the easiest callback without doing anything except AURender
static OSStatus PerformThru(
void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
OSStatus err = AudioUnitRender(THIS->rioUnit, ioActionFlags, inTimeStamp, 1, inNumberFrames, ioData);
if (err)
printf("PerformThru: error %d\n", (int)err);
return err
}
( , )...
, , , , , , , , , , , Apple ( ).
, , , - - ...
- , ?