static void Main(string[] args) { PortAudio.Initialize(); //(new SpectrumMeasurement()).Run(); //AppSettings.Current.Save(); //return; AppSettings.Current.Save(); Console.ReadKey(); return; var istreamParameters = new PaStreamParameters() { ChannelCount = 2, Device = PortAudio.Instance.GetDefaultInputDeviceIndex(), SampleFormat = PaSampleFormat.PaFloat32, SuggestedLatency = 0.1 }; var ostreamParameters = new PaStreamParameters() { ChannelCount = 2, Device = PortAudio.Instance.GetDefaultOutputDeviceIndex(), SampleFormat = PaSampleFormat.PaFloat32, SuggestedLatency = 0.1 }; var r = new Random(); var table = new float[96000]; var rec = new List <float>(); var x = 0; for (x = 0; x < 96000; x++) { table[x] = (float)(Math.Sin(x * (2 * Math.PI / 96))); } x = 0; Process.GetCurrentProcess().PriorityBoostEnabled = true; Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; int runs = 0; Console.ReadKey(); }
/// <summary> /// Starts the media capturing/source devices. /// </summary> public override async Task Start() { if (!_isStarted) { _sendingAudioFormat = base.GetSendingFormat(SDPMediaTypesEnum.audio); _isStarted = true; await base.Start(); PortAudio.Initialize(); var outputDevice = PortAudio.DefaultOutputDevice; if (outputDevice == PortAudio.NoDevice) { throw new ApplicationException("No audio output device available."); } else { StreamParameters stmInParams = new StreamParameters { device = 0, channelCount = 2, sampleFormat = SampleFormat.Float32 }; StreamParameters stmOutParams = new StreamParameters { device = outputDevice, channelCount = 2, sampleFormat = SampleFormat.Float32 }; // Combined audio capture and render. _audioIOStream = new Stream(stmInParams, stmOutParams, AUDIO_SAMPLING_RATE, AUDIO_SAMPLE_BUFFER_LENGTH, StreamFlags.NoFlag, AudioSampleAvailable, null); _audioIOStream.Start(); } if (_rtpAudioTimestampPeriod == 0) { _rtpAudioTimestampPeriod = (uint)(SDPMediaFormatInfo.GetClockRate(SDPMediaFormatsEnum.PCMU) / AUDIO_SAMPLE_BUFFER_LENGTH); } } }
public override void Initialize() { base.Initialize(); PortAudio.Initialize(); }