Skip to content

Instantly share code, notes, and snippets.

@martindevans
Created August 21, 2019 15:17
Show Gist options
  • Save martindevans/47127ccde8e5b7abeaa4cc0b49d60759 to your computer and use it in GitHub Desktop.
Save martindevans/47127ccde8e5b7abeaa4cc0b49d60759 to your computer and use it in GitHub Desktop.
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