Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than winmm, prefix the name with the module name and a period.
{
public ushort wMid;
public ushort wPid;
public uint vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string szPname;
public uint dwFormats;
public ushort wChannels;
public ushort wReserved1;
}
/// <summary>
/// Prefered structure to use with API call waveInOpen.
/// The waveInOpen function opens the given waveform-audio input device for recording. Then returning the devide id.
/// </summary>
/// <param name="hWaveIn">
/// Pointer to a buffer that receives a handle identifying the open waveform-audio input device. Use this
/// handle to identify the device when calling other waveform-audio input functions. This parameter can be NULL if WAVE_FORMAT_QUERY
/// is specified for dwFlags
/// </param>
/// <param name="deviceId">
/// Identifier of the waveform-audio input device to open. It can be either a device identifier or a handle of an open waveform-audio
/// input device. You can use the following flag instead of a device identifier.
/// </param>
/// <param name="wfx">
/// Pointer to a WAVEFORMATEX structure that identifies the desired format for recording waveform-audio data.
/// You can free this structure immediately after waveInOpen returns.
/// </param>
/// <param name="dwCallBack">
/// Pointer to a fixed callback function, an event handle, a handle to a window, or the identifier of a thread to be called during
/// waveform-audio recording to process messages related to the progress of recording. If no callback function is required, this
/// value can be zero. For more information on the callback function, see waveInProc.
/// </param>
/// <param name="dwInstance">
/// User-instance data passed to the callback mechanism. This parameter is not used with the window callback mechanism.
/// </param>
/// <param name="dwFlags">
/// Flags for opening the device. The following values are defined.
/// </param>
/// <returns></returns>
///
[DllImport("winmm.dll")]
private static extern uint waveInOpen(ref IntPtr hWaveIn, uint deviceId, ref WAVEFORMATEX wfx, IntPtr dwCallBack, uint dwInstance, uint dwFlags);
/// <summary>
/// Prefered structure to use with API call waveInOpen.
/// Needed to encapsulate wave format data.
/// </summary>
public struct WAVEFORMATEX
{
public short wFormatTag;
public short nChannels;
public uint nSamplesPerSec;
public uint nAvgBytesPerSec;
public short nBlockAlign;
public short wBitsPerSample;
public short cbSize;
}
}
public enum MMSYSERR : uint
{
// Add MMSYSERR's here!
if (retval == MMSYSERR_NOERROR)
{
Debug.Print("waveInOpen OK");
WAVEINCAPS pwoc = new WAVEINCAPS();
if (waveInGetDevCaps(hwWaveIn, ref pwoc, (uint)Marshal.SizeOf(typeof(WAVEINCAPS))) == MMSYSERR_NOERROR) // Get device description
{
Debug.Print(pwoc.szPname);
}
if (waveInClose(hwWaveIn) != MMSYSERR_NOERROR) // Close device
{
Debug.Print("Error closing device");
}
}
}
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).