engine

package module
v0.0.0-...-695f01a Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 34 Imported by: 1

Documentation

Index

Constants

View Source
const BidulePort = 3210
View Source
const EventCursor = 0x04
View Source
const EventMidiInput = 0x01

Bits for Events

View Source
const EventNoteOutput = 0x02
View Source
const PatchNameSeparator = "-"

In a quad file, the parameter names are of the form: {patchName}-{parametername}.

Variables

View Source
var BiduleExe = "bidule.exe"
View Source
var BugFixWarningCount = 0
View Source
var DataDir = "data_omnisphere" // default, override with environment variable
View Source
var EighthNote = Clicks(12)
View Source
var EngineExe = "palette_engine.exe"
View Source
var EngineHttpPort = 3330
View Source
var EventClientPort = 6666
View Source
var FirstTime = true
View Source
var FullDataPath string
View Source
var GuiExe = "palette_gui.exe"
View Source
var GuiPort = 3943
View Source
var HalfNote = Clicks(48)
View Source
var KeykitExe = "key.exe"
View Source
var LocalAddress = "127.0.0.1"
View Source
var LogEnabled = map[string]bool{
	"*":              false,
	"advance":        false,
	"api":            false,
	"attract":        false,
	"bidule":         false,
	"config":         false,
	"cursor":         false,
	"drawing":        false,
	"erae":           false,
	"exec":           false,
	"ffgl":           false,
	"freeframe":      false,
	"gensound":       false,
	"genvisual":      false,
	"gesture":        false,
	"go":             false,
	"goroutine":      false,
	"info":           false,
	"patch":          false,
	"process":        false,
	"keykit":         false,
	"layerapi":       false,
	"listeners":      false,
	"load":           false,
	"loop":           false,
	"midi":           false,
	"midicontroller": false,
	"midiports":      false,
	"mmtt":           false,
	"morph":          false,
	"mouse":          false,
	"nats":           false,
	"note":           false,
	"notify":         false,
	"osc":            false,
	"params":         false,
	"phrase":         false,
	"plugin":         false,
	"quant":          false,
	"saved":          false,
	"realtime":       false,
	"resolume":       false,
	"remote":         false,
	"router":         false,
	"scale":          false,
	"scheduler":      false,
	"task":           false,
	"transpose":      false,
	"value":          false,
}
View Source
var LogMutex sync.Mutex
View Source
var MaxClicks = Clicks(math.MaxInt64)

MaxClicks is the high-possible value for Clicks

View Source
var MmttExe = "mmtt_kinect.exe"
View Source
var MmttHttpPort = 4444
View Source
var MonitorExe = "palette_monitor.exe"
View Source
var MorphDefs map[string]string

MorphDefs xxx

View Source
var NoWriterInstance io.Writer
View Source
var OneBeatMutex sync.RWMutex
View Source
var OscPort = 3333
View Source
var PaletteExe = "palette.exe"
View Source
var ParamDefs map[string]ParamDef

ParamDefs is the set of all parameter definitions

View Source
var ParamEnums map[string][]string

ParamEnums contains the lists of enumerated values for string parameters

View Source
var Patchs = map[string]*Patch{}
View Source
var PitchSets = map[string][]uint8{
	"stylusrmx": {36, 37, 38, 39, 42, 43, 51, 49},
}
View Source
var PointZero image.Point = image.Point{0, 0}
View Source
var PortChannels map[PortChannel]*MIDIPortChannelState
View Source
var QuarterNote = Clicks(24)
View Source
var ResolumeExe = "avenue.exe"
View Source
var ResolumeJSON map[string]any

ResolumeJSON is an unmarshalled version of the resolume.json file

View Source
var ResolumePort = 7000
View Source
var SixteenthNote = Clicks(6)
View Source
var Synths map[string]*Synth
View Source
var TempoFactor = float64(1.0)

TempoFactor xxx

View Source
var TheRand *rand.Rand
View Source
var ThirtySecondNote = Clicks(3)
View Source
var Time0 = time.Time{}
View Source
var WholeNote = Clicks(96)

Functions

func ArchiveLogs

func ArchiveLogs() error

func ArgToFloat

func ArgToFloat(nm string, args map[string]string) float32

func ArgToInt

func ArgToInt(nm string, args map[string]string) int

func BoundAndScaleController

func BoundAndScaleController(v, vmin, vmax float32, cmin, cmax int) int

func BoundAndScaleFloat

func BoundAndScaleFloat(v, vmin, vmax, outmin, outmax float32) float32

func ChangeClicksPerSecond

func ChangeClicksPerSecond(factor float64)

ChangeClicksPerSecond is what you use to change the tempo

func CheckAutorestartProcesses

func CheckAutorestartProcesses()

func ClearExternalScale

func ClearExternalScale()

func Clicks2Seconds

func Clicks2Seconds(clk Clicks) float64

Clicks2Seconds converts Clicks to Time (seconds), relative

func ConfigDir

func ConfigDir() string

func ConfigFilePath

func ConfigFilePath(nm string) string

func CopyDir

func CopyDir(src, dest string) error

CopyDir xxx

func CurrentMilli

func CurrentMilli() int64

func CurrentMilliOffset

func CurrentMilliOffset() int64

func CursorToOscMsg

func CursorToOscMsg(ce CursorEvent) *osc.Message

func EngineApi

func EngineApi(api string, apiargs ...string) (map[string]string, error)

func EngineRemoteApi

func EngineRemoteApi(api string, args ...string) (map[string]string, error)

func EraeBitize7chksum

func EraeBitize7chksum(in []byte) (out []byte, chksum byte)

7-bitize an array of bytes and get the resulting checksum Algorithm taken from Erae documentation. Return value is the output bytes and checksum

func EraeUnbitize7chksum

func EraeUnbitize7chksum(in []byte) ([]byte, byte)

7-unbitize an array of bytes and get the incomming checksum Algorithm taken from Erae documentation. Return value is the output bytes and checksum

func ErrorResponse

func ErrorResponse(err error) string

ErrorResponse return an error response

func ErrorResult

func ErrorResult(err string) string

ErrorResult xxx

func ExtractAndRemoveValueOf

func ExtractAndRemoveValueOf(valName string, argsmap map[string]string) string

ExtractAndRemoveValueOf removes a named value from a map and returns it. If the value doesn't exist, "" is returned.

func FileExists

func FileExists(filepath string) bool

func Float32bytes

func Float32bytes(float float32) []byte

func Float32frombytes

func Float32frombytes(bytes []byte) float32

func GetArgsXYZ

func GetArgsXYZ(args map[string]string) (x, y, z float32, err error)

func GetNameValue

func GetNameValue(apiargs map[string]string) (name string, value string, err error)

func GetPaletteVersion

func GetPaletteVersion() string

func GetParam

func GetParam(name string) (string, error)

func GetParamBool

func GetParamBool(nm string) (bool, error)

func GetParamFloat

func GetParamFloat(nm string) (float64, error)

func GetParamInt

func GetParamInt(nm string) (int, error)

func GoroutineID

func GoroutineID() uint64

func Hostname

func Hostname() string

func HumanReadableApiOutput

func HumanReadableApiOutput(apiOutput map[string]string) string

humanReadableApiOutput takes the result of an API invocation and produces what will appear in visible output from a CLI command.

func InitEngine

func InitEngine()

func InitLog

func InitLog(logname string)

InitLog creates a logger to a log file, or stdout if logname is "".

func InitLogTypes

func InitLogTypes()

func InitMisc

func InitMisc()

func InitParams

func InitParams()

func InitSynths

func InitSynths()

func InitializeClicksPerSecond

func InitializeClicksPerSecond(clkpersec Clicks)

InitializeClicksPerSecond initializes

func IsLogging

func IsLogging(logtype string) bool

func IsPatchCategory

func IsPatchCategory(category string) bool

func IsPerPatchParam

func IsPerPatchParam(name string) bool

func IsRunning

func IsRunning(process string) bool

func IsTrueValue

func IsTrueValue(value string) bool

IsTrueValue returns true if the value is some version of true, and false otherwise.

func JsonObject

func JsonObject(args ...string) string

func JsonString

func JsonString(args ...string) string

func KillAllExceptMonitor

func KillAllExceptMonitor()

func KillProcess

func KillProcess(exe string)

KillProcess kills a process (synchronously)

func LoadImage

func LoadImage(path string) (*image.NRGBA, error)

LoadImage reads an image file

func LoadMorphs

func LoadMorphs() error

LoadMorphs initializes the list of morphs

func LoadParamDefs

func LoadParamDefs() error

LoadParamDefs initializes the list of parameters

func LoadParamEnums

func LoadParamEnums() error

LoadParamEnums initializes the list of enumerated parameter values

func LocalPaletteDir

func LocalPaletteDir() string

LocalPaletteDir gets used for local (and changed) things in saved and config

func LogError

func LogError(err error, keysAndValues ...any)

LogIfError will accept a nil value and do nothing

func LogFilePath

func LogFilePath(nm string) string

LogFilePath uses $PALETTE_LOGDIR if set

func LogIfError

func LogIfError(err error, keysAndValues ...any)

func LogInfo

func LogInfo(msg string, keysAndValues ...any)

func LogOfType

func LogOfType(logtypes string, msg string, keysAndValues ...any)

func LogWarn

func LogWarn(msg string, keysAndValues ...any)

func MIDIFilePath

func MIDIFilePath(nm string) string

MIDIFilePath xxx

func MapString

func MapString(amap map[string]string) string

func MidiToOscMsg

func MidiToOscMsg(me MidiEvent) *osc.Message

func MmttApi

func MmttApi(api string) (map[string]string, error)

func MmttRemoteApi

func MmttRemoteApi(api string) (map[string]string, error)

func MonitorIsRunning

func MonitorIsRunning() bool

func NewClickMsg

func NewClickMsg(click Clicks) string

NewClickMsg xxx

func NewExecutableLogWriter

func NewExecutableLogWriter(exe string) io.Writer

func NewSetParamMsg

func NewSetParamMsg(name string, value string) string

func OkResult

func OkResult() string

ErrorResult xxx

func PaletteDataPath

func PaletteDataPath() string

func PaletteDir

func PaletteDir() string

PaletteDir is the value of environment variable PALETTE

func ParseBool

func ParseBool(s string, name string) (bool, error)

ParseBool xxx

func ParseFloat32

func ParseFloat32(s string, name string) (float32, error)

ParseFloat32 xxx

func ParseInt

func ParseInt(s string, name string) (int, error)

ParseInt xxx

func PatchNames

func PatchNames() []string

func ProcessList

func ProcessList() []string

func ReadConfigFile

func ReadConfigFile(path string) (map[string]string, error)

ReadConfigFile xxx

func ReadableSavedFilePath

func ReadableSavedFilePath(category string, filename string, suffix string) (string, error)

ReadableSavedFilePath returns the full path of a saved file. The value of filename isn't trusted, verify its sanity.

func RemoteApiRaw

func RemoteApiRaw(url string, args string) (map[string]string, error)

func ResultResponse

func ResultResponse(resultObj any) string

ResultResponse returns a JSON 2.0 result response

func SavedDir

func SavedDir() string

func SavedFileList

func SavedFileList(category string) ([]string, error)

SavedArray returns a list of saved filenames for a particular category.

func SavedList

func SavedList(apiargs map[string]string) (string, error)

func SavedMap

func SavedMap(wantCategory string) (map[string]string, error)

