vst2

package module
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 12 Imported by: 1

README

vst2

PkgGoDev Go Report Card Test codecov

vst2 implements VST2 SDK API. It provides capabilities to build both VST2 hosts and plugins.

Installation

$ go get -u pipelined.dev/audio/vst2

Quick Start

Refer godoc documentation for example.

License

vst2 is licensed under MIT license.

Documentation

Overview

Package vst2 provides all types available in VST2 SDK. The purpose of it is to enable to develop vst2 aplications without a need to interact with CGO and unsafe directly.

Example (Plugin)
//go:build !plugin
// +build !plugin

package main

import (
	"fmt"
	"log"
	"path/filepath"
	"runtime"
	"unsafe"

	"pipelined.dev/audio/vst2"
	"pipelined.dev/signal"
)

// PrinterHostCallback returns closure that prints received opcode with
// provided prefix. This technique allows to provide callback with any
// context needed.
func PrinterHostCallback(prefix string) vst2.HostCallbackFunc {
	return func(code vst2.HostOpcode, index int32, value int64, ptr unsafe.Pointer, opt float32) int64 {
		fmt.Printf("%s: %v\n", prefix, code)
		return 0
	}
}

func main() {
	// sample data that we will process: 2 channels, 32 samples
	data := [][]float64{
		{
			-0.0027160645,
			-0.0039978027,
			-0.0071411133,
			-0.0065307617,
			0.0038757324,
			0.021972656,
			0.041229248,
			0.055511475,
			0.064971924,
			0.07342529,
			0.08300781,
			0.092681885,
			0.10070801,
			0.110809326,
			0.12677002,
			0.15231323,
			0.19058228,
			0.24459839,
			0.3140869,
			0.38861084,
			0.44683838,
			0.47177124,
			0.46643066,
			0.45007324,
			0.4449768,
			0.45724487,
			0.47451782,
			0.48321533,
			0.47824097,
			0.46679688,
			0.45999146,
			0.46765137,
		},
		{
			-0.0027160645,
			-0.0039978027,
			-0.0071411133,
			-0.0065307617,
			0.0038757324,
			0.021972656,
			0.041229248,
			0.055511475,
			0.064971924,
			0.07342529,
			0.08300781,
			0.092681885,
			0.10070801,
			0.110809326,
			0.12677002,
			0.15231323,
			0.19058228,
			0.24459839,
			0.3140869,
			0.38861084,
			0.44683838,
			0.47177124,
			0.46643066,
			0.45007324,
			0.4449768,
			0.45724487,
			0.47451782,
			0.48321533,
			0.47824097,
			0.46679688,
			0.45999146,
			0.46765137,
		},
	}

	buffer := signal.Allocator{
		Channels: len(data),
		Length:   len(data[0]),
		Capacity: len(data[0]),
	}.Float64()
	signal.WriteStripedFloat64(data, buffer)

	// Open VST library. Library contains a reference to
	// OS-specific handle, that needs to be freed with Close.
	vst, err := vst2.Open(pluginPath())
	if err != nil {
		log.Panicf("failed to open VST library: %v", err)
	}
	defer vst.Close()

	// Load VST plugin with example callback.
	plugin := vst.Plugin(PrinterHostCallback("Received opcode"))
	defer plugin.Close()

	plugin.Start()
	// Set sample rate in Hertz.
	plugin.SetSampleRate(44100)
	// Set channels information.
	plugin.SetSpeakerArrangement(
		&vst2.SpeakerArrangement{
			Type:        vst2.SpeakerArrMono,
			NumChannels: int32(buffer.Channels()),
		},
		&vst2.SpeakerArrangement{
			Type:        vst2.SpeakerArrMono,
			NumChannels: int32(buffer.Channels()),
		},
	)
	// Set buffer size.
	plugin.SetBufferSize(buffer.Length())
	// Start the plugin.
	plugin.Resume()

	// To process data with plugin, we need to use VST2 buffers.
	// It's needed because VST SDK was written in C and expected
	// memory layout differs from Golang slices.
	// We need two buffers for input and output.
	in := vst2.NewDoubleBuffer(buffer.Channels(), buffer.Length())
	defer in.Free()
	out := vst2.NewDoubleBuffer(buffer.Channels(), buffer.Length())
	defer out.Free()

	// Fill input with data values.
	in.Write(buffer)

	// Process data.
	plugin.ProcessDouble(in, out)
	// Copy processed data.
	out.Read(buffer)

}

// pluginPath returns a path to OS-specific plugin. It will panic if OS is
// not supported.
func pluginPath() string {
	os := runtime.GOOS
	var path string
	switch os {
	case "windows":
		path, _ = filepath.Abs("_testdata\\TAL-Noisemaker.dll")
	case "darwin":
		path, _ = filepath.Abs("_testdata/TAL-Noisemaker.vst")
	default:
		panic(fmt.Sprintf("unsupported OS: %v", os))
	}
	return path
}
Output:

Received opcode: HostGetCurrentProcessLevel
Received opcode: hostWantMidi
Received opcode: HostGetCurrentProcessLevel

Index

Examples

Constants

View Source
const (
	// MIDI event.
	MIDI eventType = iota + 1

	// SysExMIDI system exclusive midi event.
	SysExMIDI
)
View Source
const (
	// SpeakerUndefined is undefined.
	SpeakerUndefined SpeakerType = 0x7fffffff
	// SpeakerM is Mono (M).
	SpeakerM = iota
	// SpeakerL is Left (L).
	SpeakerL
	// SpeakerR is Right (R).
	SpeakerR
	// SpeakerC is Center (C).
	SpeakerC
	// SpeakerLfe is Subbass (Lfe).
	SpeakerLfe
	// SpeakerLs is Left Surround (Ls).
	SpeakerLs
	// SpeakerRs is Right Surround (Rs).
	SpeakerRs
	// SpeakerLc is Left of Center (Lc).
	SpeakerLc
	// SpeakerRc is Right of Center (Rc).
	SpeakerRc
	// SpeakerS is Surround (S).
	SpeakerS
	// SpeakerCs is Center of Surround (Cs) = Surround (S).
	SpeakerCs = SpeakerS
	// SpeakerSl is Side Left (Sl).
	SpeakerSl
	// SpeakerSr is Side Right (Sr).
	SpeakerSr
	// SpeakerTm is Top Middle (Tm).
	SpeakerTm
	// SpeakerTfl is Top Front Left (Tfl).
	SpeakerTfl
	// SpeakerTfc is Top Front Center (Tfc).
	SpeakerTfc
	// SpeakerTfr is Top Front Right (Tfr).
	SpeakerTfr
	// SpeakerTrl is Top Rear Left (Trl).
	SpeakerTrl
	// SpeakerTrc is Top Rear Center (Trc).
	SpeakerTrc
	// SpeakerTrr is Top Rear Right (Trr).
	SpeakerTrr
	// SpeakerLfe2 is Subbass 2 (Lfe2).
	SpeakerLfe2
)
View Source
const EffectMagic int32 = 'V'<<24 | 's'<<16 | 't'<<8 | 'P'<<0

EffectMagic is constant in every plugin.

View Source
const (
	// FileExtension of VST2 files in Windows.
	FileExtension = ".so"
)

Variables

This section is empty.

Functions

func ScanPaths

func ScanPaths() []string

ScanPaths returns a slice of default vst2 locations. Locations are OS-specific.

Types

type AutomationState added in v0.9.0

type AutomationState uintptr

