engine

package
v0.0.0-...-d0979cb Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RadToDeg = 180 / math.Pi
	DegToRad = math.Pi / 180
)

RadToDeg and DegToRad are conversion factors

Variables

View Source
var DebugEngine = util.DebugFlags{}

DebugEngine controls debugging output

Functions

func ParameterCategories

func ParameterCategories() map[string]bool

ParameterCategories is the list of parameter categories (both per-pad and global) Someday the value will be something more interesting than bool

func RotdirValue

func RotdirValue(s string) int

RotdirValue xxx

func SpriteAdjustForAge

func SpriteAdjustForAge(s Sprite, age float32)

SpriteAdjustForAge updates a SpriteState's values to reflect a given age

Types

type APIHandler

type APIHandler func(method string, pmap map[string]string) error

APIHandler is an API execution func

type ActiveCursor

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

ActiveCursor is a currently active (i.e. down) cursor

type Command

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

Command is sent on the control channel of the Engine

type Engine

type Engine struct {
	Reactors map[string]*Reactor

	MIDINumDown     int
	MIDIOctaveShift int
	// contains filtered or unexported fields
}

Engine takes events and routes them

func NewEngine

func NewEngine(engineName string) (*Engine, error)

NewEngine returns a pointer to the one-and-only Engine

func (*Engine) ChangeClicksPerSecond

func (e *Engine) ChangeClicksPerSecond(clkpersec util.Clicks)

ChangeClicksPerSecond is what you use to change the tempo

func (*Engine) InitAlgs

func (e *Engine) InitAlgs()

InitAlgs initializes all the Algorithms

func (*Engine) InitializeClicksPerSecond

func (e *Engine) InitializeClicksPerSecond(clkpersec util.Clicks)

InitializeClicksPerSecond initializes

func (*Engine) StartAPI

func (e *Engine) StartAPI(addr string)

StartAPI starts an HTTP listener to handle websocket connections

func (*Engine) StartRealtime

func (e *Engine) StartRealtime()

StartRealtime runs the looper and never returns

func (*Engine) Time

func (e *Engine) Time() time.Time

Time returns the current time

func (*Engine) TimeString

func (e *Engine) TimeString() string

TimeString returns time and clicks

type OSCEvent

type OSCEvent struct {
	Msg    *osc.Message
	Source string
}

OSCEvent is an OSC message

type Params

type Params map[string]interface{}

Params is a map of parameter names to values

type Pipeline

type Pipeline struct {
	Name   string
	Width  int
	Height int
	// contains filtered or unexported fields
}

Pipeline xxx

func NewPipeline

func NewPipeline(name string, windowWidth int, windowHeight int, visible bool) (*Pipeline, error)

NewPipeline xxx

func (*Pipeline) AddVizlet

func (pl *Pipeline) AddVizlet(viz Vizlet)

AddVizlet xxx

func (*Pipeline) Do

func (pl *Pipeline) Do()

Do runs the pipeline once

func (*Pipeline) FirstVizlet

func (pl *Pipeline) FirstVizlet() Vizlet

FirstVizlet xxx

func (*Pipeline) GetVizlet

func (pl *Pipeline) GetVizlet(name string) Vizlet

GetVizlet xxx

func (*Pipeline) LastVizlet

func (pl *Pipeline) LastVizlet() Vizlet

LastVizlet xxx

type PlaybackEvent

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

PlaybackEvent is a time-tagged cursor or API event

type PressedNote

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

PressedNote is a currently active MIDI note

type Reactor

type Reactor struct {
	ParamsOfCategory map[string]*util.ParamValues
	MIDIFile         *util.MIDIFile
	// contains filtered or unexported fields
}

Reactor is an entity that that reacts to things (cursor events, apis) and generates output (midi, graphics). In Space Palette Pro, each pad has a Reactor

func NewReactor

func NewReactor(midiOutput util.MidiDevice, router *Engine, pad string, sidmin int, sidmax int) *Reactor

NewReactor makes a new Reactor

func (*Reactor) AddSprite

func (r *Reactor) AddSprite(s Sprite) error

AddSprite xxx

func (*Reactor) CanHandleCursor

func (r *Reactor) CanHandleCursor(ce *util.CursorEvent) bool

CanHandleCursor returns true if event handled by this Reactor

func (*Reactor) ExecuteIncomingCursor

func (r *Reactor) ExecuteIncomingCursor(ce *util.CursorEvent)

ExecuteIncomingCursor xxx

func (*Reactor) SetTargetVizlet

func (r *Reactor) SetTargetVizlet(viz Vizlet)

SetTargetVizlet xxx

type Sprite

type Sprite interface {
	Draw(*glhf.Shader)
	ID() string
	SpriteState() *SpriteState
	SpriteParams() *SpriteParams
	AdjustForAge(age float32)
}

Sprite xxx

type SpriteLine

type SpriteLine struct {
	Sprite
	State  *SpriteState
	Params *SpriteParams
}

SpriteLine xxx

func NewSpriteLine

func NewSpriteLine(x, y, z float32, params *util.ParamValues) *SpriteLine

NewSpriteLine xxx

func (*SpriteLine) Draw

func (s *SpriteLine) Draw(viz *VizletISF)

Draw xxx

func (*SpriteLine) SpriteParams