SavedMap returns a map of saved names to file paths The saved names are of the form "category.name". If wantCategory is "*", all categories are returned

func SavedNameSplit

func SavedNameSplit(saved string) (string, string)

func ScheduleAt

func ScheduleAt(atClick Clicks, tag string, value any)

func SendMail

func SendMail(body string) error

func SendMailWithAttachment

func SendMailWithAttachment(body, attachfile string) error

SendMail xxx

func SetClicksPerSecond

func SetClicksPerSecond(cps Clicks)

func SetCurrentClick

func SetCurrentClick(click Clicks)

func SetCurrentClickOffset

func SetCurrentClickOffset(click Clicks)

func SetCurrentMilli

func SetCurrentMilli(milli int64)

func SetCurrentMilliOffset

func SetCurrentMilliOffset(milli int64)

func SetExternalScale

func SetExternalScale(pitch uint8, on bool)

func SetLogTypeEnabled

func SetLogTypeEnabled(dtype string, b bool)

func SetLogTypes

func SetLogTypes(logtypes string)

func Spawn

func Spawn(executable string, background bool, stdout io.Writer, stderr io.Writer, args ...string) error

Spawn executes something. If background is true, it doesn't block

func Start

func Start()

func StartDeviceInput

func StartDeviceInput()

StartDeviceInput starts anything needed to provide device inputs

func StartPlusUptime

func StartPlusUptime(startdate string, uptime float64) string

func StartRunning

func StartRunning(process string) error

func StartTwitch

func StartTwitch()

func String

func String(arg any) string

String xxx

func StringMap

func StringMap(params string) (map[string]string, error)

StringMap takes a JSON string and returns a map of elements

func SummarizeLog

func SummarizeLog(fname string) error

func ToBool

func ToBool(arg any) bool

ToBool xxx

func TwitchUser

func TwitchUser() (username string, authtoken string)

func Uptime

func Uptime() float64

Uptime returns the number of seconds since the program started.

func WaitTillDone

func WaitTillDone()

func WritableSavedFilePath

func WritableSavedFilePath(category string, filename string, suffix string) (string, error)

WritableSavedFilePath xxx

Types

type ActiveCursor

type ActiveCursor struct {
	Current     CursorEvent
	Previous    CursorEvent
	NoteOn      *NoteOn
	NoteOnClick Clicks
	Patch       *Patch
	Button      string
	// contains filtered or unexported fields
}

OscEvent is an OSC message

func NewActiveCursor

func NewActiveCursor(ce CursorEvent) *ActiveCursor

NewActiveCursor - create a new ActiveCursor for a CursorEvent An ActiveCursor can be for a Button or a Patch area.

type AttractManager

type AttractManager struct {
	// contains filtered or unexported fields
}
var TheAttractManager *AttractManager

func NewAttractManager

func NewAttractManager() *AttractManager

func (*AttractManager) AttractModeIsOn

func (am *AttractManager) AttractModeIsOn() bool

func (*AttractManager) SetAttractEnabled

func (am *AttractManager) SetAttractEnabled(b bool)

func (*AttractManager) SetAttractMode

func (am *AttractManager) SetAttractMode(onoff bool)

type Bidule

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

func TheBidule

func TheBidule() *Bidule

func (*Bidule) Activate

func (b *Bidule) Activate()

func (*Bidule) ProcessInfo

func (b *Bidule) ProcessInfo() *ProcessInfo

func (*Bidule) Reset

func (b *Bidule) Reset()

type ChanPressure

type ChanPressure struct {
	Channel  uint8
	Pressure uint8
}

func NewChanPressure

func NewChanPressure(channel, pressure uint8) *ChanPressure

func (*ChanPressure) String

func (n *ChanPressure) String() string

type ClickEvent

type ClickEvent struct {
	Click  Clicks
	Uptime float64
}

type Clicks

type Clicks int64

Clicks is a time or duration value. NOTE: A Clicks value can be negative because it's sometimes relative to the starting time of a Phrase. XXX - possiblycould have a type to distinguish Clicks that are XXX - used as absolute time versus Clicks that are step numbers

var OneBeat Clicks

func ClicksPerSecond

func ClicksPerSecond() Clicks

func CurrentClick

func CurrentClick() Clicks

func CurrentClickOffset

func CurrentClickOffset() Clicks

func Seconds2Clicks

func Seconds2Clicks(tm float64) Clicks

Seconds2Clicks converts a Time value (elapsed seconds) to Clicks

type Cmd

type Cmd struct {
	Subj   string
	Values map[string]string
}

func NewSimpleCmd

func NewSimpleCmd(subj string) Cmd

func (Cmd) ValuesBool

func (cmd Cmd) ValuesBool(name string, dflt bool) bool

func (Cmd) ValuesColor

func (cmd Cmd) ValuesColor(dflt color.RGBA) color.RGBA

func (Cmd) ValuesFloat

func (cmd Cmd) ValuesFloat(name string, dflt float32) float32

func (Cmd) ValuesInt

func (cmd Cmd) ValuesInt(name string, dflt int) int

func (Cmd) ValuesPos

func (cmd Cmd) ValuesPos(dflt image.Point) image.Point

func (Cmd) ValuesRect

func (cmd Cmd) ValuesRect(dflt image.Rectangle) image.Rectangle

func (Cmd) ValuesSetPos

func (cmd Cmd) ValuesSetPos(pos image.Point)

func (Cmd) ValuesSetXY

func (cmd Cmd) ValuesSetXY(key string, pos image.Point)

func (Cmd) ValuesSetXY0

func (cmd Cmd) ValuesSetXY0(pos image.Point)

func (Cmd) ValuesSetXY1

func (cmd Cmd) ValuesSetXY1(pos image.Point)

func (Cmd) ValuesSize

func (cmd Cmd) ValuesSize(dflt image.Point) image.Point

