#!/bin/sh

#
# (note) multisample keys C-2, G-2, C-3, G-3, ..  (Reason/MIDI note names)
#         (one sample per key)
#

IFS=§

function Usage {
  echo "Usage: ./multiloop.sh <path_to_wav_recording> <output_prefix> [<extra sxt args>..]"
  exit
}

if [ -z "$1" ]; then
  Usage
fi

if [ -z "$2" ]; then
  Usage
fi

SAMPLE_NAME="$1"
OUTPUT_NAME="$2"

echo "OUTPUT_NAME=${OUTPUT_NAME}";

shift
shift

OW_ARG1=
OW_ARG2=

if [ -d "`dirname ${OUTPUT_NAME}`/samples" ]; then
  OW_ARG1=-ow
  OW_ARG2=\*samples
fi

#tks sxt -a "$SAMPLE_NAME" -o "$OUTPUT_NAME" -dco -p -pn 2:c,d#,f#,a -l -lxf 0.5 -lxfa 4 -lss 5 -lse 3 -lte -s root_center -s clear_tune -s amp_pad $OW_ARG1 "$OW_ARG2" $*
tks sxt -a "$SAMPLE_NAME" -o "$OUTPUT_NAME" -dco -p -pn 1:c,g -l -lss 15 -lse 3 -lte -s root_center -s clear_tune -s amp_pad $OW_ARG1 "$OW_ARG2" $*

unset IFS
