Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running beep.rs example with ALSA only loads data to buffer once #142

Closed
whitespine opened this issue Dec 30, 2016 · 3 comments · Fixed by #145
Closed

Running beep.rs example with ALSA only loads data to buffer once #142

whitespine opened this issue Dec 30, 2016 · 3 comments · Fixed by #145
Labels

Comments

@whitespine
Copy link

whitespine commented Dec 30, 2016

No modifications were made to code. When I put println! statements in the stream.for_each closure, they only are called once. Issue persists with both version 0.4.0 and 0.4.1 of crate.

No panics or anything, and the program is properly blocking on the event_loop.run() call. Really not sure what could be going wrong. I can post more specific details of my system if that would help, but I'm fairly new to rust/audio stuff so not sure what would be relevant.

@nchashch
Copy link
Contributor

nchashch commented Jan 2, 2017

I tried to debug this problem and I have found that libc::poll call in EventLoop::run method in src/alsa/mod.rs at L258 doesn't return (it seems it just runs in an infinite loop) after a few iterations (hence a short bit of sound plays at the begining).

Also on my machine Buffer::finish method (defined at L674 in src/alsa/mod.rs) is called only once or twice (so alsa::snd_pcm_writei is called only once or twice) after that SamplesStream::schedule is called (maybe something goes wrong there) and then Buffer::finish is never called again.

@jwestfall69
Copy link
Contributor

Can you guys verify the above patch fixes the beep stall.

I'm a little unsatisfied with the patch with where I'm calling alsa::snd_pcm_sw_params_set_avail_min(),. Its inside the bits that are setting up buffer_len/period_len values, which seems like bad form.

@tomaka
Copy link
Collaborator

tomaka commented Jan 24, 2017

@jwestfall69 The style is not a problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants