aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-04-24 15:43:02 +0200
committerBad Diode <bd@badd10de.dev>2023-04-24 15:43:02 +0200
commitcf1684b05ee2d90b009d2ca48fb3d76f6fb0f26a (patch)
tree1b7fb8153a0bcc1cb9ab55765a6044d2b95316af
parent183c43fe2d85be24e43f09e62c07911e82935b1d (diff)
downloadstepper-cf1684b05ee2d90b009d2ca48fb3d76f6fb0f26a.tar.gz
stepper-cf1684b05ee2d90b009d2ca48fb3d76f6fb0f26a.zip
Finish clipboard for global channel params
-rw-r--r--src/clipboard.c68
-rw-r--r--src/main.c3
2 files changed, 48 insertions, 23 deletions
diff --git a/src/clipboard.c b/src/clipboard.c
index 97e083f..9d39598 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -280,38 +280,62 @@ clipboard_paste(void) {
280 draw_channels(); 280 draw_channels();
281 draw_triggers(); 281 draw_triggers();
282 } else if (input_handler == handle_channel_selection) { 282 } else if (input_handler == handle_channel_selection) {
283 if (clipboard.type == CLIP_TRIG || 283 switch (channel_selection_loc) {
284 clipboard.type == CLIP_PARAM_CH1 || 284 case 0: {
285 clipboard.type == CLIP_PARAM_CH2 || 285 if (clipboard.type == CLIP_TRIG ||
286 clipboard.type == CLIP_PARAM_CH3 || 286 clipboard.type == CLIP_PARAM_CH1 ||
287 clipboard.type == CLIP_PARAM_CH4) { 287 clipboard.type == CLIP_PARAM_CH2) {
288 if (clipboard.src_chan == channel_selection_loc) { 288 if (clipboard.src_chan == 0) {
289 switch (channel_selection_loc) {
290 case 0: {
291 for (size_t i = 0; i < 17; i++) { 289 for (size_t i = 0; i < 17; i++) {
292 pat_dst->ch1.params[i] = pat_src->ch1.params[clipboard.src_trig]; 290 pat_dst->ch1.params[i] = pat_src->ch1.params[clipboard.src_trig];
293 } 291 }
294 } break; 292 }
295 case 1: { 293 if (clipboard.src_chan == 1) {
296 for (size_t i = 0; i < 17; i++) { 294 for (size_t i = 0; i < 17; i++) {
297 pat_dst->ch2.params[i] = pat_src->ch2.params[clipboard.src_trig]; 295 pat_dst->ch1.params[i].env_volume = pat_src->ch2.params[clipboard.src_trig].env_volume;
296 pat_dst->ch1.params[i].env_time = pat_src->ch2.params[clipboard.src_trig].env_time;
297 pat_dst->ch1.params[i].env_direction = pat_src->ch2.params[clipboard.src_trig].env_direction;
298 pat_dst->ch1.params[i].duty_cycle = pat_src->ch2.params[clipboard.src_trig].duty_cycle;
298 } 299 }
299 } break; 300 }
300 case 2: { 301 }
302 } break;
303 case 1: {
304 if (clipboard.type == CLIP_TRIG ||
305 clipboard.type == CLIP_PARAM_CH1 ||
306 clipboard.type == CLIP_PARAM_CH2) {
307 if (clipboard.src_chan == 0) {
301 for (size_t i = 0; i < 17; i++) { 308 for (size_t i = 0; i < 17; i++) {
302 pat_dst->ch3.params[i] = pat_src->ch3.params[clipboard.src_trig]; 309 pat_dst->ch2.params[i] = pat_src->ch1.params[clipboard.src_trig];
303 } 310 }
304 } break; 311 }
305 case 3: { 312 if (clipboard.src_chan == 1) {
306 for (size_t i = 0; i < 17; i++) { 313 for (size_t i = 0; i < 17; i++) {
307 pat_dst->ch4.params[i] = pat_src->ch4.params[clipboard.src_trig]; 314 pat_dst->ch2.params[i] = pat_src->ch2.params[clipboard.src_trig];
308 } 315 }
309 } break; 316 }
310 } 317 }
311 } 318 } break;
312 // TODO: copy params to position 16 (per-channel) if it matches the 319 case 2: {
313 // channel type. 320 if (clipboard.src_chan != channel_selection_loc) {
314 // TODO: update all parameters in the rest of the triggers. 321 return;
322 }
323 if (clipboard.type == CLIP_TRIG || clipboard.type == CLIP_PARAM_CH3) {
324 for (size_t i = 0; i < 17; i++) {
325 pat_dst->ch3.params[i] = pat_src->ch3.params[clipboard.src_trig];
326 }
327 }
328 } break;
329 case 3: {
330 if (clipboard.src_chan != channel_selection_loc) {
331 return;
332 }
333 if (clipboard.type == CLIP_TRIG || clipboard.type == CLIP_PARAM_CH4) {
334 for (size_t i = 0; i < 17; i++) {
335 pat_dst->ch4.params[i] = pat_src->ch4.params[clipboard.src_trig];
336 }
337 }
338 } break;
315 } 339 }
316 } else if (input_handler == handle_pattern_selection && clipboard.type == CLIP_PATTERN) { 340 } else if (input_handler == handle_pattern_selection && clipboard.type == CLIP_PATTERN) {
317 // Copy an entire pattern. 341 // Copy an entire pattern.
diff --git a/src/main.c b/src/main.c
index ea10fdb..0ab251d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,9 +25,10 @@ WITH REGARD TO THIS SOFTWARE.
25// Quality of life improvements. 25// Quality of life improvements.
26// + Per channel sound adjustments that modify the sound in all trigs. 26// + Per channel sound adjustments that modify the sound in all trigs.
27// + Basic support. 27// + Basic support.
28// - Allow pasting parameters if they have been copied. 28// + Allow pasting parameters if they have been copied.
29// - Draw the global params in grey if they haven't been adjusted or aren't 29// - Draw the global params in grey if they haven't been adjusted or aren't
30// currently selected. 30// currently selected.
31// - Draw missing cursor.
31// + Per-octave note adjustment with Select + L/R on a trig. 32// + Per-octave note adjustment with Select + L/R on a trig.
32// + Transpose channel with SEL + L/R on channel select. 33// + Transpose channel with SEL + L/R on channel select.
33// - Pattern chaining for more than 1 queue and/or song mode. 34// - Pattern chaining for more than 1 queue and/or song mode.