mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-03 17:18:20 -04:00
feat(tracker): add button to make note off and use "1" also as the key event
Closes #54
This commit is contained in:
parent
01226a2910
commit
b6283cd13e
@ -382,7 +382,7 @@ func (t *Tracker) KeyEvent(w *app.Window, e key.Event) bool {
|
|||||||
t.NumberPressed(byte(iv))
|
t.NumberPressed(byte(iv))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if e.Name == "A" {
|
if e.Name == "A" || e.Name == "1" {
|
||||||
t.SetNote(0)
|
t.SetNote(0)
|
||||||
} else {
|
} else {
|
||||||
if val, ok := noteMap[e.Name]; ok {
|
if val, ok := noteMap[e.Name]; ok {
|
||||||
|
@ -49,6 +49,14 @@ func (t *Tracker) layoutTracker(gtx layout.Context) layout.Dimensions {
|
|||||||
t.AdjustSelectionPitch(-1)
|
t.AdjustSelectionPitch(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for t.NoteOffBtn.Clicked() {
|
||||||
|
t.SetNote(0)
|
||||||
|
if !(t.NoteTracking() && t.player.Playing()) && t.Step.Value > 0 {
|
||||||
|
t.SetCursor(t.Cursor().AddRows(t.Step.Value))
|
||||||
|
t.SetSelectionCorner(t.Cursor())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for t.AddOctaveBtn.Clicked() {
|
for t.AddOctaveBtn.Clicked() {
|
||||||
t.AdjustSelectionPitch(12)
|
t.AdjustSelectionPitch(12)
|
||||||
}
|
}
|
||||||
@ -74,6 +82,10 @@ func (t *Tracker) layoutTracker(gtx layout.Context) layout.Dimensions {
|
|||||||
subtractOctaveBtnStyle.Color = primaryColor
|
subtractOctaveBtnStyle.Color = primaryColor
|
||||||
subtractOctaveBtnStyle.Background = transparent
|
subtractOctaveBtnStyle.Background = transparent
|
||||||
subtractOctaveBtnStyle.Inset = layout.UniformInset(unit.Dp(6))
|
subtractOctaveBtnStyle.Inset = layout.UniformInset(unit.Dp(6))
|
||||||
|
noteOffBtnStyle := material.Button(t.Theme, t.NoteOffBtn, "Note Off")
|
||||||
|
noteOffBtnStyle.Color = primaryColor
|
||||||
|
noteOffBtnStyle.Background = transparent
|
||||||
|
noteOffBtnStyle.Inset = layout.UniformInset(unit.Dp(6))
|
||||||
deleteTrackBtnStyle := material.IconButton(t.Theme, t.DeleteTrackBtn, widgetForIcon(icons.ActionDelete))
|
deleteTrackBtnStyle := material.IconButton(t.Theme, t.DeleteTrackBtn, widgetForIcon(icons.ActionDelete))
|
||||||
deleteTrackBtnStyle.Background = transparent
|
deleteTrackBtnStyle.Background = transparent
|
||||||
deleteTrackBtnStyle.Inset = layout.UniformInset(unit.Dp(6))
|
deleteTrackBtnStyle.Inset = layout.UniformInset(unit.Dp(6))
|
||||||
@ -113,11 +125,12 @@ func (t *Tracker) layoutTracker(gtx layout.Context) layout.Dimensions {
|
|||||||
dims := layout.Flex{Axis: layout.Horizontal, Alignment: layout.Middle}.Layout(gtx,
|
dims := layout.Flex{Axis: layout.Horizontal, Alignment: layout.Middle}.Layout(gtx,
|
||||||
layout.Rigid(Label("OCT:", white)),
|
layout.Rigid(Label("OCT:", white)),
|
||||||
layout.Rigid(octave),
|
layout.Rigid(octave),
|
||||||
layout.Rigid(Label(" PITCH:", white)),
|
layout.Rigid(func(gtx C) D { return layout.Dimensions{Size: image.Pt(gtx.Px(unit.Dp(12)), 0)} }),
|
||||||
layout.Rigid(addSemitoneBtnStyle.Layout),
|
layout.Rigid(addSemitoneBtnStyle.Layout),
|
||||||
layout.Rigid(subtractSemitoneBtnStyle.Layout),
|
layout.Rigid(subtractSemitoneBtnStyle.Layout),
|
||||||
layout.Rigid(addOctaveBtnStyle.Layout),
|
layout.Rigid(addOctaveBtnStyle.Layout),
|
||||||
layout.Rigid(subtractOctaveBtnStyle.Layout),
|
layout.Rigid(subtractOctaveBtnStyle.Layout),
|
||||||
|
layout.Rigid(noteOffBtnStyle.Layout),
|
||||||
layout.Rigid(hexCheckBoxStyle.Layout),
|
layout.Rigid(hexCheckBoxStyle.Layout),
|
||||||
layout.Rigid(Label(" Voices:", white)),
|
layout.Rigid(Label(" Voices:", white)),
|
||||||
layout.Rigid(voiceUpDown),
|
layout.Rigid(voiceUpDown),
|
||||||
|
@ -35,6 +35,7 @@ type Tracker struct {
|
|||||||
SubtractSemitoneBtn *widget.Clickable
|
SubtractSemitoneBtn *widget.Clickable
|
||||||
AddOctaveBtn *widget.Clickable
|
AddOctaveBtn *widget.Clickable
|
||||||
SubtractOctaveBtn *widget.Clickable
|
SubtractOctaveBtn *widget.Clickable
|
||||||
|
NoteOffBtn *widget.Clickable
|
||||||
SongLength *NumberInput
|
SongLength *NumberInput
|
||||||
PanicBtn *widget.Clickable
|
PanicBtn *widget.Clickable
|
||||||
CopyInstrumentBtn *widget.Clickable
|
CopyInstrumentBtn *widget.Clickable
|
||||||
@ -121,6 +122,7 @@ func New(audioContext sointu.AudioContext, synthService sointu.SynthService, syn
|
|||||||
SubtractSemitoneBtn: new(widget.Clickable),
|
SubtractSemitoneBtn: new(widget.Clickable),
|
||||||
AddOctaveBtn: new(widget.Clickable),
|
AddOctaveBtn: new(widget.Clickable),
|
||||||
SubtractOctaveBtn: new(widget.Clickable),
|
SubtractOctaveBtn: new(widget.Clickable),
|
||||||
|
NoteOffBtn: new(widget.Clickable),
|
||||||
AddUnitBtn: new(widget.Clickable),
|
AddUnitBtn: new(widget.Clickable),
|
||||||
DeleteUnitBtn: new(widget.Clickable),
|
DeleteUnitBtn: new(widget.Clickable),
|
||||||
ClearUnitBtn: new(widget.Clickable),
|
ClearUnitBtn: new(widget.Clickable),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user