mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-22 04:40:53 +00:00
refactor level methods for strip/bus types
This commit is contained in:
parent
134d016e10
commit
26765f554c
18
bus.go
18
bus.go
@ -26,9 +26,9 @@ type iBus interface {
|
||||
// bus represents a bus channel
|
||||
type bus struct {
|
||||
iRemote
|
||||
eQ *eQ
|
||||
mode *busMode
|
||||
levels
|
||||
eQ *eQ
|
||||
mode *busMode
|
||||
levels *levels
|
||||
}
|
||||
|
||||
// Mute returns the value of the Mute parameter
|
||||
@ -83,7 +83,7 @@ func (b *bus) Mode() *busMode {
|
||||
|
||||
// Levels returns the levels field
|
||||
func (b *bus) Levels() *levels {
|
||||
return &b.levels
|
||||
return b.levels
|
||||
}
|
||||
|
||||
// FadeTo sets the value of gain to target over at time interval of time_
|
||||
@ -268,16 +268,16 @@ func (bm *busMode) SetRearOnly(val bool) {
|
||||
}
|
||||
|
||||
// newBusLevels represents the levels field for a channel
|
||||
func newBusLevels(i int, k *kind) levels {
|
||||
func newBusLevels(i int, k *kind) *levels {
|
||||
init := i * 8
|
||||
return levels{iRemote{fmt.Sprintf("bus[%d]", i), i}, k, init, 8, "bus"}
|
||||
return &levels{iRemote{fmt.Sprintf("bus[%d]", i), i}, k, init, 8, "bus"}
|
||||
}
|
||||
|
||||
// All returns the level values for a bus
|
||||
func (l *levels) All() []float64 {
|
||||
var levels []float64
|
||||
for i := l.init; i < l.init+l.offset; i++ {
|
||||
levels = append(levels, convertLevel(_levelCache.busLevels[i]))
|
||||
levels := make([]float64, l.offset)
|
||||
for i := range levels {
|
||||
levels[i] = convertLevel(_levelCache.busLevels[i+l.init])
|
||||
}
|
||||
return levels
|
||||
}
|
||||
|
18
strip.go
18
strip.go
@ -598,9 +598,9 @@ func newStripLevels(i int, k *kind) *levels {
|
||||
// PreFader returns the level values for this strip, PREFADER mode
|
||||
func (l *levels) PreFader() []float64 {
|
||||
_levelCache.stripMode = 0
|
||||
var levels []float64
|
||||
for i := l.init; i < l.init+l.offset; i++ {
|
||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
||||
levels := make([]float64, l.offset)
|
||||
for i := range levels {
|
||||
levels[i] = convertLevel(_levelCache.stripLevels[i+l.init])
|
||||
}
|
||||
return levels
|
||||
}
|
||||
@ -608,9 +608,9 @@ func (l *levels) PreFader() []float64 {
|
||||
// PostFader returns the level values for this strip, POSTFADER mode
|
||||
func (l *levels) PostFader() []float64 {
|
||||
_levelCache.stripMode = 1
|
||||
var levels []float64
|
||||
for i := l.init; i < l.init+l.offset; i++ {
|
||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
||||
levels := make([]float64, l.offset)
|
||||
for i := range levels {
|
||||
levels[i] = convertLevel(_levelCache.stripLevels[i+l.init])
|
||||
}
|
||||
return levels
|
||||
}
|
||||
@ -618,9 +618,9 @@ func (l *levels) PostFader() []float64 {
|
||||
// PostMute returns the level values for this strip, POSTMUTE mode
|
||||
func (l *levels) PostMute() []float64 {
|
||||
_levelCache.stripMode = 2
|
||||
var levels []float64
|
||||
for i := l.init; i < l.init+l.offset; i++ {
|
||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
||||
levels := make([]float64, l.offset)
|
||||
for i := range levels {
|
||||
levels[i] = convertLevel(_levelCache.stripLevels[i+l.init])
|
||||
}
|
||||
return levels
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user