Skip to content
Permalink
Browse files

rename stereo-offset to spatial-pan, apply pan as well as time offset

  • Loading branch information...
mmckegg committed Mar 28, 2017
1 parent 07be0ed commit 55757de3d7daadf0419473f7efeea4534b9d1d21
@@ -9,8 +9,8 @@ module.exports = function renderPanNode (node) {
Header(node, h('span', 'Pan')),
h('ParamList', [
ToggleButton(QueryParam(node, 'node'), {
title: 'Delay',
onValue: 'processor/stereo-offset',
title: 'Spatial',
onValue: 'processor/spatial-pan',
offValue: 'processor/pan'
}),
ModRange(node.offset, {
@@ -1,7 +1,7 @@
module.exports = {
name: 'Stereo Offset',
name: 'Spatial Pan',
spawn: false, // spawned by pan
node: 'processor/stereo-offset',
node: 'processor/spatial-pan',
group: 'processors',
object: require('./object'),
render: require('../pan/view')
@@ -4,13 +4,14 @@ var Apply = require('lib/apply-param')
var Multiply = require('lib/param-multiply')
var ParamClamp = require('lib/param-clamp')

module.exports = StereoOffsetNode
module.exports = SpatialPanNode

function StereoOffsetNode (context) {
function SpatialPanNode (context) {
var delayL = context.audio.createDelay(0.04)
var delayR = context.audio.createDelay(0.04)
var splitter = context.audio.createChannelSplitter(2)
var merger = context.audio.createChannelMerger(2)
var panner = context.audio.createStereoPanner()

splitter.channelCount = 2
splitter.channelCountMode = 'explicit'
@@ -19,10 +20,11 @@ function StereoOffsetNode (context) {
splitter.connect(delayR, 1)
delayL.connect(merger, 0, 0)
delayR.connect(merger, 0, 1)
merger.connect(panner)

var releases = []

var obs = Processor(context, splitter, merger, {
var obs = Processor(context, splitter, panner, {
offset: Param(context, 0.1)
}, releases)

@@ -32,6 +34,9 @@ function StereoOffsetNode (context) {
])),
Apply(context.audio, delayR.delayTime, Multiply([
ParamClamp(obs.offset, -1, 0), -0.003
])),
Apply(context.audio, panner.pan, Multiply([
obs.offset, 0.5
]))
)
return obs

0 comments on commit 55757de

Please sign in to comment.
You can’t perform that action at this time.