private void StopAudio() { if (m_Player != null) { try { m_Player.Dispose(); } finally { m_Player = null; } } if (m_Recorder != null) { try { m_Recorder.Dispose(); } finally { m_Recorder = null; } } m_Fifo.Flush(); // clear all pending data }
public void Stop() { if (at != null) { try { at.Disconnect(); } finally { at = null; } DisconnectedEvent(EventArgs.Empty); } if (m_Recorder != null) { try { //matt note: dispose fails m_Recorder.Dispose(); } finally { m_Recorder = null; } } }
/// <summary> /// Конец записи/воспроизведения звука /// </summary> public void Stop() { ThreadListen.Suspend(); if (m_Player != null) { try { m_Player.Dispose(); } finally { m_Player = null; } } if (m_Recorder != null) { try { m_Recorder.Dispose(); } finally { m_Recorder = null; } } m_Fifo.Flush(); }
public void Start() { Stop(); try { // Start Connection to Airport Express at = new RAOPClient(ip); at.Volume = Volume; try { at.Connect(); } catch (Exception ex) { at = null; ErrorEventArgs e = new ErrorEventArgs(); e.Error = ErrorEventArgs.ERRORNUMBER.ERRORCONNECTING; e.Exception = ex; ErrorEvent(e); //Console.WriteLine("Connect failed: {0}", e.Message); return; } string s = String.Format("JackStatus: {0}{1}JackType: {2}{3}", at.JackStatus == RAOPClient.JACK_STATUS_CONNECTED ? "connected" : "disconnected", Environment.NewLine, at.JackType == RAOPClient.JACK_TYPE_DIGITAL ? "digital" : "analog", Environment.NewLine); Console.WriteLine(s); // Start recorder //Get device here!!! WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(44100, 16, 2); m_Recorder = new WaveLib.WaveInRecorder(deviceid, fmt, BufferSize, 16, new WaveLib.BufferDoneEventHandler(DataArrived)); ConnectedEvent(EventArgs.Empty); } catch (Exception ex) { ErrorEventArgs e = new ErrorEventArgs(); e.Error = ErrorEventArgs.ERRORNUMBER.ERRORRECORDING; e.Exception = ex; ErrorEvent(e); at = null; Stop(); //throw; } }
private void Start() { Stop(); try { WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(44100, 16, 2); m_Player = new WaveLib.WaveOutPlayer(-1, fmt, 16384, 3, new WaveLib.BufferFillEventHandler(Filler)); m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 16384, 3, new WaveLib.BufferDoneEventHandler(DataArrived)); } catch { Stop(); throw; } }
/// <summary> /// Начало записи/воспроизведения звука /// </summary> public void Start() { Stop(); ThreadListen.Resume(); try { WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(22050, 16, 2); m_Player = new WaveLib.WaveOutPlayer(-1, fmt, 32000, 5, new WaveLib.BufferFillEventHandler(Filler)); m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 32000, 5, new WaveLib.BufferDoneEventHandler(DataSend)); } catch { Stop(); throw; } }
private void StartAudio() { StopAudio(); try { // Rates: 44100, 22050, 88200 // Valore buono: 44100, 16, 1 / Buffer 8192, 2 //WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(44100, 16, 2); //m_Player = new WaveLib.WaveOutPlayer(-1, fmt, 8192, 3, new WaveLib.BufferFillEventHandler(Filler)); //m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 8192, 3, new WaveLib.BufferDoneEventHandler(SendAudioFrame)); WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(22050, 16, 1); m_Player = new WaveLib.WaveOutPlayer(-1, fmt, 8192, 2, new WaveLib.BufferFillEventHandler(Filler)); m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 8192, 2, new WaveLib.BufferDoneEventHandler(SendAudioFrame)); } catch { StopAudio(); throw; } }
public unsafe Recorder(string tempfilepath) { cb = new VorbisEnc.CircleBuffer(); //ve = new VorbisEnc.VorbisEnc(); ve = new VorbisEnc.FlacEncoder(); //byte[] data = Encoding.GetBytes(tempfilepath); //filepath = System.Runtime.InteropServices.Marshal.AllocHGlobal(data.Length + 1); //System.Runtime.InteropServices.Marshal.Copy(data, 0, filepath, data.Length); //ve.Initialise((sbyte*)filepath.ToPointer()); ve.Initialise((sbyte*)System.Runtime.InteropServices.Marshal.StringToHGlobalUni(tempfilepath).ToPointer()); //System.Runtime.InteropServices.Marshal.FreeHGlobal(filepath);//need anymore? System.Threading.Thread th = new System.Threading.Thread(EncodeData); WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(16000, 16, 1); m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 4096, 4, new WaveLib.BufferDoneEventHandler(DataArrived)); th.Start(); }
public unsafe Recorder(string tempfilepath) { cb = new VorbisEnc.CircleBuffer(); //ve = new VorbisEnc.VorbisEnc(); ve = new VorbisEnc.FlacEncoder(); //byte[] data = Encoding.GetBytes(tempfilepath); //filepath = System.Runtime.InteropServices.Marshal.AllocHGlobal(data.Length + 1); //System.Runtime.InteropServices.Marshal.Copy(data, 0, filepath, data.Length); //ve.Initialise((sbyte*)filepath.ToPointer()); ve.Initialise((sbyte *)System.Runtime.InteropServices.Marshal.StringToHGlobalUni(tempfilepath).ToPointer()); //System.Runtime.InteropServices.Marshal.FreeHGlobal(filepath);//need anymore? System.Threading.Thread th = new System.Threading.Thread(EncodeData); WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(16000, 16, 1); m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 4096, 4, new WaveLib.BufferDoneEventHandler(DataArrived)); th.Start(); }
/// <summary> /// Конец записи/воспроизведения звука /// </summary> public void Stop() { ThreadListen.Suspend(); if (m_Player != null) try { m_Player.Dispose(); } finally { m_Player = null; } if (m_Recorder != null) try { m_Recorder.Dispose(); } finally { m_Recorder = null; } m_Fifo.Flush(); }
public void Stop() { if (at != null) { try { at.Disconnect(); } finally { at = null; } DisconnectedEvent(EventArgs.Empty); } if (m_Recorder != null) try { //matt note: dispose fails m_Recorder.Dispose(); } finally { m_Recorder = null; } }
public void Stop() { if (recorder == null) return; try { recorder.Dispose(); } catch (Exception e) { MessageBox.Show(e.Message); Stop(); } finally { recorder = null; } }
public void Start() { Stop(); refreshSettings(); try { WaveLib.WaveFormat fmt = new WaveLib.WaveFormat( Properties.Settings.Default.samplingRate, Properties.Settings.Default.samplingFormat, 1); int device = PClapper.Properties.Settings.Default.inputDevice; recorder = new WaveLib.WaveInRecorder( device, fmt, Properties.Settings.Default.bufferLength, Properties.Settings.Default.numBuffers, new WaveLib.BufferDoneEventHandler(DataArrived) ); } catch(Exception e) { Stop(); MessageBox.Show(e.Message); } }
private void Stop() { if (m_Player != null) try { m_Player.Dispose(); } finally { m_Player = null; } if (m_Recorder != null) try { m_Recorder.Dispose(); } finally { m_Recorder = null; } m_Fifo.Flush(); // clear all pending data }