meh / rust-openal

OpenAL wrapper
6 stars 4 forks source link

Capture.take() returns inconsistent Vec structure #2

Open esn01 opened 8 years ago

esn01 commented 8 years ago

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 commented 6 years ago

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");
  }
}