mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-22 04:40:53 +00:00
parent
717c738583
commit
2129d44be3
@ -79,7 +79,7 @@ type physicalBus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newPhysicalBus(i int) t_bus {
|
func newPhysicalBus(i int) t_bus {
|
||||||
pb := physicalBus{bus{iRemote{"bus", i}}}
|
pb := physicalBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}}}
|
||||||
return t_bus(&pb)
|
return t_bus(&pb)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ type virtualBus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newVirtualBus(i int) t_bus {
|
func newVirtualBus(i int) t_bus {
|
||||||
vb := virtualBus{bus{iRemote{"bus", i}}}
|
vb := virtualBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}}}
|
||||||
return t_bus(&vb)
|
return t_bus(&vb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,38 +1,31 @@
|
|||||||
package voicemeeter
|
package voicemeeter
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
type command struct {
|
type command struct {
|
||||||
identifier string
|
iRemote
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCommand() *command {
|
func newCommand() *command {
|
||||||
return &command{"command"}
|
return &command{iRemote{"command", 0}}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *command) setter(p string, v float32) {
|
|
||||||
param := fmt.Sprintf("%s.%s", c.identifier, p)
|
|
||||||
setParameterFloat(param, v)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show shows the Voicemeete GUI if it's hidden
|
// Show shows the Voicemeete GUI if it's hidden
|
||||||
func (c *command) Show() {
|
func (c *command) Show() {
|
||||||
c.setter("Show", 1)
|
c.setter_float("Show", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide hides the Voicemeete GUI if it's shown
|
// Hide hides the Voicemeete GUI if it's shown
|
||||||
func (c *command) Hide() {
|
func (c *command) Hide() {
|
||||||
c.setter("Show", 0)
|
c.setter_float("Show", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown shutdown the Voicemeeter GUI
|
// Shutdown shutdown the Voicemeeter GUI
|
||||||
func (c *command) Shutdown() {
|
func (c *command) Shutdown() {
|
||||||
c.setter("Shutdown", 1)
|
c.setter_float("Shutdown", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restart restarts the Voicemeeter audio engine
|
// Restart restarts the Voicemeeter audio engine
|
||||||
func (c *command) Restart() {
|
func (c *command) Restart() {
|
||||||
c.setter("Restart", 1)
|
c.setter_float("Restart", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock locks or unlocks the Voiceemeter GUI
|
// Lock locks or unlocks the Voiceemeter GUI
|
||||||
@ -44,5 +37,5 @@ func (c *command) Lock(val bool) {
|
|||||||
} else {
|
} else {
|
||||||
value = 0
|
value = 0
|
||||||
}
|
}
|
||||||
c.setter("Lock", value)
|
c.setter_float("Lock", value)
|
||||||
}
|
}
|
||||||
|
@ -10,19 +10,19 @@ type iRemote struct {
|
|||||||
index int
|
index int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *iRemote) identifier() string {
|
func (ir *iRemote) identifier() string {
|
||||||
return c._identifier
|
return ir._identifier
|
||||||
}
|
}
|
||||||
|
|
||||||
// getter_bool returns the value of a boolean parameter
|
// getter_bool returns the value of a boolean parameter
|
||||||
func (c *iRemote) getter_bool(p string) bool {
|
func (ir *iRemote) getter_bool(p string) bool {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
return getParameterFloat(param) == 1
|
return getParameterFloat(param) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// setter_bool sets the value of a boolean parameter
|
// setter_bool sets the value of a boolean parameter
|
||||||
func (c *iRemote) setter_bool(p string, v bool) {
|
func (ir *iRemote) setter_bool(p string, v bool) {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
var value float32
|
var value float32
|
||||||
if v {
|
if v {
|
||||||
value = 1
|
value = 1
|
||||||
@ -33,37 +33,37 @@ func (c *iRemote) setter_bool(p string, v bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getter_int returns the value of an int parameter p
|
// getter_int returns the value of an int parameter p
|
||||||
func (c *iRemote) getter_int(p string) int {
|
func (ir *iRemote) getter_int(p string) int {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
return int(getParameterFloat(param))
|
return int(getParameterFloat(param))
|
||||||
}
|
}
|
||||||
|
|
||||||
// setter_int sets the value v of an int parameter p
|
// setter_int sets the value v of an int parameter p
|
||||||
func (c *iRemote) setter_int(p string, v int) {
|
func (ir *iRemote) setter_int(p string, v int) {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
setParameterFloat(param, float32(v))
|
setParameterFloat(param, float32(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// getter_float returns the value of an int parameter p
|
// getter_float returns the value of an int parameter p
|
||||||
func (c *iRemote) getter_float(p string) float64 {
|
func (ir *iRemote) getter_float(p string) float64 {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
return getParameterFloat(param)
|
return getParameterFloat(param)
|
||||||
}
|
}
|
||||||
|
|
||||||
// setter_float sets the value v of an int parameter p
|
// setter_float sets the value v of an int parameter p
|
||||||
func (c *iRemote) setter_float(p string, v float32) {
|
func (ir *iRemote) setter_float(p string, v float32) {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
setParameterFloat(param, float32(v))
|
setParameterFloat(param, float32(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// getter_string returns the value of a string parameter p
|
// getter_string returns the value of a string parameter p
|
||||||
func (c *iRemote) getter_string(p string) string {
|
func (ir *iRemote) getter_string(p string) string {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
return getParameterString(param)
|
return getParameterString(param)
|
||||||
}
|
}
|
||||||
|
|
||||||
// setter_string sets the value v of a string parameter p
|
// setter_string sets the value v of a string parameter p
|
||||||
func (c *iRemote) setter_string(p, v string) {
|
func (ir *iRemote) setter_string(p, v string) {
|
||||||
param := fmt.Sprintf("%s[%d].%s", c.identifier(), c.index, p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
setParameterString(param, v)
|
setParameterString(param, v)
|
||||||
}
|
}
|
||||||
|
44
voicemeeter/recorder.go
Normal file
44
voicemeeter/recorder.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package voicemeeter
|
||||||
|
|
||||||
|
type recorder struct {
|
||||||
|
iRemote
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRecorder() *recorder {
|
||||||
|
return &recorder{iRemote{"recorder", 0}}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Play plays the file currently loaded into the recorder
|
||||||
|
func (r *recorder) Play() {
|
||||||
|
r.setter_float("Play", 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop stops the file currently playing
|
||||||
|
func (r *recorder) Stop() {
|
||||||
|
r.setter_float("Stop", 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause pauses the file currently playing
|
||||||
|
func (r *recorder) Pause() {
|
||||||
|
r.setter_float("Pause", 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restart restarts the Voicemeeter audio engine
|
||||||
|
func (r *recorder) Replay() {
|
||||||
|
r.setter_float("Replay", 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Record records the current track playing
|
||||||
|
func (r *recorder) Record() {
|
||||||
|
r.setter_float("Record", 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ff fast forwards the recorder
|
||||||
|
func (r *recorder) Ff() {
|
||||||
|
r.setter_float("Ff", 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rew rewinds the recorder
|
||||||
|
func (r *recorder) Rew() {
|
||||||
|
r.setter_float("Rew", 1)
|
||||||
|
}
|
@ -14,6 +14,7 @@ type remote struct {
|
|||||||
Button []button
|
Button []button
|
||||||
Command *command
|
Command *command
|
||||||
Vban *vban
|
Vban *vban
|
||||||
|
Recorder *recorder
|
||||||
|
|
||||||
pooler *pooler
|
pooler *pooler
|
||||||
}
|
}
|
||||||
@ -66,6 +67,8 @@ type remoteBuilder interface {
|
|||||||
makeButton() remoteBuilder
|
makeButton() remoteBuilder
|
||||||
makeCommand() remoteBuilder
|
makeCommand() remoteBuilder
|
||||||
makeVban() remoteBuilder
|
makeVban() remoteBuilder
|
||||||
|
makeRecorder() remoteBuilder
|
||||||
|
Build() remoteBuilder
|
||||||
Get() *remote
|
Get() *remote
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,9 +82,9 @@ func (d *director) SetBuilder(b remoteBuilder) {
|
|||||||
d.builder = b
|
d.builder = b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct defines the steps required for building a remote type
|
// Construct calls the build function for the specific builder
|
||||||
func (d *director) Construct() {
|
func (d *director) Construct() {
|
||||||
d.builder.setKind().makeStrip().makeBus().makeButton().makeCommand().makeVban()
|
d.builder.Build()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get forwards the Get method to the builder
|
// Get forwards the Get method to the builder
|
||||||
@ -156,6 +159,13 @@ func (b *genericBuilder) makeVban() remoteBuilder {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// makeVban makes a Vban type and assignss it to remote.Vban
|
||||||
|
func (b *genericBuilder) makeRecorder() remoteBuilder {
|
||||||
|
fmt.Println("building recorder")
|
||||||
|
b.r.Recorder = newRecorder()
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
// Get returns a fully constructed remote type for a kind
|
// Get returns a fully constructed remote type for a kind
|
||||||
func (b *genericBuilder) Get() *remote {
|
func (b *genericBuilder) Get() *remote {
|
||||||
return &b.r
|
return &b.r
|
||||||
@ -165,14 +175,29 @@ type basicBuilder struct {
|
|||||||
genericBuilder
|
genericBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build defines the steps required to build a basic type
|
||||||
|
func (basb *genericBuilder) Build() remoteBuilder {
|
||||||
|
return basb.setKind().makeStrip().makeBus().makeButton().makeCommand().makeVban()
|
||||||
|
}
|
||||||
|
|
||||||
type bananaBuilder struct {
|
type bananaBuilder struct {
|
||||||
genericBuilder
|
genericBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build defines the steps required to build a banana type
|
||||||
|
func (banb *bananaBuilder) Build() remoteBuilder {
|
||||||
|
return banb.setKind().makeStrip().makeBus().makeButton().makeCommand().makeVban().makeRecorder()
|
||||||
|
}
|
||||||
|
|
||||||
type potatoBuilder struct {
|
type potatoBuilder struct {
|
||||||
genericBuilder
|
genericBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build defines the steps required to build a potato type
|
||||||
|
func (potb *potatoBuilder) Build() remoteBuilder {
|
||||||
|
return potb.setKind().makeStrip().makeBus().makeButton().makeCommand().makeVban().makeRecorder()
|
||||||
|
}
|
||||||
|
|
||||||
// GetRemote returns a remote type for a kind
|
// GetRemote returns a remote type for a kind
|
||||||
// this is the interface entry point
|
// this is the interface entry point
|
||||||
func GetRemote(kindId string) *remote {
|
func GetRemote(kindId string) *remote {
|
||||||
|
@ -21,6 +21,15 @@ func TestGetBasicRemote(t *testing.T) {
|
|||||||
t.Run("Should bus length equal 2", func(t *testing.T) {
|
t.Run("Should bus length equal 2", func(t *testing.T) {
|
||||||
assert.Equal(t, 2, len(__rem.Bus))
|
assert.Equal(t, 2, len(__rem.Bus))
|
||||||
})
|
})
|
||||||
|
t.Run("Should return a valid command pointer", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Command)
|
||||||
|
})
|
||||||
|
t.Run("Should return a valid vban pointer", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Vban)
|
||||||
|
})
|
||||||
|
t.Run("Should return nil recorder pointer", func(t *testing.T) {
|
||||||
|
assert.Nil(t, __rem.Recorder)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetBananaRemote(t *testing.T) {
|
func TestGetBananaRemote(t *testing.T) {
|
||||||
@ -38,6 +47,15 @@ func TestGetBananaRemote(t *testing.T) {
|
|||||||
t.Run("Should bus length equal 5", func(t *testing.T) {
|
t.Run("Should bus length equal 5", func(t *testing.T) {
|
||||||
assert.Equal(t, 5, len(__rem.Bus))
|
assert.Equal(t, 5, len(__rem.Bus))
|
||||||
})
|
})
|
||||||
|
t.Run("Should return a valid command pointer", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Command)
|
||||||
|
})
|
||||||
|
t.Run("Should return a valid vban pointer", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Vban)
|
||||||
|
})
|
||||||
|
t.Run("Should return a valid recorder", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Recorder)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetPotatoRemote(t *testing.T) {
|
func TestGetPotatoRemote(t *testing.T) {
|
||||||
@ -55,4 +73,13 @@ func TestGetPotatoRemote(t *testing.T) {
|
|||||||
t.Run("Should bus length equal 8", func(t *testing.T) {
|
t.Run("Should bus length equal 8", func(t *testing.T) {
|
||||||
assert.Equal(t, 8, len(__rem.Bus))
|
assert.Equal(t, 8, len(__rem.Bus))
|
||||||
})
|
})
|
||||||
|
t.Run("Should return a valid command pointer", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Command)
|
||||||
|
})
|
||||||
|
t.Run("Should return a valid vban pointer", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Vban)
|
||||||
|
})
|
||||||
|
t.Run("Should return a valid recorder", func(t *testing.T) {
|
||||||
|
assert.NotNil(t, __rem.Recorder)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ type physicalStrip struct {
|
|||||||
|
|
||||||
func newPhysicalStrip(i int) t_strip {
|
func newPhysicalStrip(i int) t_strip {
|
||||||
o := newOutputs("strip", i)
|
o := newOutputs("strip", i)
|
||||||
ps := physicalStrip{strip{iRemote{"strip", i}, o}}
|
ps := physicalStrip{strip{iRemote{fmt.Sprintf("strip[%d]", i), i}, o}}
|
||||||
return t_strip(&ps)
|
return t_strip(&ps)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ type virtualStrip struct {
|
|||||||
|
|
||||||
func newVirtualStrip(i int) t_strip {
|
func newVirtualStrip(i int) t_strip {
|
||||||
o := newOutputs("strip", i)
|
o := newOutputs("strip", i)
|
||||||
vs := virtualStrip{strip{iRemote{"strip", i}, o}}
|
vs := virtualStrip{strip{iRemote{fmt.Sprintf("strip[%d]", i), i}, o}}
|
||||||
return t_strip(&vs)
|
return t_strip(&vs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package voicemeeter
|
package voicemeeter
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
type t_vban interface {
|
type t_vban interface {
|
||||||
GetOn() bool
|
GetOn() bool
|
||||||
SetOn(val bool)
|
SetOn(val bool)
|
||||||
@ -132,7 +134,7 @@ type vbanInStream struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newVbanInStream(i int) t_vban {
|
func newVbanInStream(i int) t_vban {
|
||||||
vbi := vbanInStream{vbanStream{iRemote{"vban.instream", i}}}
|
vbi := vbanInStream{vbanStream{iRemote{fmt.Sprintf("vban.instream[%d]", i), i}}}
|
||||||
return t_vban(&vbi)
|
return t_vban(&vbi)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +158,7 @@ type vbanOutStream struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newVbanOutStream(i int) t_vban {
|
func newVbanOutStream(i int) t_vban {
|
||||||
vbo := vbanOutStream{vbanStream{iRemote{"vban.outstream", i}}}
|
vbo := vbanOutStream{vbanStream{iRemote{fmt.Sprintf("vban.outstream[%d]", i), i}}}
|
||||||
return t_vban(&vbo)
|
return t_vban(&vbo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user