Add an option to enable direct channels for alffplay

This commit is contained in:
Chris Robinson 2017-07-01 19:18:57 -07:00
parent a14f651034
commit cb83f48105

View File

@ -40,6 +40,7 @@ namespace
static const std::string AppName("alffplay");
static bool do_direct_out = false;
static bool has_latency_check = false;
static LPALGETSOURCEDVSOFT alGetSourcedvSOFT;
@ -730,6 +731,17 @@ int AudioState::handler()
alGenBuffers(AUDIO_BUFFER_QUEUE_SIZE, mBuffers);
alGenSources(1, &mSource);
if(do_direct_out)
{
if(!alIsExtensionPresent("AL_SOFT_direct_channels"))
std::cerr<< "AL_SOFT_direct_channels not supported for direct output" <<std::endl;
else
{
alSourcei(mSource, AL_DIRECT_CHANNELS_SOFT, AL_TRUE);
std::cout<< "Direct out enabled" <<std::endl;
}
}
while(alGetError() == AL_NO_ERROR && !mMovie->mQuit.load())
{
/* First remove any processed buffers. */
@ -1437,6 +1449,12 @@ int main(int argc, char *argv[])
return 1;
}
if(fileidx < argc && strcmp(argv[fileidx], "-direct") == 0)
{
++fileidx;
do_direct_out = true;
}
while(fileidx < argc && !movState)
{
movState = std::unique_ptr<MovieState>(new MovieState(argv[fileidx++]));