func (s *SpriteLine) SpriteParams() *SpriteParams

SpriteParams xxx

func (*SpriteLine) SpriteState

func (s *SpriteLine) SpriteState() *SpriteState

SpriteState xxx

type SpriteParams

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

SpriteParams xxx

func NewSpriteParams

func NewSpriteParams(params *util.ParamValues) *SpriteParams

NewSpriteParams xxx

type SpriteSquare

type SpriteSquare struct {
	Sprite
	State  *SpriteState
	Params *SpriteParams
}

SpriteSquare xxx

func NewSpriteSquare

func NewSpriteSquare(x, y, z float32, params *util.ParamValues) *SpriteSquare

NewSpriteSquare xxx

func (*SpriteSquare) Draw

func (s *SpriteSquare) Draw(shader *glhf.Shader)

Draw xxx

func (*SpriteSquare) SpriteParams

func (s *SpriteSquare) SpriteParams() *SpriteParams

SpriteParams xxx

func (*SpriteSquare) SpriteState

func (s *SpriteSquare) SpriteState() *SpriteState

SpriteState xxx

type SpriteState

type SpriteState struct {
	NoAging bool // if true, the Sprite doesn't age
	// contains filtered or unexported fields
}

SpriteState xxx

type SpriteVector

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

SpriteVector xxx

type TuioCursor

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

TuioCursor is a TUIO cursor, the main purpose being to know when it hasn't been seen for a while, to generate an UP event

type Vizlet

type Vizlet interface {
	Name() string
	DoVizlet() error
	OutputTexture() *glhf.Texture
	SetSpoutIn(string)
	SetSpoutOut(string)
	SetInputFromVizlet(Vizlet)
	AddSprite(Sprite) // Eventually this should go elsewhere, when cursor handling gets put into Vizlet interface
	AgeSprites()      // Ditto, when Vizlet interface starts handling click advance
	HandleStepCursorEvent(*util.CursorEvent)
}

Vizlet xxx

func NewVizletDrawer

func NewVizletDrawer(name string, isfname string, frame *glhf.Frame) (Vizlet, error)

NewVizletDrawer xxx

func NewVizletISF

func NewVizletISF(name string, isfname string, frame *glhf.Frame) (Vizlet, error)

NewVizletISF xxx

type VizletDrawer

type VizletDrawer struct {
	Vizlet
	// contains filtered or unexported fields
}

VizletDrawer is one Drawer shader within a Pipeline

func (*VizletDrawer) AddSprite

func (viz *VizletDrawer) AddSprite(s Sprite)

AddSprite xxx

func (*VizletDrawer) AgeSprites

func (viz *VizletDrawer) AgeSprites()

AgeSprites xxx

func (*VizletDrawer) DoVizlet

func (viz *VizletDrawer) DoVizlet() error

DoVizlet xxx

func (*VizletDrawer) DrawSprites

func (viz *VizletDrawer) DrawSprites()

DrawSprites xxx

func (*VizletDrawer) Height

func (viz *VizletDrawer) Height() int

Height xxx

func (*VizletDrawer) Name

func (viz *VizletDrawer) Name() string

Name xxx

func (*VizletDrawer) OutputTexture

func (viz *VizletDrawer) OutputTexture() *glhf.Texture

OutputTexture xxx

func (*VizletDrawer) SetInputFromVizlet

func (viz *VizletDrawer) SetInputFromVizlet(from Vizlet)

SetInputFromVizlet xxx

func (*VizletDrawer) SetSpoutIn

func (viz *VizletDrawer) SetSpoutIn(spoutin string)

SetSpoutIn xxx

func (*VizletDrawer) SetSpoutOut

func (viz *VizletDrawer) SetSpoutOut(spoutout string)

SetSpoutOut xxx

func (*VizletDrawer) Shader

func (viz *VizletDrawer) Shader() *glhf.Shader

Shader xxx

func (*VizletDrawer) Sprites

func (viz *VizletDrawer) Sprites() []Sprite

Sprites xxx

func (*VizletDrawer) Width

func (viz *VizletDrawer) Width() int

Width xxx

type VizletISF

type VizletISF struct {
	Vizlet
	// contains filtered or unexported fields
}

VizletISF is one ISF shader within a Pipeline

func (*VizletISF) DoVizlet

func (viz *VizletISF) DoVizlet() error

DoVizlet xxx

func (*VizletISF) Height

func (viz *VizletISF) Height() int

Height xxx

func (*VizletISF) Name

func (viz *VizletISF) Name() string

Name xxx

func (*VizletISF) OutputTexture

func (viz *VizletISF) OutputTexture() *glhf.Texture

OutputTexture xxx

func (*VizletISF) SetInputFromVizlet

func (viz *VizletISF) SetInputFromVizlet(from Vizlet)

SetInputFromVizlet xxx

func (*VizletISF) SetSpoutIn

func (viz *VizletISF) SetSpoutIn(spoutin string)

SetSpoutIn xxx

func (*VizletISF) SetSpoutOut

func (viz *VizletISF) SetSpoutOut(spoutout string)

SetSpoutOut xxx

func (*VizletISF) Shader

func (viz *VizletISF) Shader() *glhf.Shader

Shader xxx

func (*VizletISF) Width

func (viz *VizletISF) Width() int

Width xxx

Jump to

Keyboard shortcuts

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