public static AudioUtility Create(GameObject source, SampleBufferCallback callback) { var component = source.AddComponent <AudioUtility>(); component.callback = callback; component.format = Format.DefaultForMixing; return(component); }
public AudioMixer(SampleBufferCallback callback) { // Set format this.callback = callback; this.format = Format.DefaultForMixing; // Create buffers commitBuffer = new CircularBuffer(); unityBuffer = new CircularBuffer(); mixedBuffer = new float[SampleCount * format.channelCount]; // Start thread mixerThread = new Thread(MixerLoop); mixerThread.Start(); }
public static void StartRecording(Format format, SampleBufferCallback sampleBufferCallback) { if (IsRecording) { Debug.LogError("NatMic Error: Cannot start recording because NatMic is recording"); return; } if (sampleBufferCallback == null) { Debug.LogError("NatMic Error: Cannot start recording with null callback"); return; } Implementation.StartRecording(format, sampleBufferCallback); }
public static void StartRecording(AudioSource audioSource, Format format, SampleBufferCallback sampleBufferCallback) { if (IsRecording) { Debug.LogError("NatMic Error: Cannot start recording because NatMic is recording"); return; } if (!audioSource) { Debug.LogError("NatMic Error: Cannot start recording because audio source is null"); return; } if (sampleBufferCallback == null) { Debug.LogError("NatMic Error: Cannot start recording with null callback"); return; } audioMixer = new AudioMixer(sampleBufferCallback); audioUtility = AudioUtility.Create(audioSource.gameObject, audioMixer.OnUnitySampleBuffer); Implementation.StartRecording(Format.DefaultForMixing, audioMixer.OnMicrophoneSampleBuffer); }
public void StartRecording(Format format, SampleBufferCallback dataCallback) { }
public void StartRecording(Format format, SampleBufferCallback callback) { this.callback = callback; natmic.Call("startRecording", format.sampleRate); }