diff --git a/alsacontrol/cardcontrol.go b/alsacontrol/cardcontrol.go index a8c3804..c64aaf8 100644 --- a/alsacontrol/cardcontrol.go +++ b/alsacontrol/cardcontrol.go @@ -4,6 +4,7 @@ import ( "bufio" "fmt" "os/exec" + "sort" "strconv" "strings" ) @@ -182,6 +183,10 @@ func ParseAmixerContent(cardId string) ([]*CardControl, error) { } err = cmd.Wait() + + // Sort mixers by NumID + sort.Sort(ByNumID(ret)) + return ret, err } @@ -202,3 +207,9 @@ func (cc *CardControl) CsetAmixer(cardId string, values ...string) error { return cmd.Wait() } + +type ByNumID []*CardControl + +func (a ByNumID) Len() int { return len(a) } +func (a ByNumID) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a ByNumID) Less(i, j int) bool { return a[i].NumID < a[j].NumID } diff --git a/ui/src/lib/components/Inputs.svelte b/ui/src/lib/components/Inputs.svelte index 155c3bc..7e215a9 100644 --- a/ui/src/lib/components/Inputs.svelte +++ b/ui/src/lib/components/Inputs.svelte @@ -20,7 +20,7 @@ {#if (showInactives && $inputsList.length === 0) || (!showInactives && $activeInputs.length === 0)}