Some fixes for using wav2c.

Theres a bad hack marked inside dexed_sd.cpp which should be fixed later.
pull/98/head
Holger Wirtz 3 years ago
parent efeb605811
commit c619cab005
  1. 2
      MicroDexed.ino
  2. 9
      addon/tools/wav2c.sh
  3. 32
      dexed_sd.cpp

@ -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

@ -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}"

@ -28,10 +28,25 @@
#include <Wire.h>
#include <SD.h>
#include <ArduinoJson.h>
#include <TeensyTimerTool.h>
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];
/******************************************************************************

Loading…
Cancel
Save