refactor(tracker): make struct to hold all per voice data in Player

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2023-10-20 01:26:41 +03:00
parent 0ce5ca3003
commit a60814bab7
3 changed files with 34 additions and 53 deletions

View File

@ -48,7 +48,7 @@ type InstrumentEditor struct {
tag bool
wasFocused bool
commentExpanded bool
voiceStates [vm.MAX_VOICES]float32
voiceLevels [vm.MAX_VOICES]float32
presetMenuItems []MenuItem
presetMenu Menu
}
@ -314,7 +314,7 @@ func (ie *InstrumentEditor) layoutInstrumentNames(gtx C, t *Tracker) D {
loopMax = vm.MAX_VOICES
}
for j := 0; j < loopMax; j++ {
vc := ie.voiceStates[voice]
vc := ie.voiceLevels[voice]
if c < vc {
c = vc
}

View File

@ -201,7 +201,7 @@ mainloop:
}
t.lastAvgVolume = e.AverageVolume
t.lastPeakVolume = e.PeakVolume
t.InstrumentEditor.voiceStates = e.VoiceStates
t.InstrumentEditor.voiceLevels = e.VoiceLevels
t.ProcessPlayerMessage(e)
w.Invalidate()
case e := <-w.Events():