Add 7.1 surround sound support for SDL audio output

This commit is contained in:
Cameron Gutman
2020-04-03 00:12:52 -07:00
parent 847cc0a38a
commit cd7649a666
6 changed files with 17 additions and 12 deletions
+2 -4
View File
@@ -174,8 +174,7 @@ NvHTTP::launchApp(int appId,
"&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" : "&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" :
"")+ "")+
"&localAudioPlayMode="+QString::number(localAudio ? 1 : 0)+ "&localAudioPlayMode="+QString::number(localAudio ? 1 : 0)+
"&surroundAudioInfo="+QString::number(CHANNEL_MASK_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration) << 16 | "&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration))+
CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration))+
"&remoteControllersBitmap="+QString::number(gamepadMask)+ "&remoteControllersBitmap="+QString::number(gamepadMask)+
"&gcmap="+QString::number(gamepadMask), "&gcmap="+QString::number(gamepadMask),
LAUNCH_TIMEOUT_MS); LAUNCH_TIMEOUT_MS);
@@ -197,8 +196,7 @@ NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig)
"resume", "resume",
"rikey="+QString(QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex())+ "rikey="+QString(QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex())+
"&rikeyid="+QString::number(riKeyId)+ "&rikeyid="+QString::number(riKeyId)+
"&surroundAudioInfo="+QString::number(CHANNEL_MASK_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration) << 16 | "&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration)),
CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration)),
RESUME_TIMEOUT_MS); RESUME_TIMEOUT_MS);
// Throws if the request failed // Throws if the request failed
+1
View File
@@ -252,6 +252,7 @@ StreamCommandLineParser::StreamCommandLineParser()
m_AudioConfigMap = { m_AudioConfigMap = {
{"stereo", StreamingPreferences::AC_STEREO}, {"stereo", StreamingPreferences::AC_STEREO},
{"5.1-surround", StreamingPreferences::AC_51_SURROUND}, {"5.1-surround", StreamingPreferences::AC_51_SURROUND},
{"7.1-surround", StreamingPreferences::AC_71_SURROUND},
}; };
m_VideoCodecMap = { m_VideoCodecMap = {
{"auto", StreamingPreferences::VCC_AUTO}, {"auto", StreamingPreferences::VCC_AUTO},
+4
View File
@@ -480,6 +480,10 @@ Flickable {
text: "5.1 surround sound" text: "5.1 surround sound"
val: StreamingPreferences.AC_51_SURROUND val: StreamingPreferences.AC_51_SURROUND
} }
ListElement {
text: "7.1 surround sound"
val: StreamingPreferences.AC_71_SURROUND
}
} }
// ::onActivated must be used, as it only listens for when the index is changed by a human // ::onActivated must be used, as it only listens for when the index is changed by a human
onActivated : { onActivated : {
+2 -1
View File
@@ -20,7 +20,8 @@ public:
enum AudioConfig enum AudioConfig
{ {
AC_STEREO, AC_STEREO,
AC_51_SURROUND AC_51_SURROUND,
AC_71_SURROUND
}; };
Q_ENUM(AudioConfig) Q_ENUM(AudioConfig)
+7 -6
View File
@@ -389,10 +389,13 @@ bool Session::initialize()
switch (m_Preferences->audioConfig) switch (m_Preferences->audioConfig)
{ {
case StreamingPreferences::AC_STEREO: case StreamingPreferences::AC_STEREO:
m_StreamConfig.audioConfiguration = MAKE_AUDIO_CONFIGURATION(2, 0x3); m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
break; break;
case StreamingPreferences::AC_51_SURROUND: case StreamingPreferences::AC_51_SURROUND:
m_StreamConfig.audioConfiguration = MAKE_AUDIO_CONFIGURATION(6, 0xFC); m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_51_SURROUND;
break;
case StreamingPreferences::AC_71_SURROUND:
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_71_SURROUND;
break; break;
} }
@@ -607,11 +610,9 @@ bool Session::validateLaunch(SDL_Window* testWindow)
// Gracefully degrade to stereo if surround sound doesn't work // Gracefully degrade to stereo if surround sound doesn't work
if (!audioTestPassed && CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration) > 2) { if (!audioTestPassed && CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration) > 2) {
int fallbackAudioConfig = MAKE_AUDIO_CONFIGURATION(2, 0x3); audioTestPassed = testAudio(AUDIO_CONFIGURATION_STEREO);
audioTestPassed = testAudio(fallbackAudioConfig);
if (audioTestPassed) { if (audioTestPassed) {
m_StreamConfig.audioConfiguration = fallbackAudioConfig; m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
emitLaunchWarning("Your selected surround sound setting is not supported by the current audio device."); emitLaunchWarning("Your selected surround sound setting is not supported by the current audio device.");
} }
} }