Hello everyone,
we're trying to put the AntMedia Unity SDK into an Oculus project.
We made it working for audio-chat only, but we're currently having troubles on getting the microphone to communicate with the server.
After a lot of debugging we found out that the problem seems to be the AudioRenderer.
We tried working around it by using the default Microphone API from Unity, but with no result (the app crashes as it should start communicating with the server).
The code we tried is the following:
In the Render() functions
if (sora != null && !Recvonly && Microphone.IsRecording(audioRecordingDevice)) {
if (!audioSourceInput.isPlaying) audioSourceInput.Play();
//var samples = AudioRenderer.GetSampleCountForCaptureFrame();
if (AudioSettings.speakerMode == AudioSpeakerMode.Stereo) {
//var buf = new Unity.Collections.NativeArray<float>(samples * 2, Unity.Collections.Allocator.Temp);
int samples = audioSourceInput.clip.samples * audioSourceInput.clip.channels;
int pos = 0;// Microphone.GetPosition(audioRecordingDevice);
float[] buf = new float[samples];
//audioSourceInput.clip.GetData(buf, 0);
print("mic pos: "+pos+" | clip samples: "+audioSourceInput.clip.samples+" | samples: "+samples+" | channels: "+audioSourceInput.clip.channels+" | buffer size: "+buf.Length);
//sora.ProcessAudio(buf, 0, samples);
}
}
In the Init() function:
audioSourceInput.clip = Microphone.Start(null, true, 5, maxFreq);
audioSourceInput.Play();
If we was to use the AudioRenderer (as in the base file provided) what happens is that the microphones "disappear" from the system and therefore cannot be used by the app to send audio.
Has anyone actually made it?
Thank you in advance