Skip to content

Commit c5f95ca

Browse files
committed
fix: rename max_channels_count to max_channel_count
cf. https://webaudio.github.io/web-audio-api/#dom-audiodestinationnode-maxchannelcount
1 parent b97cc68 commit c5f95ca

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

examples/merger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn main() {
2828
println!("Sample rate: {:?}", context.sample_rate());
2929
println!(
3030
"Available channels: {}",
31-
context.destination().max_channels_count()
31+
context.destination().max_channel_count()
3232
);
3333

3434
println!("Force output to two channels");

examples/multichannel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ fn main() {
3535
// this should be clamped to MAX_CHANNELS (32), even if the soundcard can provide more channels
3636
println!(
3737
"> Max channel count: {:?}",
38-
context.destination().max_channels_count()
38+
context.destination().max_channel_count()
3939
);
4040

41-
let num_channels = 8;
41+
let num_channels = context.destination().max_channel_count();
4242

4343
context.destination().set_channel_count(num_channels);
4444
context

src/node/destination.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ impl AudioNode for AudioDestinationNode {
4949
}
5050

5151
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() {
5353
panic!("NotSupportedError: not allowed to change OfflineAudioContext destination channel count");
5454
}
55-
if v > self.max_channels_count() {
55+
if v > self.max_channel_count() {
5656
panic!(
5757
"IndexSizeError: channel count cannot be greater than maxChannelCount ({})",
58-
self.max_channels_count()
58+
self.max_channel_count()
5959
);
6060
}
6161
self.channel_config.set_count(v);
@@ -104,7 +104,7 @@ impl AudioDestinationNode {
104104
}
105105
/// The maximum number of channels that the channelCount attribute can be set to (the max
106106
/// 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 {
108108
self.registration.context().base().max_channel_count()
109109
}
110110
}

tests/online.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn test_channels() {
8383
};
8484

8585
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);
8787
assert_eq!(context.destination().channel_count(), 2);
8888

8989
context.destination().set_channel_count(5);

0 commit comments

Comments
 (0)