internal Microphone(uint id, string name) { handle = id; Name = name; bufferDuration = TimeSpan.FromSeconds(1.0); State = MicrophoneState.Stopped; }
public void Stop() { if (State == MicrophoneState.Started) { AudioDevice.ActiveMics.Remove(this); AudioDevice.ALDevice.StopDeviceCapture(nativeMic); nativeMic = IntPtr.Zero; State = MicrophoneState.Stopped; } }
// Provides a simple method to check if a microphone is connected. // There is no guarantee that the microphone will not get disconnected at any time. // This method helps in simplifying the microphone enumeration code. public static bool IsConnected(this Microphone microphone) { try { MicrophoneState state = microphone.State; return(true); } catch (NoMicrophoneConnectedException) { return(false); } }
public void Start() { if (State == MicrophoneState.Stopped) { nativeMic = AudioDevice.ALDevice.StartDeviceCapture( Name, SampleRate, GetSampleSizeInBytes(bufferDuration) ); if (nativeMic == IntPtr.Zero) { throw new NoMicrophoneConnectedException(Name); } AudioDevice.ActiveMics.Add(this); State = MicrophoneState.Started; } }
void InitAudio() { if (_state != MicrophoneState.Off) { return; } for (int i = 0; i < Microphone.devices.Length; ++i) { if (Microphone.devices [i] != null) { _microphone = Microphone.devices [i]; Debug.Log("Our first device is " + _microphone); _audio.clip = Microphone.Start(_microphone, true, 1, 44100); _audio.loop = true; _state = MicrophoneState.Initialized; } } }
private void Record_Tap(object sender, System.Windows.Input.GestureEventArgs e) { MicrophoneState m = microphone.State; switch (myState) { case RecorderState.NOTHING_RECORDED: record(); break; case RecorderState.RECORDED: play(); break; default: stop(); break; } }
void StartRecording() { if (_state != MicrophoneState.Initialized) { return; } if (!_audio.isPlaying && Microphone.IsRecording(_microphone)) { if (Microphone.GetPosition(_microphone) == 0) { //Debug.Log ("not recording"); return; } _audio.Play(); _state = MicrophoneState.Recording; } }
internal Microphone(string name) { Name = name; bufferDuration = TimeSpan.FromSeconds(1.0); State = MicrophoneState.Stopped; }
/// <summary> /// Creates a new <see cref="MicrophoneInputState"/> using the individual input states from another <see cref="MicrophoneInputState"/>. /// </summary> /// <param name="other">The <see cref="MicrophoneInputState"/> to take the individual input states from. Note that states are not cloned and will remain as references to the same objects.</param> public MicrophoneInputState(MicrophoneInputState other) : base(other) { Microphone = other.Microphone ?? new MicrophoneState(); }
public KaraokeRulesetInputManagerInputState(InputState state) : base(state) { Microphone = new MicrophoneState(); }
/// <summary> /// Creates a new <see cref="InputState"/> using given individual input states. /// </summary> /// <param name="microphone">The microphone state.</param> public MicrophoneInputState(MicrophoneState microphone) { Microphone = microphone ?? new MicrophoneState(); }
public void Start() { FNAPlatform.StartMicrophone(handle); State = MicrophoneState.Started; }
public void Stop() { FNAPlatform.StopMicrophone(handle); State = MicrophoneState.Stopped; }
public KaraokeRulesetInputManagerInputState(MicrophoneState microphone) { Microphone = microphone; }