Properly shutdown the AudioUnit on drop

This commit is contained in:
mitchmindtree 2015-02-28 06:43:15 +11:00
parent f212d85889
commit d6470de74c
1 changed files with 9 additions and 0 deletions

View File

@ -72,6 +72,15 @@ impl Voice {
}
}
impl Drop for Voice {
fn drop(&mut self) {
unsafe {
check_errors(au::AudioOutputUnitStop(*self.audio_unit)).unwrap();
check_errors(au::AudioUnitUninitialize(*self.audio_unit)).unwrap();
}
}
}
impl<'a, T> Buffer<'a, T> {
pub fn get_buffer<'b>(&'b mut self) -> &'b mut [T] {
&mut self.samples[..]