AutomationState communicates the host state of automation.

const (
	// AutomationUnsupported returned when host doesn't support automation.
	AutomationUnsupported AutomationState = 0
	// AutomationOff returned when automation is switched off.
	AutomationOff
	// AutomationRead returned when host is reading the automation.
	AutomationRead
	// AutomationWrite returned when host is writing the automation.
	AutomationWrite
	// AutomationReadWrite returned when host is reading and writing the
	// automation.
	AutomationReadWrite
)

type CanDoResponse added in v0.11.0

type CanDoResponse int64

CanDoResponse lists the possible return values for CanDo queries

const (
	// YesCanDo is returned by CanDo queries when plugin/host is certain that it supports a feature.
	YesCanDo CanDoResponse = 1
	// NoCanDo is returned by CanDo queries when plugin/host is certain that it does not support a feature.
	NoCanDo CanDoResponse = -1
	// MaybeCanDo is returned by CanDo queries when plugin/host doesn't know if it supports a particular feature.
	MaybeCanDo CanDoResponse = 0
)

type DoubleBuffer

type DoubleBuffer struct {
	Frames int
	// contains filtered or unexported fields
}

DoubleBuffer is a samples buffer for VST ProcessDouble function.

func NewDoubleBuffer

func NewDoubleBuffer(numChannels, frames int) DoubleBuffer

NewDoubleBuffer allocates new memory for C-compatible buffer.

func (DoubleBuffer) Channel added in v0.9.0

func (b DoubleBuffer) Channel(i int) []float64

Channel returns slice that's backed by C array and stores samples from single channel.

func (DoubleBuffer) Free

func (b DoubleBuffer) Free()

Free the allocated memory.

func (DoubleBuffer) Read added in v0.9.0

func (b DoubleBuffer) Read(s signal.Floating) int

Read copies values to signal.Floating buffer. Buffers must have same number of channels. Returns number of read frames.

func (DoubleBuffer) Write added in v0.9.0

func (b DoubleBuffer) Write(s signal.Floating) int

Write copies values from signal.Floating. Buffers must have same number of channels. Returns number of written frames.

type EditorRectangle added in v0.9.0

type EditorRectangle struct {
	Top    int16
	Left   int16
	Bottom int16
	Right  int16
}

EditorRectangle holds the information about plugin editor window.

type Event added in v0.9.0

type Event interface {
	// contains filtered or unexported methods
}

Event interface is used to provide safety for events mapping. It's implemented by MIDIEvent and SysExMIDIEvent types.

type EventsPtr added in v0.9.0

type EventsPtr C.Events

EventsPtr is a container for events to be processed by plugin or host.

func Events added in v0.9.0

func Events(events ...Event) *EventsPtr

Events allocates new events container and place there provided events. It must be freed after use.

func (*EventsPtr) Event added in v0.9.0

func (e *EventsPtr) Event(i int) Event

Event returns an event from the container.

func (*EventsPtr) Free added in v0.9.0

func (e *EventsPtr) Free()

Free memory allocated for container.

func (*EventsPtr) NumEvents added in v0.9.0

func (e *EventsPtr) NumEvents() int

NumEvents returns number of events within container.

type FloatBuffer

type FloatBuffer struct {
	Frames int
	// contains filtered or unexported fields
}

FloatBuffer is a samples buffer for VST ProcessFloat function.

func NewFloatBuffer

func NewFloatBuffer(numChannels, frames int) FloatBuffer

NewFloatBuffer allocates new memory for C-compatible buffer.

func (FloatBuffer) Channel added in v0.9.0

func (b FloatBuffer) Channel(i int) []float32

Channel returns slice that's backed by C array and stores samples from single channel.

func (FloatBuffer) Free

func (b FloatBuffer) Free()

Free the allocated memory.

func (FloatBuffer) Read added in v0.9.0

func (b FloatBuffer) Read(s signal.Floating) int

Read copies values to signal.Floating buffer. Buffers must have same number of channels. Returns number of read frames.

func (FloatBuffer) Write added in v0.9.0

func (b FloatBuffer) Write(s signal.Floating) int

Write copies values from signal.Floating. Buffers must have same number of channels. Returns number of written frames.

type Host added in v0.9.0

type Host struct {
	GetSampleRate   HostGetSampleRateFunc
	GetBufferSize   HostGetBufferSizeFunc
	GetProcessLevel HostGetProcessLevelFunc
	GetTimeInfo     HostGetTimeInfoFunc
}

Host handles all callbacks from plugin.

func (Host) Callback added in v0.9.0

func (h Host) Callback() HostCallbackFunc

Callback returns HostCallbackFunc that handles all vst types casts and allows to write handlers without usage of unsafe package.

type HostCallbackFunc

type HostCallbackFunc func(op HostOpcode, index int32, value int64, ptr unsafe.Pointer, opt float32) int64

HostCallbackFunc used as callback function called by plugin. Use closure wrapping technique to add more types to callback.

func NoopHostCallback added in v0.9.0

func NoopHostCallback() HostCallbackFunc

NoopHostCallback returns dummy host callback that just prints received opcodes.

type HostCanDoString added in v0.9.0

type HostCanDoString string

HostCanDoString are constants that can be used to check host capabilities.

const (
	// HostCanSendEvents host can send events.
	HostCanSendEvents HostCanDoString = "sendVstEvents"
	// HostCanSendMIDIEvent host can send MIDI events.
	HostCanSendMIDIEvent HostCanDoString = "sendVstMidiEvent"
	// HostCanSendTimeInfo host can send TimeInfo.
	HostCanSendTimeInfo HostCanDoString = "sendVstTimeInfo"
	// HostCanReceiveEvents host can receive events from plugin.
	HostCanReceiveEvents HostCanDoString = "receiveVstEvents"
	// HostCanReceiveMIDIEvent host can receive MIDI events from plugin.
	HostCanReceiveMIDIEvent HostCanDoString = "receiveVstMidiEvent"
	// HostCanReportConnectionChanges host can notify the plugin when
	// something change in plugin´s routing/connections with
	// Suspend/Resume/SetSpeakerArrangement.
	HostCanReportConnectionChanges HostCanDoString = "reportConnectionChanges"
	// HostCanAcceptIOChanges host can receive HostIOChanged.
	HostCanAcceptIOChanges HostCanDoString = "acceptIOChanges"
	// HostCanSizeWindow used by VSTGUI.
	HostCanSizeWindow HostCanDoString = "sizeWindow"
	// HostCanOffline host supports offline processing feature.
	HostCanOffline HostCanDoString = "offline"
	// HostCanOpenFileSelector host supports opcode HostOpenFileSelector.
	HostCanOpenFileSelector HostCanDoString = "openFileSelector"
	// HostCanCloseFileSelector host supports opcode HostCloseFileSelector.
	HostCanCloseFileSelector HostCanDoString = "closeFileSelector"
	// HostCanStartStopProcess host supports PlugStartProcess and
	// PlugStopProcess functions.
	HostCanStartStopProcess HostCanDoString = "startStopProcess"
	// HostCanShellCategory host supports plugins with PluginCategoryShell.
	HostCanShellCategory HostCanDoString = "shellCategory"
	// HostCanSendRealtimeMIDIEvent host can send realtime MIDI events.
	HostCanSendRealtimeMIDIEvent HostCanDoString = "sendVstMidiEventFlagIsRealtime"
)

type HostGetBufferSizeFunc added in v0.9.0

type HostGetBufferSizeFunc func() int

