Hi,
My aplication works fine on x86. I dont get any errors, but when i tryrecord some sound on Vista x64 i get:
'NullReferenceException was unhandled
Object reference not set to an instance of an object.' at WaveInOpen Function.
My WaveIn declaration:
[DllImport(mmdll)]
public static extern int waveInOpen(out IntPtr phwi, int uDeviceID, WaveFormat lpFormat, WaveDelegate dwCallback, int dwInstance, int dwFlags);
This is how I use it:
WaveInHelper.Try(WaveNative.waveInOpen(out m_WaveIn, device, format, m_BufferProc, 0, WaveNative.CALLBACK_FUNCTION));
WaveFormat structure declaration:
[StructLayout(LayoutKind.Sequential)]
public class WaveFormat
{
public short wFormatTag;
public short nChannels;
public int nSamplesPerSec;
public int nAvgBytesPerSec;
public short nBlockAlign;
public short wBitsPerSample;
public short cbSize;
public WaveFormat(int rate, int bits, int channels)
{
wFormatTag = (short)WaveFormats.Pcm;
nChannels = (short)channels;
nSamplesPerSec = rate;
wBitsPerSample = (short)bits;
cbSize = 0;
nBlockAlign = (short)(channels * (bits / 8));
nAvgBytesPerSec = nSamplesPerSec * nBlockAlign;
}
}
I've tried to modify declaration with IntPtr.Zero instead of '0'. Or changing 'WaveFormat lpFormat'(argument) into 'ref WaveFormat lpFormat', but then i get'error 32'(bad format), thenrecording will not run also on x86 anymore giving me Access Volation.
Also I've tried compile it for only for x86 or AnyCpu, but it gives no results.
I'm working on it some about 7 days and i can't go forwad.
Sorry for my English.
I would begrateful if anyone can help me, it's very important for me.