I'm using waveOutWrite
to write several small buffers (80ms each). As they are playing, I'm calling this function to get the playback position:
uint GetWaveOutPosInMS()
{
WinMM.MMTIME mmtime = new WinMM.MMTIME();
mmtime.wType = 1;
WinMM.MMRESULT ret = WinMM.waveOutGetPosition(WaveOut, ref mmtime, (uint)Marshal.SizeOf(typeof(WinMM.MMTIME)));
return (mmtime.val);
}
Here are the relative extras as well:
[DllImport("winmm.dll")]
public static extern MMRESULT waveOutGetPosition(IntPtr hwo, ref MMTIME info, uint cbi);
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MMTIME
{
public uint wType;
public uint val;
}
The waveOutGetPosition returns 0 (no error), but mmtime.val is always zero. MSDN isn't really clear on what "playback position" is relative to, just that it is reset on waveOutOpen and waveOutReset.. but does it always continue to increase across multiple waveOutWrite() calls? Any ideas as to why it would always be returning zero for me?