diff --git a/MicroDexed.ino b/MicroDexed.ino index 3843ac4..da77cc9 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -850,7 +850,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) Drum[slot]->enableInterpolation(true); Drum[slot]->setPlaybackRate(drum_config[d].pitch); } - Drum[slot]->playRaw(drum_config[d].drum_data, drum_config[d].len, 1); + Drum[slot]->playRaw((int16_t*)drum_config[d].drum_data, drum_config[d].len, 1); } #ifdef DEBUG diff --git a/addon/tools/wav2c.sh b/addon/tools/wav2c.sh index 6d5d30c..3dcf699 100755 --- a/addon/tools/wav2c.sh +++ b/addon/tools/wav2c.sh @@ -78,8 +78,7 @@ then fi mkdir -p "${TMP}" -rm -f "${DRUMSET_H}" -touch drumset.h +echo "#pragma once" >"${DRUMSET_H}" rm -f "${DRUMS_H}" cat >> "${DRUMS_H}" << EOF /* @@ -119,7 +118,7 @@ typedef struct drum_config_s { uint8_t drum_class; // Type of drum uint8_t midinote; // Triggered by note char name[DRUM_NAME_LEN]; - const unsigned int* drum_data; + const uint8_t* drum_data; char shortname[2]; // 1 char name for sequencer uint32_t len; // number of elements in drum_data float32_t pitch; // @@ -181,7 +180,7 @@ do sample['len']=`expr "${sample['len']}" / 2` echo "// Converted from ${sample['filename']}, length = ${sample['len']} bytes" >> "${DRUMSET_H}" - echo "PROGMEM const int8_t ${sample['name']}[] = {" >> "${DRUMSET_H}" + echo "PROGMEM const uint8_t ${sample['name']}[] = {" >> "${DRUMSET_H}" grep "^ " "${TMP}/${basename}.h" >> "${DRUMSET_H}" if (( "${fill}" > 0 )) @@ -194,7 +193,7 @@ do let fill_counter+=1 if (( "${fill_counter}" >= 8 )) then - echo "" >> "${DRUMSET_H}" + echo "," >> "${DRUMSET_H}" fill_counter=0 else echo -n ", " >> "${DRUMSET_H}" diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 395cb71..53b9092 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -28,10 +28,25 @@ #include #include #include +#include +using namespace TeensyTimerTool; #include "synth_dexed.h" #include "dexed_sd.h" -#include "TeensyTimerTool.h" -using namespace TeensyTimerTool; + +// Bad hack!!! +typedef struct drum_config_s { + uint8_t drum_class; // Type of drum + uint8_t midinote; // Triggered by note + char name[DRUM_NAME_LEN]; + const uint8_t* drum_data; + char shortname[2]; // 1 char name for sequencer + uint32_t len; // number of elements in drum_data + float32_t pitch; // + float32_t pan; // Panorama (-1.0 - +1.0) + float32_t vol_max; // max. Volume (0.0 - 1.0) + float32_t vol_min; // min. Volume (0.0 - 1.0, should be <= vol_max) + float32_t reverb_send; // how much signal to send to the reverb (0.0 - 1.0) +} drum_config_t; extern void init_MIDI_send_CC(void); extern void check_configuration_dexed(uint8_t instance_id); @@ -62,19 +77,6 @@ extern uint8_t seq_chord_dexed_inst; extern uint8_t seq_inst_dexed[4]; extern PeriodicTimer timer1; extern float midi_volume_transform(uint8_t midi_amp); - -typedef struct drum_config_s { - uint8_t drum_class; // Type of drum - uint8_t midinote; // Triggered by note - char name[DRUM_NAME_LEN]; - const unsigned int* drum_data; - char shortname[2]; // 1 char name for sequencer - float32_t pan; // Panorama (-1.0 - +1.0) - float32_t vol_max; // max. Volume (0.0 - 1.0) - float32_t vol_min; // min. Volume (0.0 - 1.0, should be <= vol_max) - float32_t reverb_send; // how much signal to send to the reverb (0.0 - 1.0) -} drum_config_t; - extern drum_config_t drum_config[NUM_DRUMSET_CONFIG]; /******************************************************************************