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 0, 0, 0 } // 32
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
void EnvDisplay::paint(Graphics &g) { |
|
|
|
|
int rate[4]; |
|
|
|
|
int level[4]; |
|
|
|
|
|
|
|
|
|
g.setColour(Colours::black.withAlpha(0.5f)); |
|
|
|
|
g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); |
|
|
|
|
g.setColour(Colours::white); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) { |
|
|
|
|
rate[i] = s_rate[i]->getValue(); |
|
|
|
|
level[i] = s_level[i]->getValue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
env.init(rate, level, 99 << 5, 0); |
|
|
|
|
env.keydown(true); |
|
|
|
|
for (int i = 0; i < 72; i++) { |
|
|
|
|
int32_t pos = env.getsample(); |
|
|
|
|
for (int j = 0; j < 16; j++) { |
|
|
|
|
env.getsample(); |
|
|
|
|
} |
|
|
|
|
g.setPixel(i, 32 - (sqrt(pos) / 512)); |
|
|
|
|
} |
|
|
|
|
env.keydown(false); |
|
|
|
|
for (int i = 0; i < 24; i++) { |
|
|
|
|
int32_t pos = env.getsample(); |
|
|
|
|
for (int j = 0; j < 16; j++) { |
|
|
|
|
env.getsample(); |
|
|
|
|
} |
|
|
|
|
g.setPixel(i + 72, 32 - (sqrt(pos) / 512)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
AlgoDisplay::AlgoDisplay() { |
|
|
|
|
algo = NULL; |
|
|
|
|
static char tmpAlgo = 0; |
|
|
|
|
algo = &tmpAlgo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -105,10 +73,6 @@ AlgoDisplay::AlgoDisplay() { |
|
|
|
|
void AlgoDisplay::paint(Graphics &g) { |
|
|
|
|
int alg; |
|
|
|
|
|
|
|
|
|
if ( algo == NULL ) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( *algo <= 31 ) {
|
|
|
|
|
alg = *algo; |
|
|
|
|
} else { |
|
|
|
@ -116,32 +80,31 @@ void AlgoDisplay::paint(Graphics &g) { |
|
|
|
|
} |
|
|
|
|
const char *arr = algoArr[alg]; |
|
|
|
|
|
|
|
|
|
g.setColour (Colours::black.withAlpha(0.5f)); |
|
|
|
|
g.setColour (Colours::black.withAlpha(0.1f)); |
|
|
|
|
g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); |
|
|
|
|
|
|
|
|
|
for(int i=0;i<13;i++) { |
|
|
|
|
char target = arr[i]; |
|
|
|
|
bool feedback = target == arr[13]; |
|
|
|
|
int target = arr[i]; |
|
|
|
|
if ( target == 0 ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
if ( i < 6 ) { |
|
|
|
|
drawOp(g, i, 3, target, feedback); |
|
|
|
|
drawOp(g, i, 3, target); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( i < 10 ){ |
|
|
|
|
drawOp(g, (i-6)+1, 2, target, feedback); |
|
|
|
|
drawOp(g, (i-6)+1, 2, target); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( i < 12 ) { |
|
|
|
|
drawOp(g, (i-10)+2, 1, target, feedback); |
|
|
|
|
drawOp(g, (i-10)+2, 1, target); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// last one
|
|
|
|
|
drawOp(g, (i-12)+3, 0, target, feedback); |
|
|
|
|
drawOp(g, (i-12)+3, 0, target); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String algoTxt; |
|
|
|
@ -149,9 +112,9 @@ void AlgoDisplay::paint(Graphics &g) { |
|
|
|
|
g.drawText(algoTxt, 5, 1, 21, 14, Justification::left, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AlgoDisplay::drawOp(Graphics &g, int x, int y, int num, bool feedback) { |
|
|
|
|
void AlgoDisplay::drawOp(Graphics &g, int x, int y, int num) { |
|
|
|
|
String txt; |
|
|
|
|
txt << num; |
|
|
|
|
txt << abs(num); |
|
|
|
|
|
|
|
|
|
int offx = 24; |
|
|
|
|
int offy = 17; |
|
|
|
@ -160,13 +123,91 @@ void AlgoDisplay::drawOp(Graphics &g, int x, int y, int num, bool feedback) { |
|
|
|
|
g.fillRect(x*offx+4, y*offy+3, offx-2, offy-1); |
|
|
|
|
g.setColour(Colour(0xFFFFFFFF)); |
|
|
|
|
g.drawText(txt, x*offx+3, y*offy+2, offx+2, offy+2, Justification::centred, true); |
|
|
|
|
if ( feedback ) { |
|
|
|
|
if ( num < 0 ) { |
|
|
|
|
g.setColour(Colour(0xFFFFFFFF)); |
|
|
|
|
int x1 = (x*offx) + 24; |
|
|
|
|
g.drawLine(x1+1, y*offy+3, x1+1, y*offy+offy+2, 3); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void EnvDisplay::paint(Graphics &g) { |
|
|
|
|
int rate[4]; |
|
|
|
|
int level[4]; |
|
|
|
|
|
|
|
|
|
g.setColour(Colours::black.withAlpha(0.1f)); |
|
|
|
|
g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); |
|
|
|
|
g.setColour(Colours::white); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) { |
|
|
|
|
rate[i] = s_rate[i]->getValue(); |
|
|
|
|
level[i] = s_level[i]->getValue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
env.init(rate, level, 99 << 5, 0); |
|
|
|
|
env.keydown(true); |
|
|
|
|
for (int i = 0; i < 72; i++) { |
|
|
|
|
int32_t pos = env.getsample(); |
|
|
|
|
for (int j = 0; j < 16; j++) { |
|
|
|
|
env.getsample(); |
|
|
|
|
} |
|
|
|
|
g.setPixel(i, 32 - (sqrt(pos) / 512)); |
|
|
|
|
} |
|
|
|
|
env.keydown(false); |
|
|
|
|
for (int i = 0; i < 24; i++) { |
|
|
|
|
int32_t pos = env.getsample(); |
|
|
|
|
for (int j = 0; j < 16; j++) { |
|
|
|
|
env.getsample(); |
|
|
|
|
} |
|
|
|
|
g.setPixel(i + 72, 32 - (sqrt(pos) / 512)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PitchEnvDisplay::PitchEnvDisplay() { |
|
|
|
|
static char tmpDisplay[8]; |
|
|
|
|
memset(&tmpDisplay, 0x00, 8); |
|
|
|
|
pvalues = (char *) &tmpDisplay; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PitchEnvDisplay::paint(Graphics &g) { |
|
|
|
|
g.setColour(Colours::black.withAlpha(0.1f)); |
|
|
|
|
g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); |
|
|
|
|
g.setColour(Colours::white); |
|
|
|
|
|
|
|
|
|
char *levels = pvalues; |
|
|
|
|
char *rates = pvalues + 4; |
|
|
|
|
|
|
|
|
|
float dist[4]; |
|
|
|
|
float total; |
|
|
|
|
|
|
|
|
|
int old = pitchenv_tab[levels[3]] + 128; |
|
|
|
|
// find the scale
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<4;i++) { |
|
|
|
|
int nw = pitchenv_tab[levels[i]] + 128; |
|
|
|
|
dist[i] = abs(old - nw) / pitchenv_rate[rates[i]]; |
|
|
|
|
total += dist[i]; |
|
|
|
|
old = nw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO : this is WIP
|
|
|
|
|
int ratio = 96 / total; |
|
|
|
|
|
|
|
|
|
int oldx = 0; |
|
|
|
|
int oldy = (pitchenv_tab[levels[3]] + 128) / 10; |
|
|
|
|
|
|
|
|
|
for(int i=0;i<4;i++) { |
|
|
|
|
int newx = dist[i] * ratio + oldx; |
|
|
|
|
int newy = (pitchenv_tab[levels[i]] + 128) / 10; |
|
|
|
|
|
|
|
|
|
g.drawLine(oldx, oldy, newx, newy, 2); |
|
|
|
|
|
|
|
|
|
oldx = newx; |
|
|
|
|
oldy = newy; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VuMeter::paint(Graphics &g) { |
|
|
|
|
|
|
|
|
|
// taken from the drawLevelMeter ;
|
|
|
|
|