From 9a78c14a762a6db2bdbac5ff3e1c4820f18b2fc9 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 19 Oct 2021 14:28:01 +0200 Subject: [PATCH] Clean up and copyright information added. --- MicroDexed.ino | 1 + drumset.h | 24 ++++++++++ effect_auto_pan.cpp | 114 -------------------------------------------- effect_auto_pan.h | 54 --------------------- sampleset.h | 2 - sequencer.cpp | 23 +++++++++ sequencer.h | 27 ++++++++++- 7 files changed, 73 insertions(+), 172 deletions(-) delete mode 100644 effect_auto_pan.cpp delete mode 100644 effect_auto_pan.h delete mode 100644 sampleset.h diff --git a/MicroDexed.ino b/MicroDexed.ino index 72fbc12..3e74c22 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -5,6 +5,7 @@ Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android (c)2018-2021 H. Wirtz + M. Koslowski This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/drumset.h b/drumset.h index 9bbddbc..0148c32 100644 --- a/drumset.h +++ b/drumset.h @@ -1,3 +1,27 @@ +/* + MicroDexed + + MicroDexed is a port of the Dexed sound engine + (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6/4.x with audio shield. + Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android + + (c)2018-2021 M. Koslowski + H. Wirtz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + #ifndef _DRUMSET_H #define _DRUMSET_H diff --git a/effect_auto_pan.cpp b/effect_auto_pan.cpp deleted file mode 100644 index d3d8bf3..0000000 --- a/effect_auto_pan.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (c) 2019-2021 H. Wirtz - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#include -#include -#include "effect_auto_pan.h" - -/*************************************************************************/ -// A u d i o E f f e c t A u t o P a n -// Written by Holger Wirtz -// 20191205 - initial version - -static const audio_block_t zeroblock = { - 0, 0, 0, { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#if AUDIO_BLOCK_SAMPLES > 16 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#endif -#if AUDIO_BLOCK_SAMPLES > 32 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#endif -#if AUDIO_BLOCK_SAMPLES > 48 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#endif -#if AUDIO_BLOCK_SAMPLES > 64 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#endif -#if AUDIO_BLOCK_SAMPLES > 80 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#endif -#if AUDIO_BLOCK_SAMPLES > 96 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#endif -#if AUDIO_BLOCK_SAMPLES > 112 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -#endif - } -}; - -void AudioEffectAutoPan::update(void) -{ - audio_block_t *in; - audio_block_t *mod; - audio_block_t *out[2]; - - in = receiveReadOnly(0); - if (!in) - in = (audio_block_t*)&zeroblock; - - mod = receiveReadOnly(1); - if (!mod) - mod = (audio_block_t*)&zeroblock; - - out[0] = allocate(); - out[1] = allocate(); - - if (in && mod && out[0] && out[1]) - { - arm_q15_to_float(in->data, in_f, AUDIO_BLOCK_SAMPLES); - arm_q15_to_float(mod->data, pan_f, AUDIO_BLOCK_SAMPLES); - arm_offset_f32(pan_f, 1.0, pan_f, AUDIO_BLOCK_SAMPLES); - arm_scale_f32(pan_f, PI / 4.0, pan_f, AUDIO_BLOCK_SAMPLES); // PI/4 - - // right - for (uint8_t n = 0; n < AUDIO_BLOCK_SAMPLES; n++) - out_f[0][n] = in_f[n] * _pseudo_log * arm_sin_f32(pan_f[n]); - arm_float_to_q15 (out_f[0], out[0]->data, AUDIO_BLOCK_SAMPLES); - // left - for (uint8_t n = 0; n < AUDIO_BLOCK_SAMPLES; n++) - out_f[1][n] = in_f[n] * _pseudo_log * arm_cos_f32(pan_f[n]); - arm_float_to_q15 (out_f[1], out[1]->data, AUDIO_BLOCK_SAMPLES); - - if (in) - { - release(in); - } - if (in != (audio_block_t*)&zeroblock) - { - release(in); - } - if (mod != (audio_block_t*)&zeroblock) - { - release(mod); - } - - for (uint8_t i = 0; i < 2; i++) - { - if (out[i]) - { - transmit(out[i], i); - release(out[i]); - } - } - } -} diff --git a/effect_auto_pan.h b/effect_auto_pan.h deleted file mode 100644 index 688916c..0000000 --- a/effect_auto_pan.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (c) 2019-2021 H. Wirtz - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#ifndef effect_auto_pan_h_ -#define effect_auto_pan_h_ - -#include "Arduino.h" -#include "AudioStream.h" - -/*************************************************************************/ -// A u d i o E f f e c t A u t o P a n -// Written by Holger Wirtz -// 20191205 - inital version - -class AudioEffectAutoPan : public AudioStream -{ - public: - AudioEffectAutoPan(void): - AudioStream(2, inputQueueArray) - { - ; - } - - virtual void update(void); - - private: - audio_block_t *inputQueueArray[2]; - audio_block_t *out[2]; - float in_f[AUDIO_BLOCK_SAMPLES]; - float out_f[2][AUDIO_BLOCK_SAMPLES]; - float pan_f[AUDIO_BLOCK_SAMPLES]; - const float _pseudo_log = 1048575 / (float)(1 << 20); -}; - -#endif diff --git a/sampleset.h b/sampleset.h deleted file mode 100644 index 5718c27..0000000 --- a/sampleset.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -#include diff --git a/sequencer.cpp b/sequencer.cpp index 95b6645..df17679 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -1,3 +1,26 @@ +/* + MicroDexed + + MicroDexed is a port of the Dexed sound engine + (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6/4.x with audio shield. + Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android + + (c)2018-2021 M. Koslowski + H. Wirtz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "config.h" #include "sequencer.h" diff --git a/sequencer.h b/sequencer.h index ef71930..93aa7ac 100644 --- a/sequencer.h +++ b/sequencer.h @@ -1,6 +1,29 @@ +/* + MicroDexed -#ifndef SEQUENCER_H -#define SEQUENCER_H + MicroDexed is a port of the Dexed sound engine + (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6/4.x with audio shield. + Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android + + (c)2018-2021 M. Koslowski + H. Wirtz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _SEQUENCER_H +#define _SEQUENCER_H typedef struct sequencer_s { float drums_volume;