Several fixes and tests.

pull/48/head
Holger Wirtz 3 years ago
parent c36bd56c2f
commit 8e7806b081
  1. 57
      MicroDexed.ino
  2. 16
      config.h
  3. 7
      effect_auto_pan.cpp
  4. 5
      effect_modulated_delay.cpp
  5. 2
      effect_mono_stereo.cpp
  6. 5
      effect_stereo_mono.cpp

@ -90,8 +90,8 @@ AudioMixer4 audio_thru_mixer_l;
#ifdef NUM_DRUMS #ifdef NUM_DRUMS
AudioPlaySdRaw* Drum[NUM_DRUMS]; AudioPlaySdRaw* Drum[NUM_DRUMS];
AudioEffectMonoStereo* drum_mono2stereo[NUM_DRUMS]; AudioEffectMonoStereo* drum_mono2stereo[NUM_DRUMS];
AudioMixer8 drum_mixer_r; AudioMixer4 drum_mixer_r;
AudioMixer8 drum_mixer_l; AudioMixer4 drum_mixer_l;
#endif #endif
// Audio chain tail // Audio chain tail
@ -174,6 +174,8 @@ AudioConnection patchCord24(audio_thru_mixer_l, 0, i2s1, 1);
#ifdef USE_FX #ifdef USE_FX
AudioConnection patchCord25(drum_mixer_r, 0, reverb_mixer_r, 4); AudioConnection patchCord25(drum_mixer_r, 0, reverb_mixer_r, 4);
AudioConnection patchCord26(drum_mixer_l, 0, reverb_mixer_l, 4); AudioConnection patchCord26(drum_mixer_l, 0, reverb_mixer_l, 4);
AudioConnection patchCord27(drum_mixer_r, 0, master_mixer_r, 2);
AudioConnection patchCord28(drum_mixer_l, 0, master_mixer_l, 2);
#else #else
AudioConnection patchCord25(drum_mixer_r, 0, master_mixer_r, 2); AudioConnection patchCord25(drum_mixer_r, 0, master_mixer_r, 2);
AudioConnection patchCord26(drum_mixer_l, 0, master_mixer_l, 2); AudioConnection patchCord26(drum_mixer_l, 0, master_mixer_l, 2);
@ -248,10 +250,6 @@ void create_audio_drum_chain(uint8_t instance_id)
dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*Drum[instance_id], 0, *drum_mono2stereo[instance_id], 0); dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*Drum[instance_id], 0, *drum_mono2stereo[instance_id], 0);
dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 0, drum_mixer_r, instance_id); dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 0, drum_mixer_r, instance_id);
dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 1, drum_mixer_l, instance_id); dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 1, drum_mixer_l, instance_id);
drum_mono2stereo[instance_id]->panorama(0.0);
drum_mixer_r.gain(instance_id, 1.0);
drum_mixer_l.gain(instance_id, 1.0);
} }
#endif #endif
@ -446,6 +444,9 @@ void setup()
Serial.println(instance_id, DEC); Serial.println(instance_id, DEC);
#endif #endif
create_audio_drum_chain(instance_id); create_audio_drum_chain(instance_id);
drum_mixer_r.gain(instance_id, 1.0);
drum_mixer_l.gain(instance_id, 1.0);
} }
#endif #endif
@ -709,44 +710,64 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
} }
#ifdef NUM_DRUMS #ifdef NUM_DRUMS
static uint8_t drum_counter;
// Check for Drum // Check for Drum
if (inChannel == DRUM_MIDI_CHANNEL) if (inChannel == DRUM_MIDI_CHANNEL)
{ {
if (drum_counter >= NUM_DRUMS)
drum_counter = 0;
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Drum ")); char note_name[4];
Serial.println(inNumber - 48, DEC); getNoteName(note_name, inNumber);
Serial.print(F("=> Drum["));
Serial.print(drum_counter, DEC);
Serial.print(F("]: "));
Serial.println(note_name);
#endif #endif
switch (inNumber - 48) switch (inNumber - 48)
{ {
case 0: case 0:
Drum[0]->play("drm/bd01.raw"); Drum[drum_counter % 4]->play("/DRM/BD01.RAW");
drum_counter++;
break; break;
case 1: case 1:
Drum[1]->play("drm/cp02.raw"); Drum[drum_counter % 4]->play("/drm/cp02.raw");
drum_counter++;
break; break;
case 2: case 2:
Drum[2]->play("drm/sd15.raw"); Drum[drum_counter % 4]->play("/drm/sd15.raw");
drum_counter++;
break; break;
case 6: case 6:
Drum[3]->play("drm/hh01.wav"); Drum[drum_counter % 4]->play("/drm/hh01.wav");
drum_counter++;
break; break;
case 8: case 8:
Drum[3]->play("drm/hh02.wav"); Drum[drum_counter % 4]->play("/drm/hh02.wav");
drum_counter++;
break; break;
case 10: case 10:
Drum[3]->play("drm/oh02.wav"); Drum[drum_counter % 4]->play("/drm/oh02.wav");
drum_counter++;
break; break;
case 5: case 5:
Drum[4]->play("drm/lt01.raw"); Drum[drum_counter % 4]->play("/drm/lt01.raw");
drum_counter++;
break; break;
case 7: case 7:
Drum[5]->play("drm/ht01.raw"); Drum[drum_counter % 4]->play("/drm/ht01.raw");
drum_counter++;
break; break;
case 13: case 13:
Drum[6]->play("drm/rd01.raw"); Drum[drum_counter % 4]->play("/drm/rd01.raw");
drum_counter++;
break; break;
case 15: case 15:
Drum[7]->play("drm/rd02.raw"); Drum[drum_counter % 4]->play("/drm/rd02.raw");
drum_counter++;
break; break;
} }
} }

