#!/bin/sh

#
# (note) all samples layered
#

IFS=§

function Usage {
  echo "Usage: ./split_layer.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" -s amp_drum $OW_ARG1 "$OW_ARG2" --uvifalconlayerperkeygroup $*
#-dco

unset IFS
