More DX7 presets
This commit is contained in:
parent
9380e3e79e
commit
ef69701878
90
main.cpp
90
main.cpp
@ -909,11 +909,11 @@ void loadPreset(int preset) {
|
|||||||
auto placeOp = [&](int x, int y, float ratio, float att, float rel) {
|
auto placeOp = [&](int x, int y, float ratio, float att, float rel) {
|
||||||
// Layout:
|
// Layout:
|
||||||
// (x, y) : G-IN (South)
|
// (x, y) : G-IN (South)
|
||||||
// (x, y+1) : WIRE (East)
|
// (x, y+1) : WIRE (East) -> Feeds envelope chain
|
||||||
// (x+1, y+1): ATT (East)
|
// (x+1, y+1): ATT (East) ->
|
||||||
// (x+2, y+1): REL (East)
|
// (x+2, y+1): REL (East)
|
||||||
// (x+3, y+1): VCA (South)
|
// (x+3, y+1): VCA (South) -> Output is here. Gets audio from OSC, gain from envelope.
|
||||||
// (x+3, y) : OSC (South)
|
// (x+3, y) : OSC (South) -> Audio source. Gets FM from its back (x+3, y-1).
|
||||||
|
|
||||||
engine.grid[x][y].type = SynthEngine::GridCell::GATE_INPUT; engine.grid[x][y].rotation = 2; // S
|
engine.grid[x][y].type = SynthEngine::GridCell::GATE_INPUT; engine.grid[x][y].rotation = 2; // S
|
||||||
engine.grid[x][y+1].type = SynthEngine::GridCell::WIRE; engine.grid[x][y+1].rotation = 1; // E
|
engine.grid[x][y+1].type = SynthEngine::GridCell::WIRE; engine.grid[x][y+1].rotation = 1; // E
|
||||||
@ -932,8 +932,10 @@ void loadPreset(int preset) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int sinkY = SynthEngine::GRID_H - 1;
|
int sinkY = SynthEngine::GRID_H - 1;
|
||||||
|
int sinkX = SynthEngine::GRID_W / 2;
|
||||||
|
|
||||||
if (preset == 1) {
|
// Preset 0 is blank
|
||||||
|
if (preset == 1) { // Based on DX7 Algorithm 32
|
||||||
// Algo 32: Parallel Operators
|
// Algo 32: Parallel Operators
|
||||||
// 6 Ops in parallel feeding the sink
|
// 6 Ops in parallel feeding the sink
|
||||||
// We'll place 3, and wire them
|
// We'll place 3, and wire them
|
||||||
@ -966,7 +968,7 @@ void loadPreset(int preset) {
|
|||||||
engine.grid[6][y].type = SynthEngine::GridCell::WIRE; engine.grid[6][y].rotation = 2;
|
engine.grid[6][y].type = SynthEngine::GridCell::WIRE; engine.grid[6][y].rotation = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (preset == 2) {
|
} else if (preset == 2) { // Based on DX7 Algorithm 1
|
||||||
// Algo 1: Stack (FM)
|
// Algo 1: Stack (FM)
|
||||||
// Op 2 Modulates Op 1
|
// Op 2 Modulates Op 1
|
||||||
// Op 1 is Carrier
|
// Op 1 is Carrier
|
||||||
@ -989,6 +991,78 @@ void loadPreset(int preset) {
|
|||||||
for(int y=5; y<sinkY; ++y) {
|
for(int y=5; y<sinkY; ++y) {
|
||||||
engine.grid[6][y].type = SynthEngine::GridCell::WIRE; engine.grid[6][y].rotation = 2;
|
engine.grid[6][y].type = SynthEngine::GridCell::WIRE; engine.grid[6][y].rotation = 2;
|
||||||
}
|
}
|
||||||
|
} else if (preset == 3) { // Based on DX7 Algorithm 2
|
||||||
|
// Op 2 -> Op 1 (Carrier)
|
||||||
|
// Op 3 (Carrier)
|
||||||
|
|
||||||
|
// Carrier 1 stack (output at 7,3)
|
||||||
|
placeOp(4, 2, 1.0f, 0.01f, 0.8f);
|
||||||
|
placeOp(4, 0, 2.0f, 0.01f, 0.2f);
|
||||||
|
|
||||||
|
// Carrier 2 (output at 3,1)
|
||||||
|
placeOp(0, 0, 1.0f, 0.01f, 0.5f);
|
||||||
|
|
||||||
|
// --- Wiring to Sink ---
|
||||||
|
// Path for Carrier 1 (from 7,3)
|
||||||
|
engine.grid[7][4].type = SynthEngine::GridCell::WIRE; engine.grid[7][4].rotation = 3; // W, to (6,4)
|
||||||
|
|
||||||
|
// Path for Carrier 2 (from 3,1)
|
||||||
|
engine.grid[3][2].type = SynthEngine::GridCell::WIRE; engine.grid[3][2].rotation = 1; // E, to (4,2)
|
||||||
|
engine.grid[4][2].type = SynthEngine::GridCell::WIRE; engine.grid[4][2].rotation = 1; // E, to (5,2)
|
||||||
|
engine.grid[5][2].type = SynthEngine::GridCell::WIRE; engine.grid[5][2].rotation = 1; // E, to (6,2)
|
||||||
|
engine.grid[sinkX][2].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][2].rotation = 2; // S, to (6,3)
|
||||||
|
engine.grid[sinkX][3].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][3].rotation = 2; // S, to (6,4)
|
||||||
|
|
||||||
|
// Mix point at (6,4) - WIREs sum inputs automatically
|
||||||
|
engine.grid[sinkX][4].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][4].rotation = 2; // S
|
||||||
|
|
||||||
|
// Funnel from mix point down to sink
|
||||||
|
for(int y=5; y<sinkY; ++y) {
|
||||||
|
engine.grid[sinkX][y].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][y].rotation = 2; // S
|
||||||
|
}
|
||||||
|
} else if (preset == 4) { // Based on DX7 Algorithm 4
|
||||||
|
// Op 3 -> Op 2 -> Op 1 (Carrier)
|
||||||
|
placeOp(4, 4, 1.0f, 0.01f, 0.8f); // Carrier Op1, out at (7,5)
|
||||||
|
placeOp(4, 2, 2.0f, 0.01f, 0.2f); // Modulator Op2, out at (7,3)
|
||||||
|
placeOp(4, 0, 4.0f, 0.01f, 0.1f); // Modulator Op3, out at (7,1)
|
||||||
|
|
||||||
|
// Wire Carrier output to sink
|
||||||
|
engine.grid[7][6].type = SynthEngine::GridCell::WIRE; engine.grid[7][6].rotation = 3; // W
|
||||||
|
engine.grid[sinkX][6].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][6].rotation = 2; // S
|
||||||
|
|
||||||
|
// Funnel down to sink
|
||||||
|
for(int y=7; y<sinkY; ++y) {
|
||||||
|
engine.grid[sinkX][y].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][y].rotation = 2; // S
|
||||||
|
}
|
||||||
|
} else if (preset == 5) { // Based on DX7 Algorithm 5
|
||||||
|
// Op 4 -> Op 3 -> Op 2 (Carrier)
|
||||||
|
// Op 1 (Carrier)
|
||||||
|
|
||||||
|
// Carrier stack (output at 7,5)
|
||||||
|
placeOp(4, 4, 1.0f, 0.01f, 0.8f);
|
||||||
|
placeOp(4, 2, 2.0f, 0.01f, 0.2f);
|
||||||
|
placeOp(4, 0, 4.0f, 0.01f, 0.1f);
|
||||||
|
|
||||||
|
// Parallel carrier (output at 3,1)
|
||||||
|
placeOp(0, 0, 0.5f, 0.01f, 0.5f);
|
||||||
|
|
||||||
|
// --- Wiring to Sink ---
|
||||||
|
engine.grid[7][6].type = SynthEngine::GridCell::WIRE; engine.grid[7][6].rotation = 3; // W, to (6,6)
|
||||||
|
engine.grid[3][2].type = SynthEngine::GridCell::WIRE; engine.grid[3][2].rotation = 2; // S to (3,3)
|
||||||
|
engine.grid[3][3].type = SynthEngine::GridCell::WIRE; engine.grid[3][3].rotation = 1; // E to (4,3)
|
||||||
|
engine.grid[4][3].type = SynthEngine::GridCell::WIRE; engine.grid[4][3].rotation = 1; // E to (5,3)
|
||||||
|
engine.grid[5][3].type = SynthEngine::GridCell::WIRE; engine.grid[5][3].rotation = 1; // E to (6,3)
|
||||||
|
engine.grid[sinkX][3].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][3].rotation = 2; // S to (6,4)
|
||||||
|
engine.grid[sinkX][4].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][4].rotation = 2; // S to (6,5)
|
||||||
|
engine.grid[sinkX][5].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][5].rotation = 2; // S to (6,6)
|
||||||
|
|
||||||
|
// Mix point at (6,6)
|
||||||
|
engine.grid[sinkX][6].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][6].rotation = 2; // S
|
||||||
|
|
||||||
|
// Funnel from mix point down to sink
|
||||||
|
for(int y=7; y<sinkY; ++y) {
|
||||||
|
engine.grid[sinkX][y].type = SynthEngine::GridCell::WIRE; engine.grid[sinkX][y].rotation = 2; // S
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1226,10 +1300,10 @@ int main(int argc, char* argv[]) {
|
|||||||
} else if (e.key.keysym.scancode == SDL_SCANCODE_DELETE) {
|
} else if (e.key.keysym.scancode == SDL_SCANCODE_DELETE) {
|
||||||
clearGrid();
|
clearGrid();
|
||||||
} else if (e.key.keysym.scancode == SDL_SCANCODE_PAGEUP) {
|
} else if (e.key.keysym.scancode == SDL_SCANCODE_PAGEUP) {
|
||||||
current_preset = (current_preset + 1) % 3;
|
current_preset = (current_preset + 1) % 6; // Increased number of presets
|
||||||
loadPreset(current_preset);
|
loadPreset(current_preset);
|
||||||
} else if (e.key.keysym.scancode == SDL_SCANCODE_PAGEDOWN) {
|
} else if (e.key.keysym.scancode == SDL_SCANCODE_PAGEDOWN) {
|
||||||
current_preset = (current_preset - 1 + 3) % 3;
|
current_preset = (current_preset - 1 + 6) % 6; // Increased number of presets
|
||||||
loadPreset(current_preset);
|
loadPreset(current_preset);
|
||||||
} else if (e.key.keysym.scancode == SDL_SCANCODE_M) {
|
} else if (e.key.keysym.scancode == SDL_SCANCODE_M) {
|
||||||
auto_melody_enabled = !auto_melody_enabled;
|
auto_melody_enabled = !auto_melody_enabled;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user