diff options
author | Bad Diode <bd@badd10de.dev> | 2023-05-28 09:27:03 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-05-28 09:27:03 +0200 |
commit | af68ac1e1bb77fd821e042d2c8ea9a159c970d20 (patch) | |
tree | dbe9ed56d0a846c1c79db3c39e9e6f9655be6821 | |
parent | aa3db2f8c3af8163a707a87cd946c2a30070ced4 (diff) | |
download | stepper-af68ac1e1bb77fd821e042d2c8ea9a159c970d20.tar.gz stepper-af68ac1e1bb77fd821e042d2c8ea9a159c970d20.zip |
Fix bug for pattern chaining
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/sequencer.c | 2 |
3 files changed, 7 insertions, 9 deletions
@@ -27,7 +27,7 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS)) | |||
27 | INC_FLAGS += -I$(LIBGBA_SRC) | 27 | INC_FLAGS += -I$(LIBGBA_SRC) |
28 | 28 | ||
29 | # Output library names and executables. | 29 | # Output library names and executables. |
30 | TARGET := STEPPER-v1.3 | 30 | TARGET := STEPPER-v1.4-dev |
31 | ELF := $(BUILD_DIR)/$(TARGET).elf | 31 | ELF := $(BUILD_DIR)/$(TARGET).elf |
32 | BIN := $(BUILD_DIR)/$(TARGET).gba | 32 | BIN := $(BUILD_DIR)/$(TARGET).gba |
33 | 33 | ||
@@ -37,7 +37,7 @@ OBJCOPY := $(DEVKITBIN)/arm-none-eabi-objcopy | |||
37 | ARCH := -mthumb -mthumb-interwork | 37 | ARCH := -mthumb -mthumb-interwork |
38 | SPECS := -specs=gba.specs | 38 | SPECS := -specs=gba.specs |
39 | CONFIG := | 39 | CONFIG := |
40 | CFLAGS := -Wall -Wextra -pedantic -Wno-incompatible-pointer-types | 40 | CFLAGS := -Wall -Wextra -Wdouble-promotion -pedantic -Wno-incompatible-pointer-types -Wconversion -Wno-sign-conversion |
41 | CFLAGS += -fno-strict-aliasing | 41 | CFLAGS += -fno-strict-aliasing |
42 | CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) | 42 | CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) |
43 | CFLAGS += $(INC_FLAGS) | 43 | CFLAGS += $(INC_FLAGS) |
@@ -45,13 +45,14 @@ CFLAGS += $(CONFIG) | |||
45 | LDFLAGS := $(ARCH) $(SPECS) | 45 | LDFLAGS := $(ARCH) $(SPECS) |
46 | LDLIBS := $(LIBGBA) | 46 | LDLIBS := $(LIBGBA) |
47 | RELEASE_CFLAGS := -DNDEBUG -O2 | 47 | RELEASE_CFLAGS := -DNDEBUG -O2 |
48 | DEBUG_CFLAGS := -DDEBUG -O2 -g | 48 | DEBUG_CFLAGS := -DDEBUG -O2 -g3 -Wno-unused-parameter -Wno-unused-function |
49 | 49 | ||
50 | .PHONY: clean run | 50 | .PHONY: clean run |
51 | 51 | ||
52 | # Setup debug/release builds. | 52 | # Setup debug/release builds. |
53 | # make clean && make <target> DEBUG=0 | 53 | # make clean && make <target> DEBUG=0 |
54 | # make clean && make <target> DEBUG=1 | 54 | # make clean && make <target> DEBUG=1 |
55 | # TODO: make a new debugging mode with extra options (sanitizers, etc.) | ||
55 | DEBUG ?= 0 | 56 | DEBUG ?= 0 |
56 | ifeq ($(DEBUG), 1) | 57 | ifeq ($(DEBUG), 1) |
57 | CFLAGS += $(DEBUG_CFLAGS) | 58 | CFLAGS += $(DEBUG_CFLAGS) |
@@ -41,9 +41,9 @@ WITH REGARD TO THIS SOFTWARE. | |||
41 | // | 41 | // |
42 | // Bugfixes | 42 | // Bugfixes |
43 | // - Sound can get hung up sometimes, but I can't reproduce when this happens. | 43 | // - Sound can get hung up sometimes, but I can't reproduce when this happens. |
44 | // Not sure if this is an emulator thing or happens also in hardware. | 44 | // Not sure if this is an emulator thing or happens also in hardware. |
45 | // - Cursor can stay in position instead of dissapering, again I can't | 45 | // - Cursor can stay in position instead of dissapering, again I can't |
46 | // reproduce this right now, just happened randomly. Needs investigation. | 46 | // reproduce this right now, just happened randomly. Needs investigation. |
47 | // | 47 | // |
48 | 48 | ||
49 | #include "gba/gba.h" | 49 | #include "gba/gba.h" |
@@ -112,9 +112,6 @@ main(void) { | |||
112 | // Adjust system wait times. | 112 | // Adjust system wait times. |
113 | SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE; | 113 | SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE; |
114 | 114 | ||
115 | // Initialize filesystem. | ||
116 | fs_init(); | ||
117 | |||
118 | // Initialize renderer. | 115 | // Initialize renderer. |
119 | renderer_init(); | 116 | renderer_init(); |
120 | 117 | ||
diff --git a/src/sequencer.c b/src/sequencer.c index 65a2f46..6aa8eea 100644 --- a/src/sequencer.c +++ b/src/sequencer.c | |||
@@ -21,12 +21,12 @@ bool update_bpm = false; | |||
21 | 21 | ||
22 | void | 22 | void |
23 | play_step(void) { | 23 | play_step(void) { |
24 | Pattern *pat = &patterns[current_pattern]; | ||
24 | if (current_pattern != next_pattern && step_counter == 15) { | 25 | if (current_pattern != next_pattern && step_counter == 15) { |
25 | current_pattern = next_pattern; | 26 | current_pattern = next_pattern; |
26 | redraw_pattern_buttons = true; | 27 | redraw_pattern_buttons = true; |
27 | update_bpm = true; | 28 | update_bpm = true; |
28 | } | 29 | } |
29 | Pattern *pat = &patterns[current_pattern]; | ||
30 | if (pat->ch1.active) { | 30 | if (pat->ch1.active) { |
31 | TriggerNote *trig = &pat->ch1.notes[step_counter]; | 31 | TriggerNote *trig = &pat->ch1.notes[step_counter]; |
32 | ChannelSquareParams *params = &pat->ch1.params[step_counter]; | 32 | ChannelSquareParams *params = &pat->ch1.params[step_counter]; |