From d9dceb64ede9ae4da29e47f6defb40e666cc9079 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Thu, 28 Mar 2024 20:06:47 +0000 Subject: [PATCH] Attempt at adding zeroCrossingCount to audio-sync --- usermods/audioreactive/audio_reactive.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 19e59519..d068d7cc 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1021,7 +1021,7 @@ class AudioReactive : public Usermod { uint8_t samplePeak; // 01 Bytes offset 16 - 0 no peak; >=1 peak detected. In future, this will also provide peak Magnitude uint8_t frameCounter; // 01 Bytes offset 17 - track duplicate/out of order packets uint8_t fftResult[16]; // 16 Bytes offset 18 - uint8_t gap2[2]; // gap added by compiler: 02 Bytes, offset 34 + uint16_t zeroCrossingCount; // 02 Bytes, offset 34 float FFT_Magnitude; // 04 Bytes offset 36 float FFT_MajorPeak; // 04 Bytes offset 40 }; @@ -1561,6 +1561,7 @@ class AudioReactive : public Usermod { transmitData.samplePeak = udpSamplePeak ? 1:0; udpSamplePeak = false; // Reset udpSamplePeak after we've transmitted it transmitData.frameCounter = frameCounter; + transmitData.zeroCrossingCount = zeroCrossingCount; for (int i = 0; i < NUM_GEQ_CHANNELS; i++) { transmitData.fftResult[i] = (uint8_t)constrain(fftResult[i], 0, 254); @@ -1633,6 +1634,7 @@ class AudioReactive : public Usermod { FFT_MajorPeak = constrain(receivedPacket->FFT_MajorPeak, 1.0f, 11025.0f); // restrict value to range expected by effects soundPressure = volumeSmth; // substitute - V2 format does not (yet) include this value agcSensitivity = 128.0f; // substitute - V2 format does not (yet) include this value + zeroCrossingCount = receivedPacket->zeroCrossingCount; return true; }