Exemplo n.º 1
0
        public static AudioUtility Create(GameObject source, SampleBufferCallback callback)
        {
            var component = source.AddComponent <AudioUtility>();

            component.callback = callback;
            component.format   = Format.DefaultForMixing;
            return(component);
        }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 public void StartRecording(Format format, SampleBufferCallback dataCallback)
 {
 }
Exemplo n.º 6
0
 public void StartRecording(Format format, SampleBufferCallback callback)
 {
     this.callback = callback;
     natmic.Call("startRecording", format.sampleRate);
 }