Skip to content

Commit

Permalink
add missing meta parameters text input handling
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviergodart committed Dec 9, 2024
1 parent 499effc commit ab85082
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
9 changes: 8 additions & 1 deletion ui/param/bank_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"signls/core/common"
"signls/core/music"
"signls/ui/util"
"strconv"
)

const (
Expand Down Expand Up @@ -93,4 +94,10 @@ func (b BankCmd) SetAlt(value int) {
}
}

func (b BankCmd) SetEditValue(input string) {}
func (b BankCmd) SetEditValue(input string) {
value, err := strconv.Atoi(input)
if err != nil {
return
}
b.Set(value - 1)
}
8 changes: 7 additions & 1 deletion ui/param/root_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,10 @@ func (r RootCmd) SetAlt(value int) {
}
}

func (r RootCmd) SetEditValue(input string) {}
func (r RootCmd) SetEditValue(input string) {
midiKey, err := music.ConvertNoteToMIDI(input)
if err != nil {
return
}
r.Set(midiKey)
}
9 changes: 8 additions & 1 deletion ui/param/tempo_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"signls/core/common"
"signls/core/music"
"signls/ui/util"
"strconv"
)

const (
Expand Down Expand Up @@ -93,4 +94,10 @@ func (t TempoCmd) SetAlt(value int) {
}
}

func (t TempoCmd) SetEditValue(input string) {}
func (t TempoCmd) SetEditValue(input string) {
value, err := strconv.Atoi(input)
if err != nil {
return
}
t.Set(value)
}

0 comments on commit ab85082

Please sign in to comment.