Jump to content
  • 0

Unity SDK - Oculus - Issues on microphone


Michele Castelletti
 Share

Question

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
Link to comment
Share on other sites

  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

1 answer to this question

Recommended Posts

 Share

×
×
  • Create New...