#!/bin/sh

# identifysoundcards applies a sensible default ordering; we just need
# to process the results into the same format as soundcardselect uses

IFS=':'
first=true
identifysoundcards | while read driver_class id type audio_tag midi_tag ; do
	[ -z "$audio_tag" ] && continue
	if [ "$first" = "true" ]; then
		if [ "$driver_class" = "freebob" ]; then
			echo "server:jackd"
		else
			echo "server:jackdmp"
		fi
		echo "primary:$driver_class:$id"
	else
		if [ "$driver_class" = "freebob" ]; then
			continue
		fi	
		echo "secondary:$driver_class:$id"
	fi
	first=false
done 
echo "latency:auto"
echo "startup:synth"
