Fix for multi using a sampel with different pitches.

pull/98/head
Holger Wirtz 3 years ago
parent 907ba61c4b
commit efeb605811
  1. 0
      addon/tools/wav2c.cfg
  2. 15
      addon/tools/wav2c.sh

@ -138,6 +138,8 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
{ {
EOF EOF
declare -A converted_files
while IFS= read -r l while IFS= read -r l
do do
declare -A sample declare -A sample
@ -151,6 +153,7 @@ do
sample['class']=`echo "${samplecfg[0]}" | xargs` sample['class']=`echo "${samplecfg[0]}" | xargs`
sample['midinote']=`echo "${samplecfg[1]}" | xargs` sample['midinote']=`echo "${samplecfg[1]}" | xargs`
sample['name']=`echo "${samplecfg[2]}" | xargs` sample['name']=`echo "${samplecfg[2]}" | xargs`
sample['data_name']="${sample['name']}"
sample['shortname']=`echo "${samplecfg[3]}" | xargs` sample['shortname']=`echo "${samplecfg[3]}" | xargs`
sample['pitch']=`echo "${samplecfg[4]}" | xargs` sample['pitch']=`echo "${samplecfg[4]}" | xargs`
sample['pan']=`echo "${samplecfg[5]}" | xargs` sample['pan']=`echo "${samplecfg[5]}" | xargs`
@ -166,6 +169,8 @@ do
then then
# Generate drumset.h # Generate drumset.h
if [ -z "${converted_files[${sample['filename']}]}" ]
then
basename=`echo "${sample['filename']}" | cut -d'.' -f1` basename=`echo "${sample['filename']}" | cut -d'.' -f1`
sox "${WAV_DIR}/${sample['filename']}" -c 1 -b 16 -L "${TMP}/${basename}.raw" sox "${WAV_DIR}/${sample['filename']}" -c 1 -b 16 -L "${TMP}/${basename}.raw"
xxd -i "${TMP}/${basename}.raw" > "${TMP}/${basename}.h" xxd -i "${TMP}/${basename}.raw" > "${TMP}/${basename}.h"
@ -196,7 +201,13 @@ do
fi fi
done done
fi fi
echo "};" >> /tmp/b echo "};" >> "${DRUMSET_H}"
converted_files["${sample['filename']}"]="${sample['name']},${sample['len']}"
else
sample['data_name']=`echo ${converted_files[${sample['filename']}]} | cut -d"," -f1`
sample['len']=`echo ${converted_files[${sample['filename']}]} | cut -d"," -f2`
fi
# Generate drums.h # Generate drums.h
cat >> "${DRUMS_H}" << EOF cat >> "${DRUMS_H}" << EOF
@ -204,7 +215,7 @@ do
${sample[class]}, ${sample[class]},
${sample[midinote]}, ${sample[midinote]},
"${sample[name]}", "${sample[name]}",
${sample[name]}, ${sample[data_name]},
"${sample[shortname]}", "${sample[shortname]}",
${sample[len]}, ${sample[len]},
${sample[pitch]}, ${sample[pitch]},

Loading…
Cancel
Save