mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-15 17:40:51 +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
|
// bus represents a bus channel
|
||||||
type bus struct {
|
type bus struct {
|
||||||
iRemote
|
iRemote
|
||||||
eQ *eQ
|
eQ *eQ
|
||||||
mode *busMode
|
mode *busMode
|
||||||
levels
|
levels *levels
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mute returns the value of the Mute parameter
|
// Mute returns the value of the Mute parameter
|
||||||
@ -83,7 +83,7 @@ func (b *bus) Mode() *busMode {
|
|||||||
|
|
||||||
// Levels returns the levels field
|
// Levels returns the levels field
|
||||||
func (b *bus) Levels() *levels {
|
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_
|
// 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
|
// 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
|
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
|
// All returns the level values for a bus
|
||||||
func (l *levels) All() []float64 {
|
func (l *levels) All() []float64 {
|
||||||
var levels []float64
|
levels := make([]float64, l.offset)
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := range levels {
|
||||||
levels = append(levels, convertLevel(_levelCache.busLevels[i]))
|
levels[i] = convertLevel(_levelCache.busLevels[i+l.init])
|
||||||
}
|
}
|
||||||
return levels
|
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
|
// PreFader returns the level values for this strip, PREFADER mode
|
||||||
func (l *levels) PreFader() []float64 {
|
func (l *levels) PreFader() []float64 {
|
||||||
_levelCache.stripMode = 0
|
_levelCache.stripMode = 0
|
||||||
var levels []float64
|
levels := make([]float64, l.offset)
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := range levels {
|
||||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
levels[i] = convertLevel(_levelCache.stripLevels[i+l.init])
|
||||||
}
|
}
|
||||||
return levels
|
return levels
|
||||||
}
|
}
|
||||||
@ -608,9 +608,9 @@ func (l *levels) PreFader() []float64 {
|
|||||||
// PostFader returns the level values for this strip, POSTFADER mode
|
// PostFader returns the level values for this strip, POSTFADER mode
|
||||||
func (l *levels) PostFader() []float64 {
|
func (l *levels) PostFader() []float64 {
|
||||||
_levelCache.stripMode = 1
|
_levelCache.stripMode = 1
|
||||||
var levels []float64
|
levels := make([]float64, l.offset)
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := range levels {
|
||||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
levels[i] = convertLevel(_levelCache.stripLevels[i+l.init])
|
||||||
}
|
}
|
||||||
return levels
|
return levels
|
||||||
}
|
}
|
||||||
@ -618,9 +618,9 @@ func (l *levels) PostFader() []float64 {
|
|||||||
// PostMute returns the level values for this strip, POSTMUTE mode
|
// PostMute returns the level values for this strip, POSTMUTE mode
|
||||||
func (l *levels) PostMute() []float64 {
|
func (l *levels) PostMute() []float64 {
|
||||||
_levelCache.stripMode = 2
|
_levelCache.stripMode = 2
|
||||||
var levels []float64
|
levels := make([]float64, l.offset)
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := range levels {
|
||||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
levels[i] = convertLevel(_levelCache.stripLevels[i+l.init])
|
||||||
}
|
}
|
||||||
return levels
|
return levels
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user