func (Cmd) ValuesString

func (cmd Cmd) ValuesString(name string, dflt string) string

func (Cmd) ValuesToString

func (cmd Cmd) ValuesToString() string

func (Cmd) ValuesUint8

func (cmd Cmd) ValuesUint8(name string, dflt uint8) uint8

func (Cmd) ValuesXY

func (cmd Cmd) ValuesXY(xyname string, dflt image.Point) image.Point

ValuesXY is used to get any 2-valued int value (ie. pos or size)

func (Cmd) ValuesXY0

func (cmd Cmd) ValuesXY0(dflt image.Point) image.Point

func (Cmd) ValuesXY1

func (cmd Cmd) ValuesXY1(dflt image.Point) image.Point

func (Cmd) VerifyValues

func (cmd Cmd) VerifyValues(names ...string) bool

type Command

type Command struct {
	Action string // e.g. "addmidi"
	Arg    any
}

type Controller

type Controller struct {
	Controller uint8
	Value      uint8
	Channel    uint8
}

func NewController

func NewController(channel, controller, value uint8) *Controller

NewController create a new noteoff

func (*Controller) String

func (n *Controller) String() string

type CursorCallbackFunc

type CursorCallbackFunc func(e CursorEvent)

CursorDeviceCallbackFunc xxx

type CursorEvent

type CursorEvent struct {
	// Named CClick to catch everyone that accesses it
	CClick Clicks `json:"Click"`
	Gid    int    `json:"Gid"`
	Tag    string `json:"Tag"`
	// Source string
	Ddu  string    `json:"Ddu"` // "down", "drag", "up" (sometimes "clear")
	Pos  CursorPos `json:"Pos"`
	Area float32   `json:"Area"`
}

CursorEvent is a single Cursor event. NOTE: it's assumed that we can copy a CursorEvent by copying the value. Do note add pointers to this struct.

func CursorEventFromString

func CursorEventFromString(s string) (ce CursorEvent, err error)

func NewCursorClearEvent

func NewCursorClearEvent() CursorEvent

func NewCursorEvent

func NewCursorEvent(gid int, tag string, ddu string, pos CursorPos) CursorEvent

func (CursorEvent) GetClick

func (ce CursorEvent) GetClick() Clicks

func (CursorEvent) IsAttractGenerated

func (ce CursorEvent) IsAttractGenerated() bool

func (CursorEvent) Marshal

func (ce CursorEvent) Marshal() (bytes []byte, err error)

XXX - can this make use of generics? (across all the Event types)

func (*CursorEvent) SetClick

func (ce *CursorEvent) SetClick(click Clicks)

func (*CursorEvent) Source

func (ce *CursorEvent) Source() string

type CursorHandler

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

type CursorManager

type CursorManager struct {
	ClickMutex sync.RWMutex

	GidToLoopedGidMutex sync.RWMutex
	GidToLoopedGid      map[int]int

	LoopThreshold float32
	// contains filtered or unexported fields
}
var TheCursorManager *CursorManager

func NewCursorManager

func NewCursorManager() *CursorManager

func (*CursorManager) AddCursorHandler

func (cm *CursorManager) AddCursorHandler(name string, handler CursorHandler, sources ...string)

func (*CursorManager) CheckAutoCursorUp

func (cm *CursorManager) CheckAutoCursorUp()

func (*CursorManager) ClearAllActiveCursors

func (cm *CursorManager) ClearAllActiveCursors(tag string)

func (*CursorManager) DeleteActiveCursor

func (cm *CursorManager) DeleteActiveCursor(gid int)

func (*CursorManager) DeleteActiveCursorIfZLessThan

func (cm *CursorManager) DeleteActiveCursorIfZLessThan(gid int, threshold float32)

DeleteActiveCursorIfZLessThan deletes the ActiveCursor if its Z value is less than threshold.

func (*CursorManager) DeleteActiveCursorsForTag

func (cm *CursorManager) DeleteActiveCursorsForTag(tag string)

func (*CursorManager) ExecuteCursorEvent

func (cm *CursorManager) ExecuteCursorEvent(ce CursorEvent)

func (*CursorManager) GenerateGesture

func (cm *CursorManager) GenerateGesture(tag string, numsteps int, dur time.Duration, pos0 CursorPos, pos1 CursorPos)

func (*CursorManager) GenerateRandomGesture

func (cm *CursorManager) GenerateRandomGesture(tag string, numsteps int, dur time.Duration)

func (*CursorManager) LoopCursorEvent

func (cm *CursorManager) LoopCursorEvent(ac *ActiveCursor) *SchedElement

func (*CursorManager) LoopedGidFor

func (cm *CursorManager) LoopedGidFor(ce CursorEvent, warn bool) int

Keep track of names attached to each cursor "down", and use those names on subsequent "drag" and "up" events.

func (*CursorManager) PlayCursor

func (cm *CursorManager) PlayCursor(tag string, dur time.Duration, pos CursorPos)

func (*CursorManager) UniqueGid

func (cm *CursorManager) UniqueGid() int

type CursorPos

type CursorPos struct {
	X, Y, Z float32
}

type Engine

type Engine struct {
	// contains filtered or unexported fields
}
var TheEngine *Engine

func (*Engine) ExecuteApi

func (e *Engine) ExecuteApi(api string, apiargs map[string]string) (result string, err error)

ExecuteApi xxx

func (*Engine) ExecuteApiFromJson

func (e *Engine) ExecuteApiFromJson(rawjson string) (string, error)

