Skip to content

Commit

Permalink
add PSRAM support
Browse files Browse the repository at this point in the history
  • Loading branch information
modularev committed Nov 9, 2020
1 parent cc7127a commit f84a55c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 10 additions & 1 deletion architecture/teensy/teensy.cpp
Expand Up @@ -96,14 +96,23 @@ std::list<GUI*> GUI::fGuiList;
ztimedmap GUI::gTimedZoneMap;
#endif

#ifdef USEPSRAM
constexpr size_t bufSize = sizeof(mydsp);
EXTMEM uint8_t myHeap[bufSize];
#endif

AudioFaust::AudioFaust() : AudioStream(FAUST_INPUTS, new audio_block_t*[FAUST_INPUTS])
{
#ifdef NVOICES
int nvoices = NVOICES;
mydsp_poly* dsp_poly = new mydsp_poly(new mydsp(), nvoices, true, true);
fDSP = dsp_poly;
#else
fDSP = new mydsp();
#ifdef USEPSRAM
fDSP = new(myHeap) mydsp();
#else
fDSP = new mydsp();
#endif
#endif

fDSP->init(AUDIO_SAMPLE_RATE_EXACT);
Expand Down
7 changes: 7 additions & 0 deletions tools/faust2appls/faust2teensy 100755 → 100644
Expand Up @@ -20,6 +20,7 @@ set -e
LIB="0"
NVOICES=0
MIDI=0
EXT=0

echoHelp ()
{
Expand All @@ -28,6 +29,7 @@ echoHelp ()
option
option -lib "generates a package containing an object compatible with the Teensy audio library."
option -midi
option -ext "uses external PSRAM available on Teensy 4.1"
option "-nvoices <num>"
option "Faust options"
}
Expand All @@ -48,6 +50,8 @@ do
NVOICES=$1
elif [ $p = "-midi" ]; then
MIDI=1
elif [ $p = "-ext" ]; then
EXT=1
elif [[ -f "$p" ]]; then
FILE="$p"
elif [ $p = "-lib" ]; then
Expand Down Expand Up @@ -85,6 +89,9 @@ if [ $LIB -eq 1 ]; then
if [ $MIDI -eq 1 ]; then
echo '#define MIDICTRL' >> $MODULENAME/$MODULENAME.h
fi
if [ $EXT -eq 1 ]; then
echo '#define USEPSRAM' >> $MODULENAME/$MODULENAME.h
fi
cat $FAUSTARCH/teensy/teensy.h >> $MODULENAME/$MODULENAME.h
TMP=$(awk -v modName="$MODULENAME" '{gsub(/AudioFaust/,modName)}1' $MODULENAME/$MODULENAME.cpp)
echo "$TMP" > $MODULENAME/$MODULENAME.cpp
Expand Down

0 comments on commit f84a55c

Please sign in to comment.