Commit 8ded2598 authored by Ghislain MARY's avatar Ghislain MARY

Fix build with old versions of Visual Studio that do not define WINAPI_FAMILY_PARTITION.

parent e8fae3ce
......@@ -33,7 +33,7 @@ const IID IID_IAudioClient2 = __uuidof(IAudioClient2);
const IID IID_IAudioCaptureClient = __uuidof(IAudioCaptureClient);
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if !BUILD_FOR_WINDOWS_PHONE
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
#endif
......@@ -328,16 +328,16 @@ static MSSndCardDesc ms_wasapi_snd_card_desc = {
NULL
};
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if BUILD_FOR_WINDOWS_PHONE
static MSSndCard *ms_wasapi_phone_snd_card_new(void) {
MSSndCard *card = ms_snd_card_new(&ms_wasapi_snd_card_desc);
card->name = ms_strdup("WASAPI sound card");
card->latency = 250;
return card;
}
#endif
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#else
static MSSndCard *ms_wasapi_snd_card_new(LPWSTR id, const char *name, uint8_t capabilities) {
MSSndCard *card = ms_snd_card_new(&ms_wasapi_snd_card_desc);
WasapiSndCard *wasapicard = static_cast<WasapiSndCard *>(card->data);
......@@ -438,7 +438,7 @@ error:
#endif
static void ms_wasapi_snd_card_detect(MSSndCardManager *m) {
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if BUILD_FOR_WINDOWS_PHONE
MSSndCard *card = ms_wasapi_phone_snd_card_new();
ms_snd_card_manager_add_card(m, card);
#else
......
......@@ -23,11 +23,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma once
#ifndef WINAPI_FAMILY_PARTITION
/* Old version of Visual Studio, no support of Windows Phone. */
#define BUILD_FOR_WINDOWS_PHONE 0
#else
#define BUILD_FOR_WINDOWS_PHONE WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#endif
#include <vector>
#include <objbase.h>
#include <audioclient.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if BUILD_FOR_WINDOWS_PHONE
#include <phoneaudioclient.h>
#else
#include <mmdeviceapi.h>
......@@ -56,7 +62,7 @@ extern const IID IID_IAudioClient2;
extern const IID IID_IAudioCaptureClient;
extern const IID IID_IAudioRenderClient;
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if !BUILD_FOR_WINDOWS_PHONE
extern const CLSID CLSID_MMDeviceEnumerator;
extern const IID IID_IMMDeviceEnumerator;
#endif
......@@ -56,7 +56,7 @@ MSWASAPIReader::MSWASAPIReader()
MSWASAPIReader::~MSWASAPIReader()
{
RELEASE_CLIENT(mAudioClient);
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if BUILD_FOR_WINDOWS_PHONE
FREE_PTR(mCaptureId);
#endif
smInstantiated = false;
......@@ -69,7 +69,7 @@ void MSWASAPIReader::init(LPCWSTR id)
WAVEFORMATEX *pWfx = NULL;
AudioClientProperties properties;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if BUILD_FOR_WINDOWS_PHONE
mCaptureId = GetDefaultAudioCaptureId(Communications);
if (mCaptureId == NULL) {
ms_error("Could not get the CaptureId of the MSWASAPI audio input interface");
......
......@@ -55,7 +55,7 @@ MSWASAPIWriter::MSWASAPIWriter()
MSWASAPIWriter::~MSWASAPIWriter()
{
RELEASE_CLIENT(mAudioClient);
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if BUILD_FOR_WINDOWS_PHONE
FREE_PTR(mRenderId);
#endif
smInstantiated = false;
......@@ -67,7 +67,7 @@ void MSWASAPIWriter::init(LPCWSTR id) {
WAVEFORMATEX *pWfx = NULL;
AudioClientProperties properties;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#if BUILD_FOR_WINDOWS_PHONE
mRenderId = GetDefaultAudioRenderId(Communications);
if (mRenderId == NULL) {
ms_error("Could not get the RenderId of the MSWASAPI audio output interface");
......
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