Renaming of sequencer timer.

Added steps (per clock) to audio timer function.
pull/65/head
Holger Wirtz 4 years ago
parent 09ff0cb755
commit 0c922276c2
  1. 85
      MicroDexed.ino
  2. 13
      audio_timer.cpp
  3. 11
      audio_timer.h
  4. 3
      config.h

@ -36,7 +36,7 @@
#include "effect_modulated_delay.h"
#include "effect_stereo_mono.h"
#include "effect_mono_stereo.h"
#include "sequencer_timer.h"
#include "audio_timer.h"
#ifdef USE_PLATEREVERB
#include "effect_platervbstereo.h"
#else
@ -141,34 +141,59 @@ AudioMixer8 drum_reverb_send_mixer_l;
#endif
#elif defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
{stereo2mono, 0, i2s1, 0},
{stereo2mono, 1, i2s1, 1},
#elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
{stereo2mono, 0, i2s1, 0},
{stereo2mono, 1, i2s1, 1},
AudioControlWM8731master wm8731_1;
#elif defined(PT8211_AUDIO)
AudioOutputPT8211 pt8211_1;
AudioConnection patchCord10(stereo2mono, 0, pt8211_1, 0);
AudioConnection patchCord11(stereo2mono, 1, pt8211_1, 1);
{stereo2mono, 0, pt8211_1, 0},
{stereo2mono, 1, pt8211_1, 1},
#elif defined(TEENSY_DAC_SYMMETRIC)
AudioOutputAnalogStereo dacOut;
AudioMixer4 invMixer;
AudioConnection patchCord10(stereo2mono, 0, dacOut , 0);
AudioConnection patchCord11(stereo2mono, 1, invMixer, 0);
AudioConnection patchCord12(invMixer, 0, dacOut , 1);
{stereo2mono, 0, dacOut , 0},
{stereo2mono, 1, invMixer, 0},
{invMixer, 0, dacOut , 1},
#elif defined(TEENSY_DAC)
AudioOutputAnalogStereo dacOut;
AudioConnection patchCord10(stereo2mono, 0, dacOut, 0);
AudioConnection patchCord11(stereo2mono, 1, dacOut, 1);
{stereo2mono, 0, dacOut, 0},
{stereo2mono, 1, dacOut, 1},
#endif
#ifdef AUDIO_DEVICE_USB
AudioOutputUSB usb1;
AudioConnection patchCord13(stereo2mono, 0, usb1, 0);
AudioConnection patchCord14(stereo2mono, 1, usb1, 1);
{stereo2mono, 0, usb1, 0},
{stereo2mono, 1, usb1, 1},
#endif
#if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU)
AudioInputI2S i2s1in;
{stereo2mono, 0, audio_thru_mixer_r, 0},
{stereo2mono, 1, audio_thru_mixer_l, 0},
{i2s1in, 0, audio_thru_mixer_r, 1},
{i2s1in, 1, audio_thru_mixer_l, 1},
{audio_thru_mixer_r, 0, i2s1, 0},
{audio_thru_mixer_l, 0, i2s1, 1},
#endif
#if NUM_DRUMS > 0
#ifdef USE_FX
{drum_reverb_send_mixer_r, 0, reverb_mixer_r, 2},
{drum_reverb_send_mixer_l, 0, reverb_mixer_l, 2},
{drum_mixer_r, 0, master_mixer_r, 2},
{drum_mixer_l, 0, master_mixer_l, 2},
#else
{drum_mixer_r, 0, master_mixer_r, 2},
{drum_mixer_l, 0, master_mixer_l, 2},
#endif
#endif
AudioTimer audio_timer;
{reverb_mixer_r, audio_timer}
*/
// Audio chain tail
@ -252,8 +277,8 @@ AudioConnection patchCord22(drum_mixer_l, 0, master_mixer_l, 2);
#endif
#endif
AudioSequencerTimer sequencer_timer;
AudioConnection patchCord25(reverb_mixer_r, sequencer_timer);
AudioTimer audio_timer;
AudioConnection patchCord25(reverb_mixer_r, audio_timer);
//
// Dynamic patching of MicroDexed objects
@ -657,31 +682,31 @@ void setup()
#if NUM_DEXED > 1
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
master_mixer_r.gain(instance_id, 1.0);
master_mixer_l.gain(instance_id, 1.0);
master_mixer_r.gain(instance_id, VOL_MAX_FLOAT);
master_mixer_l.gain(instance_id, VOL_MAX_FLOAT);
}
#else
master_mixer_r.gain(0, 1.0);
master_mixer_l.gain(0, 1.0);
master_mixer_r.gain(0, VOL_MAX_FLOAT);
master_mixer_l.gain(0, VOL_MAX_FLOAT);
master_mixer_r.gain(1, 0.0);
master_mixer_l.gain(1, 0.0);
#endif
#if NUM_DRUMS > 0
master_mixer_r.gain(2, 1.0);
master_mixer_l.gain(2, 1.0);
master_mixer_r.gain(2, VOL_MAX_FLOAT);
master_mixer_l.gain(2, VOL_MAX_FLOAT);
#else
master_mixer_r.gain(2, 0.0);
master_mixer_l.gain(2, 0.0);
#endif
master_mixer_r.gain(3, 1.0);
master_mixer_l.gain(3, 1.0);
master_mixer_r.gain(3, VOL_MAX_FLOAT);
master_mixer_l.gain(3, VOL_MAX_FLOAT);
#if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU)
audio_thru_mixer_r.gain(0, 1.0); // MD signal sum
audio_thru_mixer_l.gain(0, 1.0); // MD signal sum
audio_thru_mixer_r.gain(0, VOL_MAX_FLOAT); // MD signal sum
audio_thru_mixer_l.gain(0, VOL_MAX_FLOAT); // MD signal sum
#ifdef TEENSY_AUDIO_BOARD
audio_thru_mixer_r.gain(1, 1.0); // I2S nput
audio_thru_mixer_l.gain(1, 1.0); // I2S input
audio_thru_mixer_r.gain(1, VOL_MAX_FLOAT); // I2S input
audio_thru_mixer_l.gain(1, VOL_MAX_FLOAT); // I2S input
#else
audio_thru_mixer_r.gain(1, 0.0);
audio_thru_mixer_l.gain(1, 0.0);
@ -692,8 +717,8 @@ void setup()
audio_thru_mixer_l.gain(3, 0.0);
#endif
sequencer_timer.set_bpm(60);
sequencer_timer.step_function(&testfunc);
audio_timer.set_bpm(60);
audio_timer.function(4, &testfunc);
#ifdef DEBUG
Serial.println(F("<setup end>"));

