#!/bin/sh

#
# (note) multisample keys C-0, C-1, C-2, ..  (Reason/MIDI note names)
#         (three samples per key)
#
# (note) meant for sampling oscillator waves, set -lss 40 and -lxfa 500 for general use
#

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" -p -pn 0:c,c,c -l -lxf 0.5 -lxfa 0.5 -mll 0.6 -mnl 20 -lss 20 -lse 5 -s root_center_alt3 -s amp_pad $* -lte -dco
tks sxt -a "$SAMPLE_NAME" -o "$OUTPUT_NAME" -p -l -lxf 0.5 -lxfa 0.5 -mll 0.6 -mnl 20 -lss 20 -lse 5 -s root_center_alt3 -s amp_pad $OW_ARG1 "$OW_ARG2" $* -lte -dco
#  -s clear_tune
# -n

unset IFS
