From 9f6d9a5534b3f9a94dc7cbd854a6429274223fb0 Mon Sep 17 00:00:00 2001 From: vboxsync Date: Mon, 10 May 2021 07:19:31 +0000 Subject: Audio/VaKit: Added driver backends for MacOS and Windows. bugref:10008 git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@88959 cfe28804-0f27-0410-a406-dd0f0b0b656f --- src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp | 6 +++++- src/VBox/Devices/Audio/DrvHostAudioDSound.cpp | 7 ++++++- src/VBox/Devices/Audio/DrvHostAudioWasApi.cpp | 6 +++++- src/VBox/Devices/Audio/VBoxDDVKAT.h | 7 +++++++ src/VBox/ValidationKit/utils/audio/vkat.cpp | 23 ++++++++++++++++++++--- 5 files changed, 43 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp b/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp index 37bf49ded6b..9836e08414f 100644 --- a/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp +++ b/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp @@ -24,7 +24,11 @@ #include #include -#include "VBoxDD.h" +#ifdef VBOX_AUDIO_VKAT +# include "VBoxDDVKAT.h" +#else +# include "VBoxDD.h" +#endif #include #include diff --git a/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp b/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp index 9e5db508785..be273940304 100644 --- a/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp +++ b/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp @@ -35,7 +35,12 @@ #include #include -#include "VBoxDD.h" +#ifdef VBOX_AUDIO_VKAT +# include "VBoxDDVKAT.h" +#else +# include "VBoxDD.h" +#endif + #ifdef VBOX_WITH_AUDIO_MMNOTIFICATION_CLIENT # include /* For bad_alloc. */ # include "DrvHostAudioDSoundMMNotifClient.h" diff --git a/src/VBox/Devices/Audio/DrvHostAudioWasApi.cpp b/src/VBox/Devices/Audio/DrvHostAudioWasApi.cpp index c806a912ff2..bc2f760232f 100644 --- a/src/VBox/Devices/Audio/DrvHostAudioWasApi.cpp +++ b/src/VBox/Devices/Audio/DrvHostAudioWasApi.cpp @@ -44,7 +44,11 @@ #include /* std::bad_alloc */ -#include "VBoxDD.h" +#ifdef VBOX_AUDIO_VKAT +# include "VBoxDDVKAT.h" +#else +# include "VBoxDD.h" +#endif /********************************************************************************************************************************* diff --git a/src/VBox/Devices/Audio/VBoxDDVKAT.h b/src/VBox/Devices/Audio/VBoxDDVKAT.h index ca6d3be71ff..d6e4b75811f 100644 --- a/src/VBox/Devices/Audio/VBoxDDVKAT.h +++ b/src/VBox/Devices/Audio/VBoxDDVKAT.h @@ -149,5 +149,12 @@ extern const PDMDRVREG g_DrvHostALSAAudio; #ifdef VBOX_WITH_AUDIO_OSS extern const PDMDRVREG g_DrvHostOSSAudio; #endif +#if defined(RT_OS_WINDOWS) +extern const PDMDRVREG g_DrvHostAudioWas; +extern const PDMDRVREG g_DrvHostDSound; +#endif +#if defined(RT_OS_DARWIN) +extern const PDMDRVREG g_DrvHostCoreAudio; +#endif #endif /* !VBOX_INCLUDED_SRC_Audio_VBoxDDVKAT_h */ diff --git a/src/VBox/ValidationKit/utils/audio/vkat.cpp b/src/VBox/ValidationKit/utils/audio/vkat.cpp index c8b3ec70262..5bd5af82db1 100644 --- a/src/VBox/ValidationKit/utils/audio/vkat.cpp +++ b/src/VBox/ValidationKit/utils/audio/vkat.cpp @@ -502,8 +502,17 @@ int mainTest(int argc, char **argv) if ( !RTStrICmp(ValueUnion.psz, "oss")) pDrvReg = &g_DrvHostOSSAudio; #endif - /** @todo Add more backends here. */ - +#if defined(RT_OS_DARWIN) + if ( !RTStrICmp(ValueUnion.psz, "coreaudio")) + pDrvReg = &g_DrvHostCoreAudio; +#endif +#if defined(RT_OS_WINDOWS) + if ( !RTStrICmp(ValueUnion.psz, "wasapi")) + pDrvReg = &g_DrvHostAudioWas; + else if ( !RTStrICmp(ValueUnion.psz, "directsound") + || !RTStrICmp(ValueUnion.psz, "dsound") + pDrvReg = &g_DrvHostDSound; +#endif if (pDrvReg == NULL) return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid / unsupported backend '%s' specified\n", ValueUnion.psz); break; @@ -584,9 +593,17 @@ int mainTest(int argc, char **argv) */ RTTestBanner(g_hTest); - /* If no backend is specified, go with the ALSA one by default. */ + /* If no backend is specified, go with the default backend for that OS. */ if (pDrvReg == NULL) +#if defined(RT_OS_WINDOWS) + pDrvReg = &g_DrvHostAudioWas; +#elif defined(RT_OS_DARWIN) + pDrvReg = &g_DrvHostCoreAudio; +#elif defined(RT_OS_SOLARIS) + pDrvReg = &g_DrvHostOSSAudio; +#else pDrvReg = &g_DrvHostALSAAudio; +#endif PPDMIHOSTAUDIO pDrvAudio; rc = audioTestDrvConstruct(pDrvReg, &g_DrvIns, &pDrvAudio); -- cgit v1.2.1