mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
feat(tracker): make shift + left/right take 1 octace / 12 semitone steps in oscillator transpose
Closes #37
This commit is contained in:
parent
b4705c941f
commit
68a50247bd
@ -296,7 +296,10 @@ func (t *Tracker) KeyEvent(w *app.Window, e key.Event) bool {
|
||||
case tracker.EditParameters:
|
||||
param, _ := t.Param(t.ParamIndex())
|
||||
if e.Modifiers.Contain(key.ModShift) {
|
||||
t.SetParam(param.Value - 16)
|
||||
p, err := t.Param(t.ParamIndex())
|
||||
if err == nil {
|
||||
t.SetParam(param.Value - p.LargeStep)
|
||||
}
|
||||
} else {
|
||||
t.SetParam(param.Value - 1)
|
||||
}
|
||||
@ -330,7 +333,10 @@ func (t *Tracker) KeyEvent(w *app.Window, e key.Event) bool {
|
||||
case tracker.EditParameters:
|
||||
param, _ := t.Param(t.ParamIndex())
|
||||
if e.Modifiers.Contain(key.ModShift) {
|
||||
t.SetParam(param.Value + 16)
|
||||
p, err := t.Param(t.ParamIndex())
|
||||
if err == nil {
|
||||
t.SetParam(param.Value + p.LargeStep)
|
||||
}
|
||||
} else {
|
||||
t.SetParam(param.Value + 1)
|
||||
}
|
||||
|
@ -42,12 +42,13 @@ type Model struct {
|
||||
}
|
||||
|
||||
type Parameter struct {
|
||||
Type ParameterType
|
||||
Name string
|
||||
Hint string
|
||||
Value int
|
||||
Min int
|
||||
Max int
|
||||
Type ParameterType
|
||||
Name string
|
||||
Hint string
|
||||
Value int
|
||||
Min int
|
||||
Max int
|
||||
LargeStep int
|
||||
}
|
||||
|
||||
type EditMode int
|
||||
@ -842,7 +843,11 @@ func (m *Model) Param(index int) (Parameter, error) {
|
||||
typ = IDParameter
|
||||
}
|
||||
}
|
||||
return Parameter{Type: typ, Min: min, Max: max, Name: name, Hint: text, Value: val}, nil
|
||||
largeStep := 16
|
||||
if unit.Type == "oscillator" && t.Name == "transpose" {
|
||||
largeStep = 12
|
||||
}
|
||||
return Parameter{Type: typ, Min: min, Max: max, Name: name, Hint: text, Value: val, LargeStep: largeStep}, nil
|
||||
}
|
||||
if unit.Type == "oscillator" && index == 0 {
|
||||
key := vm.SampleOffset{Start: uint32(unit.Parameters["samplestart"]), LoopStart: uint16(unit.Parameters["loopstart"]), LoopLength: uint16(unit.Parameters["looplength"])}
|
||||
@ -873,7 +878,7 @@ func (m *Model) Param(index int) (Parameter, error) {
|
||||
} else {
|
||||
text = fmt.Sprintf("%v / %.3f rows", val, float32(val)/float32(m.song.SamplesPerRow()))
|
||||
}
|
||||
return Parameter{Type: IntegerParameter, Min: 1, Max: 65535, Name: "delaytime", Hint: text, Value: val}, nil
|
||||
return Parameter{Type: IntegerParameter, Min: 1, Max: 65535, Name: "delaytime", Hint: text, Value: val, LargeStep: 256}, nil
|
||||
}
|
||||
}
|
||||
return Parameter{}, errors.New("invalid parameter")
|
||||
|
Loading…
Reference in New Issue
Block a user