A Go wrapper for the Voiceemeter API
Go to file
2022-08-22 22:54:38 +01:00
examples/observer fix deregister in observer example 2022-08-22 22:54:38 +01:00
tests Remote Kind field now exported. 2022-07-18 16:23:15 +01:00
.gitignore docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
base.go getMidiMessage implemented 2022-08-22 22:28:11 +01:00
bus_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
bus.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
button_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
button.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
CHANGELOG.md changelog updated to reflect changes 2022-08-22 22:40:08 +01:00
command_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
command.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
device_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
device.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
go.mod docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
go.sum package module moved into root of repository. 2022-07-09 19:01:58 +01:00
helper_test.go float/string getter/setter tests added 2022-08-22 22:34:03 +01:00
iremote.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
kinds_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
kinds.go Remote Kind field now exported. 2022-07-18 16:23:15 +01:00
levels.go Remote Kind field now exported. 2022-07-18 16:23:15 +01:00
LICENSE Initial commit 2022-06-22 20:45:19 +01:00
midi.go getMidiMessage implemented 2022-08-22 22:28:11 +01:00
outputs_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
outputs.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
path_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
path.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
publisher.go event type added for toggline evet subscriptions. 2022-08-22 22:29:30 +01:00
README.md tested against version updated. 2022-08-22 22:39:35 +01:00
recorder_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
recorder.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
remote_test.go float/string getter/setter tests added 2022-08-22 22:34:03 +01:00
remote.go getter/setter method forwarders added to Remote 2022-08-22 22:33:22 +01:00
strip_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
strip.go Remote Kind field now exported. 2022-07-18 16:23:15 +01:00
util_test.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
util.go docstrings added to functions, types and methods 2022-07-10 23:08:14 +01:00
vban_test.go package module moved into root of repository. 2022-07-09 19:01:58 +01:00
vban.go Remote Kind field now exported. 2022-07-18 16:23:15 +01:00

Go Reference

A Go Wrapper for Voicemeeter API

This package offers a Go interface for the Voicemeeter Remote C API.

For an outline of past/future changes refer to: CHANGELOG

Tested against

  • Basic 1.0.8.4
  • Banana 2.0.6.4
  • Potato 3.0.2.4

Requirements

Installation

GO.MOD

Add to your go.mod file:

require github.com/onyx-and-iris/voicemeeter-api-go vX.X.X

where vX.X.X is the version you require.

GO GET

Install voicemeeter-api-go package from your console to download the latest version.

go get github.com/onyx-and-iris/voicemeeter-api-go

Use

main.go

package main

import (
	"fmt"

	"github.com/onyx-and-iris/voicemeeter-api-go"
)

func main() {
	kindId := "banana"
	vm := voicemeeter.NewRemote(kindId)

	vm.Login()

	vm.Strip[0].SetLabel("rode podmic")
	vm.Strip[0].SetMute(true)
	fmt.Printf("Strip 0 (%s) mute was set to %v\n", vm.Strip[0].GetLabel(), vm.Strip[0].GetMute())

	vm.Logout()
}

kindId

Pass the kind of Voicemeeter as an argument. kindId may be:

  • basic
  • banana
  • potato

Remote Type

vm.Strip

[]t_strip slice containing both physicalStrip and virtualStrip types

vm.Bus

[]t_bus slice containing both physicalBus and virtualBus types

vm.Button

[]button slice containing button types, one for each macrobutton

vm.Command

pointer to command type, represents action type functions

vm.Vban

pointer to vban type, containing both vbanInStream and vbanOutStream slices

vm.Device

pointer to device type, represents physical input/output hardware devices

vm.Recorder

pointer to recorder type, represents the recorder

vm.Midi

pointer to midi type, represents a connected midi device

vm.Type()

returns the type of Voicemeeter as a string

vm.Version()

returns the version of Voicemeeter as a string

vm.GetFloat(<param>)

gets a float parameter value

vm.SetFloat(<param>, <value>)

sets a float parameter value eg. vm.SetFloat("strip[0].mute", 1)

vm.GetString(<param>)

gets a string parameter value

vm.SetString(<param>, <value>)

sets a string parameter value eg. vm.SetString("strip[0].label", "podmic")

vm.SendText(<script>)

sets many parameters in script format eg. ("Strip[0].Mute=1;Bus[3].Gain=3.6")

vm.Register(o observer)

register an object as an observer

vm.Deregister(o observer)

deregister an object as an observer

vm.EventAdd(<event>)

adds an event to the pooler eg. vm.EventAdd("ldirty")

vm.EventRemove(<event>)

removes an event to the pooler eg. vm.EventRemove("pdirty")

vm.Pdirty()

returns True iff a GUI parameter has changed

vm.Mdirty()

returns True iff a macrobutton parameter has changed

Available commands

Strip

The following methods are available

  • GetMute() bool
  • SetMute(val bool)
  • GetMono() bool
  • SetMono(val bool)
  • GetSolo() bool
  • SetSolo(val bool)
  • GetLimit() int
  • SetLimit(val int) from -40 to 12
  • GetLabel() string
  • SetLabel(val string)
  • GetGain() float64
  • SetGain(val float32) from -60.0 to 12.0
  • GetMc() bool
  • SetMc(val bool)
  • GetComp() float64
  • SetComp(val float32) from 0.0 to 10.0
  • GetGate() float64
  • SetGate(val float32) from 0.0 to 10.0
  • GetAudibility() float64
  • SetAudibility(val float32) from 0.0 to 10.0
  • GetA1() bool - GetA5() bool
  • SetA1(val bool) - SetA5(val bool)

