Skip to content

Instantly share code, notes, and snippets.

@jpcima
Created February 24, 2019 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpcima/482732dde7246b0f64f239e8382c530e to your computer and use it in GitHub Desktop.
Save jpcima/482732dde7246b0f64f239e8382c530e to your computer and use it in GitHub Desktop.
diff --git a/src/chips/opal/opal.hpp b/src/chips/opal/opal.hpp
index f554920..590f38d 100644
--- a/src/chips/opal/opal.hpp
+++ b/src/chips/opal/opal.hpp
@@ -1237,12 +1237,8 @@ void Opal::Operator::SetFrequencyMultiplier(uint16_t scale) {
//==================================================================================================
void Opal::Operator::SetKeyScale(uint16_t scale) {
- if (scale > 0)
- KeyScaleShift = 3 - scale;
-
- // No scaling, ensure it has no effect
- else
- KeyScaleShift = 15;
+ const unsigned KslShiftTable[4] = {31, 1, 2, 0};
+ KeyScaleShift = KslShiftTable[scale];
ComputeKeyScaleLevel();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment