问题
I want to create a very basic AudioContext()-instance playing a sound either on the left or on the right channel.
I know, there is already an answer about this here: https://stackoverflow.com/a/20850704/1138860
My problem is, I have to control the gain via a GainNode.
Whenever I conntect the GainNode, it makes the left/right channel to output sound again.
I extended the original Example from the answer with a GainNode: http://jsbin.com/cofiwugeca/4/edit?js,output
回答1:
It looks like you connect the source to the gain node and then connect the gain node directly to the destination. So now your source is gets to the destination via the panner and the gain node. Connect your gain node to the panner instead of the destination. I think that will fix it.
来源:https://stackoverflow.com/questions/28111136/web-audio-api-pan-audio-left-right-controlling-gain