Skip to content

Commit

Permalink
add detune effect
Browse files Browse the repository at this point in the history
  • Loading branch information
LTVA1 committed Apr 1, 2024
1 parent 5a011f4 commit 4486a44
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions tracker_engine/do_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ void do_command(
break;
}

case TE_EFFECT_PITCH: {
te_channel->finetune_note = ((int16_t)(opcode & 0xff) - 0x80) * 2;
break;
}

case TE_EFFECT_ARPEGGIO_ABS: {
te_channel->arpeggio_note = 0;
te_channel->fixed_note = ((opcode & 0xff) << 8);
Expand Down
3 changes: 2 additions & 1 deletion tracker_engine/tracker_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ void tracker_engine_advance_channel(TrackerEngine* tracker_engine, uint8_t chan)

int32_t chn_note = (int16_t)(te_channel->fixed_note != 0xffff ? te_channel->fixed_note :
te_channel->note) +
vib + ((int16_t)te_channel->arpeggio_note << 8);
vib + ((int16_t)te_channel->arpeggio_note << 8)
+ te_channel->finetune_note;

if(chn_note < 0) {
chn_note = 0;
Expand Down
3 changes: 2 additions & 1 deletion tracker_engine/tracker_engine_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ typedef enum {

TE_EFFECT_PORTA_UP_SEMITONE = 0x1d00, // Txx
TE_EFFECT_PORTA_DOWN_SEMITONE = 0x1e00, // Uxx
TE_EFFECT_PITCH = 0x1f00, //Vxx
/*
TE_EFFECT_ = 0x1f00, //Vxx
TE_EFFECT_ = 0x2000, //Wxx
*/

Expand Down Expand Up @@ -155,6 +155,7 @@ typedef struct {
uint8_t channel_flags;

uint16_t note, target_note, last_note, fixed_note;
int16_t finetune_note;
int16_t arpeggio_note;

uint8_t volume;
Expand Down
1 change: 1 addition & 0 deletions view/opcode_description.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static const OpcodeDescription opcode_desc[] = {
{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"},
{TE_EFFECT_PORTA_DOWN_SEMITONE, 0x7f00, "PORTAMENTO DOWN (SEMITONES)", "PD.SEM"},
{TE_EFFECT_PITCH, 0x7f00, "DETUNE 80=CENT.,0=-1SEM,FF=+1SEM", "DETUNE"},
{TE_EFFECT_LEGATO, 0x7f00, "LEGATO", "LEGATO"},
{TE_EFFECT_ARPEGGIO_ABS, 0x7f00, "ABSOLUTE ARPEGGIO NOTE", ""},
{TE_EFFECT_TRIGGER_RELEASE, 0x7f00, "TRIGGER RELEASE", "TR.REL"},
Expand Down

0 comments on commit 4486a44

Please sign in to comment.