Merge pull request #8721 from kencooke/audio-fixes2

Fix audio support on Windows7
This commit is contained in:
Chris Collins 2016-10-04 10:14:37 -07:00 committed by GitHub
commit 1087885380
3 changed files with 35 additions and 10 deletions

View file

@ -44,13 +44,25 @@ macro(PACKAGE_LIBRARIES_FOR_DEPLOYMENT)
set(QTAUDIO_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audio) set(QTAUDIO_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audio)
# if present, replace qtaudio_windows.dll with qtaudio_wasapi.dll if (DEPLOY_PACKAGE)
add_custom_command( # copy qtaudio_wasapi.dll alongside qtaudio_windows.dll, and let the installer resolve
TARGET ${TARGET_NAME} add_custom_command(
POST_BUILD TARGET ${TARGET_NAME}
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windows.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} ) POST_BUILD
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windowsd.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} ) COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
) COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
)
elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 6.2)
# continue using qtaudio_windows.dll on Windows 7
else ()
# replace qtaudio_windows.dll with qtaudio_wasapi.dll on Windows 8/8.1/10
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windows.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windowsd.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
)
endif ()
endif () endif ()
endmacro() endmacro()

View file

@ -23,6 +23,11 @@
;Default installation folder ;Default installation folder
InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
;--------------------------------
;Include WinVer to get Windows version
!include "WinVer.nsh"
;-------------------------------- ;--------------------------------
;General ;General
; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges ; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges
@ -600,8 +605,16 @@ Section "-Core installation"
Delete "$INSTDIR\version" Delete "$INSTDIR\version"
Delete "$INSTDIR\xinput1_3.dll" Delete "$INSTDIR\xinput1_3.dll"
;Delete old Qt files ; The installer includes two different Qt audio plugins.
Delete "$INSTDIR\audio\qtaudio_windows.dll" ; On Windows 8 and above, only qtaudio_wasapi.dll should be installed.
; On Windows 7 and below, only qtaudio_windows.dll should be installed.
${If} ${AtLeastWin8}
Delete "$INSTDIR\audio\qtaudio_windows.dll"
Delete "$INSTDIR\audio\qtaudio_windows.pdb"
${Else}
Delete "$INSTDIR\audio\qtaudio_wasapi.dll"
Delete "$INSTDIR\audio\qtaudio_wasapi.pdb"
${EndIf}
; Delete old desktop shortcuts before they were renamed during Sandbox rename ; Delete old desktop shortcuts before they were renamed during Sandbox rename
Delete "$DESKTOP\@PRE_SANDBOX_INTERFACE_SHORTCUT_NAME@.lnk" Delete "$DESKTOP\@PRE_SANDBOX_INTERFACE_SHORTCUT_NAME@.lnk"

View file

@ -1364,7 +1364,7 @@ int AudioClient::setOutputBufferSize(int numFrames, bool persist) {
// proportional to the accelerator ratio. // proportional to the accelerator ratio.
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 1.0f; const float AudioClient::CALLBACK_ACCELERATOR_RATIO = IsWindows8OrGreater() ? 1.0f : 0.25f;
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC