//fill sound recording devices array public RecordingDevices() { int waveInDevicesCount = waveInGetNumDevs(); //get total if (waveInDevicesCount > 0) { for (int uDeviceID = 0; uDeviceID < waveInDevicesCount; uDeviceID++) { WaveInCaps waveInCaps = new WaveInCaps(); waveInGetDevCapsA(uDeviceID, ref waveInCaps, Marshal.SizeOf(typeof(WaveInCaps))); deviceList.Add(new string(waveInCaps.szPname).Remove(new string(waveInCaps.szPname).IndexOf('\0')).Trim()); //clean garbage } } }
public ArrayList getRecDevs() //fill sound recording devices array { ArrayList arrLst = new ArrayList(); int waveInDevicesCount = waveInGetNumDevs(); //get total if (waveInDevicesCount > 0) { for (int uDeviceID = 0; uDeviceID < waveInDevicesCount; uDeviceID++) { WaveInCaps waveInCaps = new WaveInCaps(); waveInGetDevCapsA(uDeviceID,ref waveInCaps, Marshal.SizeOf(typeof(WaveInCaps))); waveInCaps.uDeviceID = uDeviceID; waveInCaps.szPname = new string(waveInCaps.szPname).Remove(new string(waveInCaps.szPname).IndexOf('\0')).Trim().ToCharArray(); arrLst.Add(waveInCaps); //arrLst.Add(new string(waveInCaps.szPname).Remove( //new string(waveInCaps.szPname).IndexOf('\0')).Trim()); } } return arrLst; }
public static extern int waveInGetDevCaps(int uDeviceID, ref WaveInCaps pwoc, int cbwoc);
public static extern int waveInGetDevCaps(uint uDeviceID, out WaveInCaps pwic, int cbwic);
public static extern int waveInGetDevCapsA(int uDeviceID, ref WaveInCaps lpCaps, int uSize);
/// <summary> /// A list of PCM wave formats supported by the given device /// </summary> /// <param name="DeviceID">Wave device</param> /// <returns>SoundFormats collection</returns> public SoundFormats SupportedRecordingFormats(int DeviceID) { WaveInCaps wic = new WaveInCaps(); int ret = Wave.waveInGetDevCaps(DeviceID, wic.ToByteArray(), wic.ToByteArray().Length); CheckWaveError(ret); return((SoundFormats)wic.Formats); }
private void deviceslist_SelectedIndexChanged(object sender, EventArgs e) { if (deviceslist.SelectedItems.Count > 0) { _selectedDevice = (WaveInCaps)deviceslist.SelectedItems[0].Tag; btnStart.Enabled = true; } else { btnStart.Enabled = false; } }
// 获取可以用于记录声音的设备的列表 public static void clsRecDevices() //fill sound recording devices array { int waveInDevicesCount = waveInGetNumDevs(); //get total if (waveInDevicesCount > 0) { for (int uDeviceID = 0; uDeviceID < waveInDevicesCount; uDeviceID++) { WaveInCaps waveInCaps = new WaveInCaps(); waveInGetDevCapsA(uDeviceID, ref waveInCaps, Marshal.SizeOf(typeof(WaveInCaps))); arrLst.Add(new string(waveInCaps.szPname).Remove(new string(waveInCaps.szPname).IndexOf('\0')).Trim()); } } }
//fill sound recording devices array public clsRecDevices() { int waveInDevicesCount = waveInGetNumDevs();//get total if (waveInDevicesCount > 0) { for (int uDeviceID = 0; uDeviceID < waveInDevicesCount; uDeviceID++) { WaveInCaps waveInCaps = new WaveInCaps(); waveInGetDevCapsA(uDeviceID, ref waveInCaps, Marshal.SizeOf(typeof(WaveInCaps))); arrLst.Add(new string(waveInCaps.szPname).Remove(new string(waveInCaps.szPname).IndexOf('\0')).Trim()); //clean garbage } } }
private bool m_Disposed; // Has IDisposable::Dispose been called? /// <summary> /// Returns an array of recording devices /// </summary> /// <returns>Capabilities of the devices</returns> public static WaveInCaps[] GetDevices() { int iCount = waveIn.GetNumDevs(); WaveInCaps[] pwicRet = new WaveInCaps[iCount]; for (int x = 0; x < iCount; x++) { pwicRet[x] = new WaveInCaps(); int mmr = waveIn.GetDevCaps(x, pwicRet[x], Marshal.SizeOf(pwicRet[x])); waveOut.ThrowExceptionForError(mmr); } return(pwicRet); }
public ArrayList getOutDevs() //fill sound recording devices array { ArrayList arrLst = new ArrayList(); int waveOutDevicesCount = waveOutGetNumDevs(); //get total if (waveOutDevicesCount > 0) { for (int uDeviceID = 0; uDeviceID < waveOutDevicesCount; uDeviceID++) { WaveInCaps waveInCaps = new WaveInCaps(); waveOutGetDevCapsA(uDeviceID, ref waveInCaps, Marshal.SizeOf(typeof(WaveInCaps))); waveInCaps.uDeviceID = uDeviceID; waveInCaps.szPname = new string(waveInCaps.szPname).Remove(new string(waveInCaps.szPname).IndexOf('\0')).Trim().ToCharArray(); arrLst.Add(waveInCaps); //arrLst.Add(new string(waveInCaps.szPname).Remove( //new string(waveInCaps.szPname).IndexOf('\0')).Trim()); } } return(arrLst); }
public static int waveInGetDevCapsA(int hwo, ref WaveInCaps lpCaps, int uSize) { waveInGetDevCapsADelegate d = DllImportExtern.Invoke(WINMM_DLL, "waveInGetDevCapsA", Typeof <waveInGetDevCapsADelegate>()) as waveInGetDevCapsADelegate; return(d(hwo, ref lpCaps, uSize)); }
public static extern int waveInGetDevCaps(uint uDeviceID, out WaveInCaps pwic, int cbwic);
public static extern int waveInGetDevCapsA(int uDeviceID, ref WaveInCaps lpCaps, int uSize);
public static extern int waveInGetDevCaps(int uDeviceID, ref WaveInCaps wic, int cbwic);