File tree 2 files changed +51
-0
lines changed
2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ harness = false
79
79
name = " resampler"
80
80
harness = false
81
81
82
+ [[bench ]]
83
+ name = " pipeline"
84
+ harness = false
85
+
82
86
[[example ]]
83
87
name = " music_m4a"
84
88
required-features = [" symphonia-isomp4" , " symphonia-aac" ]
Original file line number Diff line number Diff line change
1
+ use std:: time:: Duration ;
2
+
3
+ use divan:: Bencher ;
4
+ use rodio:: { source:: UniformSourceIterator , Source } ;
5
+
6
+ mod shared;
7
+ use shared:: music_wav;
8
+
9
+ fn main ( ) {
10
+ divan:: main ( ) ;
11
+ }
12
+
13
+ #[ divan:: bench]
14
+ fn long ( bencher : Bencher ) {
15
+ bencher. with_inputs ( || music_wav ( ) ) . bench_values ( |source| {
16
+ let mut take_dur = source
17
+ . high_pass ( 300 )
18
+ . amplify ( 1.2 )
19
+ . speed ( 0.9 )
20
+ . automatic_gain_control (
21
+ 1.0 , // target_level
22
+ 4.0 , // attack_time (in seconds)
23
+ 0.005 , // release_time (in seconds)
24
+ 5.0 , // absolute_max_gain
25
+ )
26
+ . delay ( Duration :: from_secs_f32 ( 0.5 ) )
27
+ . fade_in ( Duration :: from_secs_f32 ( 2.0 ) )
28
+ . take_duration ( Duration :: from_secs ( 10 ) ) ;
29
+ take_dur. set_filter_fadeout ( ) ;
30
+ let effects_applied = take_dur
31
+ . buffered ( )
32
+ . reverb ( Duration :: from_secs_f32 ( 0.05 ) , 0.3 )
33
+ . skippable ( ) ;
34
+ let resampled = UniformSourceIterator :: new ( effects_applied, 2 , 40_000 ) ;
35
+ resampled. for_each ( divan:: black_box_drop)
36
+ } )
37
+ }
38
+
39
+ #[ divan:: bench]
40
+ fn short ( bencher : Bencher ) {
41
+ bencher. with_inputs ( || music_wav ( ) ) . bench_values ( |source| {
42
+ source
43
+ . amplify ( 1.2 )
44
+ . low_pass ( 200 )
45
+ . for_each ( divan:: black_box_drop)
46
+ } )
47
+ }
You can’t perform that action at this time.
0 commit comments