#!/bin/bash
# Copyright 2005 Marcos Guglielmetti 
# Released under GNU GPL 2 or later

# si jack está corriendo, todo bien, sino, lo iniciamos

JACK_ACTIVO=0
if pidof jackd 2>&1 >/dev/null; then
JACK_ACTIVO=1
fi

# Si no esta activo jack , lo iniciamos con valor predeterminado
if [ "$JACK_ACTIVO" = "0" ]
then
/usr/bin/jackd -R -t2000 -m -dalsa -dhw:0 -r44100 -p1024 -n2 -s -S &
sleep 3s
fi


QJACK_ACTIVO=0
if pidof qjackctl 2>&1 >/dev/null; then
QJACK_ACTIVO=1
fi


# Si no esta activo jack , lo iniciamos con valor predeterminado
if [ "$QJACK_ACTIVO" = "0" ]
then
qjackctl &
sleep 3s
fi


#export USARecho -e -nLS=si
#export TEXTDOMAIN=gjack_bufsize.sh
#export TEXTDOMAINDIR="/etc/musix/locales"


#Contenido de config/encabezado :
#. /etc/musix/funciones-i18n
#[ -e /etc/musix/funciones ] && . /etc/musix/funciones


#puede ser -nearmouse o -center (o nada)

pos="-nearmouse"
echo -e -n "Elige un Sintetizador por Software DSSI
Choose a DSSI Software Synth
" | gmessage -title 'ghostess' -geometry 600x150 -file - $pos -buttons $(echo -e -n "whysynth:0,fluidsynth-dssi:1,hexter:2,xsynth-dssi:3,trivial_sampler:4,Abort:8" ) 


NB="$?"

if [ "$NB" = "8" ]; then exit 2; fi

if [ "$NB" = "0" ]; then  ghostess -1 /usr/lib/dssi/whysynth.so; fi
if [ "$NB" = "1" ]; then  ghostess -1 /usr/lib/dssi/fluidsynth-dssi.so; fi
if [ "$NB" = "2" ]; then  ghostess -1 /usr/lib/dssi/hexter.so; fi
if [ "$NB" = "3" ]; then  ghostess -1 /usr/lib/dssi/xsynth-dssi.so; fi
if [ "$NB" = "4" ]; then  ghostess -1 /usr/lib/dssi/trivial_sampler.so; fi



#/usr/lib/dssi/trivial_synth.so
#/usr/lib/dssi/less_trivial_synth.so  

