Skip to content

Instantly share code, notes, and snippets.

@azizulhakim
Created June 19, 2015 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azizulhakim/d24a36ef753f9a1536fa to your computer and use it in GitHub Desktop.
Save azizulhakim/d24a36ef753f9a1536fa to your computer and use it in GitHub Desktop.
frame_bytes = runtime->frame_bits >> 3;
chunk_length = 4096 / frame_bytes;
pcm_buffer_size = snd_pcm_lib_buffer_bytes(substream);
period_elapsed = 0;
audio->buffer_pos += chunk_length;
if (audio->buffer_pos >= pcm_buffer_size)
audio->buffer_pos -= pcm_buffer_size;
audio->period_pos += chunk_length;
if (audio->period_pos >= runtime->period_size) {
audio->period_pos %= runtime->period_size;
period_elapsed = 1;
}
if (period_elapsed)
snd_pcm_period_elapsed(substream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment