Skip to content

Commit

Permalink
dmime: Convert DMUS_PMSG music and reference times in SendPMsg.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbernon authored and julliard committed Sep 18, 2023
1 parent eedde52 commit 6cd1c4e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions dlls/dmime/performance.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ struct DMUS_PMSGItem {
DMUS_PMSGItem* next;
DMUS_PMSGItem* prev;

REFERENCE_TIME rtItemTime;
BOOL bInUse;
DWORD cb;
DMUS_PMSG pMsg;
Expand Down Expand Up @@ -141,14 +140,14 @@ static DWORD WINAPI ProcessMsgThread(LPVOID lpParam) {
it = it_next;
}

for (it = This->head; NULL != it && it->rtItemTime < rtCurTime + dwDec; ) {
for (it = This->head; NULL != it && it->pMsg.rtTime < rtCurTime + dwDec; ) {
it_next = it->next;
cur = ProceedMsg(This, it);
free(cur);
it = it_next;
}
if (NULL != it) {
timeOut = ( it->rtItemTime - rtCurTime ) + This->rtLatencyTime;
timeOut = ( it->pMsg.rtTime - rtCurTime ) + This->rtLatencyTime;
}

outrefresh:
Expand Down Expand Up @@ -425,11 +424,22 @@ static HRESULT WINAPI performance_SendPMsg(IDirectMusicPerformance8 *iface, DMUS
hr = DMUS_E_ALREADY_SENT;
else
{
/* TODO: Valid Flags */
/* TODO: DMUS_PMSGF_MUSICTIME */
message->rtItemTime = msg->rtTime;
if (!(msg->dwFlags & DMUS_PMSGF_MUSICTIME))
{
if (FAILED(hr = IDirectMusicPerformance8_ReferenceToMusicTime(iface,
msg->rtTime, &msg->mtTime)))
goto done;
msg->dwFlags |= DMUS_PMSGF_MUSICTIME;
}
if (!(msg->dwFlags & DMUS_PMSGF_REFTIME))
{
if (FAILED(hr = IDirectMusicPerformance8_MusicToReferenceTime(iface,
msg->mtTime, &msg->rtTime)))
goto done;
msg->dwFlags |= DMUS_PMSGF_REFTIME;
}

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

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

done:
LeaveCriticalSection(&This->safe);

return hr;
Expand Down

0 comments on commit 6cd1c4e

Please sign in to comment.