diff options
Diffstat (limited to 'src/sequencer.c')
-rw-r--r-- | src/sequencer.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/src/sequencer.c b/src/sequencer.c index 1447056..fccc42a 100644 --- a/src/sequencer.c +++ b/src/sequencer.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #include "bitmap.h" | ||
2 | |||
1 | // Positioning parameters. | 3 | // Positioning parameters. |
2 | #define SEQ_TRIG_POS_X 45 | 4 | #define SEQ_TRIG_POS_X 45 |
3 | #define SEQ_TRIG_POS_Y 50 | 5 | #define SEQ_TRIG_POS_Y 50 |
@@ -493,7 +495,53 @@ init_sequencer_sprites(void) { | |||
493 | init_sprite_pal(16, COLOR_CYAN); | 495 | init_sprite_pal(16, COLOR_CYAN); |
494 | init_sprite_pal(32, COLOR_RED); | 496 | init_sprite_pal(32, COLOR_RED); |
495 | init_sprite_pal(48, COLOR_GREY); | 497 | init_sprite_pal(48, COLOR_GREY); |
496 | init_sprites(0); | 498 | init_sprites(512); |
499 | |||
500 | // draw_rect(SEQ_ENV_POS_X-1, | ||
501 | // SEQ_ENV_POS_Y-1, | ||
502 | // SEQ_ENV_POS_X + 62 + 1, | ||
503 | // SEQ_ENV_POS_Y + 16 + 1, | ||
504 | // COLOR_WHITE); | ||
505 | |||
506 | // Clear wave drawing | ||
507 | draw_fill_rect(SEQ_ENV_POS_X, | ||
508 | SEQ_ENV_POS_Y, | ||
509 | SEQ_ENV_POS_X + 62, | ||
510 | SEQ_ENV_POS_Y + 16, | ||
511 | COLOR_BLACK); | ||
512 | |||
513 | // DEBUG: Testing line drawing | ||
514 | // draw_line( | ||
515 | // SEQ_ENV_POS_X, | ||
516 | // SEQ_ENV_POS_Y, | ||
517 | // SEQ_ENV_POS_X + 62, | ||
518 | // SEQ_ENV_POS_Y + 16, | ||
519 | // COLOR_RED); | ||
520 | |||
521 | // NOTE: Trying to draw this pattern. | ||
522 | // 0xEFDEBC89 | ||
523 | // 0x98CBEDFE | ||
524 | // 0x10214376 | ||
525 | // 0x67341201 | ||
526 | u8 sine_wave[] = { | ||
527 | 0x89, 0xBC, 0xDE, 0xEF, | ||
528 | 0xFE, 0xED, 0xCB, 0x98, | ||
529 | 0x76, 0x43, 0x21, 0x10, | ||
530 | 0x01, 0x12, 0x34, 0x67, | ||
531 | }; | ||
532 | // DEBUG: Drawing each byte. | ||
533 | int x = SEQ_ENV_POS_X; | ||
534 | int y = SEQ_ENV_POS_Y + 16; | ||
535 | for (size_t i = 0; i < 16; ++i) { | ||
536 | u8 byte = sine_wave[i]; | ||
537 | u8 first = (byte >> 4) & 0xF; | ||
538 | u8 second = byte & 0xF; | ||
539 | FRAMEBUFFER[y - first][x + i * 4] = COLOR_RED; | ||
540 | FRAMEBUFFER[y - first][x + i * 4 + 1] = COLOR_RED; | ||
541 | FRAMEBUFFER[y - second][x + i * 4 + 2] = COLOR_RED; | ||
542 | FRAMEBUFFER[y - second][x + i * 4 + 3] = COLOR_RED; | ||
543 | } | ||
544 | |||
497 | 545 | ||
498 | // Sprite note names. | 546 | // Sprite note names. |
499 | size_t sprite_id = load_packed_sprite_data(&sprite_note_names, 2, 73); | 547 | size_t sprite_id = load_packed_sprite_data(&sprite_note_names, 2, 73); |
@@ -828,7 +876,7 @@ update_sequencer_sprites(void) { | |||
828 | // 000-015: Step note names. | 876 | // 000-015: Step note names. |
829 | for (size_t i = 0; i < 16; ++i) { | 877 | for (size_t i = 0; i < 16; ++i) { |
830 | // Each note name is made of 2 8x8 tiles (16x8). | 878 | // Each note name is made of 2 8x8 tiles (16x8). |
831 | size_t base_tile = sequences[channel_selection_loc][i].note * 2; | 879 | size_t base_tile = seq_sprites[i].base_tile + sequences[channel_selection_loc][i].note * 2; |
832 | 880 | ||
833 | // TODO: Show the note name if is within the duration, hide when trigger | 881 | // TODO: Show the note name if is within the duration, hide when trigger |
834 | // is off or duration of previous note was cut short. If not triggered | 882 | // is off or duration of previous note was cut short. If not triggered |
@@ -964,6 +1012,11 @@ update_sequencer_sprites(void) { | |||
964 | seq_sprites[56].obj_attr_2 = base_tile | OBJ_PAL_BANK(3); | 1012 | seq_sprites[56].obj_attr_2 = base_tile | OBJ_PAL_BANK(3); |
965 | } | 1013 | } |
966 | } | 1014 | } |
1015 | |||
1016 | // DEBUG: Hide all parameter control sprites for now. | ||
1017 | for (size_t i = 34; i <= 50; ++i) { | ||
1018 | seq_sprites[i].obj_attr_0 = seq_sprites[i].obj_attr_0 | OBJ_HIDDEN; | ||
1019 | } | ||
967 | } | 1020 | } |
968 | 1021 | ||
969 | void | 1022 | void |