aboutsummaryrefslogtreecommitdiffstats
path: root/examples/alffplay.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-12-15 02:54:15 -0800
committerChris Robinson <[email protected]>2021-12-15 02:54:15 -0800
commita051909c3595b9850147e71bdf2d987013ed31f4 (patch)
tree11e287fefbd48d4ca5859b5847f570fc7fed3903 /examples/alffplay.cpp
parent54c4bea48791f353baf66917f967ef3a39af9b0b (diff)
Add an option to use Super Stereo in alffplay
Diffstat (limited to 'examples/alffplay.cpp')
-rw-r--r--examples/alffplay.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp
index 768c30c8..4c505c57 100644
--- a/examples/alffplay.cpp
+++ b/examples/alffplay.cpp
@@ -97,6 +97,10 @@ typedef void (AL_APIENTRY*LPALGETBUFFERPTRVSOFT)(ALuint buffer, ALenum param, AL
#define AL_FORMAT_UHJ4CHN8_SOFT 0x19A8
#define AL_FORMAT_UHJ4CHN16_SOFT 0x19A9
#define AL_FORMAT_UHJ4CHN_FLOAT32_SOFT 0x19AA
+#define AL_STEREO_MODE_SOFT 0x19B0
+#define AL_NORMAL_SOFT 0x0000
+#define AL_SUPER_STEREO_SOFT 0x0001
+#define AL_SUPER_STEREO_WIDTH_SOFT 0x19B1
#endif
#endif /* ALLOW_EXPERIMENTAL_EXTS */
}
@@ -122,6 +126,7 @@ const std::string AppName{"alffplay"};
ALenum DirectOutMode{AL_FALSE};
bool EnableWideStereo{false};
bool EnableUhjDecode{false};
+bool EnableSuperStereo{false};
bool DisableVideo{false};
LPALGETSOURCEI64VSOFT alGetSourcei64vSOFT;
LPALCGETINTEGER64VSOFT alcGetInteger64vSOFT;
@@ -1249,6 +1254,10 @@ int AudioState::handler()
}
}
#endif
+#ifdef AL_SOFT_UHJ
+ if(EnableSuperStereo)
+ alSourcei(mSource, AL_STEREO_MODE_SOFT, AL_SUPER_STEREO_SOFT);
+#endif
if(alGetError() != AL_NO_ERROR)
goto finish;
@@ -2055,6 +2064,20 @@ int main(int argc, char *argv[])
std::cerr<< "AL_SOFT_UHJ not supported for UHJ decoding" <<std::endl;
#endif
}
+ else if(strcmp(argv[fileidx], "-superstereo") == 0)
+ {
+#ifdef AL_SOFT_UHJ
+ if(!alIsExtensionPresent("AL_SOFTX_UHJ"))
+ std::cerr<< "AL_SOFT_UHJ not supported for Super Stereo decoding" <<std::endl;
+ else
+ {
+ std::cout<< "Found AL_SOFT_UHJ" <<std::endl;
+ EnableSuperStereo = true;
+ }
+#else
+ std::cerr<< "AL_SOFT_UHJ not supported for Super Stereo decoding" <<std::endl;
+#endif
+ }
else if(strcmp(argv[fileidx], "-novideo") == 0)
DisableVideo = true;
else