Skip to content

Commit

Permalink
fix(tracker/gioui): pressing a or 1 in hex mode created note off
Browse files Browse the repository at this point in the history
Closes #160
  • Loading branch information
vsariola committed Oct 8, 2024
1 parent ad5f762 commit 75f39f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
the command line tools.

### Fixed
- Pressing a or 1 when editing note values in hex mode created a note off line
([#160][i160])
- Warn about plugin sample rate being different from 44100 only after
ProcessFloatFunc has been called, so that host has time to set the sample rate
after initialization.
Expand Down Expand Up @@ -234,3 +236,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[i149]: https://github.com/vsariola/sointu/issues/149
[i150]: https://github.com/vsariola/sointu/issues/150
[i158]: https://github.com/vsariola/sointu/issues/158
[i160]: https://github.com/vsariola/sointu/issues/160
18 changes: 9 additions & 9 deletions tracker/gioui/note_editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,6 @@ func noteAsValue(octave, note int) byte {
}

func (te *NoteEditor) command(gtx C, t *Tracker, e key.Event) {
if e.Name == "A" || e.Name == "1" {
t.Model.Notes().Table().Fill(0)
if step := t.Model.Step().Value(); step > 0 {
te.scrollTable.Table.MoveCursor(0, step)
te.scrollTable.Table.SetCursor2(te.scrollTable.Table.Cursor())
}
te.scrollTable.EnsureCursorVisible()
return
}
var n byte
if t.Model.Notes().Effect(te.scrollTable.Table.Cursor().X) {
if nibbleValue, err := strconv.ParseInt(string(e.Name), 16, 8); err == nil {
Expand All @@ -356,6 +347,15 @@ func (te *NoteEditor) command(gtx C, t *Tracker, e key.Event) {
goto validNote
}
} else {
if e.Name == "A" || e.Name == "1" {
t.Model.Notes().Table().Fill(0)
if step := t.Model.Step().Value(); step > 0 {
te.scrollTable.Table.MoveCursor(0, step)
te.scrollTable.Table.SetCursor2(te.scrollTable.Table.Cursor())
}
te.scrollTable.EnsureCursorVisible()
return
}
if val, ok := noteMap[e.Name]; ok {
n = noteAsValue(t.OctaveNumberInput.Int.Value(), val)
t.Model.Notes().Table().Fill(int(n))
Expand Down

0 comments on commit 75f39f6

Please sign in to comment.