Commit 0e84a59d authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

mmdevapi: Clock rate should be in bytes for shared mode.

parent b634666e
...@@ -955,7 +955,7 @@ static void test_clock(int share) ...@@ -955,7 +955,7 @@ static void test_clock(int share)
trace("Clock Frequency %u\n", (UINT)freq); trace("Clock Frequency %u\n", (UINT)freq);
/* MSDN says it's arbitrary units, but shared mode is unlikely to change */ /* MSDN says it's arbitrary units, but shared mode is unlikely to change */
if (share) todo_wine if (share)
ok(freq == pwfx->nSamplesPerSec * pwfx->nBlockAlign, ok(freq == pwfx->nSamplesPerSec * pwfx->nBlockAlign,
"Clock Frequency %u\n", (UINT)freq); "Clock Frequency %u\n", (UINT)freq);
else else
......
...@@ -2822,7 +2822,10 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq) ...@@ -2822,7 +2822,10 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq)
TRACE("(%p)->(%p)\n", This, freq); TRACE("(%p)->(%p)\n", This, freq);
*freq = This->fmt->nSamplesPerSec; if(This->share == AUDCLNT_SHAREMODE_SHARED)
*freq = This->fmt->nSamplesPerSec * This->fmt->nBlockAlign;
else
*freq = This->fmt->nSamplesPerSec;
return S_OK; return S_OK;
} }
...@@ -2879,7 +2882,10 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos, ...@@ -2879,7 +2882,10 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
TRACE("frames written: %u, held: %u, avail: %ld, delay: %ld state %d, pos: %u\n", TRACE("frames written: %u, held: %u, avail: %ld, delay: %ld state %d, pos: %u\n",
(UINT32)(written_frames%1000000000), held_frames, (UINT32)(written_frames%1000000000), held_frames,
avail_frames, delay_frames, alsa_state, (UINT32)(position%1000000000)); avail_frames, delay_frames, alsa_state, (UINT32)(position%1000000000));
*pos = position; if(This->share == AUDCLNT_SHAREMODE_SHARED)
*pos = position * This->fmt->nBlockAlign;
else
*pos = position;
if(qpctime){ if(qpctime){
LARGE_INTEGER stamp, freq; LARGE_INTEGER stamp, freq;
......
...@@ -2420,7 +2420,10 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq) ...@@ -2420,7 +2420,10 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq)
TRACE("(%p)->(%p)\n", This, freq); TRACE("(%p)->(%p)\n", This, freq);
*freq = This->fmt->nSamplesPerSec; if(This->share == AUDCLNT_SHAREMODE_SHARED)
*freq = This->fmt->nSamplesPerSec * This->fmt->nBlockAlign;
else
*freq = This->fmt->nSamplesPerSec;
return S_OK; return S_OK;
} }
...@@ -2435,6 +2438,9 @@ static HRESULT AudioClock_GetPosition_nolock(ACImpl *This, ...@@ -2435,6 +2438,9 @@ static HRESULT AudioClock_GetPosition_nolock(ACImpl *This,
else else
*pos = This->inbuf_frames + This->written_frames; *pos = This->inbuf_frames + This->written_frames;
if(This->share == AUDCLNT_SHAREMODE_SHARED)
*pos *= This->fmt->nBlockAlign;
if(qpctime){ if(qpctime){
LARGE_INTEGER stamp, freq; LARGE_INTEGER stamp, freq;
QueryPerformanceCounter(&stamp); QueryPerformanceCounter(&stamp);
......
...@@ -2145,7 +2145,10 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq) ...@@ -2145,7 +2145,10 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq)
TRACE("(%p)->(%p)\n", This, freq); TRACE("(%p)->(%p)\n", This, freq);
*freq = This->fmt->nSamplesPerSec; if(This->share == AUDCLNT_SHAREMODE_SHARED)
*freq = This->fmt->nSamplesPerSec * This->fmt->nBlockAlign;
else
*freq = This->fmt->nSamplesPerSec;
return S_OK; return S_OK;
} }
...@@ -2195,6 +2198,9 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos, ...@@ -2195,6 +2198,9 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
This->last_pos_frames = *pos; This->last_pos_frames = *pos;
if(This->share == AUDCLNT_SHAREMODE_SHARED)
*pos *= This->fmt->nBlockAlign;
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
if(qpctime){ if(qpctime){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment