From 62ba94313519ed45ecd788e97c9d9910d07052bf Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 11 Aug 2021 13:59:24 +0200 Subject: [PATCH] Removed Audio-Interrupt-Timer code. Will use MetroTimer later. --- MicroDexed.ino | 36 ++++-------------------------------- audio_timer.cpp | 43 ------------------------------------------- audio_timer.h | 30 ------------------------------ 3 files changed, 4 insertions(+), 105 deletions(-) delete mode 100644 audio_timer.cpp delete mode 100644 audio_timer.h diff --git a/MicroDexed.ino b/MicroDexed.ino index d47bea9..facfc32 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -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("")); #endif diff --git a/audio_timer.cpp b/audio_timer.cpp deleted file mode 100644 index 149158e..0000000 --- a/audio_timer.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#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; -} diff --git a/audio_timer.h b/audio_timer.h deleted file mode 100644 index f6ed8ff..0000000 --- a/audio_timer.h +++ /dev/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