@ -1,8 +1,8 @@
#include <Audio.h>
#include "config.h"
#include "sequencer_timer.h"
#include "audio_timer.h"
void AudioSequencerTimer::update(void)
void AudioTimer::update(void)
{
audio_block_t *in;
@ -20,20 +20,23 @@ void AudioSequencerTimer::update(void)
}
}
uint32_t AudioSequencerTimer::get_tick(void)
uint32_t AudioTimer::get_tick(void)
{
return (tick);
}
void AudioSequencerTimer::set_bpm(uint8_t b)
void AudioTimer::set_bpm(uint8_t b)
{
bpm = b;
}
void AudioSequencerTimer::step_function(void(*func)())
void AudioTimer::function(uint8_t steps, void(*func)())
{
if (func != NULL)
{
sequencer_step_function = func;
steps = bpm * steps / 4;
}
else
sequencer_step_function = NULL;
}

@ -1,10 +1,10 @@
#ifndef _SEQUENCER_TIMER_H_
#define _SEQUENCER_TIMER_H_
#ifndef _AUDIO_TIMER_H_
#define _AUDIO_TIMER_H_
class AudioSequencerTimer : public AudioStream
class AudioTimer : public AudioStream
{
public:
AudioSequencerTimer(void):
AudioTimer(void):
AudioStream(1, inputQueueArray)
{
tick = 0;
@ -14,12 +14,13 @@ class AudioSequencerTimer : public AudioStream
virtual uint32_t get_tick(void);
virtual void set_bpm(uint8_t b);
virtual void step_function(void(*func)());
virtual void function(uint8_t steps, void(*func)());
virtual void update(void);
private:
audio_block_t *inputQueueArray[1];
uint8_t bpm;
uint16_t steps;
void (*sequencer_step_function)();
volatile uint32_t tick;
const float beat = AUDIO_SAMPLE_RATE_EXACT / float(AUDIO_BLOCK_SAMPLES) / 60.0;

@ -301,8 +301,9 @@
//*************************************************************************************************
//* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!!
//*************************************************************************************************
#define MAX_DEXED 2 // No! - even don't think about increasing this number! IT WILL PRODUCE MASSIVE PROBLEMS!
#define MAX_DEXED 2 // No! - even don't think about increasing this number! IT _WILL_ PRODUCE MASSIVE PROBLEMS!
#define CONTROL_RATE_MS 50
#define VOL_MAX_FLOAT 0.9
#define EEPROM_MARKER 0x4242

Loading…
Cancel
Save