Skip to content

Commit

Permalink
add attack
Browse files Browse the repository at this point in the history
  • Loading branch information
marchingband committed Dec 25, 2023
1 parent fae12b2 commit 9cac3a5
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 367 deletions.
9 changes: 9 additions & 0 deletions src/midi_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ int16_t note_sustain[128];
const bool channel_sustain_default[16] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false };
bool channel_sustain[16];

const uint8_t channel_attack_default[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
uint8_t channel_attack[16];

const uint8_t channel_release_default[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
uint8_t channel_release[16];

Expand Down Expand Up @@ -410,6 +413,8 @@ static void handle_midi(uint8_t *msg)
channel_vol[channel] = channel_vol_default[channel];
channel_exp[channel] = channel_exp_default[channel];
channel_sustain[channel] = channel_sustain_default[channel];
channel_attack[channel] = channel_attack_default[channel];
channel_pitch_bend = channel_pan_default[channel];
handle_channel_sustain_release(channel); // lift the sustain pedal
break;
case MIDI_CC_SUSTAIN:
Expand All @@ -427,6 +432,9 @@ static void handle_midi(uint8_t *msg)
case MIDI_CC_RELEASE:
channel_release[channel] = val;
break;
case MIDI_CC_ATTACK:
channel_attack[channel] = val;
break;
default:
break;
}
Expand All @@ -447,6 +455,7 @@ void reset_midi_controllers(void)
channel_vol[i] = channel_vol_default[i];
channel_exp[i] = channel_exp_default[i];
channel_release[i] = channel_release_default[i];
channel_attack[i] = channel_attack_default[i];
channel_sustain[i] = channel_sustain_default[i];
channel_pitch_bend[i] = channel_pitch_bend_default[i];
}
Expand Down
1 change: 1 addition & 0 deletions src/midi_in.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define MIDI_CC_PAN 10
#define MIDI_CC_EXP 11
#define MIDI_CC_SUSTAIN 64
#define MIDI_CC_ATTACK 73
#define MIDI_CC_RELEASE 72
#define MIDI_CC_MUTE 120
#define MIDI_CC_RESET 121
Expand Down
Loading

0 comments on commit 9cac3a5

Please sign in to comment.