public virtual void Open()
{
int lFlags = (int)MM_CALLBACK.Function; // Use a callback function to communicate
int result;
IntPtr tmpHandle = new IntPtr(0);
result = (int)winmm.waveOutOpen(ref tmpHandle, DeviceID, WaveFormat, fCallbackMethod, IntPtr.Zero, lFlags);
DeviceHandle = new WaveOutSafeHandle(tmpHandle);
fIsOpen = true;
}