Seems like it might be a problem for all "home-brew" audio objects! I've tried several, here is the simplest example I can think of - a do-nothing pass-through object:
Code:
//----------------------------------------------------
// Test for Teensy 4 "home brew" Audio object
// compilation.
// Derek Rowell 8/15/2019
//====================================================
#include <Audio.h>
#include "AudioPassthru.h"
#include <Wire.h>
#include <SPI.h>
#include <SerialFlash.h>
//
AudioInputI2S input;
AudioOutputI2S output;
AudioPassthru passthru;
AudioConnection c1(input,0, passthru,0);
AudioConnection c2(input,1, passthru,1);
AudioConnection c3(passthru,0, output,0);
AudioConnection c4(passthru,1, output,1);
AudioControlSGTL5000 codec;
//----------
void setup() {
Serial.begin(57600);
delay(2000);
codec.enable();
AudioMemory(20);
codec.volume(1.0);
}
//---------------
void loop() {}
//---------------
with the home-grown code::
Code:
//----------------------------------------
// *** AudioPassthru.h ***
//---------------------------------------
#ifndef audio_passthru_h_
#define audio_passthru_h_
#include "AudioStream.h"
#include "Arduino.h"
//
//---
class AudioPassthru : public AudioStream {
public:
AudioPassthru() : AudioStream(2, inputQueueArray){}
virtual void update(void);
// ----
private:
audio_block_t *inputQueueArray[2];
};
#endif
and
Code:
//----------------------------------------
// *** AudioPassthru.cpp ***
//---------------------------------------
#include "AudioPassthru.h"
void AudioPassthru::update(void) {
audio_block_t *blockI, *blockQ;
blockI = receiveWritable(0);
blockQ = receiveWritable(1);
//
if (!blockI && !blockQ) return;
if ( blockQ && !blockI) {release(blockQ); return;}
if ( blockI && !blockQ) {release(blockI); return;}
//-- Do absolutely nothing!!!
transmit(blockI, 0);
transmit(blockQ, 1);
//
release(blockI);
release(blockQ);
return;}
It compiles and runs just fine on the T3.6, but gives the same errors as above when compiling for the T4:
Code:
In file included from C:\Users\Derek\AppData\Local\Temp\arduino_build_103058\sketch\AudioPassthru.h:7:0,
from C:\Users\Derek\AppData\Local\Temp\arduino_build_103058\sketch\AudioPassthru.cpp:4:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h: In member function 'int AudioStream::processorUsage()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:108:50: error: 'F_CPU_ACTUAL' was not declared in this scope
#define CYCLE_COUNTER_APPROX_PERCENT(n) (((n) + (F_CPU_ACTUAL / 32 / AUDIO_SAMPLE_RATE * AUDIO_BLOCK_SAMPLES / 100)) / (F_CPU_ACTUAL / 16 / AUDIO_SAMPLE_RATE * AUDIO_BLOCK_SAMPLES / 100))
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:142:36: note: in expansion of macro 'CYCLE_COUNTER_APPROX_PERCENT'
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:108:50: error: 'F_CPU_ACTUAL' was not declared in this scope
#define CYCLE_COUNTER_APPROX_PERCENT(n) (((n) + (F_CPU_ACTUAL / 32 / AUDIO_SAMPLE_RATE * AUDIO_BLOCK_SAMPLES / 100)) / (F_CPU_ACTUAL / 16 / AUDIO_SAMPLE_RATE * AUDIO_BLOCK_SAMPLES / 100))
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:143:39: note: in expansion of macro 'CYCLE_COUNTER_APPROX_PERCENT'
int processorUsageMax(void) { return CYCLE_COUNTER_APPROX_PERCENT(cpu_cycles_max); }
In file included from C:\Users\Derek\AppData\Local\Temp\arduino_build_103058\sketch\AudioPassthru.h:7:0,
from C:\Users\Derek\AppData\Local\Temp\arduino_build_103058\sketch\AudioPassthru.cpp:4:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h: In static member function 'static void AudioStream::update_all()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:162:50: error: 'IRQ_SOFTWARE' was not declared in this scope
static void update_all(void) { NVIC_SET_PENDING(IRQ_SOFTWARE); }
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:162:62: error: 'NVIC_SET_PENDING' was not declared in this scope
static void update_all(void) { NVIC_SET_PENDING(IRQ_SOFTWARE); }