Skip to content

Commit 1963c7a

Browse files
committed
Fix bug in returning proper channelCountMode for StereoPannerNode
1 parent 7a820c7 commit 1963c7a

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/node/stereo_panner.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ impl AudioNode for StereoPannerNode {
142142
1
143143
}
144144

145-
fn channel_count_mode(&self) -> ChannelCountMode {
146-
ChannelCountMode::ClampedMax
147-
}
148-
149145
fn set_channel_count_mode(&self, mode: ChannelCountMode) {
150146
assert_valid_channel_count_mode(mode);
151147
self.channel_config.set_count_mode(mode);
@@ -358,6 +354,24 @@ mod tests {
358354
}
359355
}
360356

357+
#[test]
358+
fn test_init_with_channel_count_mode() {
359+
let context = OfflineAudioContext::new(2, 1, 44_100.);
360+
let options = StereoPannerOptions {
361+
channel_config: ChannelConfigOptions {
362+
count_mode: ChannelCountMode::Explicit,
363+
..ChannelConfigOptions::default()
364+
},
365+
..StereoPannerOptions::default()
366+
};
367+
let panner = StereoPannerNode::new(&context, options);
368+
assert_eq!(
369+
panner.channel_config().count_mode(),
370+
ChannelCountMode::Explicit
371+
);
372+
assert_eq!(panner.channel_count_mode(), ChannelCountMode::Explicit);
373+
}
374+
361375
#[test]
362376
fn test_get_stereo_gains() {
363377
let sine_table = precomputed_sine_table();

0 commit comments

Comments
 (0)