Robert Reif wrote:
Notify when position format not supported. Test that position is 0 at start.
Good patch. I was worried that tracing all waveGetPosition() failures would clober the output but after that's what one wants when tracing is enabled. Plus it uncovers interesting results: wave.c:584:found 1 WaveOut devices wave.c:472: 0: "SigmaTel Audio" (\\?\pci#ven_8086&dev_24c5&subsys_01641028&rev_01#3&61aaa01&0&fd#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\wave) 5.10 (1:100): channels=65535 formats=bffff support=002c(WAVECAPS_VOLUME WAVECAPS_LRVOLUME WAVECAPS_SAMPLEACCURATE) wave.c:482:Playing a 5 seconds reference tone. wave.c:483:All subsequent tones should be identical to this one. wave.c:484:Listen for stutter, changes in pitch, volume, etc. wave.c:369:Playing 5 second 440Hz tone at 22050x 8x1 wave.c:268:TIME_MS not supported, returned TIME_SAMPLES wave.c:290:TIME_SMPTE not supported, returned TIME_SAMPLES wave.c:268:TIME_MS not supported, returned TIME_SAMPLES wave.c:290:TIME_SMPTE not supported, returned TIME_SAMPLES ... I get the same results on Windows 95, 98 and NT4. How is it that this works on your machine? Anyway, assuming that we need to round up I propose to modify the implementation as in the attached patch. The advantage is that it does not rely on ceil(). In fact it doesn't even use floating point arithmetic so we cannot get any rounding error. If this patch is ok by you, then I can apply it to all the drivers. I also noticed that we have similar code for the input devices. Does this one also round up? Or does it round down? (I could very well see MS make that one round down) -- Francois Gouget fgouget(a)codeweavers.com Index: dlls/winmm/wineoss/audio.c =================================================================== RCS file: /var/cvs/wine/dlls/winmm/wineoss/audio.c,v retrieving revision 1.135 diff -u -r1.135 audio.c --- dlls/winmm/wineoss/audio.c 19 Jul 2004 20:08:06 -0000 1.135 +++ dlls/winmm/wineoss/audio.c 20 Jul 2004 08:58:43 -0000 @@ -2077,7 +2077,6 @@ */ static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize) { - double time; DWORD val; WINE_WAVEOUT* wwo; @@ -2116,15 +2115,21 @@ TRACE("TIME_SAMPLES=%lu\n", lpTime->u.sample); break; case TIME_SMPTE: - time = (double)val / (double)wwo->format.wf.nAvgBytesPerSec; - lpTime->u.smpte.hour = time / (60 * 60); - time -= lpTime->u.smpte.hour * (60 * 60); - lpTime->u.smpte.min = time / 60; - time -= lpTime->u.smpte.min * 60; - lpTime->u.smpte.sec = time; - time -= lpTime->u.smpte.sec; - lpTime->u.smpte.frame = round(time * 30); - lpTime->u.smpte.fps = 30; + val = val / (wwo->format.wBitsPerSample / 8) / wwo->format.wf.nChannels; + lpTime->u.smpte.sec = val / wwo->format.wf.nSamplesPerSec; + val -= lpTime->u.smpte.sec * wwo->format.wf.nSamplesPerSec; + lpTime->u.smpte.min = lpTime->u.smpte.sec / 60; + lpTime->u.smpte.sec -= 60 * lpTime->u.smpte.min; + lpTime->u.smpte.hour = lpTime->u.smpte.min / 60; + lpTime->u.smpte.min -= 60 * lpTime->u.smpte.hour; + lpTime->u.smpte.fps = 30; + lpTime->u.smpte.frame = val * lpTime->u.smpte.fps / wwo->format.wf.nSamplesPerSec; + val -= lpTime->u.smpte.frame * wwo->format.wf.nSamplesPerSec / lpTime->u.smpte.fps; + if (val != 0) + { + /* Round up */ + lpTime->u.smpte.frame++; + } TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n", lpTime->u.smpte.hour, lpTime->u.smpte.min, lpTime->u.smpte.sec, lpTime->u.smpte.frame);