diff options
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; } |