cntl

package
v0.0.0-...-c66ceb2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package cntl contains all methods required to streamline a song and render the single frames to output channels.

Index

Constants

View Source
const (
	LoggerFieldTransport = "transport"
	LoggerFieldWaiter    = "waiter"
)

Logger fields

View Source
const RenderFrames uint8 = 64

RenderFrames defines the smallest render unit of a bar. Has to be multiplier of 4.

Variables

This section is empty.

Functions

This section is empty.

Types

type BarChange

type BarChange struct {
	BarParams
	At uint64 `json:"at" yaml:"at"`
}

BarChange describes the changes of tempo and notes during a song

func (BarChange) Equals

func (v1 BarChange) Equals(v2 BarChange) bool

Equals returns whether the two given objects are equal

type BarParams

type BarParams struct {
	NoteValue uint8  `json:"noteValue" yaml:"noteValue"`
	NoteCount uint8  `json:"noteCount" yaml:"noteCount"`
	Speed     uint16 `json:"speed" yaml:"speed"`
}

BarParams are a reusable informational struct on how fast and in what scheme something should be played

type Command

type Command struct {
	FrameState
	DMXCommands  DMXCommands  `json:"dmxCommands" yaml:"dmxCommands"`
	MIDICommands MIDICommands `json:"midiCommands" yaml:"midiCommands"`
	BarChange    *BarChange   `json:"barChange" yaml:"barChange"`
}

Command is a container to set settings

type DMXAnimation

type DMXAnimation struct {
	ID     string              `json:"id" yaml:"id"`
	Name   string              `json:"name" yaml:"name"`
	Frames []DMXAnimationFrame `json:"frames" yaml:"frames"`
}

DMXAnimation is an animation of dmx params in relation to time

func (DMXAnimation) Equals

func (v1 DMXAnimation) Equals(v2 DMXAnimation) bool

Equals returns whether the two given objects are equal

type DMXAnimationFrame

type DMXAnimationFrame struct {
	At     uint8     `json:"at" yaml:"at"`
	Params DMXParams `json:"params" yaml:"params"`
}

DMXAnimationFrame is a single frame in an animation

func (DMXAnimationFrame) Equals

Equals returns whether the two given objects are equal

type DMXChannel

type DMXChannel uint16

DMXChannel is the channel a command can talk to (0-511)

type DMXColorVariable

type DMXColorVariable struct {
	ID    string    `json:"id" yaml:"id"`
	Name  string    `json:"name" yaml:"name"`
	Red   *DMXValue `json:"red" yaml:"red"`
	Green *DMXValue `json:"green" yaml:"green"`
	Blue  *DMXValue `json:"blue" yaml:"blue"`
	White *DMXValue `json:"white" yaml:"white"`
}

DMXColorVariable is a global variable for a DMX color

type DMXCommand

type DMXCommand struct {
	Universe DMXUniverse `json:"universe" yaml:"universe"`
	Channel  DMXChannel  `json:"channel" yaml:"channel"`
	Value    DMXValue    `json:"value" yaml:"value"`
}

DMXCommand tells a DMX controller to set a channel on a universe to a specific value

func (DMXCommand) Equals

func (cmd DMXCommand) Equals(c DMXCommand) bool

Equals returns true if given DMXCommand is equal to the called one

func (DMXCommand) EqualsChannel

func (cmd DMXCommand) EqualsChannel(c DMXCommand) bool

EqualsChannel returns true if given DMXCommand is equal to the called one in terms of channel and universe

type DMXCommands

type DMXCommands []DMXCommand

DMXCommands is an array of DMXCommands

func (DMXCommands) Contains

func (cmds DMXCommands) Contains(c DMXCommand) bool

Contains returns whether given DMXCommand is in the called collection

func (DMXCommands) ContainsChannel

func (cmds DMXCommands) ContainsChannel(c DMXCommand) bool

ContainsChannel returns whether given DMXCommand's channel and universe is in the called collection

func (DMXCommands) Equals

func (cmds DMXCommands) Equals(c DMXCommands) bool

Equals returns true when both the called and the given one have the same entries without caring for order

type DMXDevice

type DMXDevice struct {
	ID           string      `json:"id" yaml:"id"`
	Name         string      `json:"name" yaml:"name"`
	TypeID       string      `json:"typeId" yaml:"typeId"`
	Universe     DMXUniverse `json:"universe" yaml:"universe"`
	StartChannel DMXChannel  `json:"startChannel" yaml:"startChannel"`
	Tags         []Tag       `json:"tags" yaml:"tags"`
}

DMXDevice is a DMX device

