Skip to content

Commit

Permalink
Merge pull request #2 from kedder/pulseaudio-wait
Browse files Browse the repository at this point in the history
Wait for pulseaudio to start up
  • Loading branch information
linuxianer99 authored Apr 8, 2020
2 parents 251302c + 35f5a75 commit def9d66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion audiovario.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,16 @@ void start_pcm() {

pa_threaded_mainloop_lock(mainloop);
assert(pa_threaded_mainloop_start(mainloop) == 0);
assert(pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) == 0);

printf("Connecting to pulseaudio...\n");
assert(pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN | PA_CONTEXT_NOFAIL, NULL) == 0);
for(;;) {
pa_context_state_t context_state = pa_context_get_state(context);
assert(PA_CONTEXT_IS_GOOD(context_state));
if (context_state == PA_CONTEXT_READY) break;
pa_threaded_mainloop_wait(mainloop);
}
printf("Connection to pulseaudio established.\n");

pa_sample_spec sample_specifications;
sample_specifications.format = FORMAT;
Expand Down

0 comments on commit def9d66

Please sign in to comment.