18 #region --Client API--
27 audioListener.gameObject)
39 recorder, clock, audioSource.gameObject, mute)
48 Object.Destroy(attachment);
54 #region --Operations--
57 private readonly
IClock clock;
58 private readonly AudioInputAttachment attachment;
59 private readonly
bool mute;
63 this.recorder = recorder;
65 attachment = gameObject.AddComponent<AudioInputAttachment>();
66 attachment.sampleBufferDelegate = OnSampleBuffer;
70 private void OnSampleBuffer(
float[] data)
72 AndroidJNI.AttachCurrentThread();
73 recorder.CommitSamples(data, clock.timestamp);
75 Array.Clear(data, 0, data.Length);
78 private class AudioInputAttachment : MonoBehaviour
80 public Action<float[]> sampleBufferDelegate;
82 private void OnAudioFilterRead(
float[] data,
int channels)
84 sampleBufferDelegate?.Invoke(data);
Clock for generating recording timestamps. Clocks are important for synchronizing audio and video tra...