func (*DMXDevice) Equals

func (v1 *DMXDevice) Equals(v2 *DMXDevice) bool

Equals returns whether the two given objects are equal

type DMXDeviceGroup

type DMXDeviceGroup struct {
	ID      string              `json:"id" yaml:"id"`
	Name    string              `json:"name" yaml:"name"`
	Devices []DMXDeviceSelector `json:"devices" yaml:"devices"`
}

DMXDeviceGroup is a DMX device group

func (*DMXDeviceGroup) Equals

func (v1 *DMXDeviceGroup) Equals(v2 *DMXDeviceGroup) bool

Equals returns whether the two given objects are equal

type DMXDeviceParams

type DMXDeviceParams struct {
	Group      *string     `json:"group" yaml:"group"`
	Device     *string     `json:"device" yaml:"device"`
	Params     []DMXParams `json:"params" yaml:"params"`
	Animation  *string     `json:"animation" yaml:"animation"`
	Transition *string     `json:"transition" yaml:"transition"`
}

DMXDeviceParams is an object storing DMX parameters including the selection of either groups or devices

func (DMXDeviceParams) Equals

func (v1 DMXDeviceParams) Equals(v2 DMXDeviceParams) bool

Equals returns whether the two given objects are equal

type DMXDeviceSelector

type DMXDeviceSelector struct {
	ID   string `json:"id" yaml:"id"`
	Tags []Tag  `json:"tags" yaml:"tags"`
}

DMXDeviceSelector is a selector for DMX devices

func (DMXDeviceSelector) Equals

Equals returns whether the two given objects are equal

type DMXDeviceType

type DMXDeviceType struct {
	ID                  string     `json:"id" yaml:"id"`
	Name                string     `json:"name" yaml:"name"`
	ChannelCount        uint16     `json:"channelCount" yaml:"channelCount"`
	ChannelsPerLED      uint16     `json:"channelsPerLED" yaml:"channelsPerLED"`
	StrobeEnabled       bool       `json:"strobeEnabled" yaml:"strobeEnabled"`
	StrobeChannel       DMXChannel `json:"strobeChannel" yaml:"strobeChannel"`
	DimmerEnabled       bool       `json:"dimmerEnabled" yaml:"dimmerEnabled"`
	DimmerChannel       DMXChannel `json:"dimmerChannel" yaml:"dimmerChannel"`
	ModeEnabled         bool       `json:"modeEnabled" yaml:"modeEnabled"`
	ModeChannel         DMXChannel `json:"modeChannel" yaml:"modeChannel"`
	Moving              bool       `json:"moving" yaml:"moving"`
	PanChannel          DMXChannel `json:"panChannel" yaml:"panChannel"`
	PanFineChannel      DMXChannel `json:"panFineChannel" yaml:"panFineChannel"`
	TiltChannel         DMXChannel `json:"tiltChannel" yaml:"tiltChannel"`
	TiltFineChannel     DMXChannel `json:"tiltFineChannel" yaml:"tiltFineChannel"`
	PanTiltSpeedChannel DMXChannel `json:"panTiltSpeedChannel" yaml:"panTiltSpeedChannel"`
	LEDs                []LED      `json:"leds"`
}

DMXDeviceType is the type of a DMXDevice

func (*DMXDeviceType) Equals

func (v1 *DMXDeviceType) Equals(v2 *DMXDeviceType) bool

Equals returns whether the two given objects are equal

type DMXParams

type DMXParams struct {
	LEDAll       bool      `json:"ledAll"`
	LED          uint16    `json:"led" yaml:"led"`
	ColorVar     *string   `json:"$color" yaml:"$color"`
	Red          *DMXValue `json:"red" yaml:"red"`
	Green        *DMXValue `json:"green" yaml:"green"`
	Blue         *DMXValue `json:"blue" yaml:"blue"`
	White        *DMXValue `json:"white" yaml:"white"`
	Pan          *DMXValue `json:"pan" yaml:"pan"`
	PanFine      *DMXValue `json:"panFine" yaml:"panFine"`
	Tilt         *DMXValue `json:"tilt" yaml:"tilt"`
	TiltFine     *DMXValue `json:"tiltFine" yaml:"tiltFine"`
	PanTiltSpeed *DMXValue `json:"panTiltSpeed" yaml:"panTiltSpeed"`
	Strobe       *DMXValue `json:"strobe" yaml:"strobe"`
	Mode         *DMXValue `json:"mode" yaml:"mode"`
	Dimmer       *DMXValue `json:"dimmer" yaml:"dimmer"`
}

