Skip to content

Commit

Permalink
StMoviePlayer - print HRTF specifier (active and list) in application…
Browse files Browse the repository at this point in the history
… About
  • Loading branch information
gkv311 committed Feb 17, 2025
1 parent e6544fe commit 3b27f12
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
51 changes: 46 additions & 5 deletions StMoviePlayer/StVideo/StALContext.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright © 2009-2023 Kirill Gavrilov <[email protected]>
* Copyright © 2009-2025 Kirill Gavrilov <[email protected]>
*
* StMoviePlayer program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -121,7 +121,25 @@ StString StALContext::toStringExtensions() const {
if(hasExtSoftHrtf) {
ALCint aHrtfStatus = ALC_HRTF_DISABLED_SOFT;
alcGetIntegerv(myAlDevice, ALC_HRTF_STATUS_SOFT, 1, &aHrtfStatus);
anExtList += StString("ALC_SOFT_HRTF [") + hrtfStatusToString(aHrtfStatus) + "] ";

anExtList += StString("ALC_SOFT_HRTF [");
anExtList += hrtfStatusToString(aHrtfStatus);

const StString aSpec = (alcGetString(myAlDevice, ALC_HRTF_SPECIFIER_SOFT));
if (!aSpec.isEmpty()) {
anExtList += StString("; specifier: '") + aSpec + "'";
}

ALCint aNbHrtfSpecs = 0;
alcGetIntegerv(myAlDevice, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &aNbHrtfSpecs);\
if (aNbHrtfSpecs != 0) {
anExtList += StString("; specifiers: ");
for (ALCint aSpecIter = 0; aSpecIter < aNbHrtfSpecs; ++aSpecIter) {
if (aSpecIter != 0) { anExtList += ","; }
anExtList += StString("'") + alcGetStringiSOFT(myAlDevice, ALC_HRTF_SPECIFIER_SOFT, aSpecIter) + "'";
}
}
anExtList += "] ";
}
return anExtList;
}
Expand Down Expand Up @@ -161,22 +179,45 @@ bool StALContext::create(const std::string& theDeviceName) {
}

void StALContext::fullInfo(StDictionary& theMap) const {
StString anExtensions, aHrtfState, aSoftOutput;
StString anExtensions, aSoftOutput;
StString aHrtfInfo, aHrtfState, aHrtfSpec, aHrtfSpecList;
if(hasExtFloat32) { anExtensions += "AL_EXT_float32 "; }
if(hasExtFloat64) { anExtensions += "AL_EXT_double "; }
if(hasExtMultiChannel){ anExtensions += "AL_EXT_MCFORMATS "; }
if(hasExtBFormat) { anExtensions += "AL_EXT_BFORMAT "; }
if(hasExtDisconnect) { anExtensions += "ALC_EXT_disconnect "; }
if(hasExtSoftOutMode) { anExtensions += "ALC_SOFT_output_mode "; }
if(hasExtSoftOutMode) {
anExtensions += "ALC_SOFT_output_mode ";

ALCint anOutMode = ALC_ANY_SOFT;
alcGetIntegerv(myAlDevice, ALC_OUTPUT_MODE_SOFT, 1, &anOutMode);
aSoftOutput = outputModeToString(anOutMode);
}
if(hasExtSoftHrtf) {
anExtensions += "ALC_SOFT_HRTF ";

ALCint aHrtfStatus = ALC_HRTF_DISABLED_SOFT;
alcGetIntegerv(myAlDevice, ALC_HRTF_STATUS_SOFT, 1, &aHrtfStatus);
aHrtfState = hrtfStatusToString(aHrtfStatus);

aHrtfSpec = alcGetString(myAlDevice, ALC_HRTF_SPECIFIER_SOFT);

ALCint aNbHrtfSpecs = 0;
alcGetIntegerv(myAlDevice, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &aNbHrtfSpecs);\
if (aNbHrtfSpecs != 0) {
for (ALCint aSpecIter = 0; aSpecIter < aNbHrtfSpecs; ++aSpecIter) {
if (aSpecIter != 0) { aHrtfSpecList += ", "; }
aHrtfSpecList += StString("'") + alcGetStringiSOFT(myAlDevice, ALC_HRTF_SPECIFIER_SOFT, aSpecIter) + "'";
}
}

aHrtfInfo = StString("State: ") + aHrtfState;
if (!aHrtfSpec.isEmpty()) {
aHrtfInfo += StString("\nSpecifier: '") + aHrtfSpec + "'";
}
if (aNbHrtfSpecs != 0) {
aHrtfInfo += StString("\nSpecifiers: ") + aHrtfSpecList;
}
}

ALCint aFreq = 0;
Expand All @@ -195,7 +236,7 @@ void StALContext::fullInfo(StDictionary& theMap) const {
if(!aSoftOutput.isEmpty()) {
theMap.add(StDictEntry("OpenAL output mode", aSoftOutput));
}
theMap.add(StDictEntry("OpenAL HRTF mixing", !aHrtfState.isEmpty() ? aHrtfState : "Not implemented"));
theMap.add(StDictEntry("OpenAL HRTF mixing", !aHrtfInfo.isEmpty() ? aHrtfInfo : "Not implemented"));
}

void StALContext::destroy() {
Expand Down
2 changes: 1 addition & 1 deletion StMoviePlayer/StVideo/StALContext.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright © 2009-2023 Kirill Gavrilov <[email protected]>
* Copyright © 2009-2025 Kirill Gavrilov <[email protected]>
*
* StMoviePlayer program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down

0 comments on commit 3b27f12

Please sign in to comment.