ModalModule
Member
Well, bad news for me, but potentially good news for those looking to further teensy audio: my interfaces can't be aggregated because they can only use internal clock sources. So back to this plan! Haha
name=Teensyduino
version=1.8.5
rewriting=disabled
# Teensyduino Installer
compiler.path={runtime.hardware.path}/../tools/
teensytools.path={runtime.hardware.path}/../tools/
# Arduino Boards Manager
#compiler.path={runtime.tools.teensy-compile.path}/
#teensytools.path={runtime.tools.teensy-tools.path}/
[COLOR="#FF0000"]build.flags.audioblocksize=128
build.flags.audiorate=44100.0f
build.flags.USBchannelcount=2
build.flags.audio=-DAUDIO_BLOCK_SAMPLES={build.flags.audioblocksize} -DAUDIO_SAMPLE_RATE_EXACT={build.flags.audiorate} -DAUDIO_USB_CHANNEL_COUNT={build.flags.USBchannelcount}[/COLOR]
## EEPROM Data
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2hex.flags=-O ihex -R .eeprom
## Preprocessor Includes
recipe.preproc.includes="{compiler.path}{build.toolchain}{build.command.g++}" -M -MG -MP -x c++ -w {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} {includes} "{source_file}"
## Preprocessor Macros
recipe.preproc.macros="{compiler.path}{build.toolchain}{build.command.g++}" -E -CC -x c++ -w {compiler.cpp.flags} {build.flags.common} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} {includes} "{source_file}" -o "{preprocessed_file_path}"
## New Preprocessor for Arduino 1.9
tools.arduino-preprocessor.path={runtime.tools.arduino-preprocessor.path}
tools.arduino-preprocessor.cmd.path={path}/arduino-preprocessor
tools.arduino-preprocessor.pattern="{cmd.path}" "{source_file}" "{codecomplete}" -- -std=gnu++14
## Precompile Arduino.h header
recipe.hooks.sketch.prebuild.1.pattern="{teensytools.path}precompile_helper" "{runtime.platform.path}/cores/{build.core}" "{build.path}" "{compiler.path}{build.toolchain}{build.command.g++}" -x c++-header {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{runtime.platform.path}/cores/{build.core}" "{build.path}/pch/Arduino.h" -o "{build.path}/pch/Arduino.h.gch"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{build.toolchain}{build.command.g++}" -c [COLOR="#FF0000"]{build.flags.audio}[/COLOR] {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{build.path}/pch" {includes} "{source_file}" -o "{object_file}"
## Compile c files
recipe.c.o.pattern="{compiler.path}{build.toolchain}{build.command.gcc}" -c [COLOR="#FF0000"]{build.flags.audio}[/COLOR] {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.c} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} {includes} "{source_file}" -o "{object_file}"
## Compile S files
recipe.S.o.pattern="{compiler.path}{build.toolchain}{build.command.gcc}" -c [COLOR="#FF0000"]{build.flags.audio}[/COLOR] {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.S} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} {includes} "{source_file}" -o "{object_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{build.toolchain}{build.command.ar}" rcs "{archive_file_path}" "{object_file}"
## Audio
# Extra menu entries to tune the behaviour of the Audio library
menu.audiorate=Audio sample rate
teensy41.menu.audiorate.44=44.1kHz
teensy41.menu.audiorate.44.build.flags.audiorate=44100.0f
teensy41.menu.audiorate.48=48kHz
teensy41.menu.audiorate.48.build.flags.audiorate=48000.0f
teensy41.menu.audiorate.96=96kHz
teensy41.menu.audiorate.96.build.flags.audiorate=96000.0f
teensy40.menu.audiorate.44=44.1kHz
teensy40.menu.audiorate.44.build.flags.audiorate=44100.0f
teensy40.menu.audiorate.48=48kHz
teensy40.menu.audiorate.48.build.flags.audiorate=48000.0f
teensy40.menu.audiorate.96=96kHz
teensy40.menu.audiorate.96.build.flags.audiorate=96000.0f
menu.audioblocksize=Audio block size
teensy41.menu.audioblocksize.normal=128 samples (normal)
teensy41.menu.audioblocksize.normal.build.flags.audioblocksize=128
teensy41.menu.audioblocksize.16=16 samples
teensy41.menu.audioblocksize.16.build.flags.audioblocksize=16
teensy41.menu.audioblocksize.256=256 samples
teensy41.menu.audioblocksize.256.build.flags.audioblocksize=256
teensy40.menu.audioblocksize.normal=128 samples (normal)
teensy40.menu.audioblocksize.normal.build.flags.audioblocksize=128
teensy40.menu.audioblocksize.16=16 samples
teensy40.menu.audioblocksize.16.build.flags.audioblocksize=16
teensy40.menu.audioblocksize.256=256 samples
teensy40.menu.audioblocksize.256.build.flags.audioblocksize=256
menu.USBchannelcount=USB channels
teensy41.menu.USBchannelcount.2=2
teensy41.menu.USBchannelcount.2.build.flags.USBchannelcount=2
teensy41.menu.USBchannelcount.4=4
teensy41.menu.USBchannelcount.4.build.flags.USBchannelcount=4
teensy41.menu.USBchannelcount.6=6
teensy41.menu.USBchannelcount.6.build.flags.USBchannelcount=6
teensy41.menu.USBchannelcount.8=8
teensy41.menu.USBchannelcount.8.build.flags.USBchannelcount=8
teensy40.menu.USBchannelcount.2=2
teensy40.menu.USBchannelcount.2.build.flags.USBchannelcount=2
teensy40.menu.USBchannelcount.4=4
teensy40.menu.USBchannelcount.4.build.flags.USBchannelcount=4
teensy40.menu.USBchannelcount.6=6
teensy40.menu.USBchannelcount.6.build.flags.USBchannelcount=6
teensy40.menu.USBchannelcount.8=8
teensy40.menu.USBchannelcount.8.build.flags.USBchannelcount=8
Just gotta say this is so cool to see
I can tell you I will definitely look when I have a bit more time, sounds interesting to me.I've made some improvements to the multi-channel USB which I pushed up just now. The feedback sync is now apparently working, but only on a USB 1.1 connection. There's something screwy going on with USB 2.0
Thanks for that. I’ve got some similar ones, and the ADC also claims it can do different sample rates … but I’ve not found a way to do that. It’d be interesting to do it, if possible, as I got to a point where I had S/PDIF as the audio clock master, which was quite fun, and possibly even useful as well…These 2: (one dac and one ADC, I wanted both in one but couldn't find one)
https://a.co/d/6RqSvPp
https://a.co/d/byft3ep
That’s going to need some serious spec reading to fix,
plus fighting Windows’s enthusiasm for caching known devices so your changes don’t show up. Sigh.
I've made some improvements to the multi-channel USB which I pushed up just now. The feedback sync is now apparently working, but only on a USB 1.1 connection. There's something screwy going on with USB 2.0, but it doesn't show up immediately - the test I did just now ran for over 3.5 minutes before glitches started occurring every 2.5 seconds or so. I've left in a deliberate one-sample "click" when a buffer overrun happens (PC -> Teensy) - see usb_audio.cpp line 261 if you want to remove it. Teensy -> PC seems to be working OK.