handleRawJsonApi takes raw JSON (as a string of the form "{...}"") as an API and returns raw JSON

func (*Engine) LoadCurrent

func (e *Engine) LoadCurrent() (err error)

func (*Engine) LoadEngineParams

func (e *Engine) LoadEngineParams(fname string) (err error)

func (*Engine) NewRecordingPath

func (e *Engine) NewRecordingPath() (string, error)

func (*Engine) RecordCursorEvent

func (e *Engine) RecordCursorEvent(event CursorEvent)

func (*Engine) RecordMidiEvent

func (e *Engine) RecordMidiEvent(event *MidiEvent)

func (*Engine) RecordOscEvent

func (e *Engine) RecordOscEvent(event *OscEvent)

func (*Engine) RecordPlaybackEvent

func (e *Engine) RecordPlaybackEvent(event PlaybackEvent)

func (*Engine) RecordStartEvent

func (e *Engine) RecordStartEvent()

func (*Engine) RecordStopEvent

func (e *Engine) RecordStopEvent()

func (*Engine) RecordingPath

func (e *Engine) RecordingPath(fname string) string

func (*Engine) SaveCurrent

func (e *Engine) SaveCurrent() (err error)

func (*Engine) SayDone

func (e *Engine) SayDone()

func (*Engine) SendOsc

func (e *Engine) SendOsc(client *osc.Client, msg *osc.Message)

func (*Engine) Set

func (e *Engine) Set(name string, value string) error

func (*Engine) SetAutoTransposeBeats

func (e *Engine) SetAutoTransposeBeats(beats int)

func (*Engine) SetTranspose

func (e *Engine) SetTranspose(i int)

func (*Engine) Start

func (e *Engine) Start()

func (*Engine) StartHttp

func (e *Engine) StartHttp(port int)

StartHttp xxx

func (*Engine) StartOscListener

func (e *Engine) StartOscListener(port int)

func (*Engine) StartPlayback

func (e *Engine) StartPlayback(fname string) error

func (*Engine) StartRecording

func (e *Engine) StartRecording() (string, error)

func (*Engine) StopRecording

func (e *Engine) StopRecording() (string, error)

func (*Engine) WaitTillDone

func (e *Engine) WaitTillDone()

type Erae

type Erae struct {
	// contains filtered or unexported fields
}
var TheErae *Erae

func NewErae

func NewErae() *Erae

func (*Erae) EraeApiModeDisable

func (erae *Erae) EraeApiModeDisable()

func (*Erae) EraeApiModeEnable

func (erae *Erae) EraeApiModeEnable()

func (*Erae) EraeFingerIndicator

func (erae *Erae) EraeFingerIndicator(zone, x, y byte)

func (*Erae) EraeWriteSysEx

func (erae *Erae) EraeWriteSysEx(bytes []byte)

func (*Erae) EraeZoneBoundaryRequest

func (erae *Erae) EraeZoneBoundaryRequest(zone byte)

func (*Erae) EraeZoneClearDisplay

func (erae *Erae) EraeZoneClearDisplay(zone byte)

func (*Erae) EraeZoneClearPixel

func (erae *Erae) EraeZoneClearPixel(zone, x, y, r, g, b byte)

func (*Erae) EraeZoneRectangle

func (erae *Erae) EraeZoneRectangle(zone, x, y, w, h, r, g, b byte)

func (*Erae) Start

func (erae *Erae) Start()

type Event

type Event any

type FileWriter

type FileWriter struct {
	Exe string
}

func (*FileWriter) Write

func (w *FileWriter) Write(p []byte) (n int, err error)

type MIDIDeviceEvent

type MIDIDeviceEvent struct {
	Timestamp int64 // milliseconds
	Status    int64
	Data1     int64
	Data2     int64
}

MIDIDeviceEvent is a single MIDI event

type MIDIEventHandler

type MIDIEventHandler func(MidiEvent)

type MidiEvent

type MidiEvent struct {
	Click Clicks
	Tag   string
	Msg   midi.Message
}

func NewMidiEvent

func NewMidiEvent(click Clicks, tag string, msg midi.Message) MidiEvent

func (MidiEvent) HasPitch

func (me MidiEvent) HasPitch() bool

func (MidiEvent) Marshal

func (e MidiEvent) Marshal() (bytes []byte, err error)

func (MidiEvent) Pitch

func (me MidiEvent) Pitch() uint8

func (MidiEvent) String

func (e MidiEvent) String() string

type NoWriter

type NoWriter struct {
}

func (*NoWriter) Write

func (w *NoWriter) Write(p []byte) (n int, err error)

type NoteBytes

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

func NewNoteBytes

func NewNoteBytes(bytes []byte) *NoteBytes

func (*NoteBytes) String

func (n *NoteBytes) String() string

type NoteFull

type NoteFull struct {
	// Channel  uint8
	Synth     *Synth
	Duration  Clicks
	SynthName string
	Pitch     uint8
	Velocity  uint8
}

NoteFull has a duration, i.e. it's a combination of a NoteOn and NoteOff

func NewNoteFull

func NewNoteFull(synth *Synth, pitch, velocity uint8, duration Clicks) *NoteFull

func (*NoteFull) String

func (n *NoteFull) String() string

type NoteOff

type NoteOff struct {
	// Channel  uint8
	Synth    *Synth
	Pitch    uint8
	Velocity uint8
}

func NewNoteOff

func NewNoteOff(synth *Synth, pitch, velocity uint8) *NoteOff

NewNoteOff create a new noteoff

func NewNoteOffFromNoteOn

func NewNoteOffFromNoteOn(nt *NoteOn) *NoteOff

NewNoteOff create a new NoteOff from a NoteOn

func (NoteOff) String

func (n NoteOff) String() string

type NoteOn

type NoteOn struct {
	// Channel  uint8
	Synth    *Synth
	Pitch    uint8
	Velocity uint8
}

func NewNoteOn

func NewNoteOn(synth *Synth, pitch, velocity uint8) *NoteOn

NewNoteOn create a new noteon

func (*NoteOn) String

func (n *NoteOn) String() string

type NoteSystem

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

func NewNoteSystem

func NewNoteSystem(system byte) *NoteSystem

func (*NoteSystem) String

func (n *NoteSystem) String() string

type OscEvent

type OscEvent struct {
	Click  Clicks       `json:"Click"`
	Msg    *osc.Message `json:"Msg"`
	Source string       `json:"Source"`
}

func (OscEvent) Marshal

func (e OscEvent) Marshal() (bytes []byte, err error)

func (OscEvent) String

func (e OscEvent) String() string

type ParamDef

type ParamDef struct {
	TypedParamDef any
	Category      string
	Init          string
	// contains filtered or unexported fields
}

ParamDef is a single parameter definition.

type ParamDefBool

type ParamDefBool struct {
}

type ParamDefFloat

type ParamDefFloat struct {
	Init string
	// contains filtered or unexported fields
}

type ParamDefInt

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

type ParamDefString

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

type ParamValue

type ParamValue any

ParamValue is a single parameter value which could be any of the param*Value types

type ParamValues

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

ParamValues is the set of all parameter values

func NewParamValues

func NewParamValues() *ParamValues

func (*ParamValues) ApplyValuesFromMap

func (params *ParamValues) ApplyValuesFromMap(category string, paramsmap map[string]any, setfunc func(string, string) error)

Currently, no errors are ever returned, but log messages are generated.

func (*ParamValues) DoForAllParams

func (vals *ParamValues) DoForAllParams(f func(string, ParamValue))

func (*ParamValues) Exists

func (vals *ParamValues) Exists(name string) bool

func (*ParamValues) Get

func (vals *ParamValues) Get(name string) (string, error)

returns "" if parameter doesn't exist

func (*ParamValues) GetBoolValue

func (vals *ParamValues) GetBoolValue(name string) bool

func (*ParamValues) GetFloatValue

func (vals *ParamValues) GetFloatValue(name string) float32

func (*ParamValues) GetIntValue

func (vals *ParamValues) GetIntValue(name string) int

func (*ParamValues) GetStringValue

func (vals *ParamValues) GetStringValue(name string, def string) string

func (*ParamValues) JsonValues

func (vals *ParamValues) JsonValues() string

func (*ParamValues) ParamNames

func (vals *ParamValues) ParamNames() []string

func (*ParamValues) Save

func (vals *ParamValues) Save(category string, filename string) error

func (*ParamValues) Set

func (vals *ParamValues) Set(name, value string) error

type ParamsMap

type ParamsMap map[string]any
var CursorSourceToQuadPreset ParamsMap

func LoadParamsMap

func LoadParamsMap(path string) (ParamsMap, error)

func OverrideMap

func OverrideMap() ParamsMap

type Patch

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

func GetPatch

func GetPatch(patchName string) *Patch

func NewPatch

func NewPatch(patchName string) *Patch

func (*Patch) Api

func (patch *Patch) Api(api string, apiargs map[string]string) (string, error)

func (*Patch) ApplyPatchValuesFromQuadMap

func (patch *Patch) ApplyPatchValuesFromQuadMap(paramsmap map[string]any) error

func (*Patch) CursorToQuant

func (patch *Patch) CursorToQuant(ce CursorEvent) Clicks

func (*Patch) Get

func (patch *Patch) Get(paramName string) string

If no such parameter, return ""

func (*Patch) GetBool

func (patch *Patch) GetBool(paramName string) bool

func (*Patch) GetFloat

func (patch *Patch) GetFloat(paramName string) float32

func (*Patch) GetInt

func (patch *Patch) GetInt(paramName string) int

func (*Patch) Load

func (patch *Patch) Load(category string, filename string) error

func (*Patch) MIDIChannel

func (patch *Patch) MIDIChannel() uint8

func (*Patch) Name

func (patch *Patch) Name() string

func (*Patch) ParamNames

func (patch *Patch) ParamNames() []string

func (*Patch) RefreshAllIfPortnumMatches

func (patch *Patch) RefreshAllIfPortnumMatches(ffglportnum int)

func (*Patch) RefreshAllPatchValues

func (patch *Patch) RefreshAllPatchValues()

func (*Patch) SaveAndAlert

func (patch *Patch) SaveAndAlert(category string, filename string) error

func (*Patch) SaveQuadAndAlert

func (patch *Patch) SaveQuadAndAlert() error

func (*Patch) Set

func (patch *Patch) Set(paramName string, paramValue string) error

func (*Patch) SetDefaultValues

func (patch *Patch) SetDefaultValues()

SetDefaultValues xxx

func (*Patch) Status

func (patch *Patch) Status() string

func (*Patch) Synth

func (patch *Patch) Synth() *Synth

type PatchLogic

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

func NewPatchLogic

func NewPatchLogic(patch *Patch) *PatchLogic

type Phrase

type Phrase struct {
	Source      string
	Destination string
	Length      Clicks
	// contains filtered or unexported fields
}

Phrase is a time-ordered list of *PhraseElements

func NewPhrase

func NewPhrase() *Phrase

NewPhrase returns a new Phrase

func (*Phrase) AdjustTimes

func (p *Phrase) AdjustTimes(shift Clicks) *Phrase

AdjustTimes returns a new Phrase shifted by shift Clicks

func (*Phrase) Arpeggio

func (p *Phrase) Arpeggio() *Phrase

Arpeggio returns an arpeggiated version of the phrase. One way of describing is that all the notes have been separated and then put back together, back-to-back.

func (*Phrase) AtTime

func (p *Phrase) AtTime(tm Clicks) *Phrase

AtTime returns those notes in the specified phrase that are sounding at the specified time. If a note ends exactly at the specified time, it is not included.

func (*Phrase) Copy

func (p *Phrase) Copy() *Phrase

Copy returns a copy of a Phrase

func (*Phrase) CopyAndAppend

func (p *Phrase) CopyAndAppend(elem *PhraseElement) *PhraseElement

CopyAndAppend makes a copy of a Note and appends it to the Phrase

func (*Phrase) CutSound

func (p *Phrase) CutSound(sound string) *Phrase

CutSound creates a new Phrase with notes for a given sound

func (*Phrase) CutTime

func (p *Phrase) CutTime(fromclick, toclick Clicks) *Phrase

CutTime creates a new Phrase with notes in a given time range

func (*Phrase) InsertElement

func (p *Phrase) InsertElement(item *PhraseElement) *Phrase

InsertNote inserts a note into a Phrase

func (*Phrase) InsertNoLock

func (p *Phrase) InsertNoLock(pe *PhraseElement) *Phrase

InsertNoLock adds a Note to a Phrase

func (*Phrase) Legato

func (p *Phrase) Legato() *Phrase

Legato extends the duration of each note to abutt the start of the next note. Doesn't modify the duration of the last note.

func (*Phrase) Lock

func (p *Phrase) Lock()

Lock for writing

func (*Phrase) LowestPitch

func (p *Phrase) LowestPitch(delta int) uint8

LowestPitch returns the lowest pitch in a Phrase

func (*Phrase) Merge

func (p *Phrase) Merge(fromPhrase *Phrase) *Phrase

Merge merges a second Phrase into a Phrase NOTE: we get a Write lock on the Phrase, since we're actually changing it.

func (*Phrase) NextTime

func (p *Phrase) NextTime(st Clicks) Clicks

NextTime returns the time of the next note AFTER time st. If there are no notes after it, returns -1.

func (*Phrase) RLock

func (p *Phrase) RLock()

RLock for reading

func (*Phrase) RUnlock

func (p *Phrase) RUnlock()

RUnlock for reading

func (*Phrase) ResetLengthNoLock

func (p *Phrase) ResetLengthNoLock()

ResetLengthNoLock sets the length of a Phrase to the end of the lastnote

func (*Phrase) Step

func (p *Phrase) Step(stepsize Clicks) *Phrase

Step returns a stepped version of the Phrase.

func (*Phrase) Transpose

func (p *Phrase) Transpose(delta int) *Phrase

Transpose returns a Phrase whose pitch is transposed.

func (*Phrase) Unlock

func (p *Phrase) Unlock()

Unlock for writing

type PhraseElement

type PhraseElement struct {
	AtClick Clicks
	Value   any // things like *NoteFull, *NoteOn, *NoteOff, etc
}

func (*PhraseElement) Copy

func (pe *PhraseElement) Copy() *PhraseElement

func (*PhraseElement) EndOf

func (pe *PhraseElement) EndOf() Clicks

func (*PhraseElement) Format

func (pi *PhraseElement) Format(f fmt.State, c rune)

Format xxx

func (*PhraseElement) IsNote

func (pe *PhraseElement) IsNote() bool

type PhraseScanner

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

PhraseScanner represents a lexical scanner for phrase constants

func NewPhraseScanner

func NewPhraseScanner(r io.Reader) *PhraseScanner

NewScanner returns a new instance of Scanner.

func (*PhraseScanner) ScanChar

func (s *PhraseScanner) ScanChar() string

func (*PhraseScanner) ScanNumber

func (s *PhraseScanner) ScanNumber() (int, error)

func (*PhraseScanner) ScanWord

func (s *PhraseScanner) ScanWord() (tok Token, lit string)

Scan returns the next token and literal value.

type PitchBend

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

func NewPitchBend

func NewPitchBend(data0, data1, data2 uint8) *PitchBend

func (*PitchBend) String

func (n *PitchBend) String() string

type PlaybackEvent

type PlaybackEvent struct {
	Click     Clicks `json:"Click"`
	IsRunning bool   `json:"IsRunning"`
}

PlaybackEvent is for start/stop

type PortChannel

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

type ProcessInfo

type ProcessInfo struct {
	Exe       string // just the last part
	FullPath  string
	Arg       string
	Activate  func()
	Activated bool
}

func GuiProcessInfo

func GuiProcessInfo() *ProcessInfo

func KeykitProcessInfo

func KeykitProcessInfo() *ProcessInfo

func MmttProcessInfo

func MmttProcessInfo() *ProcessInfo

func NewProcessInfo

func NewProcessInfo(exe, fullPath, arg string, activate func()) *ProcessInfo

type ProcessManager

type ProcessManager struct {
	// contains filtered or unexported fields
}
var TheProcessManager *ProcessManager

func NewProcessManager

func NewProcessManager() *ProcessManager

func (*ProcessManager) AddBuiltins

func (pm *ProcessManager) AddBuiltins()

func (*ProcessManager) AddProcess

func (pm *ProcessManager) AddProcess(process string, info *ProcessInfo)

func (*ProcessManager) AddProcessBuiltIn

func (pm *ProcessManager) AddProcessBuiltIn(process string)

func (*ProcessManager) CheckAutorestartProcesses

func (pm *ProcessManager) CheckAutorestartProcesses()

CheckAutorestartProcesses will restart processes that were started but are no longer running.

func (*ProcessManager) GetProcessInfo

func (pm *ProcessManager) GetProcessInfo(process string) (*ProcessInfo, error)

func (*ProcessManager) IsAvailable

func (pm *ProcessManager) IsAvailable(process string) bool

func (*ProcessManager) IsRunning

func (pm *ProcessManager) IsRunning(process string) bool

func (*ProcessManager) KillProcess

func (pm *ProcessManager) KillProcess(process string) (err error)

func (*ProcessManager) ProcessStatus

func (pm *ProcessManager) ProcessStatus() string

func (*ProcessManager) StartRunning

func (pm *ProcessManager) StartRunning(process string) error

type ProgramChange

type ProgramChange struct {
	Channel uint8
	Program uint8
}

func NewProgramChange

func NewProgramChange(channel, program uint8) *ProgramChange

func (*ProgramChange) String

func (n *ProgramChange) String() string

type QuadPro

type QuadPro struct {
	// contains filtered or unexported fields
}
var TheQuadPro *QuadPro

func NewQuadPro

func NewQuadPro() *QuadPro

func (*QuadPro) Api

func (quadpro *QuadPro) Api(api string, apiargs map[string]string) (result string, err error)

func (*QuadPro) Load

func (quadpro *QuadPro) Load(category string, filename string) error

func (*QuadPro) PatchForCursorEvent

func (quadpro *QuadPro) PatchForCursorEvent(ce CursorEvent) (patch *Patch, button string)

func (*QuadPro) Start

func (quadpro *QuadPro) Start()

func (*QuadPro) Status

func (quadpro *QuadPro) Status(source string) string

func (*QuadPro) Stop

func (quadpro *QuadPro) Stop()

type RecordingEvent

type RecordingEvent struct {
	Event string
	Value any
}

type Resolume

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

func TheResolume

func TheResolume() *Resolume

func (*Resolume) Activate

func (r *Resolume) Activate()

func (*Resolume) PortAndLayerNumForPatch

func (r *Resolume) PortAndLayerNumForPatch(patchName string) (portNum, layerNum int)

func (*Resolume) ProcessInfo

func (r *Resolume) ProcessInfo() *ProcessInfo

func (*Resolume) SendEffectParam

func (r *Resolume) SendEffectParam(patchName string, name string, value string)

func (*Resolume) TextLayerNum

func (r *Resolume) TextLayerNum() int

func (*Resolume) ToFreeFramePlugin

func (r *Resolume) ToFreeFramePlugin(patchName string, msg *osc.Message)

type Router

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

Router takes events and routes them

var TheRouter *Router

func NewRouter

func NewRouter() *Router

func (*Router) HandleMidiEvent

func (r *Router) HandleMidiEvent(me MidiEvent)

func (*Router) InputListenOnce

func (r *Router) InputListenOnce()

func (*Router) InputListener

func (r *Router) InputListener()

InputListener listens for local device inputs (OSC, MIDI) them in a single select eliminates some need for locking.

func (*Router) ScheduleCursorEvent

func (r *Router) ScheduleCursorEvent(ce CursorEvent)

func (*Router) Start

func (r *Router) Start()

type Scale

type Scale struct {
	HasNote [128]bool
}

Scale says whether a pitch is in a scale

func GetScale

func GetScale(name string) *Scale

GetScale xxx

func MakeScale

func MakeScale(pitches ...int) *Scale

func (*Scale) ClosestTo

func (s *Scale) ClosestTo(pitch uint8) uint8

ClosestTo xxx

type SchedElement

type SchedElement struct {
	// patch             *Patch
	AAtClick Clicks
	Tag      string
	Value    any
}

func NewSchedElement

func NewSchedElement(atclick Clicks, tag string, value any) *SchedElement

func SchedElementFromString

func SchedElementFromString(s string) (se *SchedElement, err error)

func (SchedElement) GetClick

func (se SchedElement) GetClick() Clicks

func (*SchedElement) SetClick

func (se *SchedElement) SetClick(click Clicks)

NOTE: a pointer is used so se.SetClick() can modify the value

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}
var TheScheduler *Scheduler

