This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-12-31 22:31:41 +02:00
parent 2303e89bbd
commit c424d2b847
2 changed files with 4 additions and 16 deletions

View File

@ -35,13 +35,9 @@ func (s *SpectrumState) Layout(gtx C) D {
var chnModeTxt string = "???" var chnModeTxt string = "???"
switch tracker.SpecChnMode(t.Model.SpecAnChannelsInt().Value()) { switch tracker.SpecChnMode(t.Model.SpecAnChannelsInt().Value()) {
case tracker.SpecChnModeCombine: case tracker.SpecChnModeCombine:
chnModeTxt = "Combine" chnModeTxt = "Sum"
case tracker.SpecChnModeSeparate: case tracker.SpecChnModeSeparate:
chnModeTxt = "Separate" chnModeTxt = "Separate"
case tracker.SpecChnModeLeft:
chnModeTxt = "Left"
case tracker.SpecChnModeRight:
chnModeTxt = "Right"
case tracker.SpecChnModeOff: case tracker.SpecChnModeOff:
chnModeTxt = "Off" chnModeTxt = "Off"
} }

View File

@ -45,15 +45,14 @@ const (
SpecChnModeOff SpecChnMode = iota // no spectrum analysis is done to save CPU resources SpecChnModeOff SpecChnMode = iota // no spectrum analysis is done to save CPU resources
SpecChnModeCombine // calculate a single combined spectrum for both channels SpecChnModeCombine // calculate a single combined spectrum for both channels
SpecChnModeSeparate // calculate separate spectrums for left and right channels SpecChnModeSeparate // calculate separate spectrums for left and right channels
SpecChnModeLeft // calculate spectrum only for the left channel
SpecChnModeRight // calculate spectrum only for the right channel
NumSpecChnModes NumSpecChnModes
) )
const ( const (
SpecSmoothingSlow SpecSmoothing = iota SpecSmoothingMedium SpecSmoothing = iota
SpecSmoothingMedium
SpecSmoothingFast SpecSmoothingFast
SpecSmoothingSlow
NumSpecSmoothing NumSpecSmoothing
) )
@ -142,12 +141,6 @@ func (a *SpecAnalyzer) init(s SpecAnSettings) {
func (s *SpecAnalyzer) update(buf sointu.AudioBuffer) *Spectrum { func (s *SpecAnalyzer) update(buf sointu.AudioBuffer) *Spectrum {
ret := s.broker.GetSpectrum() ret := s.broker.GetSpectrum()
switch s.settings.ChnMode { switch s.settings.ChnMode {
case SpecChnModeLeft:
s.process(buf, 0)
ret[0] = append(ret[0], s.temp.power[0]...)
case SpecChnModeRight:
s.process(buf, 1)
ret[1] = append(ret[1], s.temp.power[1]...)
case SpecChnModeSeparate: case SpecChnModeSeparate:
s.process(buf, 0) s.process(buf, 0)
s.process(buf, 1) s.process(buf, 1)
@ -158,7 +151,6 @@ func (s *SpecAnalyzer) update(buf sointu.AudioBuffer) *Spectrum {
s.process(buf, 1) s.process(buf, 1)
ret[0] = append(ret[0], s.temp.power[0]...) ret[0] = append(ret[0], s.temp.power[0]...)
vek32.Add_Inplace(ret[0], s.temp.power[1]) vek32.Add_Inplace(ret[0], s.temp.power[1])
vek32.MulNumber_Inplace(ret[0], 0.5)
} }
// convert to decibels // convert to decibels
for c := range 2 { for c := range 2 {