Added colors and keybindings
This commit is contained in:
43
bdk.sh
43
bdk.sh
@ -3,11 +3,29 @@
|
|||||||
# Directory containing sounds and config file
|
# Directory containing sounds and config file
|
||||||
KIT_DIR="kits"
|
KIT_DIR="kits"
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
RED='\033[0;31m'
|
||||||
|
LRED="\033[1;31m"
|
||||||
|
BLUE="\033[0;34m"
|
||||||
|
LBLUE="\033[1;34m"
|
||||||
|
GREEN="\033[0;32m"
|
||||||
|
LGREEN="\033[1;32m"
|
||||||
|
YELLOW="\033[1;33m"
|
||||||
|
CYAN="\033[0;36m"
|
||||||
|
LCYAN="\033[1;36m"
|
||||||
|
PURPLE="\033[0;35m"
|
||||||
|
LPURPLE="\033[1;35m"
|
||||||
|
BWHITE="\e[1m"
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Check for kits and load the config
|
#Check for kits and load the config
|
||||||
#load default kit if specified kit not found
|
#load default kit if specified kit not found
|
||||||
|
|
||||||
defaultKit(){
|
defaultKit(){
|
||||||
echo "the kit: ${1} was not found"
|
echo
|
||||||
|
printf "${LRED}The kit: '${1}' was not found${NC}\n"
|
||||||
echo "Loading default kit.."
|
echo "Loading default kit.."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -38,7 +56,7 @@ checkKits(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
defaultKit
|
defaultKit ${1}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -67,6 +85,7 @@ case $1 in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
-l | --list)
|
-l | --list)
|
||||||
|
printf "\n"
|
||||||
printf "[ Installed Kits]\n"
|
printf "[ Installed Kits]\n"
|
||||||
if [[ $(ls -A $DIR) ]];then
|
if [[ $(ls -A $DIR) ]];then
|
||||||
ls ${KIT_DIR}
|
ls ${KIT_DIR}
|
||||||
@ -83,35 +102,35 @@ case $1 in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
echo "BDK - Bash Drum Kit"
|
printf "${LPURPLE}\(*)/ BDK - Bash Drum Kit${NC}\n"
|
||||||
key(){
|
key(){
|
||||||
echo
|
echo
|
||||||
echo "[d] = Bass Drum | [s] = Hi-Hat | [enter] = Snare | [h] help | [q] Quit"
|
printf "${LCYAN}[${KP}] = Kick${NC} | ${LGREEN}[${HHC}] = Hi-Hat Closed${NC} | ${YELLOW}[enter] = Snare${NC} | ${LPURPLE}[h] help${NC} |${LRED} [q] Quit${NC}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
key
|
key
|
||||||
|
|
||||||
echo
|
echo
|
||||||
while true;do
|
while true;do
|
||||||
printf "(*)> "
|
printf "${YELLOW}(*)>${NC} "
|
||||||
|
|
||||||
read -s -n 1 key
|
read -s -n 1 key
|
||||||
# -s: do not echo input character. -n 1: read only 1 character (separate with space)
|
# -s: do not echo input character. -n 1: read only 1 character (separate with space)
|
||||||
|
|
||||||
if [[ $key = "d" ]]; then
|
if [[ $key = "${KP}" ]]; then
|
||||||
aplay ${KICK} >/dev/null 2>/dev/null &
|
aplay ${KICK} >/dev/null 2>/dev/null &
|
||||||
echo "[d] Bass Drum"
|
printf "${LCYAN}[${KP}] Kick${NC}\n"
|
||||||
elif [[ $key == '' ]];then
|
elif [[ $key == ${SD} ]];then
|
||||||
aplay ${SNARE} >/dev/null 2>/dev/null &
|
aplay ${SNARE} >/dev/null 2>/dev/null &
|
||||||
echo "[enter] Snare Drum"
|
printf "${YELLOW}[${SD}] Snare Drum${NC}\n"
|
||||||
elif [[ $key == "s" ]];then
|
elif [[ $key == "${HHC}" ]];then
|
||||||
aplay ${HIHAT} >/dev/null 2>/dev/null &
|
aplay ${HIHAT} >/dev/null 2>/dev/null &
|
||||||
echo "[s] Hi-hat"
|
printf "${LGREEN}[${HHC}] Hi-Hat Closed${NC}\n"
|
||||||
elif [[ $key == "h" ]];then
|
elif [[ $key == "h" ]];then
|
||||||
key
|
key
|
||||||
elif [[ $key == "q" ]];then
|
elif [[ $key == "q" ]];then
|
||||||
exit 0;
|
exit 0;
|
||||||
else
|
else
|
||||||
echo "'${key}' does nothing!"
|
printf "${LRED}'${key}' does nothing!${NC}\n"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# SOUNDS
|
||||||
|
KICK='sounds/kick.wav'
|
||||||
|
SNARE='sounds/snare.wav'
|
||||||
|
HIHAT='sounds/hihat.wav'
|
||||||
|
|
||||||
|
# KEYBINDINGS
|
||||||
|
|
||||||
|
KP="d" # Kick Petal
|
||||||
|
SD='' # Snare Drum (leave blank single quotes)
|
||||||
|
HHC="s" #Hi-Hat
|
||||||
|
|
||||||
|
|
||||||
KICK=sounds/kick.wav
|
|
||||||
SNARE=sounds/snare.wav
|
|
||||||
HIHAT=sounds/hihat.wav
|
|
||||||
|
Reference in New Issue
Block a user