Fix mingw32 WASAPI build
authorMarcus Tomlinson <themarcustomlinson@gmail.com>
Fri, 28 Sep 2018 21:00:15 +0000 (22:00 +0100)
committerMarcus Tomlinson <themarcustomlinson@gmail.com>
Fri, 28 Sep 2018 21:00:15 +0000 (22:00 +0100)
CMakeLists.txt
RtAudio.cpp

index 9e4060a0064d8af7a296e754e337e03f02b7aa7f..14b1787ff9e132acbbaaa04d7a1cab8d1d20cabd 100644 (file)
@@ -178,7 +178,7 @@ endif()
 # WASAPI
 if (RTAUDIO_API_WASAPI)
   set(NEED_WIN32LIBS ON)
-  list(APPEND LINKLIBS uuid ksuser)
+  list(APPEND LINKLIBS ksuser mfplat mfuuid wmcodecdspuuid)
   list(APPEND API_DEFS "-D__WINDOWS_WASAPI__")
   list(APPEND API_LIST "wasapi")
 endif()
index 18e900e8fbc73402359c554f418b1a9fb9528b4a..d1920d5a12a3b2c295624fcc98d37a961caaf15e 100644 (file)
@@ -3689,17 +3689,20 @@ static const char* getAsioErrorString( ASIOError result )
 #ifndef INITGUID
   #define INITGUID
 #endif
-#include <audioclient.h>
-#include <avrt.h>
-#include <mmdeviceapi.h>
-#include <functiondiscoverykeys_devpkey.h>
 
 #include <mfapi.h>
 #include <mferror.h>
 #include <mfplay.h>
+#include <mftransform.h>
 #include <wmcodecdsp.h>
 
+#include <audioclient.h>
+#include <avrt.h>
+#include <mmdeviceapi.h>
+#include <functiondiscoverykeys_devpkey.h>
+
 #ifdef _MSC_VER
+  #pragma comment( lib, "ksuser" )
   #pragma comment( lib, "mfplat.lib" )
   #pragma comment( lib, "mfuuid.lib" )
   #pragma comment( lib, "wmcodecdspuuid" )
@@ -3890,10 +3893,13 @@ public:
     , _sampleRatio( ( float ) outSampleRate / inSampleRate )
     , _transformUnk( NULL )
     , _transform( NULL )
-    , _resamplerProps( NULL )
     , _mediaType( NULL )
     , _inputMediaType( NULL )
     , _outputMediaType( NULL )
+
+    #ifdef __IWMResamplerProps_FWD_DEFINED__
+      , _resamplerProps( NULL )
+    #endif
   {
     // 1. Initialization
 
@@ -3906,8 +3912,10 @@ public:
 
     _transformUnk->QueryInterface( IID_PPV_ARGS( &_transform ) );
 
-    _transformUnk->QueryInterface( IID_PPV_ARGS( &_resamplerProps ) );
-    _resamplerProps->SetHalfFilterLength( 60 ); // best conversion quality
+    #ifdef __IWMResamplerProps_FWD_DEFINED__
+      _transformUnk->QueryInterface( IID_PPV_ARGS( &_resamplerProps ) );
+      _resamplerProps->SetHalfFilterLength( 60 ); // best conversion quality
+    #endif
 
     // 3. Specify input / output format
 
@@ -3954,10 +3962,13 @@ public:
 
     SAFE_RELEASE( _transformUnk );
     SAFE_RELEASE( _transform );
-    SAFE_RELEASE( _resamplerProps );
     SAFE_RELEASE( _mediaType );
     SAFE_RELEASE( _inputMediaType );
     SAFE_RELEASE( _outputMediaType );
+
+    #ifdef __IWMResamplerProps_FWD_DEFINED__
+      SAFE_RELEASE( _resamplerProps );
+    #endif
   }
 
   void Convert( char* outBuffer, const char* inBuffer, unsigned int inSampleCount, unsigned int& outSampleCount )
@@ -4050,10 +4061,13 @@ private:
 
   IUnknown* _transformUnk;
   IMFTransform* _transform;
-  IWMResamplerProps* _resamplerProps;
   IMFMediaType* _mediaType;
   IMFMediaType* _inputMediaType;
   IMFMediaType* _outputMediaType;
+
+  #ifdef __IWMResamplerProps_FWD_DEFINED__
+    IWMResamplerProps* _resamplerProps;
+  #endif
 };
 
 //-----------------------------------------------------------------------------