aboutsummaryrefslogtreecommitdiffstats
path: root/src/sequencer.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-01-08 11:05:05 +0100
committerBad Diode <bd@badd10de.dev>2024-01-08 11:05:05 +0100
commit666135619b653accd72e940d4405871c6c5f453b (patch)
tree358a9ec4798eb2be6716111a497f62a34319dc4f /src/sequencer.c
parentd9f6f7f7636cb989470282370800aa23d80c432e (diff)
downloadstepper-666135619b653accd72e940d4405871c6c5f453b.tar.gz
stepper-666135619b653accd72e940d4405871c6c5f453b.zip
Fix channel params behaviour to be as expected
Diffstat (limited to 'src/sequencer.c')
-rw-r--r--src/sequencer.c103
1 files changed, 99 insertions, 4 deletions
diff --git a/src/sequencer.c b/src/sequencer.c
index e452822..fed33cb 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -1316,7 +1316,36 @@ handle_param_selection_ch1() {
1316 Pattern *pat = &patterns[pattern_selection_loc]; 1316 Pattern *pat = &patterns[pattern_selection_loc];
1317 if (set_param_selection_sq1(&ch1_params, handle_channel_selection)) { 1317 if (set_param_selection_sq1(&ch1_params, handle_channel_selection)) {
1318 for (size_t i = 0; i < 16; i++) { 1318 for (size_t i = 0; i < 16; i++) {
1319 pat->ch1.params[i] = ch1_params; 1319 switch (param_selection_loc) {
1320 case 0: {
1321 pat->ch1.params[i].duty_cycle = ch1_params.duty_cycle;
1322 } break;
1323 case 1: {
1324 pat->ch1.params[i].env_volume = ch1_params.env_volume;
1325 } break;
1326 case 2: {
1327 pat->ch1.params[i].env_time = ch1_params.env_time;
1328 } break;
1329 case 3: {
1330 pat->ch1.params[i].env_direction = ch1_params.env_direction;
1331 } break;
1332 case 4: {
1333 pat->ch1.params[i].prob = ch1_params.prob;
1334 } break;
1335 case 5: {
1336 pat->ch1.params[i].sweep_number = ch1_params.sweep_number;
1337 } break;
1338 case 6: {
1339 pat->ch1.params[i].sweep_time = ch1_params.sweep_time;
1340 } break;
1341 case 7: {
1342 pat->ch1.params[i].sweep_direction = ch1_params.sweep_direction;
1343 } break;
1344 case 9: {
1345 pat->ch1.params[i].pan = ch1_params.pan;
1346 } break;
1347 default: break;
1348 }
1320 } 1349 }
1321 } 1350 }
1322} 1351}
@@ -1326,7 +1355,27 @@ handle_param_selection_ch2() {
1326 Pattern *pat = &patterns[pattern_selection_loc]; 1355 Pattern *pat = &patterns[pattern_selection_loc];
1327 if (set_param_selection_sq2(&ch2_params, handle_channel_selection)) { 1356 if (set_param_selection_sq2(&ch2_params, handle_channel_selection)) {
1328 for (size_t i = 0; i < 16; i++) { 1357 for (size_t i = 0; i < 16; i++) {
1329 pat->ch2.params[i] = ch2_params; 1358 switch (param_selection_loc) {
1359 case 0: {
1360 pat->ch2.params[i].duty_cycle = ch2_params.duty_cycle;
1361 } break;
1362 case 1: {
1363 pat->ch2.params[i].env_volume = ch2_params.env_volume;
1364 } break;
1365 case 2: {
1366 pat->ch2.params[i].env_time = ch2_params.env_time;
1367 } break;
1368 case 3: {
1369 pat->ch2.params[i].env_direction = ch2_params.env_direction;
1370 } break;
1371 case 4: {
1372 pat->ch2.params[i].prob = ch2_params.prob;
1373 } break;
1374 case 9: {
1375 pat->ch2.params[i].pan = ch2_params.pan;
1376 } break;
1377 default: break;
1378 }
1330 } 1379 }
1331 } 1380 }
1332} 1381}
@@ -1336,7 +1385,33 @@ handle_param_selection_ch3() {
1336 Pattern *pat = &patterns[pattern_selection_loc]; 1385 Pattern *pat = &patterns[pattern_selection_loc];
1337 if (set_param_selection_wave(&ch3_params, handle_channel_selection)) { 1386 if (set_param_selection_wave(&ch3_params, handle_channel_selection)) {
1338 for (size_t i = 0; i < 16; i++) { 1387 for (size_t i = 0; i < 16; i++) {
1339 pat->ch3.params[i] = ch3_params; 1388 switch (param_selection_loc) {
1389 case 0: {
1390 pat->ch3.params[i].shape_a = ch3_params.shape_a;
1391 } break;
1392 case 1: {
1393 pat->ch3.params[i].type_a = ch3_params.type_a;
1394 } break;
1395 case 2: {
1396 pat->ch3.params[i].shape_b = ch3_params.shape_b;
1397 } break;
1398 case 3: {
1399 pat->ch3.params[i].type_b = ch3_params.type_b;
1400 } break;
1401 case 4: {
1402 pat->ch3.params[i].prob = ch3_params.prob;
1403 } break;
1404 case 5: {
1405 pat->ch3.params[i].wave_mode = ch3_params.wave_mode;
1406 } break;
1407 case 6: {
1408 pat->ch3.params[i].wave_volume = ch3_params.wave_volume;
1409 } break;
1410 case 9: {
1411 pat->ch3.params[i].pan = ch3_params.pan;
1412 } break;
1413 default: break;
1414 }
1340 } 1415 }
1341 } 1416 }
1342} 1417}
@@ -1346,7 +1421,27 @@ handle_param_selection_ch4() {
1346 Pattern *pat = &patterns[pattern_selection_loc]; 1421 Pattern *pat = &patterns[pattern_selection_loc];
1347 if (set_param_selection_noise(&ch4_params, handle_channel_selection)) { 1422 if (set_param_selection_noise(&ch4_params, handle_channel_selection)) {
1348 for (size_t i = 0; i < 16; i++) { 1423 for (size_t i = 0; i < 16; i++) {
1349 pat->ch4.params[i] = ch4_params; 1424 switch (param_selection_loc) {
1425 case 0: {
1426 pat->ch4.params[i].bit_mode = ch4_params.bit_mode;
1427 } break;
1428 case 1: {
1429 pat->ch4.params[i].env_volume = ch4_params.env_volume;
1430 } break;
1431 case 2: {
1432 pat->ch4.params[i].env_time = ch4_params.env_time;
1433 } break;
1434 case 3: {
1435 pat->ch4.params[i].env_direction = ch4_params.env_direction;
1436 } break;
1437 case 4: {
1438 pat->ch4.params[i].prob = ch4_params.prob;
1439 } break;
1440 case 9: {
1441 pat->ch4.params[i].pan = ch4_params.pan;
1442 } break;
1443 default: break;
1444 }
1350 } 1445 }
1351 } 1446 }
1352} 1447}