You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MicroDexed/control_sgtl5000plus.h

81 lines
2.3 KiB

/*
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 H. Wirtz <wirtz@parasitstudio.de>
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
the Free Software Foundation; either version 3 of the License, or
(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 _SGTL5000PLUS_H_
#define _SGTL5000PLUS_H_
#include <Arduino.h>
#include <Audio.h>
#define GRAPHIC_EQ_TYPE_0 FILTER_HIPASS
#define GRAPHIC_EQ_CENTER_FRQ_0 50.0
#define GRAPHIC_EQ_Q_0 6.0
#define GRAPHIC_EQ_TYPE_1 FILTER_BANDPASS
#define GRAPHIC_EQ_CENTER_FRQ_1 120.0
#define GRAPHIC_EQ_Q_1 6.0
#define GRAPHIC_EQ_TYPE_2 FILTER_BANDPASS
#define GRAPHIC_EQ_CENTER_FRQ_2 220.0
#define GRAPHIC_EQ_Q_2 6.0
#define GRAPHIC_EQ_TYPE_3 FILTER_BANDPASS
#define GRAPHIC_EQ_CENTER_FRQ_3 1000.0
#define GRAPHIC_EQ_Q_3 6.0
#define GRAPHIC_EQ_TYPE_4 FILTER_BANDPASS
#define GRAPHIC_EQ_CENTER_FRQ_4 2000.0
#define GRAPHIC_EQ_Q_4 6.0
#define GRAPHIC_EQ_TYPE_5 FILTER_BANDPASS
#define GRAPHIC_EQ_CENTER_FRQ_5 7000.0
#define GRAPHIC_EQ_Q_5 2.0
#define GRAPHIC_EQ_TYPE_6 FILTER_LOPASS
#define GRAPHIC_EQ_CENTER_FRQ_6 10000.0
#define GRAPHIC_EQ_Q_6 6.0
class AudioControlSGTL5000Plus : public AudioControlSGTL5000
{
public:
AudioControlSGTL5000Plus(uint8_t n = 7) {
num_bands = constrain(n, 1, 7);
init_parametric_eq();
};
void setEQType(uint8_t band, uint8_t ft);
void setEQFc(uint8_t band, float frq);
void setEQQ(uint8_t band, float q);
void setEQGain(uint8_t band, float gain);
private:
void init_parametric_eq(void);
uint8_t num_bands;
int* filter_coeff;
uint8_t* filter_type;
float* Fc;
float* Q;
float* peakGainDB;
};
#endif