public class WAVEHDR : IDisposable
{
public const int whdr_done = 0x00000001;
public const int whdr_prepared = 0x00000002;
public const int whdr_inloop = 0x00000004;
public const int whdr_endloop = 0x00000008;
public const int whdr_inq = 0x00000010;
public const int wf_PCM = 1;
public IntPtr lpData = IntPtr.Zero;
public uint dwBufferLength = 0;
public uint dwBytesRecorded = 0;
public uint dwUser = 0;
public uint dwFlags = 0;
public uint dwLoops = 0;
public IntPtr lpNext = IntPtr.Zero;
public uint reserved = 0;
//[DllImport ("winmm.lib")]
public MMSYSERR Read(BinaryReader rdr, uint readLength, int align)
{
uint bufferLength = readLength;
if (bufferLength % align != 0)
bufferLength += (uint)(align - (bufferLength % align));
dwBufferLength = bufferLength;
byte[] data = new byte[readLength];
rdr.Read(data, 0, data.Length);
if (lpData == IntPtr.Zero)
lpData = [B][I]Memory[/I][/B].LocalAlloc([B][I]Memory[/I][/B].LMEM_FIXED, (uint)bufferLength);
if (lpData == IntPtr.Zero)
return MMSYSERR.no_mem;
Marshal.Copy(data, 0, lpData, data.Length);
return MMSYSERR.noerror;
}
public wave.MMSYSERR Write(BinaryWriter wrtr)
{
if (lpData == IntPtr.Zero)
return wave.MMSYSERR.no_mem;
byte[] data = new byte[dwBytesRecorded];
Marshal.Copy(lpData, data, 0, data.Length);
wrtr.Write(data);
return wave.MMSYSERR.noerror;
}
public MMSYSERR Init(uint bufferLength, bool init)
{
if (lpData != IntPtr.Zero && dwBufferLength < bufferLength)
{
[B][B]Memory[/B][/B].LocalFree(lpData);
lpData = IntPtr.Zero;
}
if (lpData == IntPtr.Zero)
lpData = [B][I]Memory[/I][/B].LocalAlloc([B][I]Memory[/I][/B].LMEM_FIXED, bufferLength);
dwBufferLength = bufferLength;
if (lpData == IntPtr.Zero)
return MMSYSERR.no_mem;
if (init)
{
for (int i = 0; i < bufferLength; i++)
{
Marshal.WriteByte(lpData, i, 0);
}
}
return MMSYSERR.noerror;
}
public void Dispose()
{
if (lpData != IntPtr.Zero)
[B][I]Memory[/I][/B].LocalFree(lpData);
}
}
This is a part of the code where I am making a Console Application to reord a sound through an audio input device.
I am getting an error "The name 'Memory' does not exist in the current context"
The error points are in 'Bold'& 'Italics'.
Please tell me if am missing any assembly reference .... !?
:|
Please Help !
Thanx