Skip to content

Commit

Permalink
V2.0.12 Tatami
Browse files Browse the repository at this point in the history
New Module Tatami
Arrange- code cleanup
StepWave - move display inside of widget
  • Loading branch information
codygeary committed Jan 3, 2025
1 parent e1c7b34 commit 727353c
Show file tree
Hide file tree
Showing 9 changed files with 1,668 additions and 128 deletions.
35 changes: 0 additions & 35 deletions plugin.cpp

This file was deleted.

32 changes: 0 additions & 32 deletions plugin.hpp

This file was deleted.

10 changes: 9 additions & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"slug": "CVfunk",
"name": "CV funk Modules",
"version": "2.0.11",
"version": "2.0.12",
"license": "MIT",
"brand": "CV funk",
"author": "Cody Geary",
Expand Down Expand Up @@ -207,6 +207,14 @@
"tags": [
"Delay"
]
},
{
"slug": "Tatami",
"name": "Tatami",
"description": "A stereo wave-shaper and wave-folder.",
"tags": [
"Waveshaper"
]
}

]
Expand Down
425 changes: 425 additions & 0 deletions res/Tatami-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
426 changes: 426 additions & 0 deletions res/Tatami.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 59 additions & 59 deletions src/StepWave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,67 +964,67 @@ struct StepWave : Module {
}
};

struct WaveDisplay : TransparentWidget {
StepWave* module;
float centerX, centerY;
float heightScale;

void draw(const DrawArgs& args) override {
// Draw non-illuminating elements if any
}

void drawLayer(const DrawArgs& args, int layer) override {
if (!module) return;

if (layer == 1) {
centerX = box.size.x / 2.0f;
centerY = box.size.y / 2.0f;
heightScale = centerY / 5; // Calculate based on current center Y

if (!module->isSupersamplingEnabled) {
// Draw the sequence progress bar
float progressBarX = box.size.x * (module->sequenceProgress / 8.0f); // X position of the progress bar
float progressBarWidth = 1.0f; // Width of the progress bar

// Draw a vertical rectangle as the progress bar
nvgBeginPath(args.vg);
nvgRect(args.vg, progressBarX, -box.size.y*0.2, progressBarWidth, box.size.y * 1.39); // Full height of the widget
nvgFillColor(args.vg, nvgRGBAf(0.5f, 0.5f, 0.5f, 0.8f)); // Light grey color
nvgFill(args.vg); // Fill the progress bar
}

drawWaveform(args, module->waveBuffers[0], nvgRGBAf(0.3, 0.3, 0.3, 0.8));
drawWaveform(args, module->waveBuffers[1], nvgRGBAf(0, 0.4, 1, 0.8));
drawWaveform(args, module->waveBuffers[2], nvgRGBAf(0.5, 0.5, 0.6, 0.8));
}

TransparentWidget::drawLayer(args, layer);
}

void drawWaveform(const DrawArgs& args, const CircularBuffer<float, 1024>& waveBuffer, NVGcolor color) {
nvgBeginPath(args.vg);

for (size_t i = 0; i < 1024; i++) {
// Calculate x position based on the index
float xPos = (float)i / 1023 * box.size.x;

// Scale and center y position based on buffer value
float yPos = centerY - waveBuffer[i] * heightScale;

if (i == 0)
nvgMoveTo(args.vg, xPos, yPos);
else
nvgLineTo(args.vg, xPos, yPos);
}

nvgStrokeColor(args.vg, color); // Set the color for the waveform
nvgStrokeWidth(args.vg, 1.0);
nvgStroke(args.vg);
}
};

struct StepWaveWidget : ModuleWidget {

struct WaveDisplay : TransparentWidget {
StepWave* module;
float centerX, centerY;
float heightScale;

void draw(const DrawArgs& args) override {
// Draw non-illuminating elements if any
}

void drawLayer(const DrawArgs& args, int layer) override {
if (!module) return;

if (layer == 1) {
centerX = box.size.x / 2.0f;
centerY = box.size.y / 2.0f;
heightScale = centerY / 5; // Calculate based on current center Y

if (!module->isSupersamplingEnabled) {
// Draw the sequence progress bar
float progressBarX = box.size.x * (module->sequenceProgress / 8.0f); // X position of the progress bar
float progressBarWidth = 1.0f; // Width of the progress bar

// Draw a vertical rectangle as the progress bar
nvgBeginPath(args.vg);
nvgRect(args.vg, progressBarX, -box.size.y*0.2, progressBarWidth, box.size.y * 1.39); // Full height of the widget
nvgFillColor(args.vg, nvgRGBAf(0.5f, 0.5f, 0.5f, 0.8f)); // Light grey color
nvgFill(args.vg); // Fill the progress bar
}

drawWaveform(args, module->waveBuffers[0], nvgRGBAf(0.3, 0.3, 0.3, 0.8));
drawWaveform(args, module->waveBuffers[1], nvgRGBAf(0, 0.4, 1, 0.8));
drawWaveform(args, module->waveBuffers[2], nvgRGBAf(0.5, 0.5, 0.6, 0.8));
}

TransparentWidget::drawLayer(args, layer);
}

void drawWaveform(const DrawArgs& args, const CircularBuffer<float, 1024>& waveBuffer, NVGcolor color) {
nvgBeginPath(args.vg);

for (size_t i = 0; i < 1024; i++) {
// Calculate x position based on the index
float xPos = (float)i / 1023 * box.size.x;

// Scale and center y position based on buffer value
float yPos = centerY - waveBuffer[i] * heightScale;

if (i == 0)
nvgMoveTo(args.vg, xPos, yPos);
else
nvgLineTo(args.vg, xPos, yPos);
}

nvgStrokeColor(args.vg, color); // Set the color for the waveform
nvgStrokeWidth(args.vg, 1.0);
nvgStroke(args.vg);
}
};

struct DiscreteRoundBlackKnob : RoundBlackKnob {
void onDragEnd(const DragEndEvent& e) override {
ParamQuantity* paramQuantity = getParamQuantity();
Expand Down
Loading

0 comments on commit 727353c

Please sign in to comment.