diff options
author | Chris Robinson <[email protected]> | 2016-08-29 01:55:44 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-08-29 01:55:44 -0700 |
commit | 4859984e33bafa242f068da44d9eb5ca73c39632 (patch) | |
tree | e148c21e81d95f1a226514a8f955d91af1066595 /examples/alffplay.c | |
parent | 54649851fa8769c2290741c63e2255b13eec3824 (diff) |
Add an option to alffplay to toggle AL_DIRECT_CHANNELS_SOFT
Using the 'd' key will toggle the playback source's AL_DIRECT_CHANNELS_SOFT
property. Although there is no visual feedback showing when it's on or off.
Diffstat (limited to 'examples/alffplay.c')
-rw-r--r-- | examples/alffplay.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/alffplay.c b/examples/alffplay.c index b9acbb8e..16684c5e 100644 --- a/examples/alffplay.c +++ b/examples/alffplay.c @@ -33,6 +33,7 @@ #include "AL/alext.h" +static bool has_direct_out = false; static bool has_latency_check = false; static LPALGETSOURCEDVSOFT alGetSourcedvSOFT; @@ -140,6 +141,7 @@ typedef struct MovieState { volatile bool seek_req; int64_t seek_pos; + volatile bool direct_req; int av_sync_type; @@ -750,6 +752,17 @@ static int audio_thread(void *userdata) } SDL_Delay(AUDIO_BUFFER_TIME); + if(movState->direct_req) + { + if(has_direct_out) + { + alGetSourcei(movState->audio.source, AL_DIRECT_CHANNELS_SOFT, &state); + alSourcei(movState->audio.source, AL_DIRECT_CHANNELS_SOFT, + state ? AL_FALSE : AL_TRUE); + } + movState->direct_req = false; + } + almtx_lock(&movState->audio.src_mutex); } almtx_unlock(&movState->audio.src_mutex); @@ -1397,6 +1410,11 @@ int main(int argc, char *argv[]) return 1; } + if(!alIsExtensionPresent("AL_SOFT_direct_channels")) + fprintf(stderr, "AL_SOFT_direct_channels not supported.\n"); + else + has_direct_out = true; + if(!alIsExtensionPresent("AL_SOFT_source_latency")) fprintf(stderr, "AL_SOFT_source_latency not supported, audio may be a bit laggy.\n"); else @@ -1475,6 +1493,10 @@ int main(int argc, char *argv[]) stream_seek(movState, -30.0); break; + case SDLK_d: + movState->direct_req = true; + break; + default: break; } |