@ -109,7 +109,7 @@
#define USE_FX 1 #define USE_FX 1
// NUMBER OF SAMPLEDRUMS // NUMBER OF SAMPLEDRUMS
#define NUM_DRUMS 8 // Max is currently 8! #define NUM_DRUMS 4
#define DRUM_MIDI_CHANNEL 1 #define DRUM_MIDI_CHANNEL 1
// CHORUS parameters // CHORUS parameters
@ -120,7 +120,7 @@
// SGTL5000 // SGTL5000
#ifdef TEENSY_AUDIO_BOARD #ifdef TEENSY_AUDIO_BOARD
#define SGTL5000_AUDIO_ENHANCE 1 #define SGTL5000_AUDIO_ENHANCE 1
//#define SGTL5000_AUDIO_THRU 1 #define SGTL5000_AUDIO_THRU 1
#define SGTL5000_HEADPHONE_VOLUME 0.8 #define SGTL5000_HEADPHONE_VOLUME 0.8
#endif #endif
#if defined(TEENSY4) #if defined(TEENSY4)
@ -148,20 +148,12 @@
//* AUDIO SOFTWARE SETTINGS //* AUDIO SOFTWARE SETTINGS
//************************************************************************************************* //*************************************************************************************************
#define SAMPLE_RATE 44100 #define SAMPLE_RATE 44100
#ifdef USE_FX #ifdef USE_FX
#ifdef NUM_DRUMS #define AUDIO_MEM SAMPLE_RATE * NUM_DEXED * DELAY_MAX_TIME / 128000 + 36
#define AUDIO_MEM (SAMPLE_RATE * NUM_DEXED * DELAY_MAX_TIME / 128000 + 36) + NUM_DRUMS * 3
#else
// #define AUDIO_MEM 380 // T_4.1, 2 Instances, 0.5ms delay
#define AUDIO_MEM (SAMPLE_RATE * NUM_DEXED * DELAY_MAX_TIME / 128000 + 36)
#endif
#else
#ifdef NUM_DRUMS
#define AUDIO_MEM NUM_DEXED * 15 + NUM_DRUMS * 3
#else #else
#define AUDIO_MEM NUM_DEXED * 15 #define AUDIO_MEM NUM_DEXED * 15
#endif #endif
#endif
#ifdef TEENSY_AUDIO_BOARD #ifdef TEENSY_AUDIO_BOARD
/* /*

@ -36,8 +36,13 @@ void AudioEffectAutoPan::update(void)
audio_block_t *out[2]; audio_block_t *out[2];
in = receiveReadOnly(0); in = receiveReadOnly(0);
mod = receiveReadOnly(1); if (!in)
return;
mod = receiveReadOnly(1);
if (!mod)
return;
out[0] = allocate(); out[0] = allocate();
out[1] = allocate(); out[1] = allocate();

@ -77,7 +77,12 @@ void AudioEffectModulatedDelay::update(void)
return; return;
block = receiveWritable(0); block = receiveWritable(0);
if (!block)
return;
modulation = receiveReadOnly(1); modulation = receiveReadOnly(1);
if (!modulation)
return;
if (block && modulation) if (block && modulation)
{ {

@ -49,6 +49,8 @@ void AudioEffectMonoStereo::update(void)
audio_block_t *out[2]; audio_block_t *out[2];
in = receiveReadOnly(0); in = receiveReadOnly(0);
if (!in)
return;
out[0] = allocate(); out[0] = allocate();
out[1] = allocate(); out[1] = allocate();

@ -39,7 +39,12 @@ void AudioEffectStereoMono::update(void)
audio_block_t *block[2]; audio_block_t *block[2];
block[0] = receiveWritable(0); block[0] = receiveWritable(0);
if (!block[0])
return;
block[1] = receiveWritable(1); block[1] = receiveWritable(1);
if (!block[1])
return;
if (_enabled == false) if (_enabled == false)
{ {

Loading…
Cancel
Save