From 5d4492be5f1ca8164ca3316a97b8c3d34387d98f Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 15 Apr 2022 16:02:29 +0200 Subject: [PATCH] Added limit for 71, 47 or 19 samples for use with T_4.0 or T3.6 --- addon/tools/wav2c.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/addon/tools/wav2c.sh b/addon/tools/wav2c.sh index 719de7d..23e21d2 100755 --- a/addon/tools/wav2c.sh +++ b/addon/tools/wav2c.sh @@ -3,15 +3,19 @@ # Converter for WAV to C Header # Used for MicroDexed sampler # -# (C)2021 Holger Wirtz +# (C)2021-2022 Holger Wirtz # + SOX=`which sox` XXD=`which xxd` TMP="/tmp/wav2c" AUDIO_BLOCK_SIZE=128 DRUMSET_H="drumset.h" DRUMS_H="${TMP}/drums.h" +MAX_NUM_DRUMSET_CONFIG=71 # ARDUINO_TEENSY41 +#MAX_NUM_DRUMSET_CONFIG=40 # ARDUINO_TEENSY40 +#MAX_NUM_DRUMSET_CONFIG=19 # ... function cleanexit() { @@ -48,6 +52,11 @@ while [[ $# -gt 0 ]]; do shift # past argument shift # past value ;; + -n|--num) + MAX_NUM_DRUMSET_CONFIG="$2" + shift # past argument + shift # past value + ;; # -t|--test) # TEST="true" # shift # past argument @@ -120,6 +129,11 @@ do if [ -f "${WAV_DIR}/${sample['filename']}" ] then + if [ ${NUM_DRUMSET_CONFIG} -gt ${MAX_NUM_DRUMSET_CONFIG} ] + then + echo "/*" >> "${DRUMSET_H}" + fi + file "${WAV_DIR}/${sample['filename']}" | grep -i -q "WAVE audio" if [ "${?}" == 0 ] then @@ -167,6 +181,10 @@ do fi # Generate drums.h + if [ ${NUM_DRUMSET_CONFIG} -gt ${MAX_NUM_DRUMSET_CONFIG} ] + then + echo "/*" >> "${DRUMS_H}" + fi cat >> "${DRUMS_H}" << EOF { ${sample[class]}, @@ -184,7 +202,14 @@ do ${sample[reverb_send]} }, EOF + if [ ${NUM_DRUMSET_CONFIG} -gt ${MAX_NUM_DRUMSET_CONFIG} ] + then + echo "*/" >> "${DRUMS_H}" + echo "*/" >> "${DRUMSET_H}" + fi NUM_DRUMSET_CONFIG=`expr "${NUM_DRUMSET_CONFIG}" + 1` + else + echo "File ${WAV_DIR}/${sample['filename']} is not a WAV audio file" fi else echo "File \'${WAV_DIR}/${sample['filename']}\' does not exits." >&2