fix mingw and msvc cmake builds.

This commit is contained in:
aliaspider committed 2018-03-23 03:18:13 +01:00
1 parent 23dae72bce
commit 54d9406713
23 files changed
+416 -62

No files matched your search

+17 -9
View File
@@ -1,8 +1,15 @@
#include "Common/CommonWindows.h"
#include <mmreg.h>
#include <dsound.h>
#include <process.h>
#ifdef __MINGW32__
#define __null
#endif
#include <dsound.h>
#ifdef __MINGW32__
#undef __null
#endif
#include "thread/threadutil.h"
#include "Common/OSVersion.h"
#include "Core/Reporting.h"
@@ -317,8 +324,16 @@ int WASAPIAudioBackend::RunThread() {
REFERENCE_TIME hnsBufferDuration, hnsActualDuration;
UINT32 pNumBufferFrames;
UINT32 pNumPaddingFrames, pNumAvFrames;
short *shortBuf = nullptr;
int numSamples;
hnsBufferDuration = REFTIMES_PER_SEC;
enum {
UNKNOWN_FORMAT = 0,
IEEE_FLOAT = 1,
PCM16 = 2,
} format = UNKNOWN_FORMAT;
HRESULT hresult;
hresult = CoCreateInstance(CLSID_MMDeviceEnumerator,
NULL, /*Object is not created as the part of the aggregate */
@@ -357,12 +372,6 @@ int WASAPIAudioBackend::RunThread() {
sampleRate_ = pDeviceFormat->Format.nSamplesPerSec;
enum {
UNKNOWN_FORMAT = 0,
IEEE_FLOAT = 1,
PCM16 = 2,
} format = UNKNOWN_FORMAT;
// Don't know if PCM16 ever shows up here, the documentation only talks about float... but let's blindly
// try to support it :P
@@ -383,11 +392,10 @@ int WASAPIAudioBackend::RunThread() {
}
}
short *shortBuf = nullptr;
BYTE *pData;
hresult = pAudioRenderClient->GetBuffer(pNumBufferFrames, &pData);
int numSamples = pNumBufferFrames * pDeviceFormat->Format.nChannels;
numSamples = pNumBufferFrames * pDeviceFormat->Format.nChannels;
if (format == IEEE_FLOAT) {
memset(pData, 0, sizeof(float) * numSamples);
shortBuf = new short[pNumBufferFrames * pDeviceFormat->Format.nChannels];