Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.