Removed Audio-Interrupt-Timer code. Will use MetroTimer later.

pull/68/head
Holger Wirtz 3 years ago
parent c94ae88a37
commit 62ba943135
  1. 36
      MicroDexed.ino
  2. 43
      audio_timer.cpp
  3. 30
      audio_timer.h

@ -36,7 +36,6 @@
#include "effect_modulated_delay.h"
#include "effect_stereo_mono.h"
#include "effect_mono_stereo.h"
#include "audio_timer.h"
#ifdef USE_PLATEREVERB
#include "effect_platervbstereo.h"
#else
@ -357,29 +356,6 @@ extern LCDMenuLib2 LCDML;
extern void getNoteName(char* noteName, uint8_t noteNumber);
void testfunc(void)
{
static int8_t takt;
switch (takt % 4)
{
case 0:
Serial.println("EINS!");
break;
case 1:
Serial.println("ZWEI!");
break;
case 2:
Serial.println("DREI!");
break;
case 3:
Serial.println("VIER!");
takt = -1;
break;
}
takt++;
}
/***********************************************************************
SETUP
***********************************************************************/
@ -392,11 +368,6 @@ void setup()
#ifdef ENABLE_LCD_UI
setup_ui();
#ifdef DEBUG
setup_debug_message();
#endif
Serial.begin(SERIAL_SPEED);
Serial.println(CrashReport);
#endif
#ifndef ENABLE_LCD_UI
#ifdef DEBUG
@ -405,6 +376,10 @@ void setup()
#endif
#ifdef DEBUG
setup_debug_message();
Serial.begin(SERIAL_SPEED);
Serial.println(CrashReport);
generate_version_string(version_string, sizeof(version_string));
Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed"));
@ -644,9 +619,6 @@ void setup()
audio_thru_mixer_l.gain(3, 0.0);
#endif
//audio_timer.set_bpm(60);
//audio_timer.function(8, &testfunc); // 60 bpm with 1/8 pulses
#ifdef DEBUG
Serial.println(F("<setup end>"));
#endif

@ -1,43 +0,0 @@
#include <Audio.h>
#include "config.h"
#include "audio_timer.h"
void AudioTimer::update(void)
{
audio_block_t *in;
in = receiveReadOnly(0);
if (in)
release(in);
tick++;
if (tick >= _steps)
{
if (step_function != NULL)
(*step_function)();
tick = 0;
}
}
uint32_t AudioTimer::get_tick(void)
{
return (tick);
}
void AudioTimer::set_bpm(uint8_t b)
{
bpm = b;
}
void AudioTimer::function(uint8_t stepping, void(*func)())
{
steps = stepping;
if (func != NULL)
{
step_function = func;
_steps = beat * float(bpm) * 4.0 / float(stepping) + 0.5;
}
else
step_function = NULL;
}

@ -1,30 +0,0 @@
#ifndef _AUDIO_TIMER_H_
#define _AUDIO_TIMER_H_
class AudioTimer : public AudioStream
{
public:
AudioTimer(void):
AudioStream(1, inputQueueArray)
{
tick = 0;
bpm = 60;
steps = 4;
step_function = NULL;
}
virtual uint32_t get_tick(void);
virtual void set_bpm(uint8_t b);
virtual void function(uint8_t stepping, void(*func)());
virtual void update(void);
private:
audio_block_t *inputQueueArray[1];
uint8_t bpm;
uint8_t steps;
uint16_t _steps;
void (*step_function)();
volatile uint32_t tick;
const float beat = AUDIO_SAMPLE_RATE_EXACT / float(AUDIO_BLOCK_SAMPLES) / 60.0;
};
#endif
Loading…
Cancel
Save