WIN64: Use correct IReferenceClock definition from <strmif.h> (PR #1250)
This commit is contained in:
parent
6a9f2ee5f9
commit
abab213e15
|
@ -646,7 +646,8 @@ void SoundCore_SetErrorMax(const int nErrorMax)
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
static DWORD g_dwAdviseToken;
|
// Use DWORD_PTR according to IReferenceClock from <strmif.h>.
|
||||||
|
static DWORD_PTR g_pdwAdviseCookie = 0; // Not really used as pointer.
|
||||||
static IReferenceClock *g_pRefClock = NULL;
|
static IReferenceClock *g_pRefClock = NULL;
|
||||||
static HANDLE g_hSemaphore = NULL;
|
static HANDLE g_hSemaphore = NULL;
|
||||||
static bool g_bRefClockTimerActive = false;
|
static bool g_bRefClockTimerActive = false;
|
||||||
|
@ -713,7 +714,9 @@ void SysClk_StartTimerUsec(DWORD dwUsecPeriod)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pRefClock->AdvisePeriodic(rtNow, rtPeriod, g_hSemaphore, &g_dwAdviseToken) != S_OK)
|
// IReferenceClock from <strmif.h> (origin <axcore.idl>) is "oddly" defined to use HSEMAPHORE.
|
||||||
|
static_assert(sizeof(HSEMAPHORE) == sizeof(HANDLE), "must be same size");
|
||||||
|
if (g_pRefClock->AdvisePeriodic(rtNow, rtPeriod, (HSEMAPHORE)g_hSemaphore, &g_pdwAdviseCookie) != S_OK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error creating timer\n");
|
fprintf(stderr, "Error creating timer\n");
|
||||||
_ASSERT(0);
|
_ASSERT(0);
|
||||||
|
@ -729,7 +732,7 @@ void SysClk_StopTimer()
|
||||||
if(!g_bRefClockTimerActive)
|
if(!g_bRefClockTimerActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_pRefClock->Unadvise(g_dwAdviseToken) != S_OK)
|
if (g_pRefClock->Unadvise(g_pdwAdviseCookie) != S_OK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error deleting timer\n");
|
fprintf(stderr, "Error deleting timer\n");
|
||||||
_ASSERT(0);
|
_ASSERT(0);
|
||||||
|
@ -737,4 +740,4 @@ void SysClk_StopTimer()
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bRefClockTimerActive = false;
|
g_bRefClockTimerActive = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
|
// <strmif.h> has the correct IReferenceClock definition that works for both x86 and x64,
|
||||||
|
// whereas the alternative definition in <dsound.h> is incorrect for x64. (out of
|
||||||
|
// maintenance perhaps)
|
||||||
|
// <strmif.h> *must* be included before <dsound.h> for x64 to work.
|
||||||
|
#include <strmif.h>
|
||||||
#include <dsound.h>
|
#include <dsound.h>
|
||||||
#include <dshow.h>
|
#include <dshow.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue