// ================= Audio Engineering & Frequency Analysis ================= public void LlenarComboDispositivos() { for (int i = 0; i < WaveIn.DeviceCount; i++) { // La variable tipo WaveInCapabilities almacena los dispositivos en la iteración [i] hasta guardar todos los aparatos de entrada WaveInCapabilities capacidades = WaveIn.GetCapabilities(i); // Ahora agregamos a los "items" de nuestro combo box el Nombre del dispositivo almacenado en capacidades[i] cmb_Dispositivos.Items.Add(capacidades.ProductName); } cmb_Dispositivos.SelectedIndex = 0; }
/// <summary> /// Start audio source. /// </summary> /// /// <remarks>Starts audio source and return execution to caller. audio source /// object creates background thread and notifies about new frames with the /// help of <see cref="DataAvailable"/> event.</remarks> /// /// <exception cref="ArgumentException">audio source is not specified.</exception> /// public void Start() { if (string.IsNullOrEmpty(_source)) { throw new ArgumentException("Audio source is not specified."); } if (_started) { return; } // check source lock (_lock) { if (_started) { return; } int i = 0, selind = -1; for (var n = 0; n < WaveIn.DeviceCount; n++) { if (WaveIn.GetCapabilities(n).ProductName == _source) { selind = i; } i++; } if (selind == -1) { AudioFinished?.Invoke(this, new PlayingFinishedEventArgs(ReasonToFinishPlaying.DeviceLost)); return; } _started = true; _waveIn = new WaveInEvent { BufferMilliseconds = 200, DeviceNumber = selind, WaveFormat = RecordingFormat }; _waveIn.DataAvailable += WaveInDataAvailable; _waveIn.RecordingStopped += WaveInRecordingStopped; _waveProvider = new WaveInProvider(_waveIn); _sampleChannel = new SampleChannel(_waveProvider); _sampleChannel.PreVolumeMeter += SampleChannelPreVolumeMeter; _waveIn.StartRecording(); } }
private void setupMicList() { int waveInDevices = WaveIn.DeviceCount; for (int i = 0; i < waveInDevices; i++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(i); //device info devicesComboBox.Items.Add(deviceInfo.ProductName); } devicesComboBox.SelectedIndex = 0; }
private void GetInputDevices() { for (int i = 0; i < WaveIn.DeviceCount; i++) { var capabilities = WaveIn.GetCapabilities(i); Cmb_InputDevices.Items.Add(capabilities.ProductName); } if (Cmb_InputDevices.Items.Count > 0) { Cmb_InputDevices.SelectedIndex = 0; } }
public static IList <Device> GetDevices() { var list = new List <Device>(); var waveInDevices = WaveIn.DeviceCount; for (int deviceIndex = 0; deviceIndex < waveInDevices; deviceIndex++) { list.Add(DeviceMapper.Map(deviceIndex, WaveIn.GetCapabilities(deviceIndex))); } return(list); }
public SoundBoard() { InitializeComponent(); Console.WriteLine("INIT"); int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); Console.WriteLine("Device {0}: {1}, {2} channels", waveInDevice, deviceInfo.ProductName, deviceInfo.Channels); } load_platforms(); }
public void Setup() { WaveInCapabilities capabilities = WaveIn.GetCapabilities(deviceNumber); foreach (int waveFormat in Enum.GetValues(typeof(SupportedWaveFormat))) { if (capabilities.SupportsWaveFormat((SupportedWaveFormat)waveFormat)) { SetWaveFormat((SupportedWaveFormat)waveFormat); break; } } }
public void Activated(object state) { this.recordingDevices.Clear(); for (int n = 0; n < WaveIn.DeviceCount; n++) { this.recordingDevices.Add(WaveIn.GetCapabilities(n).ProductName); } this.recordingDevices2.Clear(); for (int n = 0; n < WaveIn.DeviceCount; n++) { this.recordingDevices2.Add(WaveIn.GetCapabilities(n).ProductName); } }
// Obtain all current recording devices. public static string[] GetDevices() { deviceTotal = WaveIn.DeviceCount; string[] devices = new string[deviceTotal]; for (int deviceCount = 0; deviceCount < deviceTotal; deviceCount++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(deviceCount); devices[deviceCount] = deviceCount + ": " + deviceInfo.ProductName + " - " + deviceInfo.Channels + " Channels"; } return(devices); }
public static string[] WaveInDevices() { List <string> str = new List <string>(); int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); str.Add(String.Format("Device {0}: {1}", waveInDevice, deviceInfo.ProductName)); } ; return(str.ToArray()); }
public string[] GetIDev() { string [] res = new string[WaveIn.DeviceCount]; int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); res[waveInDevice] = string.Format("Device {0}: {1}, {2} channels", waveInDevice, deviceInfo.ProductName, deviceInfo.Channels); } return(res); }
public RecordingDevice(bool enabled) { this.enabled = enabled; if (DeviceManager.Instance.RecordingDevice != null) { if (DeviceManager.Instance.RecordingDevice.Number < WaveIn.DeviceCount) { var deviceCaps = WaveIn.GetCapabilities(DeviceManager.Instance.RecordingDevice.Number); this.SetRecordingSettings(48000, (deviceCaps.Channels > 2) ? 2 : deviceCaps.Channels); } } }
private int SearchDeviceNumber(DataFlow dataflow, string friendlyName) { int result = 0; for (int i = 0; i < WaveIn.DeviceCount; i++) { if (WaveIn.GetCapabilities(i).ProductName.Equals(friendlyName, StringComparison.OrdinalIgnoreCase)) { result = i; } } return(result); }
private void GetWaveInDeviceId(string deviceName) { this.WaveInDevices = new string[WaveIn.DeviceCount]; for (int i = 0; i < WaveIn.DeviceCount; i++) { var caps = WaveIn.GetCapabilities(i); this.WaveInDevices[i] = caps.ProductName; if (caps.ProductName.StartsWith(deviceName) || deviceName.StartsWith(caps.ProductName)) { this.WaveInDeviceId = i; } } }
private void RefreshIn() { RecordInputCheck.Checked = true; InputsCombo.Items.Clear(); _inDevices.Clear(); for (int i = 0; i < WaveIn.DeviceCount; i++) { InputsCombo.Items.Add(WaveIn.GetCapabilities(i).ProductName); _inDevices.Add(i == 0); } InputsCombo.SelectedItem = 0; }
public AudioEngine() { if (Config.Instance.RecordingDevice != null && WaveIn.DeviceCount != 0 && Config.Instance.RecordingDevice.Number <= WaveIn.DeviceCount) { var capabilities = WaveIn.GetCapabilities(Config.Instance.RecordingDevice.Number); SetRecordingSettings(48000, capabilities.Channels > 2 ? 2 : capabilities.Channels); } if (Config.Instance.PlaybackDevice != null && WaveOut.DeviceCount != 0 && Config.Instance.PlaybackDevice.Number <= WaveOut.DeviceCount) { var capabilities = WaveOut.GetCapabilities(Config.Instance.PlaybackDevice.Number); SetPlaybackSettings(48000, capabilities.Channels > 2 ? 2 : capabilities.Channels); } }
/// <summary> /// Gets a list of Windows recording devices. /// </summary> /// <returns>Collection of devices.</returns> public static IEnumerable <RecordingDeviceInfo> GetRecordingDeviceList() { var result = new List <RecordingDeviceInfo>(); var count = WaveIn.DeviceCount; for (var n = 0; n < count; ++n) { var caps = WaveIn.GetCapabilities(n); result.Add(new RecordingDeviceInfo(n, caps.ProductName)); } return(result); }
/// <summary> /// Returns a list of audio device names that support recording in the format we need. /// </summary> internal static List <string> GetInputDeviceNames() { List <string> names = new List <string>(); for (int i = 0; i < WaveIn.DeviceCount; i++) { var capabilities = WaveIn.GetCapabilities(i); if (capabilities.SupportsWaveFormat(RequiredSupportedWaveFormat)) { names.Add(capabilities.ProductName); } } return(names); }
/// <summary> /// Returns a list of audio device names that support recording in the format we need. /// </summary> public IReadOnlyList <IAudioInput> GetInputs() { List <IAudioInput> inputs = new List <IAudioInput>(); for (int i = 0; i < WaveIn.DeviceCount; i++) { var capabilities = WaveIn.GetCapabilities(i); if (capabilities.SupportsWaveFormat(RequiredSupportedWaveFormat)) { inputs.Add(new InputDevice(capabilities.ProductName, i)); } } return(inputs.AsReadOnly()); }
public void start_voice_chat(Socket voice_socket) { voice_state = true; sourceStream = new WaveInEvent { DeviceNumber = 0, WaveFormat = new WaveFormat(8000, 16, WaveIn.GetCapabilities(0).Channels) }; sourceStream.DataAvailable += sourceStream_DataAvailable; P2P_Communication.Voice_Receive(voice_socket, recievedStream, waveProvider, this); //sourceStream.DataAvailable += sourceStream_DataAvailable; sourceStream.StartRecording(); }
public static string[] GetDeviceNames() { var res = new List <string>(); int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); res.Add(deviceInfo.ProductName); //Console.WriteLine("Device {0}: {1}, {2} channels", waveInDevice, deviceInfo.ProductName, deviceInfo.Channels); } return(res.ToArray()); }
private int GetMicDeviceId() { int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); if (deviceInfo.ProductName.Contains("麦克风")) { return waveInDevice; } // Console.WriteLine("Device {0}: {1}, {2} channels", waveInDevice, deviceInfo.ProductName, deviceInfo.Channels); } return 0; }
private void Form2_Load(object sender, EventArgs e) { for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); richTextBox1.AppendText("Device " + waveInDevice + " " + deviceInfo.ProductName + ", " + deviceInfo.Channels + " channels \n"); Values.micname = deviceInfo.ProductName; } lblCreator.Text = "by /id/beggarboy"; txtMic.Text = Convert.ToString(Values.micpicked); txtVol.Text = Convert.ToString(Values.prefvol); }
public zStackoverflowTest() { InitializeComponent(); int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); txtArea.AppendText(String.Format("Device {0}: {1}, {2} channels\n", waveInDevice, deviceInfo.ProductName, deviceInfo.Channels)); } waveIn = null; }
public object Execute(DevicesArgs args) { var model = new DevicesViewModel(); int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice); model.Devices.Add($"Device {waveInDevice}: {deviceInfo.ProductName}, {deviceInfo.Channels} channels"); } return(View("Devices", model)); }
public MachineTool() { InitializeComponent(); stop.Enabled = false; mAdapter.AddDataItem(mAvail); mAvail.Value = "AVAILABLE"; mAdapter.AddDataItem(mEStop); mAdapter.AddDataItem(mMode); mAdapter.AddDataItem(mExec); mAdapter.AddDataItem(mFunctionalMode); mAdapter.AddDataItem(mProgram); mAdapter.AddDataItem(mMessage); mAdapter.AddDataItem(mPosition); mAdapter.AddDataItem(mxLoad); mAdapter.AddDataItem(mSpeed); mAdapter.AddDataItem(mcLoad); mAdapter.AddDataItem(mSystem); mAdapter.AddDataItem(mTemp); mAdapter.AddDataItem(mOverload); mAdapter.AddDataItem(mTravel); mAdapter.AddDataItem(mFillLevel); mAdapter.AddDataItem(mAudio); int count = WaveIn.DeviceCount; for (int dev = 0; dev < count; dev++) { WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(dev); Console.WriteLine("Device {0}: {1}, {2} channels", dev, deviceInfo.ProductName, deviceInfo.Channels); } mWave = new WaveIn(); mWave.DeviceNumber = 0; mWave.WaveFormat = new WaveFormat(8000, 1); mWave.DataAvailable += waveIn_DataAvailable; mAdapter.AddDataItem(mCommonVariable); string[] row = { "1", "2", "3", "4" }; commonVariables.Rows.Add(row); }
private void LoadDevices() { for (int deviceId = 0; deviceId < WaveIn.DeviceCount; deviceId++) { var deviceInfo = WaveIn.GetCapabilities(deviceId); RecordingDeviceComboBox.Items.Add(deviceInfo.ProductName); } for (int deviceId = 0; deviceId < WaveOut.DeviceCount; deviceId++) { var deviceInfo = WaveOut.GetCapabilities(deviceId); PlaybackDeviceComboBox.Items.Add(deviceInfo.ProductName); } }
private void Start_Click(object sender, RoutedEventArgs e) { waveIn = new WaveIn(); waveIn.DeviceNumber = 0; string outputFilename = @"F:\demo.mp3"; waveIn.WaveFormat = new WaveFormat(44100, WaveIn.GetCapabilities(waveIn.DeviceNumber).Channels); waveIn.DataAvailable += new EventHandler <WaveInEventArgs>(waveIn_DataAvailable); waveWriter = new WaveFileWriter(outputFilename, waveIn.WaveFormat); waveIn.StartRecording(); MainWindow.SnackbarMessage.Content = "Запись началась!"; MainWindow.Snackbar.IsActive = true; }
/// <summary> /// Start audio source. /// </summary> /// /// <remarks>Starts audio source and return execution to caller. audio source /// object creates background thread and notifies about new frames with the /// help of <see cref="DataAvailable"/> event.</remarks> /// /// <exception cref="ArgumentException">audio source is not specified.</exception> /// public void Start() { if (!IsRunning) { // check source int i = 0, selind = -1; for (int n = 0; n < WaveIn.DeviceCount; n++) { if (WaveIn.GetCapabilities(n).ProductName == _source) { selind = i; } i++; } if (selind == -1) { //device no longer connected or not configured if (i > 0) { selind = 0; } else { //if (AudioSourceError != null) // AudioSourceError(this, new AudioSourceErrorEventArgs("not connected")); if (AudioFinished != null) { AudioFinished(this, ReasonToFinishPlaying.DeviceLost); } return; } } _waveIn = new WaveIn { BufferMilliseconds = 200, DeviceNumber = selind, WaveFormat = RecordingFormat }; _waveIn.DataAvailable += WaveInDataAvailable; _waveIn.RecordingStopped += WaveInRecordingStopped; _waveProvider = new WaveInProvider(_waveIn); _sampleChannel = new SampleChannel(_waveProvider); if (LevelChanged != null) { _sampleChannel.PreVolumeMeter += SampleChannelPreVolumeMeter; } _waveIn.StartRecording(); } }
private void RefreshAudioDevices() { inputDeviceComboBox.SelectedIndex = 0; while (inputDeviceComboBox.Items.Count > 2) { inputDeviceComboBox.Items.RemoveAt(inputDeviceComboBox.Items.Count - 1); } for (int i = 0; i < WaveIn.DeviceCount; i++) { inputDeviceComboBox.Items.Add(WaveIn.GetCapabilities(i).ProductName); } }