HostGetBufferSizeFunc returns host buffer size.

type HostGetProcessLevelFunc added in v0.9.0

type HostGetProcessLevelFunc func() ProcessLevel

HostGetProcessLevel returns the context of execution.

type HostGetSampleRateFunc added in v0.9.0

type HostGetSampleRateFunc func() signal.Frequency

HostGetSampleRateFunc returns host sample rate.

type HostGetTimeInfoFunc added in v0.9.0

type HostGetTimeInfoFunc func(flags TimeInfoFlag) *TimeInfo

HostGetTimeInfo returns current time info.

type HostLanguage added in v0.9.0

type HostLanguage uintptr

HostLanguage is the language of the host.

const (
	// HostLanguageEnglish English.
	HostLanguageEnglish HostLanguage = iota + 1
	// HostLanguageGerman German.
	HostLanguageGerman
	// HostLanguageFrench French.
	HostLanguageFrench
	// HostLanguageItalian Italian.
	HostLanguageItalian
	// HostLanguageSpanish Spanish.
	HostLanguageSpanish
	// HostLanguageJapanese Japanese.
	HostLanguageJapanese
)

type HostOpcode

type HostOpcode uint32

HostOpcode is sent by plugin in dispatch call to host. It reflects AudioMasterOpcodes and AudioMasterOpcodesX opcodes values.

const (
	// HostAutomate passed to when parameter value is automated.
	// Index: parameter index.
	// Opt: parameter value.
	HostAutomate HostOpcode = iota
	// HostVersion passed to get VST version of host.
	// Return: host VST version (for example 2400 for VST 2.4).
	HostVersion
	// HostCurrentID passed when unique ID is requested.
	// Return: current unique identifier on shell plug-in.
	HostCurrentID
	// HostIdle passed to indicate that plugin does some modal action.
	HostIdle

	// HostGetTime passed when plugin needs time info.
	// Return: *TimeInfo or null if not supported.
	// Value: request mask.
	HostGetTime
	// HostProcessEvents passed when plugin has MIDI events to process.
	// Ptr: *Events the events to be processed.
	// Return: 1 if supported and processed.
	HostProcessEvents

	// HostIOChanged passed when plugin's IO setup has changed.
	// Return: 1 if supported.
	HostIOChanged

	// HostSizeWindow passed when host needs to resize plugin window.
	// Index: new width.
	// Value: new height.
	HostSizeWindow
	// HostGetSampleRate passed when plugin needs sample rate.
	// Return: current sample rate.
	HostGetSampleRate
	// HostGetBufferSize passed when plugin needs buffer size.
	// Return: current buffer size.
	HostGetBufferSize
	// HostGetInputLatency passed when plugin needs input latency.
	// Return: input latency in samples.
	HostGetInputLatency
	// HostGetOutputLatency passed when plugin needs output latency.
	// Return: output latency in samples.
	HostGetOutputLatency

	// HostGetCurrentProcessLevel passed to get current process level.
	// Return: ProcessLevel value.
	HostGetCurrentProcessLevel
	// HostGetAutomationState passed to get current automation state.
	// Return: AutomationState value.
	HostGetAutomationState

	// HostOfflineStart is sent when plugin is ready for offline processing.
	// Index: number of new audio files.
	// Value: number of audio files.
	// Ptr: *AudioFile the host audio files. Flags can be updated from plugin.
	HostOfflineStart
	// HostOfflineRead is sent when plugin reads the data.
	// Index: boolean - if this value is true then the host will read the original
	//	file's samples, but if it is false it will read the samples which the plugin
	//	has written via HostOfflineWrite.
	// Value: see OfflineOption
	// Ptr: *OfflineTask describing the task.
	// Return: 1 on success.
	HostOfflineRead
	// HostOfflineWrite is sent when plugin writes the data.
	// Value: see OfflineOption
	// Ptr: *OfflineTask describing the task.
	HostOfflineWrite
	// HostOfflineGetCurrentPass is unknown.
	HostOfflineGetCurrentPass
	// HostOfflineGetCurrentMetaPass is unknown.
	HostOfflineGetCurrentMetaPass

	// HostGetVendorString is sent to get host vendor string.
	// Ptr: *[maxVendorStrLen]byte buffer for host vendor name.
	HostGetVendorString
	// HostGetProductString is sent to get host product string.
	// Ptr: *[maxProductStrLen]byte buffer for host product name.
	HostGetProductString
	// HostGetVendorVersion is sent to get host version.
	// Return: vendor-specific version.
	HostGetVendorVersion
	// HostVendorSpecific is sent vendor-specific handling.
	HostVendorSpecific

	// HostCanDo passed to check capabilities of host.
	// Ptr: "can do" string
	// Return: 0 is don't know, -1 is no, 1 is yes.
	HostCanDo
	// HostGetLanguage passed to get a language of the host.
	// Return: HostLanguage value.
	HostGetLanguage

	// HostGetDirectory passed to get the current directory.
	// Return: *[]byte with path.
	HostGetDirectory
	// HostUpdateDisplay passed to request host screen refresh.
	HostUpdateDisplay
	// HostBeginEdit passed to notify host that it should capture parameter changes.
	// Index: index of the control.
	// Return: true on success.
	HostBeginEdit
	// HostEndEdit passed to notify that control is no longer being changed.
	// Index: index of the control.
	// Return: true on success.
	HostEndEdit
	// HostOpenFileSelector passed to open the host file selector.
	// Ptr: *FileSelect.
	// Return: true on success.
	HostOpenFileSelector
	// HostCloseFileSelector passed to close the host file selector.
	// Ptr: *FileSelect.
	HostCloseFileSelector
)

func (HostOpcode) String

func (i HostOpcode) String() string

type KeyCode added in v0.9.0

type KeyCode struct {
	Character int32 // ASCII character.
	VirtualKey
	ModifierKeyFlag // Bit flags.
}

KeyCode used to pass information about key presses.

type MIDIEvent added in v0.9.0

type MIDIEvent struct {
	DeltaFrames int32 // Number of sample frames into the current processing block that this event occurs on.
	Flags       MIDIEventFlag
	NoteLength  int32   // In sample frames, 0 if not available.
	NoteOffset  int32   // In sample frames from note start, 0 if not available.
	Data        [3]byte // 1 to 3 MIDI bytes.

	Detune          uint8 // Between -64 to +63 cents, for scales other than 'well-tempered' e.g. 'microtuning'.
	NoteOffVelocity uint8 // Between 0 and 127.
	// contains filtered or unexported fields
}

MIDIEvent contains midi information.

type MIDIEventFlag added in v0.9.0

type MIDIEventFlag int32

MIDIEventFlag is set in midi event.

const (
	// MIDIEventRealtime means that this event is played and not coming
	// from sequencer.
	MIDIEventRealtime MIDIEventFlag = 1
)

type MIDIKey added in v0.9.0

type MIDIKey struct {
	Index     int32
	KeyNumber int32 // [0; 127]
	Name      ascii64
	// contains filtered or unexported fields
}

MIDIKey describes the MIDI key.

type MIDIProgram added in v0.9.0

type MIDIProgram struct {
	Index       int32
	Name        ascii64
	MIDIProgram int8 // -1:off [-1;-127]
	MIDIBankMsb int8 // -1:off [-1;-127]
	MIDIBankLsb int8 // -1:off [-1;-127]

	ParentIndex int32 // -1 means there is no parent category.
	Flags       MIDIProgramFlag
	// contains filtered or unexported fields
}

