-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added interpolation for some parameters
- Loading branch information
Showing
6 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#define NUM_VOICES 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
============================================================================== | ||
ParameterInterpolator.cpp | ||
Created: 25 Jun 2020 6:07:10pm | ||
Author: August | ||
============================================================================== | ||
*/ | ||
|
||
#include "ParameterInterpolator.h" | ||
|
||
void ParameterInterpolator::StartNewBuffer(AudioProcessorValueTreeState& State, int& BuffSize) | ||
{ | ||
for (int i = 0; i < NUM_FLOAT_PARAMS; i++) | ||
{ | ||
OldFloatParams[i] = GoalFloatParams[i]; | ||
} | ||
|
||
for (int i = 0; i < NUM_FLOAT_PARAMS; i++) | ||
{ | ||
GoalFloatParams[i] = State.getParameterAsValue(FloatParamProps[i].ID).getValue(); | ||
} | ||
|
||
BufferSize = BuffSize; | ||
} | ||
|
||
float ParameterInterpolator::GetFloat(const int& i, const int& SampleIdx) | ||
{ | ||
float Multiplyer = (float)SampleIdx / (float)BufferSize; | ||
return OldFloatParams[i] + Multiplyer*(GoalFloatParams[i] - OldFloatParams[i]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
============================================================================== | ||
ParameterInterpolator.h | ||
Created: 25 Jun 2020 6:07:10pm | ||
Author: August | ||
============================================================================== | ||
*/ | ||
|
||
#pragma once | ||
#include "Defs.h" | ||
#include "JuceHeader.h" | ||
|
||
class ParameterInterpolator | ||
{ | ||
public: | ||
ParameterInterpolator() {} | ||
~ParameterInterpolator() {} | ||
|
||
void StartNewBuffer(AudioProcessorValueTreeState& State, int& BuffSize); | ||
float GetFloat(const int& i, const int& SampleIdx); | ||
|
||
|
||
private: | ||
int BufferSize = 0; | ||
float OldFloatParams[NUM_FLOAT_PARAMS]; | ||
float GoalFloatParams[NUM_FLOAT_PARAMS]; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters