Created
August 21, 2019 15:17
-
-
Save martindevans/47127ccde8e5b7abeaa4cc0b49d60759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using NAudio.Wave; | |
using UnityEngine; | |
namespace Dissonance.Audio.Capture | |
{ | |
public class SomeNamespace | |
: MonoBehaviour, IMicrophoneCapture | |
{ | |
public bool IsRecording { get; private set; } | |
public TimeSpan Latency { get; private set; } | |
private readonly List<IMicrophoneSubscriber> _subscribers = new List<IMicrophoneSubscriber>(); | |
public WaveFormat StartCapture(string name) | |
{ | |
IsRecording = true; | |
Latency = TimeSpan.FromMilliseconds(0); | |
return new WaveFormat(48000, 1); | |
} | |
public void StopCapture() | |
{ | |
IsRecording = false; | |
} | |
public void Subscribe(IMicrophoneSubscriber listener) | |
{ | |
_subscribers.Add(listener); | |
} | |
public bool Unsubscribe(IMicrophoneSubscriber listener) | |
{ | |
return _subscribers.Remove(listener); | |
} | |
public bool UpdateSubscribers() | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment