Exemplo n.º 1
0
 /// <summary>
 /// Prepares a Wave input device for recording
 /// </summary>
 public WaveInEventPulse(PulseAudioConnectionParameters connection)
 {
     _connection        = connection;
     _api               = PulseAudioFactory.GetApi();
     callbackEvent      = new AutoResetEvent(false);
     syncContext        = SynchronizationContext.Current;
     BufferMilliseconds = 100;
     WaveFormat         = new WaveFormat(8000, 8, 1);
     _captureState      = CaptureState.Stopped;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Opens a WaveOut device
        /// </summary>
        public WaveOutPulse(PulseAudioConnectionParameters connection)
        {
            _connection = connection;
            _api        = PulseAudioFactory.GetApi();

            syncContext = SynchronizationContext.Current;
            if (syncContext != null &&
                ((syncContext.GetType().Name == "LegacyAspNetSynchronizationContext") ||
                 (syncContext.GetType().Name == "AspNetSynchronizationContext")))
            {
                syncContext = null;
            }

            // set default values up
            DesiredLatency  = 300;
            NumberOfBuffers = 2;

            waveOutLock = new object();
        }