Skip to content

Commit 40c6d9e

Browse files
committed
AudioDestinationNode: mention spec in comments
1 parent 186a11c commit 40c6d9e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/node/destination.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,24 @@ impl AudioNode for AudioDestinationNode {
5555
}
5656

5757
fn set_channel_count(&self, v: usize) {
58+
// <https://webaudio.github.io/web-audio-api/#AudioDestinationNode>
59+
// numberOfChannels is the number of channels specified when constructing the
60+
// OfflineAudioContext. This value may not be changed; a NotSupportedError exception MUST
61+
// be thrown if channelCount is changed to a different value.
62+
//
63+
// <https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount>
64+
// The channel count cannot be changed. An InvalidStateError exception MUST be thrown for
65+
// any attempt to change the value.
66+
//
67+
// TODO spec issue: NotSupportedError or InvalidStateError?
5868
assert!(
5969
!self.registration.context().offline() || v == self.max_channel_count(),
6070
"NotSupportedError - not allowed to change OfflineAudioContext destination channel count"
6171
);
6272

73+
// <https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount>
74+
// The channel count MUST be between 1 and maxChannelCount. An IndexSizeError exception
75+
// MUST be thrown for any attempt to set the count outside this range.
6376
assert!(
6477
v <= self.max_channel_count(),
6578
"IndexSizeError - channel count cannot be greater than maxChannelCount ({})",
@@ -70,7 +83,11 @@ impl AudioNode for AudioDestinationNode {
7083
}
7184

7285
fn set_channel_count_mode(&self, v: ChannelCountMode) {
73-
// [spec] If the AudioDestinationNode is the destination node of an
86+
// <https://webaudio.github.io/web-audio-api/#AudioDestinationNode>
87+
// For an OfflineAudioContext, the defaults are [..] channelCountMode: "explicit"
88+
//
89+
// <https://webaudio.github.io/web-audio-api/#dom-audionode-channelcountmode>
90+
// If the AudioDestinationNode is the destination node of an
7491
// OfflineAudioContext, then the channel count mode cannot be changed.
7592
// An InvalidStateError exception MUST be thrown for any attempt to change the value.
7693
assert!(

0 commit comments

Comments
 (0)