Fixed a bug with connecting with alsa.

This commit is contained in:
Storm Dragon 2023-12-16 00:07:56 -05:00
parent 11e4a4d183
commit e034c518ee

18
tojam
View File

@ -168,10 +168,11 @@ configure_ninjam() {
alsaParameters[2]="bps ${alsaParameters[2]}" alsaParameters[2]="bps ${alsaParameters[2]}"
alsaParameters[3]="srate ${alsaParameters[3]}" alsaParameters[3]="srate ${alsaParameters[3]}"
alsaParameters[4]="nch ${alsaParameters[4]}" alsaParameters[4]="nch ${alsaParameters[4]}"
alsaParameters[5]="in ${alsaParameters[5]}" alsaParameters[5]="in hw:${alsaParameters[5]}"
alsaParameters[6]="out ${alsaParameters[6]}" alsaParameters[6]="out hw:${alsaParameters[6]}"
soundDriver="alsaconfig '${alsaParameters[*]}'" soundDriver="alsa"
sed -i "s/^soundDriver=.*/soundDriver=\"${soundDriver}\"/" "${config}/config" && alsaParameters="${alsaParameters[*]}"
sed -i -e "s/^soundDriver=.*/soundDriver=\"${soundDriver}\"/" -e "s/^alsaParameters=.*/alsaParameters=\"${alsaParameters}\"/" "${config}/config" &&
dialog --msgbox "Sound driver set to alsa." -1 -1 dialog --msgbox "Sound driver set to alsa." -1 -1
;; ;;
"username") "username")
@ -195,7 +196,8 @@ mkdir -p "${config}"
if ! [[ -r "${config}/config" ]]; then if ! [[ -r "${config}/config" ]]; then
# Write initial config file # Write initial config file
{ echo 'anonymous="true"'; { echo 'alsaParameters=""';
echo 'anonymous="true"';
echo 'saveSourceFiles="false"'; echo 'saveSourceFiles="false"';
echo 'soundDriver="jack"'; echo 'soundDriver="jack"';
echo "userName='Tojam$(date '+%S')'"; } >> "${config}/config" echo "userName='Tojam$(date '+%S')'"; } >> "${config}/config"
@ -276,4 +278,8 @@ esac
ninjam="$(command -v cninjam 2> /dev/null)" ninjam="$(command -v cninjam 2> /dev/null)"
[[ ${#ninjam} -le 3 ]] && { echo "Could not find cninjam."; exit 1; } [[ ${#ninjam} -le 3 ]] && { echo "Could not find cninjam."; exit 1; }
$ninjam "${server}" -user "${userName}" -${soundDriver} -sessiondir "${sessiondir}" ${saveSourceFiles} if [[ "${soundDriver}" == "jack" ]]; then
$ninjam "${server}" -user "${userName}" -jack -sessiondir "${sessiondir}" ${saveSourceFiles}
else
$ninjam "${server}" -user "${userName}" -alsaconfig "${alsaParameters}" -sessiondir "${sessiondir}" ${saveSourceFiles}
fi