Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy

Search Results for "WAVEHDR" in [All]

Structures

.

public struct WAVEHDR

.

  public WaveHdrFlags dwFlags; // assorted flags (see defines)

.

  public IntPtr lpNext; // PWaveHdr, reserved for driver

.

Structure WAVEHDR

.

  Dim dwFlags As WaveHdrFlags

.

WaveHdrFlags

.
Documentation
[WAVEHDR] on MSDN

Enums

.
Summary
Enumeration for WAVEHDR structure flags.
.

enum WaveHdrFlags : uint

.

Enum WaveHdrFlags As UInteger

.
Documentation
[WAVEHDR] on MSDN

winmm

.

public static extern uint waveInAddBuffer(IntPtr hwi, ref WAVEHDR pwh, uint cbwh);

.

Shared Function waveInAddBuffer(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer, ByRef pwh As WAVEHDR, ByVal cbwh As UInteger) As MMRESULT

.

WAVEHDR

.

When recording waveform audio, usually buffers are allocated with unmanaged functions and kept in an IntPtr() array; for this reason the function is provided in two versions, one processing a WAVEHDR ByRef and the other working with an IntPtr.

.

Instead of allocating memory using an unmanaged function, it is possible to lock the WAVEHDR and Buffer in place using GCHandle.Allocate(object, GCHandleType.Pinned);

.

static extern MMRESULT waveInUnprepareHeader(IntPtr hwi, ref WAVEHDR pwh, uint cbwh);

.

Shared Function waveInUnprepareHeader(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer, ByRef pwh As WAVEHDR, ByVal cbwh As UInteger) As MMRESULT

.

WAVEHDR

.

The same WAVEHDR structure used with waveOutPrepareHeader() is also used with

.

audio driver will asynchronously set the WHDR_DONE bit in WAVEHDR.dwflags when

.

This means that the WAVEHDR struct passed to the waveOutWrite() function must be

.

    waveHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(waveHdr));

.

    waveHdr.lpData = wavedata;  // audio buffer

.

    waveHdr.dwBufferLength = wf.nSamplesPerSec * wf.nBlockAlign;  // it's size

.

    waveHdr.dwFlags = 0;    // clear before waveOutPrepareHeader()

.

    Marshal.StructureToPtr(waveHdr, waveHdrPtr, true);    // copy to unmanaged memory

.

    if ((MMRESULT = waveOutPrepareHeader(waveDevice, waveHdrPtr, Marshal.SizeOf(waveHdr))) != MMSYSERR_NOERROR)

.

    WAVEHDR wh = (WAVEHDR)Marshal.PtrToStructure(waveHdrPtr, typeof(WAVEHDR));  // copy struct back from unmanaged memory

.

    waveHdr = wh;  // reset managed struct

.

    waveHdr.dwFlags |= (WHDR_BEGINLOOP | WHDR_ENDLOOP);  // add the looping flag bits

.

    waveHdr.dwLoops = MINUS_ONE; ;

.

    Marshal.StructureToPtr(waveHdr, waveHdrPtr, true);   // and update the unmanaged struct.

.

    if ((MMRESULT = waveOutWrite(waveDevice, waveHdrPtr, Marshal.SizeOf(waveHdr))) != MMSYSERR_NOERROR)

.

    while ((waveHdr.dwFlags & WHDR_DONE) == 0)  // wait for it

.

       WAVEHDR wh = (WAVEHDR)Marshal.PtrToStructure(waveHdrPtr, typeof(WAVEHDR)); // copy unmanaged struct

.

       waveHdr = wh;  // update managed struct

.

    if ((MMRESULT = waveOutUnprepareHeader(waveDevice, waveHdrPtr, Marshal.SizeOf(waveHdr))) != MMSYSERR_NOERROR)

.

        Marshal.FreeHGlobal(waveHdrPtr);

.

public static extern uint waveOutUnprepareHeader(IntPtr hwo,ref WAVEHDR pwh,uint cbwh);

.

public static extern uint waveOutWrite(IntPtr hwo, ref WAVEHDR pwh, uint cbwh);


 
Access PInvoke.net directly from VS: