export pdirty, mdirty through remote type

remote sync from setters.

add sync to tests.
This commit is contained in:
onyx-and-iris
2022-06-30 23:08:35 +01:00
parent 232f8561de
commit a7abc43726
5 changed files with 48 additions and 13 deletions

View File

@@ -52,7 +52,8 @@ func login(kindId string) {
os.Exit(1)
}
fmt.Println("Logged into API")
sync()
for pdirty() || mdirty() {
}
}
// logout logs out of the API,
@@ -111,12 +112,6 @@ func mdirty() bool {
return int(res) == 1
}
func sync() {
time.Sleep(30 * time.Millisecond)
for pdirty() || mdirty() {
}
}
// getVMType returns the type of Voicemeeter, as a string
func getVMType() string {
var type_ uint64
@@ -165,7 +160,6 @@ func setParameterFloat(name string, value float32) {
fmt.Println(err)
os.Exit(1)
}
sync()
}
// getParameterString gets the value of a string parameter
@@ -198,7 +192,6 @@ func setParameterString(name, value string) {
fmt.Println(err)
os.Exit(1)
}
sync()
}
// setParametersMulti sets multiple parameters with a script
@@ -242,8 +235,6 @@ func setMacroStatus(id, state, mode int) {
fmt.Println(err)
os.Exit(1)
}
time.Sleep(30 * time.Millisecond)
sync()
}
func get_num_devices(dir string) uint64 {

View File

@@ -5,7 +5,7 @@ type observer interface {
OnUpdate(subject string)
}
// Publisher defines methods that support observers
// publisher defines methods that support observers
type publisher struct {
observerList []observer
}
@@ -36,7 +36,7 @@ func (p *publisher) notify(subject string) {
}
}
// Pooler continuously polls the dirty paramters
// pooler continuously polls the dirty paramters
// it is expected to be run in a goroutine
type pooler struct {
run bool

View File

@@ -47,6 +47,16 @@ func (r *remote) Version() string {
return getVersion()
}
// Pdirty returns true iff a parameter value has changed
func (r *remote) Pdirty() bool {
return pdirty()
}
// Mdirty returns true iff a macrobutton value has changed
func (r *remote) Mdirty() bool {
return mdirty()
}
func (r *remote) SendText(script string) {
setParametersMulti(script)
}