@@ -5,13 +5,13 @@ extern crate coreaudio;
5
5
use std:: collections:: VecDeque ;
6
6
use std:: sync:: { Arc , Mutex } ;
7
7
8
- use coreaudio:: audio_unit:: { AudioUnit , Element , SampleFormat , Scope , StreamFormat } ;
9
8
use coreaudio:: audio_unit:: audio_format:: LinearPcmFlags ;
10
9
use coreaudio:: audio_unit:: render_callback:: { self , data} ;
10
+ use coreaudio:: audio_unit:: { AudioUnit , Element , SampleFormat , Scope , StreamFormat } ;
11
11
use coreaudio:: sys:: * ;
12
12
13
-
14
- type S = f32 ; const SAMPLE_FORMAT : SampleFormat = SampleFormat :: F32 ;
13
+ type S = f32 ;
14
+ const SAMPLE_FORMAT : SampleFormat = SampleFormat :: F32 ;
15
15
// type S = i32; const SAMPLE_FORMAT: SampleFormat = SampleFormat::I32;
16
16
// type S = i16; const SAMPLE_FORMAT: SampleFormat = SampleFormat::I16;
17
17
// type S = i8; const SAMPLE_FORMAT: SampleFormat = SampleFormat::I8;
@@ -34,7 +34,9 @@ pub fn run_example() -> Result<(), coreaudio::Error> {
34
34
35
35
let format_flag = match SAMPLE_FORMAT {
36
36
SampleFormat :: F32 => LinearPcmFlags :: IS_FLOAT ,
37
- SampleFormat :: I32 | SampleFormat :: I16 | SampleFormat :: I8 => LinearPcmFlags :: IS_SIGNED_INTEGER ,
37
+ SampleFormat :: I32 | SampleFormat :: I16 | SampleFormat :: I8 => {
38
+ LinearPcmFlags :: IS_SIGNED_INTEGER
39
+ }
38
40
} ;
39
41
40
42
// Using IS_NON_INTERLEAVED everywhere because data::Interleaved is commented out / not implemented
@@ -61,8 +63,18 @@ pub fn run_example() -> Result<(), coreaudio::Error> {
61
63
println ! ( "output_asbd={:#?}" , & out_stream_format. to_asbd( ) ) ;
62
64
63
65
let id = kAudioUnitProperty_StreamFormat;
64
- input_audio_unit. set_property ( id, Scope :: Output , Element :: Input , Some ( & in_stream_format. to_asbd ( ) ) ) ?;
65
- output_audio_unit. set_property ( id, Scope :: Input , Element :: Output , Some ( & out_stream_format. to_asbd ( ) ) ) ?;
66
+ input_audio_unit. set_property (
67
+ id,
68
+ Scope :: Output ,
69
+ Element :: Input ,
70
+ Some ( & in_stream_format. to_asbd ( ) ) ,
71
+ ) ?;
72
+ output_audio_unit. set_property (
73
+ id,
74
+ Scope :: Input ,
75
+ Element :: Output ,
76
+ Some ( & out_stream_format. to_asbd ( ) ) ,
77
+ ) ?;
66
78
67
79
let buffer_left = Arc :: new ( Mutex :: new ( VecDeque :: < S > :: new ( ) ) ) ;
68
80
let producer_left = buffer_left. clone ( ) ;
0 commit comments