Added audioreactive to usermod_list
Formatting in usermod
This commit is contained in:
parent
1828a2a81c
commit
dd584e929f
@ -380,21 +380,20 @@ class AudioReactive : public Usermod {
|
||||
uint8_t myVals[32]; // Used to store a pile of samples because WLED frame rate and WLED sample rate are not synchronized. Frame rate is too low.
|
||||
bool samplePeak = 0; // Boolean flag for peak. Responding routine must reset this flag
|
||||
bool udpSamplePeak = 0; // Boolean flag for peak. Set at the same tiem as samplePeak, but reset by transmitAudioData
|
||||
int delayMs = 10; // I don't want to sample too often and overload WLED
|
||||
int micIn = 0; // Current sample starts with negative values and large values, which is why it's 16 bit signed
|
||||
int sample; // Current sample. Must only be updated ONCE!!!
|
||||
float sampleMax = 0.f; // Max sample over a few seconds. Needed for AGC controler.
|
||||
float sampleReal = 0.f; // "sample" as float, to provide bits that are lost otherwise. Needed for AGC.
|
||||
uint16_t delayMs = 10; // I don't want to sample too often and overload WLED
|
||||
int16_t micIn = 0; // Current sample starts with negative values and large values, which is why it's 16 bit signed
|
||||
int16_t sample; // Current sample. Must only be updated ONCE!!!
|
||||
float sampleMax = 0.0f; // Max sample over a few seconds. Needed for AGC controler.
|
||||
float sampleReal = 0.0f; // "sample" as float, to provide bits that are lost otherwise. Needed for AGC.
|
||||
float tmpSample; // An interim sample variable used for calculatioins.
|
||||
float sampleAdj; // Gain adjusted sample value
|
||||
float sampleAgc = 0.f; // Our AGC sample
|
||||
int rawSampleAgc = 0; // Our AGC sample - raw
|
||||
float sampleAgc = 0.0f; // Our AGC sample
|
||||
int16_t rawSampleAgc = 0; // Our AGC sample - raw
|
||||
long timeOfPeak = 0;
|
||||
long lastTime = 0;
|
||||
float micLev = 0.f; // Used to convert returned value to have '0' as minimum. A leveller
|
||||
float sampleAvg = 0.f; // Smoothed Average
|
||||
float beat = 0.f; // beat Detection
|
||||
|
||||
float micLev = 0.0f; // Used to convert returned value to have '0' as minimum. A leveller
|
||||
float sampleAvg = 0.0f; // Smoothed Average
|
||||
float beat = 0.0f; // beat Detection
|
||||
float expAdjF; // Used for exponential filter.
|
||||
float weighting = 0.2f; // Exponential filter weighting. Will be adjustable in a future release.
|
||||
|
||||
@ -406,12 +405,9 @@ class AudioReactive : public Usermod {
|
||||
static const char _digitalmic[];
|
||||
|
||||
|
||||
// private methods
|
||||
bool isValidUdpSyncVersion(char header[6]) {
|
||||
if (strncmp(header, UDP_SYNC_HEADER, 6) == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return strncmp(header, UDP_SYNC_HEADER, 6) == 0;
|
||||
}
|
||||
|
||||
|
||||
@ -773,10 +769,13 @@ class AudioReactive : public Usermod {
|
||||
um_data->uf8_data[0] = &FFT_MajorPeak;
|
||||
um_data->uf8_data[1] = &FFT_Magnitude;
|
||||
//...
|
||||
// these are values used by effects in soundreactive fork
|
||||
//uint8_t *fftResult = um_data->;
|
||||
//float *fftAvg = um_data->;
|
||||
//float *fftBin = um_data->;
|
||||
//float FFT_MajorPeak = um_data->;
|
||||
//float FFT_Magnitude = um_data->;
|
||||
//float *fftCalc = um_data->;
|
||||
//double FFT_MajorPeak = um_data->;
|
||||
//double FFT_Magnitude = um_data->;
|
||||
//float sampleAgc = um_data->;
|
||||
//float sampleReal = um_data->;
|
||||
//float multAgc = um_data->;
|
||||
@ -790,6 +789,7 @@ class AudioReactive : public Usermod {
|
||||
//uint8_t maxVol = um_data->;
|
||||
//uint8_t binNum = um_data->;
|
||||
//uint16_t *myVals = um_data->;
|
||||
//int16_t sample = um_data->;
|
||||
|
||||
// Reset I2S peripheral for good measure
|
||||
i2s_driver_uninstall(I2S_NUM_0);
|
||||
|
@ -217,6 +217,7 @@ void WiFiEvent(WiFiEvent_t event);
|
||||
|
||||
//um_manager.cpp
|
||||
typedef struct UM_Exchange_Data {
|
||||
// should just use: size_t arr_size, void **arr_ptr, byte *ptr_type
|
||||
size_t ub8_size; // size of ub8_data
|
||||
uint8_t **ub8_data; // array of pointers to bytes (pointer can point to an array of bytes, depends on the usermod)
|
||||
size_t uw16_size; // size of uw16_data
|
||||
|
@ -132,6 +132,10 @@
|
||||
#include "../usermods/Si7021_MQTT_HA/usermod_si7021_mqtt_ha.h"
|
||||
#endif
|
||||
|
||||
#ifdef USERMOD_AUDIOREACTIVE
|
||||
#include "../usermods/audioreactive/audio_reactive.h"
|
||||
#endif
|
||||
|
||||
void registerUsermods()
|
||||
{
|
||||
/*
|
||||
@ -251,4 +255,8 @@ void registerUsermods()
|
||||
#ifdef USERMOD_SI7021_MQTT_HA
|
||||
usermods.add(new Si7021_MQTT_HA());
|
||||
#endif
|
||||
|
||||
#ifdef USERMOD_AUDIOREACTIVE
|
||||
usermods.add(new AudioReactive());
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user