MIDIProgram describes the MIDI program.

type MIDIProgramCategory added in v0.9.0

type MIDIProgramCategory struct {
	Index       int32
	Name        ascii64 ///< name
	ParentIndex int32   // -1 means there is no parent category.
	// contains filtered or unexported fields
}

MIDIProgramCategory describes the MIDI program category.

type MIDIProgramFlag added in v0.9.0

type MIDIProgramFlag int32

MIDIProgramFlag values.

const MIDIProgramIsOmni MIDIProgramFlag = 1

MIDIProgramIsOmni program is in omni mode, channel 0 is used for inquiries and program changes.

type ModifierKeyFlag added in v0.9.0

type ModifierKeyFlag uint8

ModifierKeyFlag are flags used in KeyCode messages.

const (
	// ModifierKeyShift is Shift key.
	ModifierKeyShift ModifierKeyFlag = 1 << iota
	// ModifierKeyAlternate is Alt key.
	ModifierKeyAlternate
	// ModifierKeyCommand is Command key on Mac.
	ModifierKeyCommand
	// ModifierKeyControl is Control key.
	ModifierKeyControl
)

type PanningLaw added in v0.9.0

type PanningLaw float32

PanningLaw determines the algorithm panning happens.

const (
	// PanningLawLinear uses the following formula: L = pan * M; R = (1 -
	// pan) * M.
	PanningLawLinear PanningLaw = 0
	// PanningLawEqualPower uses the following formula: L = pow (pan, 0.5)
	// * M; R = pow ((1 - pan), 0.5) * M.
	PanningLawEqualPower
)

type Parameter added in v0.9.0

type Parameter struct {
	Name              string
	Unit              string
	Value             float32
	NotAutomated      bool
	GetValueLabelFunc func(value float32) string
	GetValueFunc      func(value float32) float32
}

Parameter refers to plugin parameter that can be mutated in the pipe.

func (Parameter) GetValue added in v0.10.0

func (e Parameter) GetValue() float32

GetValue should be called in ProcessDoubleFunc or ProcessFloatFunc and will be called in GetDisplayVal. It returns the plain Value or the return value of GetValueFunc, when it was set for the Parameter

func (Parameter) GetValueLabel added in v0.10.0

func (e Parameter) GetValueLabel() string

GetValueLabel will be called in HostOpcode plugGetParamDisplay. Return a string formatted float value or the return value of GetValueLabelFunc, when it was set for the Parameter

type ParameterFlag added in v0.9.0

type ParameterFlag int32

ParameterFlag is used to describe ParameterProperties struct.

const (
	// ParameterIsSwitch is set if parameter is a switch (on/off).
	ParameterIsSwitch ParameterFlag = 1 << iota
	// ParameterUsesIntegerMinMax is set if parameter has min/max int
	// values.
	ParameterUsesIntegerMinMax
	// ParameterUsesFloatStep is set if parameter uses float steps.
	ParameterUsesFloatStep
	// ParameterUsesIntStep is set if parameter uses int steps.
	ParameterUsesIntStep
	// ParameterSupportsDisplayIndex is set if parameter should be
	// displayed at certain position.
	ParameterSupportsDisplayIndex
	// ParameterSupportsDisplayCategory is set if parameter should be
	// displayed under specific category.
	ParameterSupportsDisplayCategory
	// ParameterCanRamp is set if parameter can ramp up/down.
	ParameterCanRamp
)

type ParameterProperties added in v0.9.0

type ParameterProperties struct {
	// valid if ParameterUsesIntegerMinMax is set
	StepFloat      float32
	SmallStepFloat float32
	LargeStepFloat float32

	Label ascii64
	Flags ParameterFlag

	// valid if ParameterUsesIntegerMinMax is set
	MinInteger int32
	MaxInteger int32

	// valid if ParameterUsesIntStep is set
	StepInteger      int32
	LargeStepInteger int32
	ShortLabel       ascii8

	// valid if ParameterSupportsDisplayIndex is set
	DisplayIndex int16 // Index where parameter should be displayed, starts with 0

	// valid if ParameterSupportsDisplayCategory is set
	Category             int16
	ParametersInCategory int16

	CategoryLabel ascii24
	// contains filtered or unexported fields
}

ParameterProperties contains the information about parameter.

type PatchChunk added in v0.9.0

type PatchChunk struct {
	PluginUniqueID int32
	PluginVersion  int32
	NumElements    int32 // Number of presets for bank or number of parameters for preset.
	// contains filtered or unexported fields
}

PatchChunk is used to communicate preset or bank properties with plugin before uploading it.

type PinProperties added in v0.9.0

type PinProperties struct {
	Label ascii64
	Flags PinPropertiesFlag
	SpeakerArrangementType
	ShortLabel ascii8 // Short name, recommended 6 chars + delimiter.
	// contains filtered or unexported fields
}

PinProperties provides info about about plugin connectivity.

type PinPropertiesFlag added in v0.9.0

type PinPropertiesFlag int32

PinPropertiesFlag values.

const (
	// PinIsActive is ignored by Host.
	PinIsActive PinPropertiesFlag = 1 << iota
	// PinIsStereo means that pin is first of a stereo pair.
	PinIsStereo
	// PinUseSpeaker means that arrangement type is valid and pin can be
	// used for arrangement setup.
	PinUseSpeaker
)

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin is an instance of loaded VST plugin.

func (*Plugin) CanProcessFloat32

func (p *Plugin) CanProcessFloat32() bool

CanProcessFloat32 checks if plugin can process float32.

func (*Plugin) CanProcessFloat64

func (p *Plugin) CanProcessFloat64() bool

CanProcessFloat64 checks if plugin can process float64.

func (*Plugin) Close

func (p *Plugin) Close()

Close stops the plugin and cleans up C refs for plugin.

func (*Plugin) CurrentProgramName added in v0.9.0

func (p *Plugin) CurrentProgramName() string

CurrentProgramName returns current program name.

func (*Plugin) Dispatch

func (p *Plugin) Dispatch(opcode PluginOpcode, index int32, value int64, ptr unsafe.Pointer, opt float32) uintptr

Dispatch wraps-up C method to dispatch calls to plugin

func (*Plugin) Flags added in v0.9.0

func (p *Plugin) Flags() PluginFlag

Flags returns the plugin flags.

func (*Plugin) GetBankData added in v0.9.0

func (p *Plugin) GetBankData() []byte

GetBankData returns current bank data. Plugin allocates required memory, then this function allocates new byte slice of required length where data is copied.

func (*Plugin) GetProgramData added in v0.9.0

func (p *Plugin) GetProgramData() []byte

GetProgramData returns current preset data. Plugin allocates required memory, then this function allocates new byte slice of required length where data is copied.

func (*Plugin) NumParams added in v0.9.0

func (p *Plugin) NumParams() int

NumParams returns the number of parameters.

func (*Plugin) NumPrograms added in v0.9.0

func (p *Plugin) NumPrograms() int

NumPrograms returns the number of programs.

func (*Plugin) ParamName added in v0.9.0

func (p *Plugin) ParamName(index int) string

ParamName returns the parameter label: "Release", "Gain", etc.

func (*Plugin) ParamProperties added in v0.9.0

func (p *Plugin) ParamProperties(index int) (*ParameterProperties, bool)

ParamProperties returns parameter properties for provided parameter index. If opcode is not supported, boolean result is false.

func (*Plugin) ParamUnitName added in v0.9.0

func (p *Plugin) ParamUnitName(index int) string

ParamUnitName returns the parameter unit label: "db", "ms", etc.

func (*Plugin) ParamValue added in v0.9.0

func (p *Plugin) ParamValue(index int) float32

ParamValue returns the value of parameter.

func (*Plugin) ParamValueName added in v0.9.0

func (p *Plugin) ParamValueName(index int) string

ParamValueName returns the parameter value label: "0.5", "HALL", etc.

func (*Plugin) ProcessDouble

func (p *Plugin) ProcessDouble(in, out DoubleBuffer)

ProcessDouble audio with VST plugin.

func (*Plugin) ProcessFloat

func (p *Plugin) ProcessFloat(in, out FloatBuffer)

ProcessFloat audio with VST plugin.

func (*Plugin) Program added in v0.9.0

func (p *Plugin) Program() int

Program returns current program number.

func (*Plugin) ProgramName added in v0.9.0

func (p *Plugin) ProgramName(index int) string

ProgramName returns program name for provided program index.

func (*Plugin) Resume added in v0.9.0

func (p *Plugin) Resume()

Resume the plugin processing. It must be called before processing is done.

func (*Plugin) SetBankData added in v0.9.0

func (p *Plugin) SetBankData(data []byte)

SetBankData sets preset data to the plugin. Data is the full preset including chunk header.

func (*Plugin) SetBufferSize

func (p *Plugin) SetBufferSize(bufferSize int)

SetBufferSize sets a buffer size per channel.

func (*Plugin) SetCurrentProgramName added in v0.9.0

func (p *Plugin) SetCurrentProgramName(s string)

SetCurrentProgramName sets new name to the current program. It will use up to 24 ASCII characters. Non-ASCII characters are ignored.

func (*Plugin) SetParamValue added in v0.9.0

func (p *Plugin) SetParamValue(index int, value float32)

SetParamValue sets new value for parameter.

func (*Plugin) SetProgram added in v0.9.0

func (p *Plugin) SetProgram(index int)

SetProgram changes current program index.

func (*Plugin) SetProgramData added in v0.9.0

func (p *Plugin) SetProgramData(data []byte)

SetProgramData sets preset data to the plugin. Data is the full preset including chunk header.

func (*Plugin) SetSampleRate

func (p *Plugin) SetSampleRate(sampleRate signal.Frequency)

SetSampleRate sets a sample rate for plugin.

func (*Plugin) SetSpeakerArrangement

func (p *Plugin) SetSpeakerArrangement(in, out *SpeakerArrangement)

SetSpeakerArrangement creates and passes SpeakerArrangement structures to plugin

func (*Plugin) Start

func (p *Plugin) Start()

Start executes the PlugOpen opcode.

func (*Plugin) Suspend added in v0.9.0

func (p *Plugin) Suspend()

Suspend the plugin processing. It must be called after processing is done and no new signal is expected at this moment.

type PluginCanDoString added in v0.9.0

type PluginCanDoString string

PluginCanDoString are constants that can be used to check plugin capabilities.

const (
	// PluginCanSendEvents plugin can send events.
	PluginCanSendEvents PluginCanDoString = "sendVstEvents"
	// PluginCanSendMIDIEvent plugin can send MIDI events.
	PluginCanSendMIDIEvent PluginCanDoString = "sendVstMidiEvent"
	// PluginCanReceiveEvents plugin can receive events.
	PluginCanReceiveEvents PluginCanDoString = "receiveVstEvents"
	// PluginCanReceiveMIDIEvent plugin can receive MIDI events.
	PluginCanReceiveMIDIEvent PluginCanDoString = "receiveVstMidiEvent"
	// PluginCanReceiveTimeInfo plugin can receive TimeInfo.
	PluginCanReceiveTimeInfo PluginCanDoString = "receiveVstTimeInfo"
	// PluginCanOffline plugin supports offline functions.
	PluginCanOffline PluginCanDoString = "offline"
	// PluginCanMIDIProgramNames plugin supports function
	// GetMIDIProgramName.
	PluginCanMIDIProgramNames PluginCanDoString = "midiProgramNames"
	// PluginCanBypass plugin supports function SetBypass.
	PluginCanBypass PluginCanDoString = "bypass"
)

type PluginCategory added in v0.9.0

type PluginCategory int64

PluginCategory denotes the category of plugin.

const (
	// PluginCategoryUnknown means category not implemented.
	PluginCategoryUnknown PluginCategory = iota
	// PluginCategoryEffect simple Effect.
	PluginCategoryEffect
	// PluginCategorySynth VST Instrument: synth, sampler, etc.
	PluginCategorySynth
	// PluginCategoryAnalysis scope, tuner.
	PluginCategoryAnalysis
	// PluginCategoryMastering dynamics control.
	PluginCategoryMastering
	// PluginCategorySpacializer panner.
	PluginCategorySpacializer
	// PluginCategoryRoomFx delay and reverb.
	PluginCategoryRoomFx
	// PluginCategorySurroundFx dedicated surround.
	PluginCategorySurroundFx
	// PluginCategoryRestoration denoiser.
	PluginCategoryRestoration
	// PluginCategoryOfflineProcess offline processor.
	PluginCategoryOfflineProcess
	// PluginCategoryShell plugin is a shell for other plugins.
	PluginCategoryShell
	// PluginCategoryGenerator tone generator.
	PluginCategoryGenerator
)

type PluginFlag added in v0.9.0

type PluginFlag int32

PluginFlag values.

const (
	// PluginHasEditor is set if the plugin provides a custom editor.
	PluginHasEditor PluginFlag = 1 << iota

	// PluginFloatProcessing is set if plugin supports replacing process
	// mode.
	PluginFloatProcessing
	// PluginProgramChunks is set if preset data is handled in formatless
	// chunks.
	PluginProgramChunks

	// PluginIsSynth is set if plugin is a synth.
	PluginIsSynth
	// PluginNoSoundInStop is set if plugin does not produce sound when
	// input is silence.
	PluginNoSoundInStop

	// PluginDoubleProcessing is set if plugin supports double precision
	// processing.
	PluginDoubleProcessing
)

type PluginOpcode added in v0.9.0

type PluginOpcode uint32

PluginOpcode is sent by host in dispatch call to plugin. It reflects APluginOpcodes and APluginXOpcodes opcodes values.

const (

	// PlugEditGetRect passed to get editor size.
	// Ptr: ERect** receiving pointer to editor size.
	PlugEditGetRect PluginOpcode
	// PlugEditOpen passed to get system dependent window pointer, eg HWND on Windows.
	// Ptr: window pointer.
	PlugEditOpen
	// PlugEditClose passed to close editor window.
	PlugEditClose

	// PlugEditIdle passed to notify plugin that host goes idle.
	PlugEditIdle

	// PlugProcessEvents passed to communicate events.
	// Ptr: *Events.
	PlugProcessEvents
	// PlugCanBeAutomated passed to check if parameter could be automated.
	// Index: parameter index.
	// Return: 1 for true, 0 for false.
	PlugCanBeAutomated
	// PlugString2Parameter passed to convert parameter value to string: "mono" to "1".
	// Index: parameter index.
	// Ptr: parameter string.
	// Return: true for success.
	PlugString2Parameter

	// PlugGetInputProperties passed to check if certain input configuration is supported.
	// Index: input index.
	// Ptr: *PinProperties.
	// Return: 1 if supported.
	PlugGetInputProperties
	// PlugGetOutputProperties passed to check if certain output configuration is supported.
	// Index: output index.
	// Ptr: *PinProperties.
	// Return: 1 if supported.
	PlugGetOutputProperties
	// PlugGetPlugCategory passed to get plugin's category.
	// Return: VstPlugCategory value.
	PlugGetPlugCategory

	// PlugOfflineNotify passed to notify about offline file processing.
	// Ptr: []AudioFile.
	// Value: count.
	// Index: start flag.
	PlugOfflineNotify
	// PlugOfflinePrepare passed to trigger offline processing preparation.
	// Ptr: []OfflineTask.
	// Value: count.
	PlugOfflinePrepare
	// PlugOfflineRun passed to trigger offline processing execution.
	// Ptr: []OfflineTask.
	// Value: count.
	PlugOfflineRun

	// PlugProcessVarIo passed to provide variable I/O processing (offline p.g. timestretching).
	// Ptr: *VariableIo.
	PlugProcessVarIo

	// PlugSetBypass passed to make plugin bypassed.
	// Value: 1 is bypass, 0 is no bypass.
	PlugSetBypass
	// PlugGetPluginName passed to get a name of the plugin.
	// Ptr: *[maxPluginNameLen]byte buffer for plugin name.
	PlugGetPluginName

	// PlugGetVendorString passed to get vendor string.
	// *[maxVendorStrLen]byte buffer for plugin vendor string.
	PlugGetVendorString
	// PlugGetProductString passed to get product string.
	// *[maxProductStrLen]byte buffer for plugin product string.
	PlugGetProductString
	// PlugGetVendorVersion passed to get vendor-specific version.
	// Return: vendor-specific version.
	PlugGetVendorVersion
	// PlugVendorSpecific passed to get vendor-specific string.
	// No definition, vendor specific handling.
	PlugVendorSpecific
	// PlugCanDo passed to check capabilities of plugin.
	// Ptr: "can do" string
	// Return: 0 is don't know, -1 is no, 1 is yes.
	PlugCanDo

	// PlugGetTailSize passed to check if "tail" data is expected.
	// Return: tail size (p.g. reverb time). 0 is default, 1 means no tail.
	PlugGetTailSize

	// PlugGetVstVersion passed to get VST version of plugin.
	// Return: VST version, 2400 for VST 2.4.
	PlugGetVstVersion

	// PlugEditKeyDown passed when key is pressed.
	// Index: ASCII character.
	// Value: virtual key.
	// Opt: ModifierKey flags.
	// Return: 1 if key used.
	PlugEditKeyDown
	// PlugEditKeyUp passed when key is released.
	// Index: ASCII character.
	// Value: virtual key.
	// Opt: ModifierKey flags.
	// Return: 1 if key used.
	PlugEditKeyUp
	// PlugSetEditKnobMode passed to set knob Mode.
	// Value: knob mode 0 is circular, 1 is circular relative, 2 is linear.
	PlugSetEditKnobMode

	// PlugGetMidiProgramName passed to get a name of used MIDI program.
	// Index: MIDI channel.
	// Ptr: *MidiProgramName.
	// Return: number of used programs, 0 if unsupported.
	PlugGetMidiProgramName
	// PlugGetCurrentMidiProgram passed to get a name of current MIDI program.
	// Index: MIDI channel.
	// Ptr: *MidiProgramName.
	// Return: index of current program .
	PlugGetCurrentMidiProgram
	// PlugGetMidiProgramCategory passed to get a category of MIDI program.
	// Index: MIDI channel.
	// Ptr: *MidiProgramCategory.
	// Return: number of used categories, 0 if unsupported.
	PlugGetMidiProgramCategory
	// PlugHasMidiProgramsChanged passed to check if MIDI program has changed.
	// Index: MIDI channel.
	// Return: 1 if the MidiProgramNames or MidiKeyNames have changed.
	PlugHasMidiProgramsChanged
	// PlugGetMidiKeyName passed to
	// Index: MIDI channel.
	// Ptr: *MidiKeyName.
	// Return: true if supported, false otherwise.
	PlugGetMidiKeyName

	// PlugBeginSetProgram passed before preset is loaded.
	PlugBeginSetProgram
	// PlugEndSetProgram passed after preset is loaded.
	PlugEndSetProgram

	// PlugGetSpeakerArrangement passed to get a speaker configuration of plugin.
	// Value: input *SpeakerArrangement.
	// Ptr: output *SpeakerArrangement.
	PlugGetSpeakerArrangement
	// PlugShellGetNextPlugin passed to get unique id of next plugin.
	// Ptr: *[maxProductStrLen]byte buffer for plug-in name.
	// Return: next plugin's unique ID.
	PlugShellGetNextPlugin

	// PlugStartProcess passed to indicate that the process call might be interrupted.
	PlugStartProcess
	// PlugStopProcess passed to indicate that process call is stopped.
	PlugStopProcess
	// PlugSetTotalSampleToProcess passed to identify a number of samples to process.
	// Value: number of samples to process. Called in offline mode before processing.
	PlugSetTotalSampleToProcess
	// PlugSetPanLaw passed to set pan law type and gain values.
	// Value: PanLawType value.
	// Opt: gain value.
	PlugSetPanLaw

	// PlugBeginLoadBank is passed when VST bank loaded.
	// Ptr: *PatchChunkInfo.
	// Return: -1 is bank can't be loaded, 1 is bank can be loaded, 0 is unsupported.
	PlugBeginLoadBank
	// PlugBeginLoadProgram is passed when VST preset loaded.
	// Ptr: *PatchChunkInfo.
	// Return: -1 is bank can't be loaded, 1 is bank can be loaded, 0 is unsupported.
	PlugBeginLoadProgram

	// PlugSetProcessPrecision passed to set processing precision.
	// Value: 0 if 32 bit, anything else if 64 bit.
	PlugSetProcessPrecision

	// PlugGetNumMidiInputChannels passed to get a number of used MIDI inputs.
	// Return: number of used MIDI input channels (1-15).
	PlugGetNumMidiInputChannels
	// PlugGetNumMidiOutputChannels passed to get a number of used MIDI outputs.
	// Return: number of used MIDI output channels (1-15).
	PlugGetNumMidiOutputChannels
)

func (PluginOpcode) String added in v0.9.0

func (i PluginOpcode) String() string

type Preset added in v0.9.0

type Preset struct {
	// contains filtered or unexported fields
}

Preset refers to plugin presets.

type ProcessLevel added in v0.9.0

type ProcessLevel uintptr

ProcessLevel is used as result for in HostGetCurrentProcessLevel call. It tells the plugin in which thread host is right now.

const (
	// ProcessLevelUnknown is returned when not supported by host.
	ProcessLevelUnknown ProcessLevel = iota
	// ProcessLevelUser is returned when in user thread (GUI).
	ProcessLevelUser
	// ProcessLevelRealtime is returned when in audio thread (where process
	// is called).
	ProcessLevelRealtime
	// ProcessLevelPrefetch is returned when in sequencer thread (MIDI,
	// timer etc).
	ProcessLevelPrefetch
	// ProcessLevelOffline is returned when in offline processing and thus
	// in user thread.
	ProcessLevelOffline
)

type ProcessPrecision added in v0.9.0

type ProcessPrecision int64

ProcessPrecision allows to set processing precision of plugin.

const (
	// ProcessFloat is 32 bits processing.
	ProcessFloat ProcessPrecision = iota
	// ProcessDouble is 64 bits processing.
	ProcessDouble
)

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

