11use bindings:: audio_unit as au;
22use error:: { self , Error } ;
33use libc;
4- use std:: marker:: PhantomData ;
54use super :: { AudioUnit , Element , Scope } ;
65
76pub use self :: action_flags:: ActionFlags ;
@@ -26,7 +25,7 @@ pub struct InputProcFnWrapper {
2625
2726/// Arguments given to the render callback function.
2827#[ derive( Copy , Clone ) ]
29- pub struct Args < ' a , D > {
28+ pub struct Args < D > {
3029 /// A type wrapping the the buffer that matches the expected audio format.
3130 pub data : D ,
3231 /// Timing information for the callback.
@@ -41,7 +40,6 @@ pub struct Args<'a, D> {
4140 pub bus_number : u32 ,
4241 /// The number of frames in the buffer as `usize` for easier indexing.
4342 pub num_frames : usize ,
44- callback_lifetime : PhantomData < & ' a ( ) > ,
4543}
4644
4745/// Format specific render callback data.
@@ -120,7 +118,7 @@ pub mod data {
120118 // }
121119
122120 /// A wrapper around the pointer to the `mBuffers` array.
123- pub struct NonInterleaved < ' a , S : ' a > {
121+ pub struct NonInterleaved < S > {
124122 /// A pointer to the first buffer.
125123 ///
126124 /// TODO: Work out why this works and `&'a mut [au::AudioBuffer]` does not!
@@ -129,7 +127,7 @@ pub mod data {
129127 num_buffers : usize ,
130128 /// The number of frames in each channel.
131129 frames : usize ,
132- sample_format : PhantomData < & ' a S > ,
130+ sample_format : PhantomData < S > ,
133131 }
134132
135133 /// An iterator produced by a `NoneInterleaved`, yielding a reference to each channel.
@@ -146,6 +144,8 @@ pub mod data {
146144 sample_format : PhantomData < S > ,
147145 }
148146
147+ unsafe impl < S > Send for NonInterleaved < S > where S : Send { }
148+
149149 impl < ' a , S > Iterator for Channels < ' a , S > {
150150 type Item = & ' a [ S ] ;
151151 #[ allow( non_snake_case) ]
@@ -170,7 +170,7 @@ pub mod data {
170170 }
171171 }
172172
173- impl < ' a , S > NonInterleaved < ' a , S > {
173+ impl < S > NonInterleaved < S > {
174174
175175 /// An iterator yielding a reference to each channel in the array.
176176 pub fn channels ( & self ) -> Channels < S > {
@@ -193,11 +193,11 @@ pub mod data {
193193 }
194194
195195 // Implementation for a non-interleaved linear PCM audio format.
196- impl < ' a , S > Data for NonInterleaved < ' a , S >
196+ impl < S > Data for NonInterleaved < S >
197197 where S : Sample ,
198198 {
199199 fn does_stream_format_match ( format : & StreamFormat ) -> bool {
200- // TODO: This is never set, in though the default ABSD on OS X is non-interleaved!
200+ // TODO: This is never set, even though the default ABSD on OS X is non-interleaved!
201201 // Should really investigate why this is.
202202 // format.flags.contains(linear_pcm_flags::IS_NON_INTERLEAVED) &&
203203 S :: sample_format ( ) . does_match_flags ( format. flags )
@@ -303,7 +303,7 @@ impl AudioUnit {
303303
304304 /// Pass a render callback (aka "Input Procedure") to the **AudioUnit**.
305305 pub fn set_render_callback < F , D > ( & mut self , mut f : F ) -> Result < ( ) , Error >
306- where F : for < ' a > FnMut ( Args < ' a , D > ) -> Result < ( ) , ( ) > + ' static ,
306+ where F : FnMut ( Args < D > ) -> Result < ( ) , ( ) > + ' static ,
307307 D : Data ,
308308 {
309309 // First, we'll retrieve the stream format so that we can ensure that the given callback
@@ -336,7 +336,6 @@ impl AudioUnit {
336336 flags : flags,
337337 bus_number : in_bus_number as u32 ,
338338 num_frames : in_number_frames as usize ,
339- callback_lifetime : PhantomData ,
340339 }
341340 } ;
342341
0 commit comments