func NewScheduler

func NewScheduler() *Scheduler

func (*Scheduler) CountEventsWithTag

func (sched *Scheduler) CountEventsWithTag(tag string) int

func (*Scheduler) DeleteCursorEventsWhoseGidIs

func (sched *Scheduler) DeleteCursorEventsWhoseGidIs(gid int)

func (*Scheduler) DeleteEventsWithTag

func (sched *Scheduler) DeleteEventsWithTag(tag string)

func (*Scheduler) Format

func (sched *Scheduler) Format(f fmt.State, c rune)

func (*Scheduler) PendingToString

func (sched *Scheduler) PendingToString() string

func (*Scheduler) Start

func (sched *Scheduler) Start()

Start runs the scheduler and never returns

func (*Scheduler) ToString

func (sched *Scheduler) ToString() string

type Synth

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

func GetSynth

func GetSynth(synthName string) *Synth

func NewSynth

func NewSynth(name string, port string, channel int, bank int, program int) *Synth

func (*Synth) Channel

func (synth *Synth) Channel() uint8

func (*Synth) ClearNoteDowns

func (synth *Synth) ClearNoteDowns()

func (*Synth) SendANO

func (synth *Synth) SendANO()

SendANO sends all-notes-off

func (*Synth) SendBytes

func (synth *Synth) SendBytes(bytes []byte) error

func (*Synth) SendBytesToMidiOutput

func (synth *Synth) SendBytesToMidiOutput(bytes []byte)

SendBytesToMidiOutput

func (*Synth) SendController

func (synth *Synth) SendController(cnum uint8, cval uint8)

func (*Synth) SendNoteToMidiOutput

func (synth *Synth) SendNoteToMidiOutput(value any)

func (*Synth) UpdateBankProgram

func (synth *Synth) UpdateBankProgram()

type Token

type Token int

Token is something returned by the PhraseScanner

const (
	EOF Token = iota
	WORD
	NUMBER
	MINUS
	PLUS
	COMMA
	SINGLEQUOTE
	SPACE
	UNKNOWN
)

type VizColor

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

VizColor xxx

func ColorFromHLS

func ColorFromHLS(hue, luminance, saturation float32) VizColor

ColorFromHLS creates a color from hue, luminance, and saturation

func ColorFromRGB

func ColorFromRGB(red, green, blue float32) VizColor

ColorFromRGB creates a VizColor from red, green, blue

Jump to

Keyboard shortcuts

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