Processor is pipe component that wraps.

func (*Processor) Allocator added in v0.9.0

Allocator returns pipe processor allocator that can be plugged into line.

type ProcessorInitFunc

type ProcessorInitFunc func(*Plugin)

ProcessorInitFunc applies configuration on plugin before starting it in the processor routine.

type ProgressProcessedFunc added in v0.9.0

type ProgressProcessedFunc func(int)

HostProgressProcessed is executed by processor after every process call.

type SMPTEFrameRate

type SMPTEFrameRate int32

SMPTEFrameRate values, used in TimeInfo.

const (
	// SMPTE24fps is 24 fps.
	SMPTE24fps SMPTEFrameRate = iota
	// SMPTE25fps is 25 fps.
	SMPTE25fps
	// SMPTE2997fps is 29.97 fps.
	SMPTE2997fps
	// SMPTE30fps is 30 fps.
	SMPTE30fps
	// SMPTE2997dfps is 29.97 drop.
	SMPTE2997dfps
	// SMPTE30dfps is 30 drop.
	SMPTE30dfps
	// SMPTEFilm16mm is Film 16mm.
	SMPTEFilm16mm
	// SMPTEFilm35mm is Film 35mm.
	SMPTEFilm35mm

	// SMPTE239fps is HDTV 23.976 fps.
	SMPTE239fps
	// SMPTE249fps is HDTV 24.976 fps.
	SMPTE249fps
	// SMPTE599fps is HDTV 59.94 fps.
	SMPTE599fps
	// SMPTE60fps is HDTV 60 fps.
	SMPTE60fps
)

type Speaker

type Speaker struct {
	Azimuth   float32
	Elevation float32
	Radius    float32
	Reserved  float32
	Name      ascii64
	Type      SpeakerType
	Future    [28]byte
}

Speaker configuration.

type SpeakerArrangement

type SpeakerArrangement struct {
	Type        SpeakerArrangementType
	NumChannels int32
	Speakers    [8]Speaker
}

SpeakerArrangement contains information about a channel.

type SpeakerArrangementType

type SpeakerArrangementType int32

SpeakerArrangementType indicates how the channels are intended to be used in the plugin. Only useful for some hosts.

const (
	// SpeakerArrUserDefined is user defined.
	SpeakerArrUserDefined SpeakerArrangementType = iota - 2
	// SpeakerArrEmpty is empty arrangement.
	SpeakerArrEmpty
	// SpeakerArrMono is M.
	SpeakerArrMono
	// SpeakerArrStereo is L R.
	SpeakerArrStereo
	// SpeakerArrStereoSurround is Ls Rs.
	SpeakerArrStereoSurround
	// SpeakerArrStereoCenter is Lc Rc.
	SpeakerArrStereoCenter
	// SpeakerArrStereoSide is Sl Sr.
	SpeakerArrStereoSide
	// SpeakerArrStereoCLfe is C Lfe.
	SpeakerArrStereoCLfe
	// SpeakerArr30Cine is L R C.
	SpeakerArr30Cine
	// SpeakerArr30Music is L R S.
	SpeakerArr30Music
	// SpeakerArr31Cine is L R C Lfe.
	SpeakerArr31Cine
	// SpeakerArr31Music is L R Lfe S.
	SpeakerArr31Music
	// SpeakerArr40Cine is L R C S (LCRS).
	SpeakerArr40Cine
	// SpeakerArr40Music is L R Ls Rs (Quadro).
	SpeakerArr40Music
	// SpeakerArr41Cine is L R C Lfe S (LCRS+Lfe).
	SpeakerArr41Cine
	// SpeakerArr41Music is L R Lfe Ls Rs (Quadro+Lfe).
	SpeakerArr41Music
	// SpeakerArr50 is L R C Ls Rs.
	SpeakerArr50
	// SpeakerArr51 is L R C Lfe Ls Rs.
	SpeakerArr51
	// SpeakerArr60Cine is L R C Ls Rs Cs.
	SpeakerArr60Cine
	// SpeakerArr60Music is L R Ls Rs Sl Sr.
	SpeakerArr60Music
	// SpeakerArr61Cine is L R C Lfe Ls Rs Cs.
	SpeakerArr61Cine
	// SpeakerArr61Music is L R Lfe Ls Rs Sl Sr.
	SpeakerArr61Music
	// SpeakerArr70Cine is L R C Ls Rs Lc Rc.
	SpeakerArr70Cine
	// SpeakerArr70Music is L R C Ls Rs Sl Sr.
	SpeakerArr70Music
	// SpeakerArr71Cine is L R C Lfe Ls Rs Lc Rc.
	SpeakerArr71Cine
	// SpeakerArr71Music is L R C Lfe Ls Rs Sl Sr.
	SpeakerArr71Music
	// SpeakerArr80Cine is L R C Ls Rs Lc Rc Cs.
	SpeakerArr80Cine
	// SpeakerArr80Music is L R C Ls Rs Cs Sl Sr.
	SpeakerArr80Music
	// SpeakerArr81Cine is L R C Lfe Ls Rs Lc Rc Cs.
	SpeakerArr81Cine
	// SpeakerArr81Music is L R C Lfe Ls Rs Cs Sl Sr.
	SpeakerArr81Music
	// SpeakerArr102 is L R C Lfe Ls Rs Tfl Tfc Tfr Trl Trr Lfe2.
	SpeakerArr102
)

type SpeakerType

type SpeakerType int32

SpeakerType of particular speaker.

type SysExDataPtr added in v0.9.0

type SysExDataPtr struct {
	// contains filtered or unexported fields
}

SysExDataPtr holds sysex dump data.

func SysExData added in v0.9.0

func SysExData(b []byte) SysExDataPtr

SysExData allocates new SysExDumpPtr with provided bytes. It must be freed after use.

func (SysExDataPtr) Bytes added in v0.9.0

func (s SysExDataPtr) Bytes() []byte

Bytes returns bytes representation of sysex data.

func (SysExDataPtr) Free added in v0.9.0

func (s SysExDataPtr) Free()

Free releases allocated memory.

type SysExMIDIEvent added in v0.9.0

type SysExMIDIEvent struct {
	DeltaFrames int32 // Number of sample frames into the current processing block that this event occurs on.

	SysExDump SysExDataPtr
	// contains filtered or unexported fields
}

SysExMIDIEvent is system exclusive MIDI event.

type TimeInfo

type TimeInfo struct {
	// Current Position in audio samples.
	SamplePos float64
	// Current Sample Rate in Herz.
	SampleRate float64
	// System Time in nanoseconds.
	NanoSeconds float64
	// Musical Position, in Quarter Note (1.0 equals 1 Quarter Note).
	PpqPos float64
	// Current Tempo in BPM (Beats Per Minute).
	Tempo float64
	// Last Bar Start Position, in Quarter Note.
	BarStartPos float64
	// Cycle Start (left locator), in Quarter Note.
	CycleStartPos float64
	// Cycle End (right locator), in Quarter Note.
	CycleEndPos float64
	// Time Signature Numerator (e.g. 3 for 3/4).
	TimeSigNumerator int32
	// Time Signature Denominator (e.g. 4 for 3/4).
	TimeSigDenominator int32
	// SMPTE offset in SMPTE subframes (bits; 1/80 of a frame). The
	// current SMPTE position can be calculated using SamplePos,
	// SampleRate, and SMPTEFrameRate.
	SMPTEOffset int32
	// SMPTEFrameRate value.
	SMPTEFrameRate
	// MIDI Clock Resolution (24 Per Quarter Note), can be negative
	// (nearest clock).
	SamplesToNextClock int32
	// TimeInfoFlags values.
	Flags TimeInfoFlag
}

