Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
April 2005
- 133 participants
- 666 messages
Re: dsound: fix test to compile on vs
by Dimitrie O. Paun
On Sun, Apr 03, 2005 at 01:25:22PM -0500, James Hawkins wrote:
> Changelog
> * LPLPVOID is unknown to Visual Studio, use LPVOID * instead.
If so, how come it's defined in our headers? We should remove
the definition if it's not standard.
--
Dimi.
April 3, 2005
Re: [WAVEMAP] waveOutGetPosition bug
by Robert Reif
Robert Reif wrote:
> dlls/winmm/wavemap/wavemap.c
> Correctly handle where waveOutGetPosition changes timepos.wType
> because the requested type is not supported.
>
> dlls/winmm/tests/wave.c
> Changed regression test to make sure position is correctly
> checked when a different type is returned.
>
>
>
This revised patch adds the following:
dlls/winmm/wavemap/wavemap.c
Adds Jeremy White's waveOutGetPosition fix to waveInGetPosition.
dlls/winmm/tests/capture.c
Adds Jeremy White's WAVE_FORMAT_DIRECT/WAVE_MAPPER fix.
Adds waveInGetPosition checks.
Index: dlls/winmm/tests/capture.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/tests/capture.c,v
retrieving revision 1.15
diff -u -p -r1.15 capture.c
--- dlls/winmm/tests/capture.c 3 Nov 2004 22:13:44 -0000 1.15
+++ dlls/winmm/tests/capture.c 3 Apr 2005 17:30:59 -0000
@@ -50,6 +50,87 @@ static const char * wave_in_error(MMRESU
return long_msg;
}
+static void check_position(int device, HWAVEIN win, DWORD bytes,
+ LPWAVEFORMATEX pwfx )
+{
+ MMTIME mmtime;
+ DWORD samples;
+ double duration;
+ MMRESULT rc;
+ DWORD returned;
+
+ samples=bytes/(pwfx->wBitsPerSample/8*pwfx->nChannels);
+ duration=((double)samples)/pwfx->nSamplesPerSec;
+
+ mmtime.wType = TIME_BYTES;
+ rc=waveInGetPosition(win, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveInGetPosition(%s): rc=%s\n",dev_name(device),wave_in_error(rc));
+ if (mmtime.wType != TIME_BYTES && winetest_debug > 1)
+ trace("waveInGetPosition(%s): TIME_BYTES not supported, returned %s\n",
+ dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveInGetPosition(%s): returned %ld bytes, "
+ "should be %ld\n", dev_name(device), returned, bytes);
+
+ mmtime.wType = TIME_SAMPLES;
+ rc=waveInGetPosition(win, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveInGetPosition(%s): rc=%s\n",dev_name(device),wave_in_error(rc));
+ if (mmtime.wType != TIME_SAMPLES && winetest_debug > 1)
+ trace("waveInGetPosition(%s): TIME_SAMPLES not supported, "
+ "returned %s\n",dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveInGetPosition(%s): returned %ld samples, "
+ "should be %ld\n", dev_name(device), bytes_to_samples(returned, pwfx),
+ bytes_to_samples(bytes, pwfx));
+
+ mmtime.wType = TIME_MS;
+ rc=waveInGetPosition(win, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveInGetPosition(%s): rc=%s\n",dev_name(device),wave_in_error(rc));
+ if (mmtime.wType != TIME_MS && winetest_debug > 1)
+ trace("waveInGetPosition(%s): TIME_MS not supported, returned %s\n",
+ dev_name(device), wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveInGetPosition(%s): returned %ld ms, "
+ "should be %ld\n", dev_name(device), bytes_to_ms(returned, pwfx),
+ bytes_to_ms(bytes, pwfx));
+
+ mmtime.wType = TIME_SMPTE;
+ rc=waveInGetPosition(win, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveInGetPosition(%s): rc=%s\n",dev_name(device),wave_in_error(rc));
+ if (mmtime.wType != TIME_SMPTE && winetest_debug > 1)
+ trace("waveInGetPosition(%s): TIME_SMPTE not supported, returned %s\n",
+ dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveInGetPosition(%s): SMPTE test failed\n",
+ dev_name(device));
+
+ mmtime.wType = TIME_MIDI;
+ rc=waveInGetPosition(win, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveInGetPosition(%s): rc=%s\n",dev_name(device),wave_in_error(rc));
+ if (mmtime.wType != TIME_MIDI && winetest_debug > 1)
+ trace("waveInGetPosition(%s): TIME_MIDI not supported, returned %s\n",
+ dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveInGetPosition(%s): MIDI test failed\n",
+ dev_name(device));
+
+ mmtime.wType = TIME_TICKS;
+ rc=waveInGetPosition(win, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveInGetPosition(%s): rc=%s\n",dev_name(device),wave_in_error(rc));
+ if (mmtime.wType != TIME_TICKS && winetest_debug > 1)
+ trace("waveInGetPosition(%s): TIME_TICKS not supported, returned %s\n",
+ dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveInGetPosition(%s): TICKS test failed\n",
+ dev_name(device));
+}
+
static void wave_in_test_deviceIn(int device, LPWAVEFORMATEX pwfx, DWORD format, DWORD flags, LPWAVEINCAPS pcaps)
{
HWAVEIN win;
@@ -107,6 +188,9 @@ static void wave_in_test_deviceIn(int de
pwfx->nSamplesPerSec, pwfx->wBitsPerSample,
pwfx->nChannels, nSamplesPerSec, wBitsPerSample, nChannels);
+ /* Check that the position is 0 at start */
+ check_position(device, win, 0, pwfx);
+
frag.lpData=malloc(pwfx->nAvgBytesPerSec);
frag.dwBufferLength=pwfx->nAvgBytesPerSec;
frag.dwBytesRecorded=0;
@@ -131,6 +215,9 @@ static void wave_in_test_deviceIn(int de
ok(rc==MMSYSERR_NOERROR,"waveInAddBuffer(%s): rc=%s\n",
dev_name(device),wave_in_error(rc));
+ /* Check that the position is 0 at start */
+ check_position(device, win, 0, pwfx);
+
rc=waveInStart(win);
ok(rc==MMSYSERR_NOERROR,"waveInStart(%s): rc=%s\n",
dev_name(device),wave_in_error(rc));
@@ -141,6 +228,7 @@ static void wave_in_test_deviceIn(int de
ok(frag.dwBytesRecorded==pwfx->nAvgBytesPerSec,
"frag.dwBytesRecorded=%ld, should=%ld\n",
frag.dwBytesRecorded,pwfx->nAvgBytesPerSec);
+
/* stop playing on error */
if (res!=WAIT_OBJECT_0) {
rc=waveInStop(win);
@@ -316,11 +404,12 @@ static void wave_in_test_device(int devi
format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
format.cbSize=0;
wave_in_test_deviceIn(device,&format,win_formats[f][0],0, &capsA);
- wave_in_test_deviceIn(device,&format,win_formats[f][0],
- WAVE_FORMAT_DIRECT, &capsA);
- if (device != WAVE_MAPPER)
+ if (device != WAVE_MAPPER) {
+ wave_in_test_deviceIn(device,&format,win_formats[f][0],
+ WAVE_FORMAT_DIRECT, &capsA);
wave_in_test_deviceIn(device,&format,win_formats[f][0],
WAVE_MAPPED, &capsA);
+ }
}
/* Try a PCMWAVEFORMAT aligned next to an unaccessible page for bounds
@@ -342,11 +431,12 @@ static void wave_in_test_device(int devi
pwfx->nBlockAlign=pwfx->nChannels*pwfx->wBitsPerSample/8;
pwfx->nAvgBytesPerSec=pwfx->nSamplesPerSec*pwfx->nBlockAlign;
wave_in_test_deviceIn(device,pwfx,WAVE_FORMAT_2M08,0, &capsA);
- wave_in_test_deviceIn(device,pwfx,WAVE_FORMAT_2M08,
- WAVE_FORMAT_DIRECT, &capsA);
- if (device != WAVE_MAPPER)
+ if (device != WAVE_MAPPER) {
+ wave_in_test_deviceIn(device,pwfx,WAVE_FORMAT_2M08,
+ WAVE_FORMAT_DIRECT, &capsA);
wave_in_test_deviceIn(device,pwfx,WAVE_FORMAT_2M08,
WAVE_MAPPED, &capsA);
+ }
}
VirtualFree(twoPages, 2 * dwPageSize, MEM_RELEASE);
}
Index: dlls/winmm/tests/wave.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/tests/wave.c,v
retrieving revision 1.50
diff -u -p -r1.50 wave.c
--- dlls/winmm/tests/wave.c 18 Mar 2005 10:25:48 -0000 1.50
+++ dlls/winmm/tests/wave.c 3 Apr 2005 17:31:00 -0000
@@ -303,7 +303,7 @@ static const char * wave_out_caps(DWORD
#undef ADD_FLAG
}
-static const char * wave_time_format(UINT type)
+const char * wave_time_format(UINT type)
{
static char msg[32];
#define TIME_FORMAT(f) case f: return #f
@@ -373,6 +373,34 @@ const char * get_format_str(WORD format)
return msg;
}
+DWORD bytes_to_samples(DWORD bytes, LPWAVEFORMATEX pwfx)
+{
+ return bytes / pwfx->nBlockAlign;
+}
+
+DWORD bytes_to_ms(DWORD bytes, LPWAVEFORMATEX pwfx)
+{
+ return bytes_to_samples(bytes, pwfx) * 1000 / pwfx->nSamplesPerSec;
+}
+
+DWORD time_to_bytes(LPMMTIME mmtime, LPWAVEFORMATEX pwfx)
+{
+ if (mmtime->wType == TIME_BYTES)
+ return mmtime->u.cb;
+ else if (mmtime->wType == TIME_SAMPLES)
+ return mmtime->u.sample * pwfx->nBlockAlign;
+ else if (mmtime->wType == TIME_MS)
+ return mmtime->u.ms * pwfx->nAvgBytesPerSec / 1000;
+ else if (mmtime->wType == TIME_SMPTE)
+ return ((mmtime->u.smpte.hour * 60.0 * 60.0) +
+ (mmtime->u.smpte.min * 60.0) +
+ (mmtime->u.smpte.sec) +
+ (mmtime->u.smpte.frame / 30.0)) * pwfx->nAvgBytesPerSec;
+
+ trace("FIXME: time_to_bytes() type not supported\n");
+ return -1;
+}
+
static void check_position(int device, HWAVEOUT wout, DWORD bytes,
LPWAVEFORMATEX pwfx )
{
@@ -380,6 +408,7 @@ static void check_position(int device, H
DWORD samples;
double duration;
MMRESULT rc;
+ DWORD returned;
samples=bytes/(pwfx->wBitsPerSample/8*pwfx->nChannels);
duration=((double)samples)/pwfx->nSamplesPerSec;
@@ -388,60 +417,69 @@ static void check_position(int device, H
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
- if (mmtime.wType == TIME_BYTES)
- ok(mmtime.u.cb==bytes,
- "waveOutGetPosition(%s): returned %ld bytes, should be %ld\n",
- dev_name(device),mmtime.u.cb, bytes);
- else
+ if (mmtime.wType != TIME_BYTES && winetest_debug > 1)
trace("waveOutGetPosition(%s): TIME_BYTES not supported, returned %s\n",
dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveOutGetPosition(%s): returned %ld bytes, "
+ "should be %ld\n", dev_name(device), returned, bytes);
mmtime.wType = TIME_SAMPLES;
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
- if (mmtime.wType == TIME_SAMPLES)
- ok(mmtime.u.sample==samples,
- "waveOutGetPosition(%s): returned %ld samples, should be %ld\n",
- dev_name(device), mmtime.u.sample, samples);
- else
+ if (mmtime.wType != TIME_SAMPLES && winetest_debug > 1)
trace("waveOutGetPosition(%s): TIME_SAMPLES not supported, "
"returned %s\n",dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveOutGetPosition(%s): returned %ld samples, "
+ "should be %ld\n", dev_name(device), bytes_to_samples(returned, pwfx),
+ bytes_to_samples(bytes, pwfx));
mmtime.wType = TIME_MS;
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
- if (mmtime.wType == TIME_MS)
- ok(mmtime.u.ms==floor(duration*1000.0),
- "waveOutGetPosition(%s): returned %ld ms, should be %ld\n",
- dev_name(device), mmtime.u.ms, (long)floor(duration*1000.0));
- else
+ if (mmtime.wType != TIME_MS && winetest_debug > 1)
trace("waveOutGetPosition(%s): TIME_MS not supported, returned %s\n",
- dev_name(device),wave_time_format(mmtime.wType));
+ dev_name(device), wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveOutGetPosition(%s): returned %ld ms, "
+ "should be %ld\n", dev_name(device), bytes_to_ms(returned, pwfx),
+ bytes_to_ms(bytes, pwfx));
mmtime.wType = TIME_SMPTE;
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
- if (mmtime.wType == TIME_SMPTE)
- {
- BYTE frames=(BYTE)ceil(fmod(duration*mmtime.u.smpte.fps, mmtime.u.smpte.fps));
- ok(mmtime.u.smpte.hour==(BYTE)(floor(duration/(60*60))) &&
- mmtime.u.smpte.min==(BYTE)(fmod(floor(duration/60), 60)) &&
- mmtime.u.smpte.sec==(BYTE)(fmod(duration,60)) &&
- mmtime.u.smpte.frame==frames,
- "waveOutGetPosition(%s): returned %d:%d:%d %d, "
- "should be %d:%d:%d %d\n", dev_name(device), mmtime.u.smpte.hour,
- mmtime.u.smpte.min, mmtime.u.smpte.sec, mmtime.u.smpte.frame,
- (BYTE)(floor(duration/(60*60))),
- (BYTE)(fmod(floor(duration/60), 60)),
- (BYTE)(fmod(duration,60)),
- frames);
- }
- else
+ if (mmtime.wType != TIME_SMPTE && winetest_debug > 1)
trace("waveOutGetPosition(%s): TIME_SMPTE not supported, returned %s\n",
dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveOutGetPosition(%s): SMPTE test failed\n",
+ dev_name(device));
+
+ mmtime.wType = TIME_MIDI;
+ rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
+ if (mmtime.wType != TIME_MIDI && winetest_debug > 1)
+ trace("waveOutGetPosition(%s): TIME_MIDI not supported, returned %s\n",
+ dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveOutGetPosition(%s): MIDI test failed\n",
+ dev_name(device));
+
+ mmtime.wType = TIME_TICKS;
+ rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
+ if (mmtime.wType != TIME_TICKS && winetest_debug > 1)
+ trace("waveOutGetPosition(%s): TIME_TICKS not supported, returned %s\n",
+ dev_name(device),wave_time_format(mmtime.wType));
+ returned = time_to_bytes(&mmtime, pwfx);
+ ok(returned == bytes, "waveOutGetPosition(%s): TICKS test failed\n",
+ dev_name(device));
}
static void wave_out_test_deviceOut(int device, double duration,
@@ -1030,7 +1068,7 @@ static void wave_out_tests()
"waveOutGetDevCapsW(%s): MMSYSERR_NOERROR or MMSYSERR_NOTSUPPORTED "
"expected, got %s\n",dev_name(WAVE_MAPPER),mmsys_error(rc));
else
- ok(rc==MMSYSERR_BADDEVICEID || rc==MMSYSERR_NODRIVER ||
+ ok(rc==MMSYSERR_BADDEVICEID || rc==MMSYSERR_NODRIVER ||
rc==MMSYSERR_NOTSUPPORTED,
"waveOutGetDevCapsW(%s): MMSYSERR_BADDEVICEID or MMSYSERR_NODRIVER "
" or MMSYSERR_NOTSUPPORTED expected, got %s\n",
Index: dlls/winmm/tests/winmm_test.h
===================================================================
RCS file: /home/wine/wine/dlls/winmm/tests/winmm_test.h,v
retrieving revision 1.8
diff -u -p -r1.8 winmm_test.h
--- dlls/winmm/tests/winmm_test.h 19 Aug 2004 01:13:58 -0000 1.8
+++ dlls/winmm/tests/winmm_test.h 3 Apr 2005 17:31:00 -0000
@@ -72,3 +72,7 @@ extern const char* wave_open_flags(DWORD
extern const char* mmsys_error(MMRESULT);
extern const char* wave_out_error(MMRESULT);
extern const char* get_format_str(WORD format);
+extern const char* wave_time_format(UINT type);
+extern DWORD bytes_to_samples(DWORD bytes, LPWAVEFORMATEX pwfx);
+extern DWORD bytes_to_ms(DWORD bytes, LPWAVEFORMATEX pwfx);
+extern DWORD time_to_bytes(LPMMTIME mmtime, LPWAVEFORMATEX pwfx);
Index: dlls/winmm/wavemap/wavemap.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/wavemap/wavemap.c,v
retrieving revision 1.42
diff -u -p -r1.42 wavemap.c
--- dlls/winmm/wavemap/wavemap.c 15 Mar 2005 15:39:18 -0000 1.42
+++ dlls/winmm/wavemap/wavemap.c 3 Apr 2005 17:31:01 -0000
@@ -428,9 +428,10 @@ static DWORD wodGetPosition(WAVEMAPDATA*
if (lpTime->wType == TIME_MS)
timepos.wType = TIME_BYTES;
+ /* This can change timepos.wType if the requested type is not supported */
val = waveOutGetPosition(wom->u.out.hInnerWave, &timepos, dwParam2);
- if (lpTime->wType == TIME_BYTES || lpTime->wType == TIME_MS)
+ if (timepos.wType == TIME_BYTES)
{
DWORD dwInnerSamplesPerOuter = wom->nSamplesPerSecInner / wom->nSamplesPerSecOuter;
if (dwInnerSamplesPerOuter > 0)
@@ -464,10 +465,12 @@ static DWORD wodGetPosition(WAVEMAPDATA*
/* Once we have the TIME_BYTES right, we can easily convert to TIME_MS */
if (lpTime->wType == TIME_MS)
- lpTime->u.cb = MulDiv(lpTime->u.cb, 1000, wom->avgSpeedOuter);
+ lpTime->u.ms = MulDiv(lpTime->u.cb, 1000, wom->avgSpeedOuter);
+ else
+ lpTime->wType = TIME_BYTES;
}
- else if (lpTime->wType == TIME_SAMPLES)
- lpTime->u.cb = MulDiv(timepos.u.cb, wom->nSamplesPerSecOuter, wom->nSamplesPerSecInner);
+ else if (lpTime->wType == TIME_SAMPLES && timepos.wType == TIME_SAMPLES)
+ lpTime->u.sample = MulDiv(timepos.u.sample, wom->nSamplesPerSecOuter, wom->nSamplesPerSecInner);
else
/* other time types don't require conversion */
lpTime->u = timepos.u;
@@ -962,15 +965,62 @@ static DWORD widUnprepare(WAVEMAPDATA* w
static DWORD widGetPosition(WAVEMAPDATA* wim, LPMMTIME lpTime, DWORD dwParam2)
{
DWORD val;
-
+ MMTIME timepos;
TRACE("(%p %p %08lx)\n", wim, lpTime, dwParam2);
- val = waveInGetPosition(wim->u.in.hInnerWave, lpTime, dwParam2);
- if (lpTime->wType == TIME_BYTES)
- lpTime->u.cb = MulDiv(lpTime->u.cb, wim->avgSpeedOuter, wim->avgSpeedInner);
- if (lpTime->wType == TIME_SAMPLES)
- lpTime->u.cb = MulDiv(lpTime->u.cb, wim->nSamplesPerSecOuter, wim->nSamplesPerSecInner);
- /* other time types don't require conversion */
+ memcpy(&timepos, lpTime, sizeof(timepos));
+
+ /* For TIME_MS, we're going to recalculate using TIME_BYTES */
+ if (lpTime->wType == TIME_MS)
+ timepos.wType = TIME_BYTES;
+
+ /* This can change timepos.wType if the requested type is not supported */
+ val = waveInGetPosition(wim->u.in.hInnerWave, &timepos, dwParam2);
+
+ if (timepos.wType == TIME_BYTES)
+ {
+ DWORD dwInnerSamplesPerOuter = wim->nSamplesPerSecInner / wim->nSamplesPerSecOuter;
+ if (dwInnerSamplesPerOuter > 0)
+ {
+ DWORD dwInnerBytesPerSample = wim->avgSpeedInner / wim->nSamplesPerSecInner;
+ DWORD dwInnerBytesPerOuterSample = dwInnerBytesPerSample * dwInnerSamplesPerOuter;
+ DWORD remainder = 0;
+
+ /* If we are up sampling (going from lower sample rate to higher),
+ ** we need to make a special accomodation for times when we've
+ ** written a partial output sample. This happens frequently
+ ** to us because we use msacm to do our up sampling, and it
+ ** will up sample on an unaligned basis.
+ ** For example, if you convert a 2 byte wide 8,000 'outer'
+ ** buffer to a 2 byte wide 48,000 inner device, you would
+ ** expect 2 bytes of input to produce 12 bytes of output.
+ ** Instead, msacm will produce 8 bytes of output.
+ ** But reporting our position as 1 byte of output is
+ ** nonsensical; the output buffer position needs to be
+ ** aligned on outer sample size, and aggressively rounded up.
+ */
+ remainder = timepos.u.cb % dwInnerBytesPerOuterSample;
+ if (remainder > 0)
+ {
+ timepos.u.cb -= remainder;
+ timepos.u.cb += dwInnerBytesPerOuterSample;
+ }
+ }
+
+ lpTime->u.cb = MulDiv(timepos.u.cb, wim->avgSpeedOuter, wim->avgSpeedInner);
+
+ /* Once we have the TIME_BYTES right, we can easily convert to TIME_MS */
+ if (lpTime->wType == TIME_MS)
+ lpTime->u.ms = MulDiv(lpTime->u.cb, 1000, wim->avgSpeedOuter);
+ else
+ lpTime->wType = TIME_BYTES;
+ }
+ else if (lpTime->wType == TIME_SAMPLES && timepos.wType == TIME_SAMPLES)
+ lpTime->u.sample = MulDiv(timepos.u.sample, wim->nSamplesPerSecOuter, wim->nSamplesPerSecInner);
+ else
+ /* other time types don't require conversion */
+ lpTime->u = timepos.u;
+
return val;
}
April 3, 2005
Re: WineConf Agenda
by Steven Edwards
--- Andrew Tridgell <tridge(a)osdl.org> wrote:
> Finally, if we have time, I'd like to discuss cooperation on IDL files
> and MSRPC interfaces.
Yes I would like to discuss this as well. Eirc Kohl has made quite a lot of changes to WIDL for
ReactOS to support our MSRPC and PLug and Pray implementation and I would like to see these
changes merged back in for Wine and Samba so we can adopt a common IDL compiler.
Thanks
Steven
__________________________________
Yahoo! Messenger
Show us what our next emoticon should look like. Join the fun.
http://www.advision.webevents.yahoo.com/emoticontest
April 3, 2005
Re: Riched20: thanks + regression "beta" not shown
by Dimitrie O. Paun
On Sun, Apr 03, 2005 at 12:32:28PM +0200, Krzysztof Foltman wrote:
> I'm currently working on complete tab support, and will post a patch
> next week. It already includes support for tab positions.
This is very cool. From the limitted exposure I have with Richedit
controls used in apps, this will make the current riched20 useful
in 70-80% of the cases. For example, AFAICT tab support is the only
feature missing to get perfect output in the richedit controls used
in MS' control spy.
--
Dimi.
April 3, 2005
Re: WineConf Agenda
by Andrew Tridgell
Brian,
> I think a full agenda would be about 11 items. If you would like to
> present something let me know - there's definitely space available.
I'd like to present something on the way Samba4 stores the extra NTFS
meta-data in posix filesystems (streams, NT ACLs, DOS attributes,
extra timestamps etc) and open up a discussion on whether we could
come to an agreement with the wine project on how this should be
done. I can provide a demo of the implementation we currently have in
the posix NTVFS backend in Samba4.
I'd similarly like to discuss cooperating on share modes, oplocks and
byte range locks.
In each case I will be trying to encourage methods which can store the
full NTFS semantics, rather than limiting ourselves to only the things
that fit natually in posix filesystems. I'm guessing we will have some
lively discussion on whether this is a worthwhile aim :-)
Finally, if we have time, I'd like to discuss cooperation on IDL files
and MSRPC interfaces.
btw, I'm arriving in Stuttgart early on the 28th, so if anyone from
the wine or Samba community wants to meet up early then please let me
know. I'm sure we could find a corner where we can chat about windows
interoperability.
Cheers, Tridge
April 3, 2005
Re: Riched20: thanks + regression "beta" not shown
by Krzysztof Foltman
Tobias Burnus wrote:
>> I suppose this is more addressed to Krzysztof... The readability could be
>> even better if tab positions were supported :)
> True ;) But failing to write patches for Wine myself, I'll try not to
> ask too much.
I'm currently working on complete tab support, and will post a patch
next week. It already includes support for tab positions.
Krzysztof
April 3, 2005
Re: Hints needed for riched20/scroll bug solving
by Krzysztof Foltman
Paul Vriens wrote:
> agreement appears. I know that nobody reads this ;-) but hey. When I
> click in the scrollbar (page down) the page goes down 1 page and the
> scrollbar changes.
My newest patch (released 5 minutes ago, not in CVS yet) attempts to fix
that - at least, it works for me. Try it and tell me if it works for you.
Krzysztof
April 3, 2005
wineps: rewriting in terms of 32-bit functions
by Dimitrie O. Paun
Hi Huw,
Currenty wineps.dll is one of the worse offenders in terms
of using non-standard, 16-bit entry points. Namely, wineps
makes use of the following 16-bit functions:
CloseJob16()
DrvGetPrinterData16()
DrvSetPrinterData16()
OpenJob16()
SelectVisRgn16()
WriteSpool16()
I was wondering if there's anything that holds us back from
using 32-bit APIs instead of the 16-bit ones like so:
CloseJob16() --> ClosePrinter()
DrvGetPrinterData16() --> GetPrinterDataEx()
DrvSetPrinterData16() --> SetPrinterDataEx()
OpenJob16() --> OpenPrinter()
SelectVisRgn16() --> ?
WriteSpool16() --> WritePrinter()
I haven't looked too deeply into the problem, but given that
you probably know the code inside out, maybe you can help me
put this into perspective...
--
Dimi.
April 3, 2005
Re: Riched20: thanks + regression "beta" not shown
by Brian Vincent
On Apr 1, 2005 11:37 AM, Phil Krylov <phil(a)newstar.rinet.ru> wrote:
> On Fri, 01 Apr 2005 18:04:32 +0200
> Tobias Burnus <burnus(a)gmx.de> wrote:
>
> > Hmm, I think the reason for my boxes was that I didn't install
> > symbol.ttf from Windows (I had only a "Symbol Set BT" and bitmap fonts
> > before).
>
> Yes, I also noticed some problems with font substitution...
The problem I've noticed is if there is only one truetype font
available, and thanks to the new Marlett replacement there is exactly
one on a default install, then it gets chosen to display any truetype
font. This is easily seen when using Word Viewer 2003, all fonts in
the document will use Marlett.
Steven - you mentioned there was a Tahoma ttf replacement on the way
from ROS? Greenville? Has it been completed?
With regard to making our own replacement fonts, I think there's
already a sufficient amount of fonts out there we could potentially
use. Of course we'd need to contact the authors, but I'm sure we
could just "import" an existing one into fontforge. I sent this email
a few months ago:
The issue of fonts came up a while ago and I know some people are
working on free replacements for some of the core fonts. Anyway, I
stumbled on this resource tonight with a huge listing of fonts:
http://cgm.cs.mcgill.ca/~luc/originalfonts.html
Seems like there's got to be a few decent ones in there the authors
would be willing to let us use and relicense.
Another thing I just thought of is glyph tracing. Maybe this would be
a good time to explore our OSDL legal resources. In theory, it's
legal to take an existing font, trace the outlines of the glyphs, and
use that to create a new font set. Fontforge has more info on how
that works. It would be interesting to find out if there's a
precedent for doing that.
-Brian
April 2, 2005
Hints needed for riched20/scroll bug solving
by Paul Vriens
Hi,
When starting the Zoo Tycoon 1 demo for the first time, the license
agreement appears. I know that nobody reads this ;-) but hey. When I
click in the scrollbar (page down) the page goes down 1 page and the
scrollbar changes. When I however click the down-arrow in the scrollbar,
the page goes down (2 lines) but the scrollbar doesn't change.
Who/what is responsible for this scrollbar? I've tried (extra) tracing
for riched20 and scroll but nothing so far.
Cheers,
Paul.
April 2, 2005