Skip to content

Commit

Permalink
add set engine rate command
Browse files Browse the repository at this point in the history
  • Loading branch information
LTVA1 committed Mar 26, 2024
1 parent 501fd1e commit 3d87c7b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"tracker_engine.h": "c"
}
}
10 changes: 10 additions & 0 deletions tracker_engine/do_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "../sound_engine/sound_engine_filter.h"
#include "tracker_engine.h"

#include "../flizzer_tracker_hal.h"

void do_command(
uint16_t opcode,
TrackerEngine* tracker_engine,
Expand Down Expand Up @@ -427,6 +429,14 @@ void do_command(
break;
}

case TE_EFFECT_SET_RATE: {
if(tick == 0 && (opcode & 0xff) > 0) {
tracker_engine_set_rate(opcode & 0xff);
}

break;
}

case TE_EFFECT_PORTA_UP_SEMITONE: {
uint32_t prev = te_channel->note;

Expand Down
5 changes: 2 additions & 3 deletions tracker_engine/tracker_engine_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ typedef enum {
TE_EFFECT_SET_SUSTAIN = 0x1700, // Nxx
TE_EFFECT_SET_RELEASE = 0x1800, // Oxx
TE_EFFECT_PROGRAM_RESTART = 0x1900, // Pxx
/*
TE_EFFECT_ = 0x1a00, //Qxx
*/

TE_EFFECT_SET_RATE = 0x1a00, //Qxx

TE_EFFECT_SET_RING_MOD_SRC = 0x1b00, // Rxx
TE_EFFECT_SET_HARD_SYNC_SRC = 0x1c00, // Sxx
Expand Down
1 change: 1 addition & 0 deletions view/opcode_description.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static const OpcodeDescription opcode_desc[] = {
{TE_EFFECT_SET_SUSTAIN, 0x7f00, "SET ENVELOPE SUSTAIN", "ADSR S"},
{TE_EFFECT_SET_RELEASE, 0x7f00, "SET ENVELOPE RELEASE", "ADSR R"},
{TE_EFFECT_PROGRAM_RESTART, 0x7f00, "RESTART INSTRUMENT PROGRAM", "P.RES."},
{TE_EFFECT_SET_RATE, 0x7f00, "SET TRACKER ENGINE RATE (HZ)", "E.RATE"},
{TE_EFFECT_SET_RING_MOD_SRC, 0x7f00, "SET RING MODULATION SOURCE CH.", "R.SRC"},
{TE_EFFECT_SET_HARD_SYNC_SRC, 0x7f00, "SET HARD SYNC SOURCE CHANNEL", "S.SRC"},
{TE_EFFECT_PORTA_UP_SEMITONE, 0x7f00, "PORTAMENTO UP (SEMITONES)", "PU.SEM"},
Expand Down

0 comments on commit 3d87c7b

Please sign in to comment.