TimeInfo describes the time at the start of the block currently being processed.

type TimeInfoFlag added in v0.9.0

type TimeInfoFlag int32

TimeInfoFlag used in TimeInfo.

const (
	// TransportChanged is set if play, cycle or record state has changed.
	TransportChanged TimeInfoFlag = 1 << iota
	// TransportPlaying is set if Host sequencer is currently playing
	TransportPlaying
	// TransportCycleActive is set if Host sequencer is in cycle mode.
	TransportCycleActive
	// TransportRecording is set if Host sequencer is in record mode.
	TransportRecording

	// AutomationWriting is set if automation write mode active.
	AutomationWriting
	// AutomationReading is set if automation read mode active.
	AutomationReading
	// NanosValid is set if TimeInfo.NanoSeconds are valid.
	NanosValid
	// PpqPosValid is set if TimeInfo.PpqPos is valid.
	PpqPosValid
	// TempoValid is set if TimeInfo.Tempo is valid.
	TempoValid
	// BarsValid is set if TimeInfo.BarStartPos is valid.
	BarsValid
	// CyclePosValid is set if both TimeInfo.CycleStartPos and
	// TimeInfo.CycleEndPos are valid.
	CyclePosValid
	// TimeSigValid is set if both TimeInfo.TimeSigNumerator and
	// TimeInfo.TimeSigDenominator are valid.
	TimeSigValid
	// SMPTEValid is set if both TimeInfo.SMPTEOffset and
	// TimeInfo.SMPTEFrameRate are valid.
	SMPTEValid
	// ClockValid is set if TimeInfo.SamplesToNextClock are valid.
	ClockValid
)

type VST

type VST struct {
	Name string
	// contains filtered or unexported fields
}

VST is a reference to VST main function. It also keeps reference to VST handle to clean up on Closp.

func Open

func Open(path string) (*VST, error)

Open loads the plugin entry point into memory. It's SO in linux.

func (*VST) Close

func (m *VST) Close() error

Close frees plugin handle.

func (*VST) Plugin added in v0.9.0

func (v *VST) Plugin(c HostCallbackFunc) *Plugin

Plugin new instance of VST plugin with provided callback. This function also calls dispatch with EffOpen opcodp.

func (*VST) Processor added in v0.9.0

func (v *VST) Processor(h Host, progressFn ProgressProcessedFunc) *Processor

Processor represents vst2 sound processor. Processor always overrides GetBufferSize and GetSampleRate callbacks, because this vaules are injected when processor is allocated by pipe.

type VirtualKey added in v0.9.0

type VirtualKey uint8

VirtualKey is platform-independent definition of Virtual Keys used in KeyCode messages.

const (
	// VirtualKeyBack is Backspace key.
	VirtualKeyBack VirtualKey = iota + 1
	// VirtualKeyTab is Tab key.
	VirtualKeyTab
	// VirtualKeyClear is Clear key.
	VirtualKeyClear
	// VirtualKeyReturn is Return key.
	VirtualKeyReturn
	// VirtualKeyPause is Pause key.
	VirtualKeyPause
	// VirtualKeyEscape is Escape key.
	VirtualKeyEscape
	// VirtualKeySpace is Space key.
	VirtualKeySpace
	// VirtualKeyNext is Next key.
	VirtualKeyNext
	// VirtualKeyEnd is End key.
	VirtualKeyEnd
	// VirtualKeyHome is Home key.
	VirtualKeyHome
	// VirtualKeyLeft is Left key.
	VirtualKeyLeft
	// VirtualKeyUp is Up key.
	VirtualKeyUp
	// VirtualKeyRight is Right key.
	VirtualKeyRight
	// VirtualKeyDown is Down key.
	VirtualKeyDown
	// VirtualKeyPageUp is PageUp key.
	VirtualKeyPageUp
	// VirtualKeyPageDown is PageDown key.
	VirtualKeyPageDown
	// VirtualKeySelect is Select key.
	VirtualKeySelect
	// VirtualKeyPrint is Print key.
	VirtualKeyPrint
	// VirtualKeyEnter is Enter key.
	VirtualKeyEnter
	// VirtualKeySnapshot is Snapshot key.
	VirtualKeySnapshot
	// VirtualKeyInsert is Insert key.
	VirtualKeyInsert
	// VirtualKeyDelete is Delete key.
	VirtualKeyDelete
	// VirtualKeyHelp is Help key.
	VirtualKeyHelp
	// VirtualKeyNumpad0 is Numpad0 key.
	VirtualKeyNumpad0
	// VirtualKeyNumpad1 is Numpad1 key.
	VirtualKeyNumpad1
	// VirtualKeyNumpad2 is Numpad2 key.
	VirtualKeyNumpad2
	// VirtualKeyNumpad3 is Numpad3 key.
	VirtualKeyNumpad3
	// VirtualKeyNumpad4 is Numpad4 key.
	VirtualKeyNumpad4
	// VirtualKeyNumpad5 is Numpad5 key.
	VirtualKeyNumpad5
	// VirtualKeyNumpad6 is Numpad6 key.
	VirtualKeyNumpad6
	// VirtualKeyNumpad7 is Numpad7 key.
	VirtualKeyNumpad7
	// VirtualKeyNumpad8 is Numpad8 key.
	VirtualKeyNumpad8
	// VirtualKeyNumpad9 is Numpad9 key.
	VirtualKeyNumpad9
	// VirtualKeyMultiply is Multiply key.
	VirtualKeyMultiply
	// VirtualKeyAdd is Add key.
	VirtualKeyAdd
	// VirtualKeySeparator is Separator key.
	VirtualKeySeparator
	// VirtualKeySubtract is Subtract key.
	VirtualKeySubtract
	// VirtualKeyDecimal is Decimal key.
	VirtualKeyDecimal
	// VirtualKeyDivide is Divide key.
	VirtualKeyDivide
	// VirtualKeyF1 is F1 key.
	VirtualKeyF1
	// VirtualKeyF2 is F2 key.
	VirtualKeyF2
	// VirtualKeyF3 is F3 key.
	VirtualKeyF3
	// VirtualKeyF4 is F4 key.
	VirtualKeyF4
	// VirtualKeyF5 is F5 key.
	VirtualKeyF5
	// VirtualKeyF6 is F6 key.
	VirtualKeyF6
	// VirtualKeyF7 is F7 key.
	VirtualKeyF7
	// VirtualKeyF8 is F8 key.
	VirtualKeyF8
	// VirtualKeyF9 is F9 key.
	VirtualKeyF9
	// VirtualKeyF10 is F10 key.
	VirtualKeyF10
	// VirtualKeyF11 is F11 key.
	VirtualKeyF11
	// VirtualKeyF12 is F12 key.
	VirtualKeyF12
	// VirtualKeyNumlock is Numlock key.
	VirtualKeyNumlock
	// VirtualKeyScroll is Scroll key.
	VirtualKeyScroll
	// VirtualKeyShift is Shift key.
	VirtualKeyShift
	// VirtualKeyControl is Control key.
	VirtualKeyControl
	// VirtualKeyAlt is Alt key.
	VirtualKeyAlt
	// VirtualKeyEquals is Equals key.
	VirtualKeyEquals
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL