Revisión | 429ba69ea4a9e77cc7dad569eee685f443842003 (tree) |
---|---|
Tiempo | 2018-06-06 02:13:36 |
Autor | Starg <starg@user...> |
Commiter | Starg |
Support compilers without AUDCLNT_STREAMOPTIONS_AMBISONICS
@@ -137,6 +137,14 @@ const IID tim_IID_IAudioClient = {0x1CB9AD4C, 0xDBFA, 0x4C32, {0xB1, 0 | ||
137 | 137 | const IID tim_IID_IAudioRenderClient = {0xF294ACFC, 0x3146, 0x4483, {0xA7, 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2}}; |
138 | 138 | const IID tim_IID_IAudioClient2 = {0x726778CD, 0xF60A, 0x4EDA, {0x82, 0xDE, 0xE4, 0x76, 0x10, 0xCD, 0x78, 0xAA}}; |
139 | 139 | |
140 | +// Some compilers do not have the latest version of AudioClientProperties | |
141 | +typedef struct { | |
142 | + UINT32 cbSize; | |
143 | + BOOL bIsOffload; | |
144 | + INT /* AUDIO_STREAM_CATEGORY */ eCategory; | |
145 | + INT /* AUDCLNT_STREAMOPTIONS */ Options; | |
146 | +} timAudioClientProperties; | |
147 | + | |
140 | 148 | #define SPEAKER_FRONT_LEFT 0x1 |
141 | 149 | #define SPEAKER_FRONT_RIGHT 0x2 |
142 | 150 | #define SPEAKER_FRONT_CENTER 0x4 |
@@ -927,25 +935,24 @@ int open_output(void) | ||
927 | 935 | |
928 | 936 | if (SUCCEEDED(IAudioClient_QueryInterface(pAudioClient, &tim_IID_IAudioClient2, (void**)&pAudioClient2))) |
929 | 937 | { |
930 | - AudioClientProperties acp = {0}; | |
931 | - acp.cbSize = min(sizeof(AudioClientProperties), ver >= 4 ? 16 : 12); | |
938 | + timAudioClientProperties acp = {0}; | |
939 | + acp.cbSize = (ver >= 4 ? 16 : 12); | |
932 | 940 | acp.bIsOffload = FALSE; |
933 | 941 | acp.eCategory = opt_wasapi_stream_category; |
934 | 942 | |
935 | -#if (NTDDI_VERSION >= NTDDI_WINBLUE) && !defined(__MINGW32__) | |
936 | 943 | if (opt_wasapi_stream_option & 4) { |
937 | 944 | if (ver >= 6) // win10以上 |
938 | - acp.Options |= AUDCLNT_STREAMOPTIONS_AMBISONICS; | |
945 | + acp.Options |= 4 /* AUDCLNT_STREAMOPTIONS_AMBISONICS */; | |
939 | 946 | } |
940 | 947 | if (opt_wasapi_stream_option & 2) { |
941 | 948 | if (ver >= 6) // win10以上 |
942 | - acp.Options |= AUDCLNT_STREAMOPTIONS_MATCH_FORMAT; | |
949 | + acp.Options |= 2 /* AUDCLNT_STREAMOPTIONS_MATCH_FORMAT */; | |
943 | 950 | } |
944 | 951 | if (opt_wasapi_stream_option & 1){ |
945 | 952 | if(ver >= 4) // win8.1以上 |
946 | - acp.Options |= AUDCLNT_STREAMOPTIONS_RAW; | |
953 | + acp.Options |= 1 /* AUDCLNT_STREAMOPTIONS_RAW */; | |
947 | 954 | } |
948 | -#endif | |
955 | + | |
949 | 956 | hr = IAudioClient2_SetClientProperties(pAudioClient2, &acp); |
950 | 957 | IAudioClient2_Release(pAudioClient2); |
951 | 958 | if (FAILED(hr)) |