From 88a600a9160376e536bb380478ead36ef72c813a Mon Sep 17 00:00:00 2001 From: boblark Date: Wed, 18 Jan 2023 21:01:08 -0800 Subject: [PATCH] Fixed to compile with T3.x (run only T4.x) --- async_input_spdif3_F32.cpp | 14 +++++++------- async_input_spdif3_F32.h | 14 ++++++++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/async_input_spdif3_F32.cpp b/async_input_spdif3_F32.cpp index d95b029..da03595 100644 --- a/async_input_spdif3_F32.cpp +++ b/async_input_spdif3_F32.cpp @@ -407,16 +407,18 @@ int32_t AsyncAudioInputSPDIF3_F32::getHalfFilterLength() const{ return _resampler.getHalfFilterLength(); } -#endif // __IMXRT1062__ +// Only for T4.x (__IMXRT1062__). +#endif #if defined(__MK66FX1M0__) || defined(__MK64FX512__) || defined(__MK20DX256__) || defined(__MKL26Z64__) // empty code to allow compile (but no sound input) on other Teensy models -#include "async_input_spdif3.h" -AsyncAudioInputSPDIF3_F32::AsyncAudioInputSPDIF3_F32(bool dither, bool noiseshaping,float attenuation, int32_t minHalfFilterLength, int32_t maxHalfFilterLength): - AudioStream(0, NULL), _resampler(attenuation, minHalfFilterLength, maxHalfFilterLength) - { } +#include "async_input_spdif3_F32.h" +// Removed next for T3.x compile. Bob L Jan 2023 +//AsyncAudioInputSPDIF3_F32::AsyncAudioInputSPDIF3_F32(bool dither, bool noiseshaping,float attenuation, int32_t minHalfFilterLength, int32_t maxHalfFilterLength): +// AudioStream(0, NULL), _resampler(attenuation, minHalfFilterLength, maxHalfFilterLength) +// { } void AsyncAudioInputSPDIF3_F32::begin() { } void AsyncAudioInputSPDIF3_F32::update(void) { } double AsyncAudioInputSPDIF3_F32::getBufferedTime() const { return 0; } @@ -427,6 +429,4 @@ double AsyncAudioInputSPDIF3_F32::getAttenuation() const { return 0; } int32_t AsyncAudioInputSPDIF3_F32::getHalfFilterLength() const { return 0; } AsyncAudioInputSPDIF3_F32::~AsyncAudioInputSPDIF3_F32() { } - #endif - diff --git a/async_input_spdif3_F32.h b/async_input_spdif3_F32.h index b808a9a..b93d817 100644 --- a/async_input_spdif3_F32.h +++ b/async_input_spdif3_F32.h @@ -37,6 +37,9 @@ //#define DEBUG_SPDIF_IN //activates debug output +// Only for T4.x +// #if defined(__IMXRT1062__) + class Scaler_F32; // internal class AsyncAudioInputSPDIF3_F32 : public AudioStream_F32 @@ -55,7 +58,7 @@ public: double getTargetLantency() const; double getAttenuation() const; int32_t getHalfFilterLength() const; -protected: +protected: static DMAChannel dma; static void isr(void); private: @@ -74,12 +77,12 @@ private: Resampler _resampler; Scaler_F32* quantizer[2]; arm_biquad_cascade_df2T_instance_f32 _bufferLPFilter; - + volatile double _bufferedTime; volatile double _lastValidInputFrequ; double _inputFrequency=0.; double _targetLatencyS; //target latency [seconds] - const double _blockDuration=AUDIO_BLOCK_SAMPLES/AUDIO_SAMPLE_RATE_EXACT; //[seconds] + const double _blockDuration=AUDIO_BLOCK_SAMPLES/AUDIO_SAMPLE_RATE_EXACT; //[seconds] double _maxLatency=2.*_blockDuration; static float sample_rate_Hz; // configured output sample rate @@ -88,4 +91,7 @@ private: #endif }; -#endif \ No newline at end of file +// Only for T4.x +//#endif + +#endif