DMXParams is a DMX parameter object

func (DMXParams) Equals

func (v1 DMXParams) Equals(v2 DMXParams) bool

Equals returns whether the two given objects are equal

type DMXPreset

type DMXPreset struct {
	ID           string            `json:"id" yaml:"id"`
	Name         string            `json:"name" yaml:"name"`
	DeviceParams []DMXDeviceParams `json:"deviceParams" yaml:"deviceParams"`
}

DMXPreset is a DMX Preet for devices or device groups

func (DMXPreset) Equals

func (v1 DMXPreset) Equals(v2 DMXPreset) bool

Equals returns whether the two given objects are equal

type DMXScene

type DMXScene struct {
	ID        string        `json:"id" yaml:"id"`
	Name      string        `json:"name" yaml:"name"`
	NoteValue uint8         `json:"noteValue" yaml:"noteValue"`
	NoteCount uint16        `json:"noteCount" yaml:"noteCount"`
	SubScenes []DMXSubScene `json:"subScenes" yaml:"subScenes"`
}

DMXScene is a whole light scene

func (DMXScene) Equals

func (v1 DMXScene) Equals(v2 DMXScene) bool

Equals returns whether the two given objects are equal

type DMXScenePosition

type DMXScenePosition struct {
	ID     string `json:"id" yaml:"id"`
	At     uint64 `json:"at" yaml:"at"`
	Repeat uint8  `json:"repeat" yaml:"repeat"`
	Marker string `json:"marker" yaml:"marker"`
}

DMXScenePosition describes the position of a DMX scene within a song

func (DMXScenePosition) Equals

func (v1 DMXScenePosition) Equals(v2 DMXScenePosition) bool

Equals returns whether the two given objects are equal

type DMXSubScene

type DMXSubScene struct {
	At           []uint64          `json:"at" yaml:"at"`
	DeviceParams []DMXDeviceParams `json:"deviceParams" yaml:"deviceParams"`
	Preset       *string           `json:"preset" yaml:"preset"`
}

DMXSubScene is a sub scene of a light scene

func (DMXSubScene) Equals

func (v1 DMXSubScene) Equals(v2 DMXSubScene) bool

Equals returns whether the two given objects are equal

type DMXTransition

type DMXTransition struct {
	ID     string                `json:"id" yaml:"id"`
	Name   string                `json:"name" yaml:"name"`
	Ease   EaseFunc              `json:"ease" yaml:"ease"`
	Length uint16                `json:"length" yaml:"length"`
	Params []DMXTransitionParams `json:"params" yaml:"params"`
}

DMXTransition is a transition from a given state to another one using an ease function

type DMXTransitionParams

type DMXTransitionParams struct {
	From DMXParams `json:"from" yaml:"from"`
	To   DMXParams `json:"to" yaml:"to"`
}

DMXTransitionParams hold the params for a transition

type DMXUniverse

type DMXUniverse uint16

DMXUniverse is the universe a DMXDevice is in

type DMXValue

type DMXValue struct {
	Value uint8
}

DMXValue is the value a DMX channel can represent (0-255)

func (*DMXValue) Byte

func (v *DMXValue) Byte() byte

Byte returns the byte representation of the value

func (*DMXValue) Equals

func (v *DMXValue) Equals(v2 *DMXValue) bool

Equals returns whether the two given objects are equal

func (*DMXValue) MarshalJSON

func (v *DMXValue) MarshalJSON() ([]byte, error)

MarshalJSON converts the value to a json byte array

func (*DMXValue) MarshalYAML

func (v *DMXValue) MarshalYAML() (interface{}, error)

MarshalYAML encodes the value to YAML

func (*DMXValue) Uint8

func (v *DMXValue) Uint8() uint8

Uint8 returns the original uint8 representation of the value

func (*DMXValue) UnmarshalJSON

func (v *DMXValue) UnmarshalJSON(b []byte) error

UnmarshalJSON sets the value from a json byte array

func (*DMXValue) UnmarshalYAML

func (v *DMXValue) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML takes the value from YAML

type DataStore

type DataStore struct {
	SetLists          map[string]*SetList
	Songs             map[string]*Song
	DMXScenes         map[string]*DMXScene
	DMXPresets        map[string]*DMXPreset
	DMXAnimations     map[string]*DMXAnimation
	DMXTransitions    map[string]*DMXTransition
	DMXDevices        map[string]*DMXDevice
	DMXDeviceTypes    map[string]*DMXDeviceType
	DMXDeviceGroups   map[string]*DMXDeviceGroup
	DMXColorVariables map[string]*DMXColorVariable
}

