Skip to content

Commit

Permalink
v small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
tesselode committed Apr 12, 2018
1 parent 966548d commit 974e19a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 0 additions & 8 deletions source/MikaMicro.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
#include <vector>
#include "Voice.h"

enum EVoiceModes
{
kPoly,
kMono,
kLegato,
kNumVoiceModes
};

class MikaMicro : public IPlug
{
public:
Expand Down
8 changes: 7 additions & 1 deletion source/Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ double Voice::Next(double dt, double lfoValue, double driftValue)
lfoValue *= lfoEnv.Get(0.0, velocity);

// mono glide
baseFrequency += (targetFrequency - baseFrequency) * p[kGlideSpeed] * dt;
switch ((EVoiceModes)(int)p[kVoiceMode])
{
case kMono:
case kLegato:
baseFrequency += (targetFrequency - baseFrequency) * p[kGlideSpeed] * dt;
break;
}

// oscillator base frequencies
auto osc1Frequency = baseFrequency * osc1PitchFactor * pitchBendFactor * (1.0 + driftValue);
Expand Down
8 changes: 8 additions & 0 deletions source/Voice.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
#include "Parameters.h"
#include "Util.h"

enum EVoiceModes
{
kPoly,
kMono,
kLegato,
kNumVoiceModes
};

class Voice
{
public:
Expand Down

0 comments on commit 974e19a

Please sign in to comment.