Skip to content

Instantly share code, notes, and snippets.

@Xenakios
Last active January 31, 2025 16:17
Show Gist options
  • Save Xenakios/db0c8a74dc45f55a261a5e467e9fdad0 to your computer and use it in GitHub Desktop.
Save Xenakios/db0c8a74dc45f55a261a5e467e9fdad0 to your computer and use it in GitHub Desktop.
diff --git a/src/dsp/matrix_node.h b/src/dsp/matrix_node.h
index a728ced..0c953cf 100644
--- a/src/dsp/matrix_node.h
+++ b/src/dsp/matrix_node.h
@@ -705,7 +705,7 @@ struct OutputNode : EnvelopeSupport<Patch::OutputNode>,
mech::scale_by<blockSize>(finalEnvLevel, output[0], output[1]);
- auto pn = panMod + pan + panModNode.level;
+ auto pn = panMod + pan + panModNode.level + voiceValues.panExpression;
if (pn != 0.f)
{
pn = (pn + 1) * 0.5;
diff --git a/src/synth/synth.h b/src/synth/synth.h
index 1cd1e37..a45dd4d 100644
--- a/src/synth/synth.h
+++ b/src/synth/synth.h
@@ -213,6 +213,9 @@ struct Synth
case CLAP_NOTE_EXPRESSION_BRIGHTNESS:
v->voiceValues.mpeTimbre = val;
break;
+ case CLAP_NOTE_EXPRESSION_PAN:
+ v->voiceValues.panExpression = -1.0f + 2.0f * val;
+ break;
default:
break;
}
diff --git a/src/synth/voice.cpp b/src/synth/voice.cpp
index 7695d19..daa2248 100644
--- a/src/synth/voice.cpp
+++ b/src/synth/voice.cpp
@@ -59,6 +59,7 @@ void Voice::attack()
n.attack();
voiceValues.setGated(true);
+ voiceValues.panExpression = 0.0f;
}
void Voice::renderBlock()
diff --git a/src/synth/voice_values.h b/src/synth/voice_values.h
index 4b68b76..72c76a6 100644
--- a/src/synth/voice_values.h
+++ b/src/synth/voice_values.h
@@ -51,7 +51,7 @@ struct VoiceValues
int portaSign{0};
float mpeBendInSemis{0}, mpeBendNormalized{0}, mpeTimbre{0}, mpePressure{0};
-
+ float panExpression{0.0};
float noteExpressionTuningInSemis{0};
float uniRatioMul{1.0};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment