MCPcopy Create free account
hub / github.com/LabSound/LabSound / PannerNode

Method PannerNode

src/core/PannerNode.cpp:73–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73PannerNode::PannerNode(AudioContext & ac)
74 : AudioNode(ac, *desc())
75 , m_sampleRate(ac.sampleRate())
76{
77 /// @TODO in the future a panner could be multi-channel beyond stereo
78 addInput(unique_ptr<AudioNodeInput>(new AudioNodeInput(this)));
79 addOutput(unique_ptr<AudioNodeOutput>(new AudioNodeOutput(this, 2)));
80
81 m_orientationX = param("orientationX");
82 m_orientationY = param("orientationY");
83 m_orientationZ = param("orientationZ");
84 m_velocityX = param("velocityX");
85 m_velocityY = param("velocityY");
86 m_velocityZ = param("velocityZ");
87 m_positionX = param("positionX");
88 m_positionY = param("positionY");
89 m_positionZ = param("positionZ");
90 m_distanceGain = param("distanceGain");
91 m_coneGain = param("coneGain");
92 m_distanceModel = setting("distanceModel");
93 m_refDistance = setting("refDistance");
94 m_maxDistance = setting("maxDistance");
95 m_rolloffFactor = setting("rolloffFactor");
96 m_coneInnerAngle = setting("coneInnerAngle");
97 m_coneOuterAngle = setting("coneOuterAngle");
98 m_panningModel = setting("panningMode");
99
100 m_distanceEffect.reset(new DistanceEffect());
101 m_coneEffect.reset(new ConeEffect());
102
103 m_distanceModel->setValueChanged(
104 [this]() {
105 DistanceEffect::ModelType model(static_cast<DistanceEffect::ModelType>(m_distanceModel->valueUint32()));
106 switch (model)
107 {
108 case DistanceEffect::ModelLinear:
109 case DistanceEffect::ModelInverse:
110 case DistanceEffect::ModelExponential:
111 m_distanceEffect->setModel(model, true);
112 break;
113
114 default:
115 throw std::invalid_argument("invalid distance model");
116 break;
117 }
118 });
119
120 m_refDistance->setValueChanged(
121 [this]() {
122 m_distanceEffect->setRefDistance(m_refDistance->valueFloat());
123 });
124
125 m_maxDistance->setValueChanged(
126 [this]() {
127 m_distanceEffect->setMaxDistance(m_maxDistance->valueFloat());
128 });
129
130 m_rolloffFactor->setValueChanged(

Callers

nothing calls this directly

Calls 12

setValueChangedMethod · 0.80
valueUint32Method · 0.80
setModelMethod · 0.80
valueFloatMethod · 0.80
setInnerAngleMethod · 0.80
setOuterAngleMethod · 0.80
setUint32Method · 0.80
sampleRateMethod · 0.45
resetMethod · 0.45
setRefDistanceMethod · 0.45
setMaxDistanceMethod · 0.45
setRolloffFactorMethod · 0.45

Tested by

no test coverage detected