example:

vm.Strip[3].SetGain(3.7)
fmt.Println(vm.Strip[0].GetLabel())
vm.Strip[4].SetA1(true)
Gainlayers
  • vm.Strip[i].GainLayer()[j]

The following methods are available

  • Get() float64
  • Set(val float32)

example:

vm.Strip[6].GainLayer()[3].Set(-13.6)
Levels
  • vm.Strip[i].Levels()

The following methods are available

  • PreFader() []float32
  • PostFader() []float32
  • PostMute() []float32

example:

fmt.Println(vm.Strip[5].Levels().PreFader())

Bus

The following methods are available

  • String() string
  • GetMute() bool
  • SetMute(val bool)
  • GetEq() bool
  • SetEq(val bool)
  • GetMono() bool
  • SetMono(val bool)
  • GetLabel() string
  • SetLabel(val string)
  • GetGain() float64
  • SetGain(val float32) from -60.0 to 12.0
vm.Bus[3].SetEq(true)
fmt.Println(vm.Bus[0].GetLabel())
Modes
  • vm.Bus[i].Mode()

The following methods are available

  • SetNormal(val bool)
  • GetNormal() bool
  • SetAmix(val bool)
  • GetAmix() bool
  • SetBmix(val bool)
  • GetBmix() bool
  • SetRepeat(val bool)
  • GetRepeat() bool
  • SetComposite(val bool)
  • GetComposite() bool
  • SetTvMix(val bool)
  • GetTvMix() bool
  • SetUpMix21(val bool)
  • GetUpMix21() bool
  • SetUpMix41(val bool)
  • GetUpMix41() bool
  • SetUpMix61(val bool)
  • GetUpMix61() bool
  • SetCenterOnly(val bool)
  • GetCenterOnly() bool
  • SetLfeOnly(val bool)
  • GetLfeOnly() bool
  • SetRearOnly(val bool)
  • GetRearOnly() bool

example:

vm.Bus[3].Mode().SetAmix(true)
vm.Bus[4].Mode().SetCenterOnly(true)
Levels
  • vm.Bus[i].Levels()

The following methods are available

  • All() []float32

example:

fmt.Println(vm.Bus[1].Levels().All())

Button

The following methods are available

  • GetState() bool
  • SetState(val bool)
  • GetStateOnly() bool
  • SetStateOnly(val bool)
  • GetTrigger() bool
  • SetTrigger(val bool)

example:

vm.Button[37].SetState(true)
fmt.Println(vm.Button[64].GetStateOnly())

Command

The following methods are available

  • Show() Show Voicemeeter GUI if it's hidden
  • Hide() Hide Voicemeeter GUI if it's shown
  • Shutdown() Shuts down the GUI
  • Restart() Restart the audio engine
  • Lock(val bool) Lock the Voicemeeter GUI

example:

vm.Command.Restart()
vm.Command.Show()

VBAN

  • vm.Vban.Enable() vm.Vban.Disable() Turn VBAN on or off
Instream | Outstream
  • vm.Vban.InStream vm.Vban.OutStream

The following methods are available

  • GetOn() bool
  • SetOn(val bool)
  • GetName() string
  • SetName(val string)
  • GetIp() string
  • SetIp(val string)
  • GetPort() int
  • SetPort(val int) from 1024 to 65535
  • GetSr() int
  • SetSr(val int) (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
  • GetChannel() int
  • SetChannel(val int) from 1 to 8
  • GetBit() int
  • SetBit(val int) 16 or 24
  • GetQuality() int
  • SetQuality(val int) from 0 to 4
  • GetRoute() int
  • SetRoute(val int) from 0 to 8

example:

# turn VBAN on
vm.Vban.Enable()

// turn on vban instream 0
vm.Vban.InStream[0].SetOn(true)

// set bit property for outstream 3 to 24
vm.Vban.OutStream[3].SetBit(24)

Device

The following methods are available

  • Ins()
  • Outs()
  • Input(val int)
  • Output(val int)

example:

for i := 0; i < int(vm.Device.Ins()); i++ {
	fmt.Println(vm.Device.Input(i))
}

Recorder

The following methods are available

  • Play()
  • Stop()
  • Pause()
  • Replay()
  • Record()
  • Ff()
  • Rew()

example:

vm.Recorder.Play()
vm.Recorder.Stop()

# Enable loop play
vm.Recorder.Loop(true)

# Disable recorder out channel B2
vm.Recorder.SetB2(false)

Midi

The following methods are available

  • Channel() returns the current midi channel
  • Current() returns the most recently pressed midi button
  • Get(<button>) returns the value in cache for the midi button

example:

var current = vm.Midi.Current()
var val = vm.Midi.Get(current)

Events

By default level updates are disabled. Any event may be enabled or disabled. The following events exist:

  • pdirty parameter updates
  • mdirty macrobutton updates
  • midi midi updates
  • ldirty level updates

example:

vm.EventAdd("ldirty")

vm.EventRemove("pdirty")

Run tests

To run all tests:

go test ./...

Official Documentation