Change AUDIO_BLOCK_SAMPLES from the ino file

Status
Not open for further replies.

Rickote

New member
I know this topic was covered in the past and saw the thread from chipaudette years ago. Today I see the Audiostream.h file has a #ifndef AUDIO_BLOCK_SAMPLES... but when I try to pre define this in the ino file, all hell breaks loose. I mean it has an effect but not the same than when defined directly in the Audiostream.h file.
I am trying to minimize my latency in a synth sine wave from a DAC in Teensy 3.6, so can be synchronized with an external pulse. When reducing from 128 to 16 samples (minimum possible) latency goes from over 10mS to under 3mS and things work nice and smooth, but trying to define in the ino file has different effects, depending the block size can be from emitting a random noise, to just crash the program.
I want to make the program easily portable for students to use in their own simple IDE setups, where they may need the default 128 samples (needed for most other audio applications) and know little about deep buried libraries. No idea why this is happening, I try to find other defines everywhere that may be at conflict, but only see other under the Teensy 4 tree. Does anybody is aware of any easy way to define this from the ino or some other sketch folder file?

Thank you,
Rick.
 
as he say
this is in the AudioStream.h

Code:
#ifndef AUDIO_BLOCK_SAMPLES
#define AUDIO_BLOCK_SAMPLES  128
#endif

would it not then be possible to do a custom define in the .ino file
just before all #include:s ?


or do the compiler compile all core files first without any includes in the .ino file?
 
Status
Not open for further replies.
Back
Top