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

Capture.take() returns inconsistent Vec structure #2

Open
esn01 opened this issue Dec 16, 2015 · 1 comment
Open

Capture.take() returns inconsistent Vec structure #2

esn01 opened this issue Dec 16, 2015 · 1 comment

Comments

@esn01
Copy link

esn01 commented Dec 16, 2015

alcCaptureSamples fills the memory of the result structure (Vec) only.
Capture.take() needs to call result.set_len(self.len()) after call to alcCaptureSamples().

@sbditto85
Copy link

sbditto85 commented Apr 18, 2018

If anyone is wondering why take is returning an Ok([]) that is why. you can "fix" it by doing something like:

let mut res = cap.take();
match res {
  Ok(mut v) => {
    unsafe {v.set_len(num_samples); }
    println!("{:?}", v);
  },
  Err(_) => {
    println!("couldn't get samples");
  }
}

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

No branches or pull requests

2 participants