File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,5 +67,20 @@ describe("Panner", () => {
6767 expect ( r [ 0 ] ) . to . be . closeTo ( 0.707 , 0.01 ) ;
6868 } ) ;
6969 } ) ;
70+
71+ it ( "can chain two panners when channelCount is 2" , ( ) => {
72+ return Offline ( ( ) => {
73+ const panner1 = new Panner ( {
74+ channelCount : 2 ,
75+ } ) . toDestination ( ) ;
76+ const panner0 = new Panner ( - 1 ) . connect ( panner1 ) ;
77+ new Signal ( 1 ) . connect ( panner0 ) ;
78+ } , 0.1 , 2 ) . then ( ( buffer ) => {
79+ const l = buffer . toArray ( ) [ 0 ] ;
80+ const r = buffer . toArray ( ) [ 1 ] ;
81+ expect ( l [ 0 ] ) . to . be . closeTo ( 1 , 0.01 ) ;
82+ expect ( r [ 0 ] ) . to . be . closeTo ( 0 , 0.01 ) ;
83+ } ) ;
84+ } ) ;
7085 } ) ;
7186} ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { readOnly } from "../../core/util/Interface";
66
77interface TonePannerOptions extends ToneAudioNodeOptions {
88 pan : AudioRange ;
9+ channelCount : number ;
910}
1011
1112/**
@@ -55,7 +56,7 @@ export class Panner extends ToneAudioNode<TonePannerOptions> {
5556 // this is necessary for standardized-audio-context
5657 // doesn't make any difference for the native AudioContext
5758 // https://github.com/chrisguttandin/standardized-audio-context/issues/647
58- this . _panner . channelCount = 1 ;
59+ this . _panner . channelCount = options . channelCount ;
5960 this . _panner . channelCountMode = "explicit" ;
6061
6162 // initial value
@@ -65,6 +66,7 @@ export class Panner extends ToneAudioNode<TonePannerOptions> {
6566 static getDefaults ( ) : TonePannerOptions {
6667 return Object . assign ( ToneAudioNode . getDefaults ( ) , {
6768 pan : 0 ,
69+ channelCount : 1 ,
6870 } ) ;
6971 }
7072
You can’t perform that action at this time.
0 commit comments