aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-04-24 15:24:41 +0200
committerBad Diode <bd@badd10de.dev>2023-04-24 15:24:41 +0200
commit183c43fe2d85be24e43f09e62c07911e82935b1d (patch)
treeedf5077020499179fb909b98935f7971d3e37ace
parentac038887279d43f0a8c346b4392619dfe2e6084a (diff)
downloadstepper-183c43fe2d85be24e43f09e62c07911e82935b1d.tar.gz
stepper-183c43fe2d85be24e43f09e62c07911e82935b1d.zip
Add initial copy-paste of trig to ch
-rw-r--r--src/clipboard.c34
-rw-r--r--src/main.c8
-rw-r--r--src/sequencer.c4
3 files changed, 43 insertions, 3 deletions
diff --git a/src/clipboard.c b/src/clipboard.c
index d802645..97e083f 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -279,6 +279,40 @@ clipboard_paste(void) {
279 } 279 }
280 draw_channels(); 280 draw_channels();
281 draw_triggers(); 281 draw_triggers();
282 } else if (input_handler == handle_channel_selection) {
283 if (clipboard.type == CLIP_TRIG ||
284 clipboard.type == CLIP_PARAM_CH1 ||
285 clipboard.type == CLIP_PARAM_CH2 ||
286 clipboard.type == CLIP_PARAM_CH3 ||
287 clipboard.type == CLIP_PARAM_CH4) {
288 if (clipboard.src_chan == channel_selection_loc) {
289 switch (channel_selection_loc) {
290 case 0: {
291 for (size_t i = 0; i < 17; i++) {
292 pat_dst->ch1.params[i] = pat_src->ch1.params[clipboard.src_trig];
293 }
294 } break;
295 case 1: {
296 for (size_t i = 0; i < 17; i++) {
297 pat_dst->ch2.params[i] = pat_src->ch2.params[clipboard.src_trig];
298 }
299 } break;
300 case 2: {
301 for (size_t i = 0; i < 17; i++) {
302 pat_dst->ch3.params[i] = pat_src->ch3.params[clipboard.src_trig];
303 }
304 } break;
305 case 3: {
306 for (size_t i = 0; i < 17; i++) {
307 pat_dst->ch4.params[i] = pat_src->ch4.params[clipboard.src_trig];
308 }
309 } break;
310 }
311 }
312 // TODO: copy params to position 16 (per-channel) if it matches the
313 // channel type.
314 // TODO: update all parameters in the rest of the triggers.
315 }
282 } else if (input_handler == handle_pattern_selection && clipboard.type == CLIP_PATTERN) { 316 } else if (input_handler == handle_pattern_selection && clipboard.type == CLIP_PATTERN) {
283 // Copy an entire pattern. 317 // Copy an entire pattern.
284 if (pattern_selection_loc != clipboard.src_pat) { 318 if (pattern_selection_loc != clipboard.src_pat) {
diff --git a/src/main.c b/src/main.c
index d4e6dbb..ea10fdb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,7 +23,11 @@ WITH REGARD TO THIS SOFTWARE.
23// - Theming support, with a number of pre-configured themes and custom colors. 23// - Theming support, with a number of pre-configured themes and custom colors.
24// 24//
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.
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
30// currently selected.
27// + Per-octave note adjustment with Select + L/R on a trig. 31// + Per-octave note adjustment with Select + L/R on a trig.
28// + Transpose channel with SEL + L/R on channel select. 32// + Transpose channel with SEL + L/R on channel select.
29// - Pattern chaining for more than 1 queue and/or song mode. 33// - Pattern chaining for more than 1 queue and/or song mode.
@@ -42,7 +46,7 @@ WITH REGARD TO THIS SOFTWARE.
42#include "renderer_m0.c" 46#include "renderer_m0.c"
43#include "sequencer.c" 47#include "sequencer.c"
44 48
45#define PROF_ENABLE 0 49#define PROF_ENABLE 1
46#include "profiling.c" 50#include "profiling.c"
47 51
48void 52void
diff --git a/src/sequencer.c b/src/sequencer.c
index b5339fa..179e72f 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -216,8 +216,8 @@ handle_channel_selection(void) {
216 case 2: { input_handler = handle_param_selection_ch3; } break; 216 case 2: { input_handler = handle_param_selection_ch3; } break;
217 case 3: { input_handler = handle_param_selection_ch4; } break; 217 case 3: { input_handler = handle_param_selection_ch4; } break;
218 } 218 }
219 redraw_params = true;
220 } 219 }
220 redraw_params = true;
221 } else if (key_tap(KEY_L)) { 221 } else if (key_tap(KEY_L)) {
222 s32 inc = -1; 222 s32 inc = -1;
223 if (key_hold(KEY_SELECT)) { 223 if (key_hold(KEY_SELECT)) {
@@ -267,6 +267,7 @@ handle_channel_selection(void) {
267 } else { 267 } else {
268 channel_selection_loc = MAX(channel_selection_loc - 1, 0); 268 channel_selection_loc = MAX(channel_selection_loc - 1, 0);
269 } 269 }
270 param_selection_loc = 0;
270 redraw_trigs = true; 271 redraw_trigs = true;
271 redraw_params = true; 272 redraw_params = true;
272 } else if (key_tap(KEY_DOWN)) { 273 } else if (key_tap(KEY_DOWN)) {
@@ -275,6 +276,7 @@ handle_channel_selection(void) {
275 } else { 276 } else {
276 channel_selection_loc = MIN(channel_selection_loc + 1, SEQ_N_CHANNELS); 277 channel_selection_loc = MIN(channel_selection_loc + 1, SEQ_N_CHANNELS);
277 } 278 }
279 param_selection_loc = 0;
278 redraw_trigs = true; 280 redraw_trigs = true;
279 redraw_params = true; 281 redraw_params = true;
280 } 282 }