Skip to content

Commit 6cd1c4e

Browse files
rbernonjulliard
authored andcommitted
dmime: Convert DMUS_PMSG music and reference times in SendPMsg.
1 parent eedde52 commit 6cd1c4e

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

dlls/dmime/performance.c

+18-7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ struct DMUS_PMSGItem {
7474
DMUS_PMSGItem* next;
7575
DMUS_PMSGItem* prev;
7676

77-
REFERENCE_TIME rtItemTime;
7877
BOOL bInUse;
7978
DWORD cb;
8079
DMUS_PMSG pMsg;
@@ -141,14 +140,14 @@ static DWORD WINAPI ProcessMsgThread(LPVOID lpParam) {
141140
it = it_next;
142141
}
143142

144-
for (it = This->head; NULL != it && it->rtItemTime < rtCurTime + dwDec; ) {
143+
for (it = This->head; NULL != it && it->pMsg.rtTime < rtCurTime + dwDec; ) {
145144
it_next = it->next;
146145
cur = ProceedMsg(This, it);
147146
free(cur);
148147
it = it_next;
149148
}
150149
if (NULL != it) {
151-
timeOut = ( it->rtItemTime - rtCurTime ) + This->rtLatencyTime;
150+
timeOut = ( it->pMsg.rtTime - rtCurTime ) + This->rtLatencyTime;
152151
}
153152

154153
outrefresh:
@@ -425,11 +424,22 @@ static HRESULT WINAPI performance_SendPMsg(IDirectMusicPerformance8 *iface, DMUS
425424
hr = DMUS_E_ALREADY_SENT;
426425
else
427426
{
428-
/* TODO: Valid Flags */
429-
/* TODO: DMUS_PMSGF_MUSICTIME */
430-
message->rtItemTime = msg->rtTime;
427+
if (!(msg->dwFlags & DMUS_PMSGF_MUSICTIME))
428+
{
429+
if (FAILED(hr = IDirectMusicPerformance8_ReferenceToMusicTime(iface,
430+
msg->rtTime, &msg->mtTime)))
431+
goto done;
432+
msg->dwFlags |= DMUS_PMSGF_MUSICTIME;
433+
}
434+
if (!(msg->dwFlags & DMUS_PMSGF_REFTIME))
435+
{
436+
if (FAILED(hr = IDirectMusicPerformance8_MusicToReferenceTime(iface,
437+
msg->mtTime, &msg->rtTime)))
438+
goto done;
439+
msg->dwFlags |= DMUS_PMSGF_REFTIME;
440+
}
431441

432-
for (it = *queue; NULL != it && it->rtItemTime < message->rtItemTime; it = it->next)
442+
for (it = *queue; NULL != it && it->pMsg.rtTime < message->pMsg.rtTime; it = it->next)
433443
prev_it = it;
434444

435445
if (!prev_it)
@@ -452,6 +462,7 @@ static HRESULT WINAPI performance_SendPMsg(IDirectMusicPerformance8 *iface, DMUS
452462
hr = S_OK;
453463
}
454464

465+
done:
455466
LeaveCriticalSection(&This->safe);
456467

457468
return hr;

0 commit comments

Comments
 (0)