mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-30 09:45:35 +00:00
Waveshape full name displayed
This commit is contained in:
parent
07f0987380
commit
417937b0d5
@ -49,10 +49,18 @@ void VCODroplet::Process(float** in, float** out, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VCODroplet::Draw() {
|
void VCODroplet::Draw() {
|
||||||
WriteString(*Patch(), 0, 54, Font_6x8,
|
WriteDoubleCentered(*Patch(),
|
||||||
|
(GetScreenMax()-GetScreenMin())/2,
|
||||||
|
54,
|
||||||
|
GetScreenMax()-GetScreenMin(),
|
||||||
|
Font_6x8,
|
||||||
WaveToString(wavectrl.Process()));
|
WaveToString(wavectrl.Process()));
|
||||||
SetWaveState(wavectrl.Process());
|
SetWaveState(wavectrl.Process());
|
||||||
wave->DrawTile(*Patch(), GetScreenMin(), 0, GetScreenMax(), GetTitleHeight());
|
wave->DrawTile(*Patch(),
|
||||||
|
GetScreenMin(),
|
||||||
|
0,
|
||||||
|
GetScreenMax(),
|
||||||
|
GetTitleHeight());
|
||||||
if(NeedUpdate()) {
|
if(NeedUpdate()) {
|
||||||
wave->AdjustXShift(1);
|
wave->AdjustXShift(1);
|
||||||
}
|
}
|
||||||
@ -73,11 +81,11 @@ std::string VCODroplet::WaveToString(uint8_t wf) {
|
|||||||
case Oscillator::WAVE_RAMP:
|
case Oscillator::WAVE_RAMP:
|
||||||
return "Ramp";
|
return "Ramp";
|
||||||
case Oscillator::WAVE_POLYBLEP_TRI:
|
case Oscillator::WAVE_POLYBLEP_TRI:
|
||||||
return "Poly Triangle";
|
return "PolyBLEP Triangle";
|
||||||
case Oscillator::WAVE_POLYBLEP_SQUARE:
|
case Oscillator::WAVE_POLYBLEP_SQUARE:
|
||||||
return "Poly Square";
|
return "PolyBLEP Square";
|
||||||
case Oscillator::WAVE_POLYBLEP_SAW:
|
case Oscillator::WAVE_POLYBLEP_SAW:
|
||||||
return "Poly Saw";
|
return "PolyBLEP Saw";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ Droplet* GetDroplet() {
|
|||||||
switch(menu.GetState()) {
|
switch(menu.GetState()) {
|
||||||
case MenuState::kVCO:
|
case MenuState::kVCO:
|
||||||
return new VCODroplet(&patch,
|
return new VCODroplet(&patch,
|
||||||
DropletState::kFull,
|
DropletState::kLeft,
|
||||||
sample_rate);
|
sample_rate);
|
||||||
case MenuState::kNoise:
|
case MenuState::kNoise:
|
||||||
default:
|
default:
|
||||||
|
46
src/util.cpp
46
src/util.cpp
@ -47,3 +47,49 @@ void WriteCenteredString(DaisyPatch patch,
|
|||||||
std::string text) {
|
std::string text) {
|
||||||
WriteCenteredString(patch, x, y, font, text, true);
|
WriteCenteredString(patch, x, y, font, text, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteDoubleCentered(DaisyPatch patch,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
FontDef font,
|
||||||
|
std::string text,
|
||||||
|
bool on) {
|
||||||
|
// If only one line is needed
|
||||||
|
if ((int) text.length() * font.FontWidth < width) {
|
||||||
|
WriteCenteredString(patch,
|
||||||
|
x,
|
||||||
|
y - font.FontHeight/2,
|
||||||
|
font,
|
||||||
|
text,
|
||||||
|
on);
|
||||||
|
} else {
|
||||||
|
unsigned int split = text.find(" ");
|
||||||
|
if (split == std::string::npos) {
|
||||||
|
split = width / font.FontWidth;
|
||||||
|
}
|
||||||
|
std::string row1 = text.substr(0, split);
|
||||||
|
std::string row2 = text.substr(split+1, text.length());
|
||||||
|
WriteCenteredString(patch,
|
||||||
|
x,
|
||||||
|
y - font.FontHeight,
|
||||||
|
font,
|
||||||
|
row1,
|
||||||
|
on);
|
||||||
|
WriteCenteredString(patch,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
font,
|
||||||
|
row2,
|
||||||
|
on);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WriteDoubleCentered(DaisyPatch patch,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
FontDef font,
|
||||||
|
std::string text) {
|
||||||
|
WriteDoubleCentered(patch, x, y, width, font, text, true);
|
||||||
|
}
|
||||||
|
36
src/util.h
36
src/util.h
@ -90,4 +90,40 @@ void WriteCenteredString(DaisyPatch patch,
|
|||||||
FontDef font,
|
FontDef font,
|
||||||
std::string text);
|
std::string text);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws text on screen centered taking up two lines.
|
||||||
|
*
|
||||||
|
* @param patch daisy patch board
|
||||||
|
* @param x center of text x coordinate
|
||||||
|
* @param y start of text y coordinate
|
||||||
|
* @param width text field width
|
||||||
|
* @param font text font
|
||||||
|
* @param text text to be written
|
||||||
|
* @param on draw screen on or off
|
||||||
|
*/
|
||||||
|
void WriteDoubleCentered(DaisyPatch patch,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
FontDef font,
|
||||||
|
std::string text,
|
||||||
|
bool on);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws text on screen centered taking up two lines.
|
||||||
|
*
|
||||||
|
* @param patch daisy patch board
|
||||||
|
* @param x center of text x coordinate
|
||||||
|
* @param y start of text y coordinate
|
||||||
|
* @param width text field width
|
||||||
|
* @param font text font
|
||||||
|
* @param text text to be written
|
||||||
|
*/
|
||||||
|
void WriteDoubleCentered(DaisyPatch patch,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
FontDef font,
|
||||||
|
std::string text);
|
||||||
|
|
||||||
#endif // CASCADE_UTIL_H_
|
#endif // CASCADE_UTIL_H_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user