Dateien hochladen nach „“

Added Velocity Input+Output to Sequencer
pull/55/head
positionhigh 3 years ago
parent d2a5bcb8d1
commit 362cec9db3
  1. 17
      UI.hpp
  2. 2
      drums.h
  3. 3
      midi_devices.hpp
  4. 29
      sequencer.cpp
  5. 15
      sequencer.h

@ -74,6 +74,7 @@ extern uint8_t seq_active_track;
extern elapsedMillis seq_millis_timer;
extern uint8_t seq_menu;
extern bool seq_button_r;
extern uint8_t seq_reverb[4][16];
#if NUM_DRUMS > 0
#include "drums.h"
#endif
@ -3563,6 +3564,21 @@ const char* seq_find_shortname(uint8_t sstep)
return shortname;
}
// deactivated for now since audio library seems not like to change reverb settings at runtime (and is skipping notes)
//void seq_set_rev_for_single_instr_per_step(uint8_t track, uint8_t note)
//{
//
// if (track < 3) {
// for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
// {
// if (seq_data[track][seq_step_timer] == drum_config[d].midinote)
// {
// drum_config[d].reverb_send = float(seq_reverb[track][seq_step_timer]) / float(100);
// break;
// }
// }
// }
//}
void UI_func_sequencer(uint8_t param)
{
@ -3638,6 +3654,7 @@ void UI_func_sequencer(uint8_t param)
memset(seq_data[0], 0, sizeof(seq_data[0]));
memset(seq_data[1], 0, sizeof(seq_data[1]));
memset(seq_data[2], 0, sizeof(seq_data[2]));
memset(seq_data[3], 0, sizeof(seq_data[3]));
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
lcd.print(seq_find_shortname(i) );

@ -164,7 +164,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
1.0,
0.9,
0.0,
0.4
0.1
},
{
DRUM_SNARE,

@ -28,6 +28,7 @@
extern config_t configuration;
extern uint8_t seq_note_in;
extern uint8_t seq_note_in_velocity;
/* #if defined(MIDI_DEVICE_USB)
#include <midi_UsbTransport.h>
#endif */
@ -84,6 +85,7 @@ void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity
{
handleNoteOn(inChannel, inNumber, inVelocity);
seq_note_in=inNumber;
seq_note_in_velocity=inVelocity;
#ifdef DEBUG
Serial.print(F("[MIDI_DIN] NoteOn"));
#endif
@ -584,6 +586,7 @@ void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVel
{
handleNoteOn(inChannel, inNumber, inVelocity);
seq_note_in=inNumber;
seq_note_in_velocity=inVelocity;
#ifdef DEBUG
Serial.print(F("[MIDI_USB_HOST] NoteOn"));
#endif

@ -11,6 +11,7 @@ extern void handleNoteOn(byte , byte , byte );
extern void handleNoteOff(byte , byte , byte );
extern void UI_func_sequencer(uint8_t);
extern const char* seq_find_shortname(uint8_t);
extern void seq_set_rev_for_single_instr_per_step(byte, byte);
void sequencer()
{
@ -31,13 +32,15 @@ void sequencer()
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) {
//write to sequencer if in sequencer menu (step recording and live recording)
//write to sequencer if in sequencer menu
if (seq_note_in > 0 && seq_recording == true) {
if (seq_active_track == 3) handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 0);
seq_data[seq_active_track][seq_step_timer] = seq_note_in;
seq_vel[seq_active_track][seq_step_timer] = seq_note_in_velocity;
seq_note_in = 0;
seq_note_in_velocity=0;
}
lcd.setCursor(seq_step_timer, 1);
lcd.print("X");
@ -51,21 +54,21 @@ void sequencer()
lcd.print(seq_find_shortname(seq_step_timer - 1));
}
}
if (seq_data[0][seq_step_timer] > 0)
//loop for drum track 0-2
for (uint8_t d = 0; d < 3; d++)
{
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[0][seq_step_timer] , 99);
}
if (seq_data[1][seq_step_timer] > 0)
if (seq_data[d][seq_step_timer] > 0 && seq_vel[d][seq_step_timer] > 0)
{
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[1][seq_step_timer] , 99);
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[d][seq_step_timer] , seq_vel[d][seq_step_timer]);
}
if (seq_data[2][seq_step_timer] > 0)
{
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[2][seq_step_timer] , 99);
}
if (seq_data[3][seq_step_timer] > 0) //test instrument sequencer Instance=2
// instrument track
if (seq_data[3][seq_step_timer] > 0) //test instrument sequencer Instance=0
{
handleNoteOn(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 99);
handleNoteOn(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , seq_vel[3][seq_step_timer]);
}
seq_noteoffsent = false;
@ -81,14 +84,14 @@ void sequencer()
{
if (seq_step_timer > 0) {
if (seq_data[3][seq_step_timer - 1] > 0) //test instrument sequencer Instance=2
if (seq_data[3][seq_step_timer - 1] > 0) //test instrument sequencer Instance=0
{
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer - 1] + seq_transpose , 0);
}
} else
{
if (seq_step_timer == 0) {
if (seq_data[3][15] > 0) //test instrument sequencer Instance=2
if (seq_data[3][15] > 0) //test instrument sequencer Instance=0
{
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][15] + seq_transpose , 0);
;

@ -9,9 +9,22 @@ uint32_t seq_timer_previous = 0;
bool seq_running = false;
bool seq_recording = false;
uint8_t seq_note_in;
uint8_t seq_note_in_velocity;
int seq_transpose;
uint8_t seq_data[4][16] = {72, 0, 0, 0, 72, 0, 0, 0, 72, 0, 0, 0, 72, 0, 0, 0,
uint8_t seq_data[4][16] = {72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0,
0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57,
};
uint8_t seq_vel[4][16] = {128, 0, 0, 0, 108, 0, 0, 33, 117, 0, 0, 0, 109, 0, 0, 0,
0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0,
78, 58, 88, 48, 78, 38, 78, 78, 68, 48, 68, 48, 88, 48, 78, 48,
85, 45, 87, 27, 2, 6, 5, 37, 7, 45, 33, 37, 5, 35, 2, 27,
};
//uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
//};

Loading…
Cancel
Save