File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ fn main() {
28
28
println ! ( "Sample rate: {:?}" , context. sample_rate( ) ) ;
29
29
println ! (
30
30
"Available channels: {}" ,
31
- context. destination( ) . max_channels_count ( )
31
+ context. destination( ) . max_channel_count ( )
32
32
) ;
33
33
34
34
println ! ( "Force output to two channels" ) ;
Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ fn main() {
35
35
// this should be clamped to MAX_CHANNELS (32), even if the soundcard can provide more channels
36
36
println ! (
37
37
"> Max channel count: {:?}" ,
38
- context. destination( ) . max_channels_count ( )
38
+ context. destination( ) . max_channel_count ( )
39
39
) ;
40
40
41
- let num_channels = 8 ;
41
+ let num_channels = context . destination ( ) . max_channel_count ( ) ;
42
42
43
43
context. destination ( ) . set_channel_count ( num_channels) ;
44
44
context
Original file line number Diff line number Diff line change @@ -49,13 +49,13 @@ impl AudioNode for AudioDestinationNode {
49
49
}
50
50
51
51
fn set_channel_count ( & self , v : usize ) {
52
- if self . registration . context ( ) . offline ( ) && v != self . max_channels_count ( ) {
52
+ if self . registration . context ( ) . offline ( ) && v != self . max_channel_count ( ) {
53
53
panic ! ( "NotSupportedError: not allowed to change OfflineAudioContext destination channel count" ) ;
54
54
}
55
- if v > self . max_channels_count ( ) {
55
+ if v > self . max_channel_count ( ) {
56
56
panic ! (
57
57
"IndexSizeError: channel count cannot be greater than maxChannelCount ({})" ,
58
- self . max_channels_count ( )
58
+ self . max_channel_count ( )
59
59
) ;
60
60
}
61
61
self . channel_config . set_count ( v) ;
@@ -104,7 +104,7 @@ impl AudioDestinationNode {
104
104
}
105
105
/// The maximum number of channels that the channelCount attribute can be set to (the max
106
106
/// number of channels that the hardware is capable of supporting).
107
- pub fn max_channels_count ( & self ) -> usize {
107
+ pub fn max_channel_count ( & self ) -> usize {
108
108
self . registration . context ( ) . base ( ) . max_channel_count ( )
109
109
}
110
110
}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ fn test_channels() {
83
83
} ;
84
84
85
85
let context = AudioContext :: new ( options) ;
86
- assert_eq ! ( context. destination( ) . max_channels_count ( ) , MAX_CHANNELS ) ;
86
+ assert_eq ! ( context. destination( ) . max_channel_count ( ) , MAX_CHANNELS ) ;
87
87
assert_eq ! ( context. destination( ) . channel_count( ) , 2 ) ;
88
88
89
89
context. destination ( ) . set_channel_count ( 5 ) ;
You can’t perform that action at this time.
0 commit comments