File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -67,5 +67,20 @@ describe("Panner", () => {
67
67
expect ( r [ 0 ] ) . to . be . closeTo ( 0.707 , 0.01 ) ;
68
68
} ) ;
69
69
} ) ;
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
+ } ) ;
70
85
} ) ;
71
86
} ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { readOnly } from "../../core/util/Interface";
6
6
7
7
interface TonePannerOptions extends ToneAudioNodeOptions {
8
8
pan : AudioRange ;
9
+ channelCount : number ;
9
10
}
10
11
11
12
/**
@@ -55,7 +56,7 @@ export class Panner extends ToneAudioNode<TonePannerOptions> {
55
56
// this is necessary for standardized-audio-context
56
57
// doesn't make any difference for the native AudioContext
57
58
// https://github.com/chrisguttandin/standardized-audio-context/issues/647
58
- this . _panner . channelCount = 1 ;
59
+ this . _panner . channelCount = options . channelCount ;
59
60
this . _panner . channelCountMode = "explicit" ;
60
61
61
62
// initial value
@@ -65,6 +66,7 @@ export class Panner extends ToneAudioNode<TonePannerOptions> {
65
66
static getDefaults ( ) : TonePannerOptions {
66
67
return Object . assign ( ToneAudioNode . getDefaults ( ) , {
67
68
pan : 0 ,
69
+ channelCount : 1 ,
68
70
} ) ;
69
71
}
70
72
You can’t perform that action at this time.
0 commit comments