A DataStore holds the controllers data state during playback, or more specifically during the rendering of a song into DMX frames

func NewStore

func NewStore() *DataStore

NewStore creates a new DataStore instance

type EaseFunc

type EaseFunc string

EaseFunc names a function that is used to ease a transition

const (
	EaseLinear        EaseFunc = "Linear"
	EaseQuadIn        EaseFunc = "InQuad"
	EaseQuadOut       EaseFunc = "OutQuad"
	EaseQuadInOut     EaseFunc = "InOutQuad"
	EaseCubicIn       EaseFunc = "InCubic"
	EaseCubicOut      EaseFunc = "OutCubic"
	EaseCubicInOut    EaseFunc = "InOutCubic"
	EaseQuartIn       EaseFunc = "InQuart"
	EaseQuartOut      EaseFunc = "OutQuart"
	EaseQuartInOut    EaseFunc = "InOutQuart"
	EaseQuintIn       EaseFunc = "InQuint"
	EaseQuintOut      EaseFunc = "OutQuint"
	EaseQuintInOut    EaseFunc = "InOutQuint"
	EaseSineIn        EaseFunc = "InSine"
	EaseSineOut       EaseFunc = "OutSine"
	EaseSineInOut     EaseFunc = "InOutSine"
	EaseCircularIn    EaseFunc = "InCircular"
	EaseCircularOut   EaseFunc = "OutCircular"
	EaseCircularInOut EaseFunc = "InOutCircular"
	EaseExpoIn        EaseFunc = "InExpo"
	EaseExpoOut       EaseFunc = "OutExpo"
	EaseExpoInOut     EaseFunc = "InOutExpo"
	EaseElasticIn     EaseFunc = "InElastic"
	EaseElasticOut    EaseFunc = "OutElastic"
	EaseElasticInOut  EaseFunc = "InOutElastic"
	EaseBackIn        EaseFunc = "InBack"
	EaseBackOut       EaseFunc = "OutBack"
	EaseBackInOut     EaseFunc = "InOutBack"
	EaseBounceIn      EaseFunc = "InBounce"
	EaseBounceOut     EaseFunc = "OutBounce"
	EaseBounceInOut   EaseFunc = "InOutBounce"
)

easing function names

type FrameState

type FrameState struct {
	Frame uint64 `json:"frame" yaml:"frame"`
	Bar   uint16 `json:"bar" yaml:"bar"`
	Note  uint8  `json:"note" yaml:"note"`
}

FrameState stores information about which bar and note the command is in

type LED

type LED struct {
	Red   DMXChannel `json:"red" yaml:"red"`
	Green DMXChannel `json:"green" yaml:"green"`
	Blue  DMXChannel `json:"blue" yaml:"blue"`
	White DMXChannel `json:"white" yaml:"white"`
}

LED maps a single LEDs DMX channels

func (LED) Equals

func (v1 LED) Equals(v2 LED) bool

Equals returns whether the two given objects are equal

type MIDICommand

type MIDICommand struct {
	At     uint64 `json:"at" yaml:"at"`
	Status uint8  `json:"status" yaml:"status"`
	Data1  uint8  `json:"data1" yaml:"data1"`
	Data2  uint8  `json:"data2" yaml:"data2"`
}

MIDICommand tells a MIDI controller to set a channel to a specific value

type MIDICommands

type MIDICommands []MIDICommand

MIDICommands is an array of MIDICommands

type SetList

type SetList struct {
	ID    string   `json:"id" yaml:"id"`
	Name  string   `json:"name" yaml:"name"`
	Songs []string `json:"songs" yaml:"songs"`
}

SetList is a set of songs in a specific order

func (*SetList) Equals

func (v1 *SetList) Equals(v2 *SetList) bool

Equals returns whether the two given objects are equal

type Song

type Song struct {
	ID           string             `json:"id" yaml:"id"`
	Name         string             `json:"name" yaml:"name"`
	BarChanges   []BarChange        `json:"barChanges" yaml:"barChanges"`
	DMXScenes    []DMXScenePosition `json:"dmxScenes" yaml:"dmxScenes"`
	MIDICommands []MIDICommand      `json:"midiCommands" yaml:"midiCommands"`
}

Song is the whole container for everything that needs to be controlled during a song.

func (*Song) Equals

func (v1 *Song) Equals(v2 *Song) bool

Equals returns whether the two given objects are equal

type Tag

type Tag string

Tag is a string literal tagging a DMX device

func (Tag) Equals

func (t Tag) Equals(v2 Tag) bool

Equals returns whether the two given objects are equal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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