Function bodies 1,902 total
copyCell method · cpp · L612-L625 (14 LOC)src/Launchpad.cpp
void copyCell(int srcRow, int srcCol, int dstRow, int dstCol) {
if (srcRow == dstRow && srcCol == dstCol) return;
CellData& src = cells[srcRow][srcCol];
CellData& dst = cells[dstRow][dstCol];
// Copy data to destination
dst.buffer = src.buffer; // Copy, not move
dst.recordedLength = src.recordedLength;
dst.loopClocks = src.loopClocks;
dst.waveformCache = src.waveformCache;
dst.state = (dst.recordedLength > 0) ? CELL_HAS_CONTENT : CELL_EMPTY;
dst.playPosition = 0;
}triggerScene method · cpp · L626-L668 (43 LOC)src/Launchpad.cpp
void triggerScene(int col) {
// Trigger cells in the target column (Ableton Live style)
// Scene acts as a "snapshot" - cells not in this scene get stopped
for (int r = 0; r < 8; r++) {
CellData& cell = cells[r][col];
if (cell.state == CELL_HAS_CONTENT) {
// Scene cell has content: play it
int quantize = quantizeValues[(int)params[QUANTIZE_PARAM].getValue()];
if (quantize == 0) {
// Free mode: immediate start (startPlaying stops other cells)
startPlaying(r, col);
} else {
// Quantize mode: queue this cell
// Cancel any other QUEUED in this row (only one can be queued)
for (int c = 0; c < 8; c++) {
if (c != col && cells[r][c].state == CELL_QUEUED) {
cells[r][c].state = CELL_HAS_CONTENT;
}
process method · cpp · L669-L910 (242 LOC)src/Launchpad.cpp
void process(const ProcessArgs& args) override {
// Process reset
if (resetTrigger.process(inputs[RESET_INPUT].getVoltage(), 0.1f, 1.f)) {
clockCount = 0;
for (int r = 0; r < 8; r++) {
for (int c = 0; c < 8; c++) {
if (cells[r][c].state == CELL_PLAYING) {
cells[r][c].playPosition = 0;
}
}
}
}
// Process clock
bool clockTriggered = clockTrigger.process(inputs[CLOCK_INPUT].getVoltage(), 0.1f, 1.f);
if (clockTriggered) {
// Calculate samples per clock for accurate loop timing
if (samplesSinceLastClock > 0) {
samplesPerClock = samplesSinceLastClock;
}
samplesSinceLastClock = 0;
clockCount++;
// Check quantize triggers
int quantize = quantizeValues[(int)params[QUANTIZE_PARAM].getValue()];
if (quadataToJson method · cpp · L911-L943 (33 LOC)src/Launchpad.cpp
json_t* dataToJson() override {
json_t* rootJ = json_object();
json_object_set_new(rootJ, "panelTheme", json_integer(panelTheme));
json_object_set_new(rootJ, "panelContrast", json_real(panelContrast));
// Save cell data
json_t* cellsJ = json_array();
for (int r = 0; r < 8; r++) {
for (int c = 0; c < 8; c++) {
json_t* cellJ = json_object();
CellData& cell = cells[r][c];
json_object_set_new(cellJ, "loopClocks", json_integer(cell.loopClocks));
json_object_set_new(cellJ, "recordedLength", json_integer(cell.recordedLength));
json_object_set_new(cellJ, "playbackSpeed", json_real(cell.playbackSpeed));
// Save buffer as base64 or skip if empty
if (cell.recordedLength > 0) {
json_t* bufferJ = json_array();
for (int i = 0; i < cell.recordedLength; i++) {
jdataFromJson method · cpp · L944-L984 (41 LOC)src/Launchpad.cpp
void dataFromJson(json_t* rootJ) override {
json_t* themeJ = json_object_get(rootJ, "panelTheme");
if (themeJ) panelTheme = json_integer_value(themeJ);
json_t* contrastJ = json_object_get(rootJ, "panelContrast");
if (contrastJ) {
panelContrast = json_real_value(contrastJ);
}
json_t* cellsJ = json_object_get(rootJ, "cells");
if (cellsJ) {
int index = 0;
for (int r = 0; r < 8; r++) {
for (int c = 0; c < 8; c++) {
json_t* cellJ = json_array_get(cellsJ, index++);
if (!cellJ) continue;
CellData& cell = cells[r][c];
json_t* loopClocksJ = json_object_get(cellJ, "loopClocks");
if (loopClocksJ) cell.loopClocks = json_integer_value(loopClocksJ);
json_t* recordedLengthJ = json_object_get(cellJ, "recordedLength");
if (recordedLengthJ) cell.recoronButton method · cpp · L988-L998 (11 LOC)src/Launchpad.cpp
void CellWidget::onButton(const event::Button& e) {
// Must consume left-click to enable drag system
if (e.button == GLFW_MOUSE_BUTTON_LEFT && e.action == GLFW_PRESS) {
e.consume(this);
}
// Right-click to open context menu
if (e.button == GLFW_MOUSE_BUTTON_RIGHT && e.action == GLFW_PRESS) {
createContextMenu();
e.consume(this);
}
}onDragStart method · cpp · L999-L1008 (10 LOC)src/Launchpad.cpp
void CellWidget::onDragStart(const event::DragStart& e) {
if (e.button != GLFW_MOUSE_BUTTON_LEFT) return;
pressed = true;
pressTime = 0.f;
dragSource = this;
dragOffset = Vec(0, 0);
dragCopyMode = (APP->window->getMods() & GLFW_MOD_SHIFT);
}Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
onDragMove method · cpp · L1009-L1023 (15 LOC)src/Launchpad.cpp
void CellWidget::onDragMove(const event::DragMove& e) {
// Accumulate mouse movement
dragOffset = dragOffset.plus(e.mouseDelta);
// Pre-calculate target cell (only once per move, not per cell per frame)
if (dragSource) {
const float cellSpacingX = 44.f;
const float cellSpacingY = 28.f;
int deltaCol = (int)std::round(dragOffset.x / cellSpacingX);
int deltaRow = (int)std::round(dragOffset.y / cellSpacingY);
targetRow = clamp(dragSource->row + deltaRow, 0, 7);
targetCol = clamp(dragSource->col + deltaCol, 0, 7);
}
}onDragEnd method · cpp · L1024-L1071 (48 LOC)src/Launchpad.cpp
void CellWidget::onDragEnd(const event::DragEnd& e) {
// Only process left mouse button drag end
if (e.button != GLFW_MOUSE_BUTTON_LEFT) return;
// Only process if this cell started the drag
if (dragSource != this) {
pressed = false;
return;
}
if (!module) {
dragSource = nullptr;
targetRow = -1;
targetCol = -1;
pressed = false;
return;
}
// Check if we moved to a different valid cell (use pre-calculated target)
bool movedToOtherCell = (targetRow != row || targetCol != col) &&
targetRow >= 0 && targetRow < 8 &&
targetCol >= 0 && targetCol < 8;
if (movedToOtherCell && module->cells[row][col].state != CELL_EMPTY) {
// Drag to another cell - move or copy
bool copyMode = (APP->window->getMods() & GLFW_MOD_SHIFT);
if (copyMode) {
module->copyCell(row, col, targetRow, targetCol);
} else {
draw method · cpp · L1072-L1216 (145 LOC)src/Launchpad.cpp
void CellWidget::draw(const DrawArgs& args) {
// Update press time (using frame time ~60fps)
if (pressed) {
pressTime += 1.f / 60.f;
}
// Get cell state
CellState state = CELL_EMPTY;
if (module) {
state = module->cells[row][col].state;
}
// Choose color based on state
NVGcolor bgColor;
switch (state) {
case CELL_HAS_CONTENT: bgColor = LaunchpadColors::HAS_CONTENT; break;
case CELL_PLAYING: bgColor = LaunchpadColors::PLAYING; break;
case CELL_RECORDING: bgColor = LaunchpadColors::RECORDING; break;
case CELL_QUEUED: bgColor = LaunchpadColors::QUEUED; break;
case CELL_STOP_QUEUED: bgColor = LaunchpadColors::STOP_QUEUED; break;
case CELL_RECORD_QUEUED: bgColor = LaunchpadColors::RECORD_QUEUED; break;
default: bgColor = LaunchpadColors::EMPTY; break;
}
float x = 0, y = 0, w = box.size.x, h = box.size.y;
// Outer shadow
nvgBeginPath(args.vg);
nvgRoundedRectdrawWaveform method · cpp · L1217-L1288 (72 LOC)src/Launchpad.cpp
void CellWidget::drawWaveform(const DrawArgs& args, CellData& cell) {
// Use recordPosition during recording, recordedLength otherwise
int length = (cell.state == CELL_RECORDING) ? cell.recordPosition : cell.recordedLength;
if (length == 0) return;
int displayWidth = (int)box.size.x - 8;
cell.updateWaveformCache(displayWidth);
// Choose waveform color
NVGcolor waveColor;
switch (cell.state) {
case CELL_PLAYING: waveColor = LaunchpadColors::WAVE_PLAYING; break;
case CELL_STOP_QUEUED: waveColor = LaunchpadColors::WAVE_PLAYING; break; // Still playing
case CELL_RECORDING: waveColor = LaunchpadColors::WAVE_RECORDING; break;
default: waveColor = LaunchpadColors::WAVE_CONTENT; break;
}
float centerY = box.size.y / 2;
float maxHeight = box.size.y / 2 - 4; // Leave 4px margin top/bottom
// Find max amplitude for auto-scaling
float maxAmp = 0.001f; // Minimum to avoid division by zero
for (int i = 0;createContextMenu method · cpp · L1289-L1394 (106 LOC)src/Launchpad.cpp
void CellWidget::createContextMenu() {
if (!module) return;
CellData& cell = module->cells[row][col];
if (cell.state == CELL_EMPTY) return; // No menu for empty cells
ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("Cell " + std::to_string(row + 1) + "-" + std::to_string(col + 1)));
menu->addChild(new ui::MenuSeparator);
menu->addChild(createMenuLabel("Playback Speed"));
// Speed presets
struct SpeedItem : ui::MenuItem {
Launchpad* launchpad;
int cellRow, cellCol;
float speed;
void onAction(const event::Action& e) override {
if (launchpad) {
launchpad->cells[cellRow][cellCol].playbackSpeed = speed;
launchpad->cells[cellRow][cellCol].playbackPhase = 0.0f;
}
}
void step() override {
if (launchpad) {
rightText = (launchpad->cells[cellRow][cellCol].playbackSpeed == speed) ? "✔" : "";
}
onAction method · cpp · L1307-L1312 (6 LOC)src/Launchpad.cpp
void onAction(const event::Action& e) override {
if (launchpad) {
launchpad->cells[cellRow][cellCol].playbackSpeed = speed;
launchpad->cells[cellRow][cellCol].playbackPhase = 0.0f;
}
}step method · cpp · L1313-L1318 (6 LOC)src/Launchpad.cpp
void step() override {
if (launchpad) {
rightText = (launchpad->cells[cellRow][cellCol].playbackSpeed == speed) ? "✔" : "";
}
MenuItem::step();
}setValue method · cpp · L1356-L1361 (6 LOC)src/Launchpad.cpp
void setValue(float value) override {
if (launchpad) {
launchpad->cells[cellRow][cellCol].playbackSpeed = knobToSpeed(value);
}
}Repobility — same analyzer, your code, free for public repos · /scan/
getValue method · cpp · L1362-L1365 (4 LOC)src/Launchpad.cpp
float getValue() override {
if (!launchpad) return 0.5f;
return speedToKnob(launchpad->cells[cellRow][cellCol].playbackSpeed);
}getDisplayValueString method · cpp · L1372-L1381 (10 LOC)src/Launchpad.cpp
std::string getDisplayValueString() override {
float speed = knobToSpeed(getValue());
char buf[32];
if (speed < 0) {
snprintf(buf, sizeof(buf), "%.2fx (Rev)", speed);
} else {
snprintf(buf, sizeof(buf), "%.2fx", speed);
}
return buf;
}~SpeedSlider method · cpp · L1388-L1390 (3 LOC)src/Launchpad.cpp
~SpeedSlider() {
delete quantity;
}draw method · cpp · L1398-L1403 (6 LOC)src/Launchpad.cpp
void draw(const DrawArgs& args) override {
nvgBeginPath(args.vg);
nvgRect(args.vg, 0, 330, box.size.x, box.size.y - 330);
nvgFillColor(args.vg, nvgRGB(255, 255, 255));
nvgFill(args.vg);
}LaunchpadWidget method · cpp · L1409-L1523 (115 LOC)src/Launchpad.cpp
LaunchpadWidget(Launchpad* module) {
setModule(module);
panelThemeHelper.init(this, "40HP", module ? &module->panelContrast : nullptr);
box.size = Vec(40 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT);
// White bottom panel
WhiteBottomPanel40HP* whitePanel = new WhiteBottomPanel40HP();
whitePanel->box.size = box.size;
addChild(whitePanel);
// Title labels (2x size compared to other modules)
NVGcolor titleColor = nvgRGB(255, 200, 0); // Yellow
addChild(new LaunchpadLabel(Vec(0, 1), Vec(200, 30), "LAUNCHPAD", 24.f, titleColor, true));
addChild(new LaunchpadLabel(Vec(160, 9), Vec(100, 20), "MADZINE", 20.f, titleColor, false));
// Clock, Reset, Quantize - upper right (with labels)
addChild(new LaunchpadLabel(Vec(475 - 25, 25), Vec(50, 12), "Clock", 8.f));
addInput(createInputCentered<PJ301MPort>(Vec(475, 50), module, Launchpad::CLOCK_INPUT));
addChild(new LaunchpadLabel(Vstep method · cpp · L1524-L1531 (8 LOC)src/Launchpad.cpp
void step() override {
Launchpad* module = dynamic_cast<Launchpad*>(this->module);
if (module) {
panelThemeHelper.step(module);
}
ModuleWidget::step();
}appendContextMenu method · cpp · L1532-L1538 (7 LOC)src/Launchpad.cpp
void appendContextMenu(ui::Menu* menu) override {
Launchpad* module = dynamic_cast<Launchpad*>(this->module);
if (!module) return;
addPanelThemeMenu(menu, module);
}draw method · cpp · L22-L39 (18 LOC)src/MADDY.cpp
void draw(const DrawArgs &args) override {
nvgFontSize(args.vg, fontSize);
nvgFontFaceId(args.vg, APP->window->uiFont->handle);
nvgTextAlign(args.vg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE);
if (bold) {
// 使用描邊模擬粗體效果
nvgFillColor(args.vg, color);
nvgText(args.vg, box.size.x / 2.f, box.size.y / 2.f, text.c_str(), NULL);
nvgStrokeColor(args.vg, color);
nvgStrokeWidth(args.vg, 0.3f);
nvgText(args.vg, box.size.x / 2.f, box.size.y / 2.f, text.c_str(), NULL);
} else {
nvgFillColor(args.vg, color);
nvgText(args.vg, box.size.x / 2.f, box.size.y / 2.f, text.c_str(), NULL);
}
}All rows above produced by Repobility · https://repobility.com
OldMADDYStandardBlackKnob_UNUSED method · cpp · L46-L49 (4 LOC)src/MADDY.cpp
OldMADDYStandardBlackKnob_UNUSED() {
box.size = Vec(26, 26);
}getDisplayAngle method · cpp · L50-L56 (7 LOC)src/MADDY.cpp
float getDisplayAngle() {
ParamQuantity* pq = getParamQuantity();
if (!pq) return 0.0f;
float normalizedValue = pq->getScaledValue();
return rescale(normalizedValue, 0.0f, 1.0f, -0.75f * M_PI, 0.75f * M_PI);
}draw method · cpp · L57-L93 (37 LOC)src/MADDY.cpp
void draw(const DrawArgs& args) override {
float radius = box.size.x / 2.0f;
float angle = getDisplayAngle();
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgFillColor(args.vg, nvgRGB(30, 30, 30));
nvgFill(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgStrokeWidth(args.vg, 1.0f);
nvgStrokeColor(args.vg, nvgRGB(100, 100, 100));
nvgStroke(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 4);
nvgFillColor(args.vg, nvgRGB(50, 50, 50));
nvgFill(args.vg);
float indicatorLength = radius - 8;
float lineX = radius + indicatorLength * std::sin(angle);
float lineY = radius - indicatorLength * std::cos(angle);
nvgBeginPath(args.vg);
nvgMoveTo(args.vg, radius, radius);
nvgLineTo(args.vg, lineonButton method · cpp · L94-L104 (11 LOC)src/MADDY.cpp
void onButton(const event::Button& e) override {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) {
isDragging = true;
e.consume(this);
}
else if (e.action == GLFW_RELEASE && e.button == GLFW_MOUSE_BUTTON_LEFT) {
isDragging = false;
}
ParamWidget::onButton(e);
}onDragMove method · cpp · L105-L116 (12 LOC)src/MADDY.cpp
void onDragMove(const event::DragMove& e) override {
ParamQuantity* pq = getParamQuantity();
if (!isDragging || !pq) return;
float sensitivity = 0.002f;
float deltaY = -e.mouseDelta.y;
float range = pq->getMaxValue() - pq->getMinValue();
float currentValue = pq->getValue();
float newValue = clamp(currentValue + deltaY * sensitivity * range, pq->getMinValue(), pq->getMaxValue());
pq->setValue(newValue);
}onDoubleClick method · cpp · L117-L123 (7 LOC)src/MADDY.cpp
void onDoubleClick(const event::DoubleClick& e) override {
ParamQuantity* pq = getParamQuantity();
if (!pq) return;
pq->reset();
e.consume(this);
}OldMADDYSnapKnob_UNUSED method · cpp · L130-L134 (5 LOC)src/MADDY.cpp
OldMADDYSnapKnob_UNUSED() {
box.size = Vec(26, 26);
snap = true;
}getDisplayAngle method · cpp · L135-L141 (7 LOC)src/MADDY.cpp
float getDisplayAngle() {
ParamQuantity* pq = getParamQuantity();
if (!pq) return 0.0f;
float normalizedValue = pq->getScaledValue();
return rescale(normalizedValue, 0.0f, 1.0f, -0.75f * M_PI, 0.75f * M_PI);
}Repobility · severity-and-effort ranking · https://repobility.com
draw method · cpp · L142-L178 (37 LOC)src/MADDY.cpp
void draw(const DrawArgs& args) override {
float radius = box.size.x / 2.0f;
float angle = getDisplayAngle();
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgFillColor(args.vg, nvgRGB(30, 30, 30));
nvgFill(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgStrokeWidth(args.vg, 1.0f);
nvgStrokeColor(args.vg, nvgRGB(100, 100, 100));
nvgStroke(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 4);
nvgFillColor(args.vg, nvgRGB(130, 130, 130));
nvgFill(args.vg);
float indicatorLength = radius - 8;
float lineX = radius + indicatorLength * std::sin(angle);
float lineY = radius - indicatorLength * std::cos(angle);
nvgBeginPath(args.vg);
nvgMoveTo(args.vg, radius, radius);
nvgLineTo(args.vg, lonButton method · cpp · L179-L186 (8 LOC)src/MADDY.cpp
void onButton(const event::Button& e) override {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) {
accumDelta = 0.0f;
e.consume(this);
}
ParamWidget::onButton(e);
}onDragMove method · cpp · L187-L207 (21 LOC)src/MADDY.cpp
void onDragMove(const event::DragMove& e) override {
ParamQuantity* pq = getParamQuantity();
if (!pq) return;
accumDelta += (e.mouseDelta.x - e.mouseDelta.y);
float threshold = 30.0f;
if (accumDelta >= threshold) {
float currentValue = pq->getValue();
float newValue = clamp(currentValue + 1.0f, pq->getMinValue(), pq->getMaxValue());
pq->setValue(newValue);
accumDelta = 0.0f;
}
else if (accumDelta <= -threshold) {
float currentValue = pq->getValue();
float newValue = clamp(currentValue - 1.0f, pq->getMinValue(), pq->getMaxValue());
pq->setValue(newValue);
accumDelta = 0.0f;
}
}onDoubleClick method · cpp · L208-L214 (7 LOC)src/MADDY.cpp
void onDoubleClick(const event::DoubleClick& e) override {
ParamQuantity* pq = getParamQuantity();
if (!pq) return;
pq->reset();
e.consume(this);
}OldWhiteKnob_UNUSED method · cpp · L221-L224 (4 LOC)src/MADDY.cpp
OldWhiteKnob_UNUSED() {
box.size = Vec(30, 30);
}getDisplayAngle method · cpp · L225-L231 (7 LOC)src/MADDY.cpp
float getDisplayAngle() {
ParamQuantity* pq = getParamQuantity();
if (!pq) return 0.0f;
float normalizedValue = pq->getScaledValue();
return rescale(normalizedValue, 0.0f, 1.0f, -0.75f * M_PI, 0.75f * M_PI);
}draw method · cpp · L232-L268 (37 LOC)src/MADDY.cpp
void draw(const DrawArgs& args) override {
float radius = box.size.x / 2.0f;
float angle = getDisplayAngle();
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgFillColor(args.vg, nvgRGB(30, 30, 30));
nvgFill(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgStrokeWidth(args.vg, 1.0f);
nvgStrokeColor(args.vg, nvgRGB(100, 100, 100));
nvgStroke(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 4);
nvgFillColor(args.vg, nvgRGB(255, 255, 255));
nvgFill(args.vg);
float indicatorLength = radius - 8;
float lineX = radius + indicatorLength * std::sin(angle);
float lineY = radius - indicatorLength * std::cos(angle);
nvgBeginPath(args.vg);
nvgMoveTo(args.vg, radius, radius);
nvgLineTo(args.vg, lonButton method · cpp · L269-L279 (11 LOC)src/MADDY.cpp
void onButton(const event::Button& e) override {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) {
isDragging = true;
e.consume(this);
}
else if (e.action == GLFW_RELEASE && e.button == GLFW_MOUSE_BUTTON_LEFT) {
isDragging = false;
}
ParamWidget::onButton(e);
}Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
onDragMove method · cpp · L280-L291 (12 LOC)src/MADDY.cpp
void onDragMove(const event::DragMove& e) override {
ParamQuantity* pq = getParamQuantity();
if (!isDragging || !pq) return;
float sensitivity = 0.002f;
float deltaY = -e.mouseDelta.y;
float range = pq->getMaxValue() - pq->getMinValue();
float currentValue = pq->getValue();
float newValue = clamp(currentValue + deltaY * sensitivity * range, pq->getMinValue(), pq->getMaxValue());
pq->setValue(newValue);
}onDoubleClick method · cpp · L292-L298 (7 LOC)src/MADDY.cpp
void onDoubleClick(const event::DoubleClick& e) override {
ParamQuantity* pq = getParamQuantity();
if (!pq) return;
pq->reset();
e.consume(this);
}OldSmallGrayKnob_UNUSED method · cpp · L305-L308 (4 LOC)src/MADDY.cpp
OldSmallGrayKnob_UNUSED() {
box.size = Vec(21, 21);
}getDisplayAngle method · cpp · L309-L315 (7 LOC)src/MADDY.cpp
float getDisplayAngle() {
ParamQuantity* pq = getParamQuantity();
if (!pq) return 0.0f;
float normalizedValue = pq->getScaledValue();
return rescale(normalizedValue, 0.0f, 1.0f, -0.75f * M_PI, 0.75f * M_PI);
}draw method · cpp · L316-L352 (37 LOC)src/MADDY.cpp
void draw(const DrawArgs& args) override {
float radius = box.size.x / 2.0f;
float angle = getDisplayAngle();
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgFillColor(args.vg, nvgRGB(30, 30, 30));
nvgFill(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgStrokeWidth(args.vg, 1.0f);
nvgStrokeColor(args.vg, nvgRGB(100, 100, 100));
nvgStroke(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 3);
nvgFillColor(args.vg, nvgRGB(180, 180, 180));
nvgFill(args.vg);
float indicatorLength = radius - 6;
float lineX = radius + indicatorLength * std::sin(angle);
float lineY = radius - indicatorLength * std::cos(angle);
nvgBeginPath(args.vg);
nvgMoveTo(args.vg, radius, radius);
nvgLineTo(args.vg, lonButton method · cpp · L353-L363 (11 LOC)src/MADDY.cpp
void onButton(const event::Button& e) override {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) {
isDragging = true;
e.consume(this);
}
else if (e.action == GLFW_RELEASE && e.button == GLFW_MOUSE_BUTTON_LEFT) {
isDragging = false;
}
ParamWidget::onButton(e);
}onDragMove method · cpp · L364-L375 (12 LOC)src/MADDY.cpp
void onDragMove(const event::DragMove& e) override {
ParamQuantity* pq = getParamQuantity();
if (!isDragging || !pq) return;
float sensitivity = 0.002f;
float deltaY = -e.mouseDelta.y;
float range = pq->getMaxValue() - pq->getMinValue();
float currentValue = pq->getValue();
float newValue = clamp(currentValue + deltaY * sensitivity * range, pq->getMinValue(), pq->getMaxValue());
pq->setValue(newValue);
}onDoubleClick method · cpp · L376-L382 (7 LOC)src/MADDY.cpp
void onDoubleClick(const event::DoubleClick& e) override {
ParamQuantity* pq = getParamQuantity();
if (!pq) return;
pq->reset();
e.consume(this);
}Repobility — same analyzer, your code, free for public repos · /scan/
OldMediumGrayKnob_UNUSED method · cpp · L389-L392 (4 LOC)src/MADDY.cpp
OldMediumGrayKnob_UNUSED() {
box.size = Vec(26, 26);
}getDisplayAngle method · cpp · L393-L399 (7 LOC)src/MADDY.cpp
float getDisplayAngle() {
ParamQuantity* pq = getParamQuantity();
if (!pq) return 0.0f;
float normalizedValue = pq->getScaledValue();
return rescale(normalizedValue, 0.0f, 1.0f, -0.75f * M_PI, 0.75f * M_PI);
}draw method · cpp · L400-L436 (37 LOC)src/MADDY.cpp
void draw(const DrawArgs& args) override {
float radius = box.size.x / 2.0f;
float angle = getDisplayAngle();
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgFillColor(args.vg, nvgRGB(30, 30, 30));
nvgFill(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 1);
nvgStrokeWidth(args.vg, 1.0f);
nvgStrokeColor(args.vg, nvgRGB(100, 100, 100));
nvgStroke(args.vg);
nvgBeginPath(args.vg);
nvgCircle(args.vg, radius, radius, radius - 4);
nvgFillColor(args.vg, nvgRGB(130, 130, 130));
nvgFill(args.vg);
float indicatorLength = radius - 8;
float lineX = radius + indicatorLength * std::sin(angle);
float lineY = radius - indicatorLength * std::cos(angle);
nvgBeginPath(args.vg);
nvgMoveTo(args.vg, radius, radius);
nvgLineTo(args.vg, l