util

package
v0.0.0-...-075f868 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoteOnStatus       byte = 0x90
	NoteOffStatus      byte = 0x80
	PressureStatus     byte = 0xa0
	ControllerStatus   byte = 0xb0
	ProgramStatus      byte = 0xc0
	ChanPressureStatus byte = 0xd0
	PitchbendStatus    byte = 0xe0
)

These are the values of MIDI status bytes

View Source
const MaxClicks = Clicks(math.MaxInt64)

MaxClicks is the high-possible value for Clicks

View Source
const UnfinishedDuration = math.MaxInt32 - 1

UnfinishedDuration is an 'unset' value for Duration

Variables

View Source
var DebugWorld = DebugFlags{
	MIDI:     false,
	API:      false,
	Loop:     false,
	Gen:      false,
	Realtime: false,
	OSC:      false,
	ISF:      false,
}

DebugWorld controls some debugging output

View Source
var DefaultFragmentShader = `
#version 330

uniform sampler2D tex;
uniform vec2 tjt;

in vec2 fragTexCoord;
in vec4 finalcolor;
in vec2 finaldebug;
in vec2 finaltjt;

out vec4 outputColor;

void main() {
	outputColor = finalcolor;
	// if ( finaldebug.x < 0.5 ) {
	// 	outputColor = texture(tex, fragTexCoord);
	// } else if ( finaldebug.x > 0.5 ) {
		outputColor.r = 0.0;
		outputColor.g = 0.8;
		outputColor.b = 0.0;
	outputColor = texture(tex, fragTexCoord);
	outputColor.r = 1.0;
	// }
}
` + "\x00"

DefaultFragmentShader is

View Source
var DefaultVertexShader = `
#version 330

uniform mat4 projection;
uniform vec4 color;
uniform vec4 misc;
uniform vec2 debug;

in vec3 vert;
in vec2 vertTexCoord;

out vec2 fragTexCoord;
out vec4 finalcolor;
out vec4 finalvert;
out int finaltype;
out vec2 finaldebug;

vec3 hsl2rgb( in vec3 c )
{
    vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );

    return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0));
}

vec3 HueShift (in vec3 Color, in float Shift)
{
    vec3 P = vec3(0.55735)*dot(vec3(0.55735),Color);
    
    vec3 U = Color-P;
    
    vec3 V = cross(vec3(0.55735),U);    

    Color = U*cos(Shift*6.2832) + V*sin(Shift*6.2832) + P;
    
    return vec3(Color);
}

vec3 rgb2hsl( in vec3 c ){
  float h = 0.0;
	float s = 0.0;
	float l = 0.0;
	float r = c.r;
	float g = c.g;
	float b = c.b;
	float cMin = min( r, min( g, b ) );
	float cMax = max( r, max( g, b ) );

	l = ( cMax + cMin ) / 2.0;
	if ( cMax > cMin ) {
		float cDelta = cMax - cMin;
        
        //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); Original
		s = l < .0 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
        
		if ( r == cMax ) {
			h = ( g - b ) / cDelta;
		} else if ( g == cMax ) {
			h = 2.0 + ( b - r ) / cDelta;
		} else {
			h = 4.0 + ( r - g ) / cDelta;
		}

		if ( h < 0.0) {
			h += 6.0;
		}
		h = h / 6.0;
	}
	return vec3( h, s, l );
}

vec3 rgb2hsv(vec3 c)
{
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

vec3 hsv2rgb(vec3 c)
{
    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

void main() {

	float angle = misc.x;
	float invsize = 1.0 / misc.y;
	float size = misc.y;
	float x = misc.z;
	float y = misc.w;

	fragTexCoord = vertTexCoord;
	finalvert = vec4(size*vert.x,size*vert.y,vert.z,1);
	if (angle != 0.0) {
		mat4 rotation = mat4(mat2(
			cos(angle), -sin(angle),
			sin(angle), cos(angle)));
		finalvert = finalvert * rotation;
	}
	finalvert.x += x;
	finalvert.y += y;

	gl_Position = projection * finalvert;

	vec4 mycolor = vec4(hsl2rgb(vec3(color.x,color.y,color.z)), color.a);
	finalcolor = mycolor;
	finaltype = 1;
	finaldebug = debug;
}
` + "\x00"

DefaultVertexShader is

View Source
var EffectsJSON map[string]interface{}

EffectsJSON is an unmarshalled version of the Effects.json file

View Source
var FragmentShader2 = `
#version 330

uniform sampler2D tex;
uniform vec2 tjt;

in vec2 fragTexCoord;
in vec4 finalcolor;
in vec2 finaldebug;
in vec2 finaltjt;

out vec4 outputColor;

void main() {
	outputColor = finalcolor;
	// if ( finaldebug.x < 0.5 ) {
	// 	outputColor = texture(tex, fragTexCoord);
	// } else if ( finaldebug.x > 0.5 ) {
		outputColor.r = 0.0;
		outputColor.g = 0.0;
		outputColor.b = 0.8;
	outputColor = texture(tex, fragTexCoord);
	outputColor.g = 1.0;
	// }
}
` + "\x00"

FragmentShader2 is

View Source
var LineVerticesForLines = []float32{

	0.0, 0.0, 1.0, 0.0, 0.0,
	1.0, 0.0, 1.0, 1.0, 0.0,
}

LineVerticesForLines is

View Source
var LineVerticesForLines2 = []float32{

	0.0, 0.0, 1.0, 0.0, 0.0,
	1.0, 0.0, 1.0, 1.0, 0.0,
}

LineVerticesForLines2 is

View Source
var PadSettings = map[string]PadSetting{
	"A": {Sidmin: 11000, Sidmax: 12999, Reslayer: 1},
}

PadSettings gives va;ies

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 Scales map[string]*Scale

Scales maps a name to a Scale

View Source
var SquareVerticesForLines = []float32{

	-1.0, -1.0, 1.0, 0.0, 0.0,
	1.0, -1.0, 1.0, 1.0, 0.0,

	1.0, -1.0, 1.0, 1.0, 0.0,
	1.0, 1.0, 1.0, 1.0, 1.0,

	1.0, 1.0, 1.0, 1.0, 1.0,
	-1.0, 1.0, 1.0, 0.0, 1.0,

	-1.0, 1.0, 1.0, 0.0, 1.0,
	-1.0, -1.0, 1.0, 0.0, 0.0,
}

SquareVerticesForLines is

View Source
var SquareVerticesForLines2 = []float32{

	-1.0, -1.0, 1.0, 0.0, 0.0,
	1.0, -1.0, 1.0, 1.0, 0.0,

	1.0, -1.0, 1.0, 1.0, 0.0,
	1.0, 1.0, 1.0, 1.0, 1.0,

	1.0, 1.0, 1.0, 1.0, 1.0,
	-1.0, 1.0, 1.0, 0.0, 1.0,

	-1.0, 1.0, 1.0, 0.0, 1.0,
	-1.0, -1.0, 1.0, 0.0, 0.0,
}

SquareVerticesForLines2 is

View Source
var SquareVerticiesForTriangles = []float32{

	-1.0, -1.0, 1.0, 1.0, 0.0,
	1.0, -1.0, 1.0, 0.0, 0.0,
	-1.0, 1.0, 1.0, 1.0, 1.0,
	1.0, -1.0, 1.0, 0.0, 0.0,
	1.0, 1.0, 1.0, 0.0, 1.0,
	-1.0, 1.0, 1.0, 1.0, 1.0,
}

SquareVerticiesForTriangles is

View Source
var SquareVerticiesForTriangles2 = []float32{

	-1.0, -1.0, 1.0, 1.0, 0.0,
	1.0, -1.0, 1.0, 0.0, 0.0,
	-1.0, 1.0, 1.0, 1.0, 1.0,
	1.0, -1.0, 1.0, 0.0, 0.0,
	1.0, 1.0, 1.0, 0.0, 1.0,
	-1.0, 1.0, 1.0, 1.0, 1.0,
}

SquareVerticiesForTriangles2 is

View Source
var VertexShader2 = `
#version 330

uniform mat4 projection;
uniform vec4 color;
uniform vec4 misc;
uniform vec2 debug;

in vec3 vert;
in vec2 vertTexCoord;

out vec2 fragTexCoord;
out vec4 finalcolor;
out vec4 finalvert;
out int finaltype;
out vec2 finaldebug;

vec3 hsl2rgb( in vec3 c )
{
    vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );

    return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0));
}

vec3 HueShift (in vec3 Color, in float Shift)
{
    vec3 P = vec3(0.55735)*dot(vec3(0.55735),Color);
    
    vec3 U = Color-P;
    
    vec3 V = cross(vec3(0.55735),U);    

    Color = U*cos(Shift*6.2832) + V*sin(Shift*6.2832) + P;
    
    return vec3(Color);
}

vec3 rgb2hsl( in vec3 c ){
  float h = 0.0;
	float s = 0.0;
	float l = 0.0;
	float r = c.r;
	float g = c.g;
	float b = c.b;
	float cMin = min( r, min( g, b ) );
	float cMax = max( r, max( g, b ) );

	l = ( cMax + cMin ) / 2.0;
	if ( cMax > cMin ) {
		float cDelta = cMax - cMin;
        
        //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); Original
		s = l < .0 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
        
		if ( r == cMax ) {
			h = ( g - b ) / cDelta;
		} else if ( g == cMax ) {
			h = 2.0 + ( b - r ) / cDelta;
		} else {
			h = 4.0 + ( r - g ) / cDelta;
		}

		if ( h < 0.0) {
			h += 6.0;
		}
		h = h / 6.0;
	}
	return vec3( h, s, l );
}

vec3 rgb2hsv(vec3 c)
{
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

vec3 hsv2rgb(vec3 c)
{
    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

void main() {

	float angle = misc.x;
	float invsize = 1.0 / misc.y;
	float size = misc.y;
	float x = misc.z;
	float y = misc.w;

	fragTexCoord = vertTexCoord;
	finalvert = vec4(size*vert.x,size*vert.y,vert.z,1);
	if (angle != 0.0) {
		mat4 rotation = mat4(mat2(
			cos(angle), -sin(angle),
			sin(angle), cos(angle)));
		finalvert = finalvert * rotation;
	}
	finalvert.x += x;
	finalvert.y += y;

	gl_Position = projection * finalvert;

	vec4 mycolor = vec4(hsl2rgb(vec3(color.x,color.y,color.z)), color.a);
	finalcolor = mycolor;
	finaltype = 1;
	finaldebug = debug;
}
` + "\x00"

VertexShader2 is

Functions

func BinDir

func BinDir() string

BinDir is where executables are

func BinFilePath

func BinFilePath(nm string) string

BinFilePath is

func ClearExternalScale

func ClearExternalScale()

ClearExternalScale is

func ErrorResponse

func ErrorResponse(err error, id string) string

ErrorResponse return a JSON 2.0 error response

func GetBool

func GetBool(paramvalues *map[string]string, name string) (bool, error)

GetBool complains if a parameter is not there, but still returns false

func GetFloat

func GetFloat(paramvalues *map[string]string, name string) (float32, error)

GetFloat returns an error if the parameter is not there

func GetInt

func GetInt(paramvalues *map[string]string, name string) (int, error)

GetInt throws an error if the parameter is not there

func GetMorphArgs

func GetMorphArgs(name string) ([]string, error)

GetMorphArgs is

func GetRequest

func GetRequest(conn *websocket.Conn) (method, params, id string, err error)

GetRequest reads a JSON request from a websocket

func GetString

func GetString(paramvalues *map[string]string, name string) (string, error)

GetString complains if a parameter is not there, but still returns ""

func ISFFilePaths

func ISFFilePaths(nm string) (string, string)

ISFFilePaths is

func IsTrueValue

func IsTrueValue(value string) bool

IsTrueValue returns true if the value is some version of true

func LoadEffectsJSON

func LoadEffectsJSON()

LoadEffectsJSON returns an unmarshalled version of the Effects.json file

func LoadImage

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

LoadImage reads an image file

func LoadParamDefs

func LoadParamDefs() error

LoadParamDefs initializes the list of parameters

func LoadParamEnums

func LoadParamEnums()

LoadParamEnums initializes the list of enumerated parameter values

func MidiFilePath

func MidiFilePath(nm string) string

MidiFilePath is

func ParamValueMap

func ParamValueMap(params string) (*map[string]string, error)

ParamValueMap takes a JSON string and returns a map of elements

func ParseBool

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

ParseBool is

func ParseFloat32

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

ParseFloat32 is

func ParseInt

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

ParseInt is

func ReadVizUsers

func ReadVizUsers() error

ReadVizUsers reads the users database and returns it all

func RecordingsFilePath

func RecordingsFilePath(nm string) string

RecordingsFilePath is

func ResultResponse

func ResultResponse(resultObj interface{}, id string) string

ResultResponse returns a JSON 2.0 result response

func SendErrorResponse

func SendErrorResponse(conn *websocket.Conn, rpcerr error, id string)

SendErrorResponse sends a JSON 2.0 response

func SendResponse

func SendResponse(conn *websocket.Conn, result string, err error, id string)

SendResponse sends a JSON 2.0 response

func SendResultResponse

func SendResultResponse(conn *websocket.Conn, result string, id string)

SendResultResponse sends a JSON 2.0 response

func SetExternalScale

func SetExternalScale(pitch int, on bool)

SetExternalScale is

func VenueDir

func VenueDir() string

VenueDir is

func VenueFilePath

func VenueFilePath(nm string) string

VenueFilePath is

func VizDir

func VizDir() string

VizDir is the root

func WorldDir

func WorldDir() string

WorldDir is

func WorldFilePath

func WorldFilePath(nm string) string

WorldFilePath is

func WriteUsers

func WriteUsers() error

WriteUsers writes out all users data. Assumes the caller has done the mutex.

Types

type APIEvent

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

APIEvent is an API invocation

type ActivePhrase

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

ActivePhrase is a currently active MIDI phrase

func NewActivePhrase

func NewActivePhrase(p *Phrase) *ActivePhrase

NewActivePhrase constructs a new ActivePhrase for a Phrase

type ActivePhrasesManager

type ActivePhrasesManager struct {
	ActivePhrasesMutex sync.RWMutex
	// contains filtered or unexported fields
}

ActivePhrasesManager manages ActivePhrases

func NewActivePhrasesManager

func NewActivePhrasesManager(mididevice MidiDevice) *ActivePhrasesManager

NewActivePhrasesManager is

func (*ActivePhrasesManager) AdvanceActivePhrasesByOneStep

func (mgr *ActivePhrasesManager) AdvanceActivePhrasesByOneStep()

AdvanceActivePhrasesByOneStep is

func (*ActivePhrasesManager) CallbackOnOutput

func (mgr *ActivePhrasesManager) CallbackOnOutput(callback NoteOutputCallbackFunc) CallbackID

CallbackOnOutput is

func (*ActivePhrasesManager) StartPhrase

func (mgr *ActivePhrasesManager) StartPhrase(p *Phrase, cid string)

StartPhrase is NOTE: startPhrase assumes that the r.activePhrasesMutex is held for writing

func (*ActivePhrasesManager) StopPhrase

func (mgr *ActivePhrasesManager) StopPhrase(cid string, active *ActivePhrase, forceDelete bool)

StopPhrase is NOTE: stopPhrase assumes that the r.activePhrasesMutex is held for writing

func (*ActivePhrasesManager) UncallbackOnOutput

func (mgr *ActivePhrasesManager) UncallbackOnOutput(id CallbackID)

UncallbackOnOutput is

type Alg

type Alg interface {
	// Draw(pl *Pipeline)
	// ID() string
	// State() SpriteState
	// Params() *SpriteParams
	// AdjustForAge(secs float32)
	CanHandleCursor(ce *CursorEvent) bool
	ExecuteIncomingCursor(ce *CursorEvent)
}

Alg is

type AlgDefault

type AlgDefault struct {
	Alg
}

AlgDefault is an Alg that does nothing

type AlgMaze

type AlgMaze struct {
	Alg
}

AlgMaze is an Alg that manages a maze

type CallbackID

type CallbackID int

CallbackID is

type Clicks

type Clicks int64

Clicks is a time or duration value. It is NOT MIDI clock. NOTE: A Clicks value for a Note can be negative because it's relative to the starting time of a Phrase

type CursorEvent

type CursorEvent struct {
	ID         string // of the form {sessionid}@{IP}
	X          float32
	Y          float32
	Z          float32
	Downdragup string
	LoopsLeft  int
	Fresh      bool
	Quantized  bool
}

CursorEvent is a down, drag, or up event inside a loop step

type DebugFlags

type DebugFlags struct {
	MIDI     bool
	API      bool
	Loop     bool
	Gen      bool
	Realtime bool
	OSC      bool
	ISF      bool
}

DebugFlags is

var DebugUtil DebugFlags // default is no debugging, all false

DebugUtil controls debugging

type Guest

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

Guest is

type LoopEvent

type LoopEvent struct {
	CursorEvent *CursorEvent
}

LoopEvent is what gets played back in a loop

type MIDIFile

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

MIDIFile lets you read a MIDI File

func NewMIDIFile

func NewMIDIFile(path string) (*MIDIFile, error)

NewMIDIFile creates a MIDIFile

func (*MIDIFile) Parse

func (m *MIDIFile) Parse() error

Parse reads the contents of a MIDIFile and creates Phrases for each track

func (*MIDIFile) Phrase

func (m *MIDIFile) Phrase() *Phrase

Phrase returns a single Phrase containing all tracks in the MIDIFile

type MidiDevice

type MidiDevice interface {
	Inputs() []string
	ListeningInputs() []string
	Outputs() []string
	SendNote(note *Note, debug bool, callbacks []*NoteOutputCallback)
	SendANO(outputName string) // lame
	ReadEvent(inputName string) (MidiEvent, error)
	Poll(inputName string) (bool, error)
	Listen(inputName string) error
}

MidiDevice mediates all access to MIDI devices

type MidiEvent

type MidiEvent struct {
	Timestamp int64
	Status    int64
	Data1     int64
	Data2     int64
}

MidiEvent is a single MIDI event

type MorphDef

type MorphDef struct {
	Name string   `json:"name"`
	Args []string `json:"args"`
}

MorphDef gives the command-line parameters to start monitoring a Morph

func MorphDefs

func MorphDefs() ([]MorphDef, error)

MorphDefs is

type Note

type Note struct {
	TypeOf   NoteType // NOTE, NOTEON, NOTEOFF, NOTEBYTES
	Clicks   Clicks   // nanoseconds
	Duration Clicks   // nanoseconds, when it's a NOTE
	// Channel  uint8    // MIDI Channel 1-based, 0 if not set?
	Pitch    uint8 // 0-127
	Velocity uint8 // 0-127
	Synth    string
	// contains filtered or unexported fields
}

Note is a single item in a Phrase

func NewNote

func NewNote(synth string, pitch uint8, velocity uint8, duration Clicks) *Note

NewNote creates a Note with a Duration

func NewNoteOff

func NewNoteOff(synth string, pitch uint8, velocity uint8) *Note

NewNoteOff creates a new NOTEOFF

func NewNoteOn

func NewNoteOn(synth string, pitch uint8, velocity uint8) *Note

NewNoteOn createx a new NOTEON

func (*Note) Compare

func (n *Note) Compare(n2 *Note) int

Compare is used to determine Note ordering

func (*Note) Copy

func (n *Note) Copy() *Note

Copy a Note. NOTE: the next value is cleared

func (*Note) EndOf

func (n *Note) EndOf() Clicks

EndOf returns the ending time of a note

func (*Note) Format

func (n *Note) Format(f fmt.State, c rune)

Format lets you conveniently print a Note with fmt functions

func (*Note) IsNote

func (n *Note) IsNote() bool

IsNote returns true if the note is a NOTE, NOTEON, or NOTEOFF

func (*Note) ReadablePitch

func (n *Note) ReadablePitch() string

ReadablePitch returns a readable string for a note pitch Note that it also includes a + or - if it's a NOTEON or NOTEOFF. If it's not a NOTE-type note, "" is returned

func (*Note) ToString

func (n *Note) ToString() string

ToString produces a human-readable version of a Note. Note that it includes the surrounding quotes that make it look like a Phrase

type NoteOutputCallback

type NoteOutputCallback struct {
	Callback func(n *Note)
	// contains filtered or unexported fields
}

NoteOutputCallback is a call

type NoteOutputCallbackFunc

type NoteOutputCallbackFunc func(n *Note)

NoteOutputCallbackFunc is

type NoteType

type NoteType int

NoteType is NOTE, NOTEON, NOTEOFF, or NOTEBYTES

const (
	// Values match keykit, make it easier to debug
	NOTE      NoteType = 2 // full note with duration
	NOTEON    NoteType = 4
	NOTEOFF   NoteType = 8
	NOTEBYTES NoteType = 1
)

These are the constant values of NoteType

type PadSetting

type PadSetting struct {
	Sidmin, Sidmax int
	Reslayer       int // Resolume layer number
	ResolumePort   int // OSC
}

PadSetting specifies a range of sid (session IDs from TUIO)

type ParamCallback

type ParamCallback func(name string, value string) error

ParamCallback is the callback when setting parameter values

type ParamDef

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

ParamDef is a single parameter definition.

type ParamValue

type ParamValue interface{}

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

NewParamValues creates a new ParamValues

func (*ParamValues) ParamBoolValue

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

ParamBoolValue is

func (*ParamValues) ParamFloatValue

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

ParamFloatValue is

func (*ParamValues) ParamIntValue

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

ParamIntValue is

func (*ParamValues) ParamStringValue

func (vals *ParamValues) ParamStringValue(name string) string

ParamStringValue is

func (*ParamValues) SetParamValue

func (vals *ParamValues) SetParamValue(nm string, v ParamValue)

SetParamValue is

func (*ParamValues) SetParamValueWithString

func (vals *ParamValues) SetParamValueWithString(name, value string, callback ParamCallback) error

SetParamValueWithString is

type Phrase

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

Phrase is a time-ordered list of Notes which are MIDI messages and other realtime events).

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) Append

func (p *Phrase) Append(n *Note)

Append appends a note to the end of a Phrase, assuming that the last note in the Phrase is before or at the same time as tne appended note.

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(n *Note) *Note

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

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) Format

func (p *Phrase) Format(f fmt.State, c rune)

Format lets you conveniently print a Phrase with fmt functions

func (*Phrase) InsertNoLock

func (p *Phrase) InsertNoLock(note *Note) *Phrase

InsertNoLock adds a Note to a Phrase

func (*Phrase) InsertNote

func (p *Phrase) InsertNote(nt *Note) *Phrase

InsertNote inserts a note into a Phrase NOTE: it's assumed that the Phrase is already locked for writing.

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) NumNotes

func (p *Phrase) NumNotes() int

NumNotes returns the number of notes in a Phrase

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) ToString

func (p *Phrase) ToString() string

ToString returns a human-readable version of a 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 Recording

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

Recording is

type Remote

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

Remote represents a remote Viz thing, either an engine or hub

func NewRemote

func NewRemote(name, addr string) *Remote

NewRemote returns a Remote for the given address

func (*Remote) CheckConnection

func (r *Remote) CheckConnection(verbose bool) bool

CheckConnection returns true if the connection is respondig

func (*Remote) DoLogin

func (r *Remote) DoLogin(user, password string, verbose bool) (err error)

DoLogin logs in on a websocket connection

func (*Remote) InvokeAPI

func (r *Remote) InvokeAPI(method string, params string, verbose bool) (result string, err error)

InvokeAPI does an API on an already-connected websocket This version assumes the "result" is a string, rather than an object

func (*Remote) SetUser

func (r *Remote) SetUser(user, password string)

SetUser sets login info for the connection

type Scale

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

Scale says whether a pitch is in a scale

func GetScale

func GetScale(name string) *Scale

GetScale is

func (*Scale) ClosestTo

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

ClosestTo is

type Step

type Step struct {
	Events []*LoopEvent
}

Step is one step of one loop in the looper

type StepLoop

type StepLoop struct {
	CurrentStep Clicks
	Length      Clicks
	Steps       []*Step
}

StepLoop is one loop

func NewLoop

func NewLoop(nclicks Clicks) *StepLoop

NewLoop allocates and adds a new steploop

func (*StepLoop) AddToStep

func (loop *StepLoop) AddToStep(ce *CursorEvent, stepnum Clicks, debug bool)

AddToStep adds a StepItem to the loop at the current step

func (*StepLoop) Clear

func (loop *StepLoop) Clear()

Clear removes everything from Loop

func (*StepLoop) ClearID

func (loop *StepLoop) ClearID(id string)

ClearID removes all cursorEvents with a given id

func (*StepLoop) SetLength

func (loop *StepLoop) SetLength(nclicks Clicks)

SetLength changesthe length of a loop

type Venue

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

Venue is

func (*Venue) FeedMeEventsLive

func (rm *Venue) FeedMeEventsLive(callback VenueEventCallback)

FeedMeEventsLive is

func (*Venue) VenueCheckin

func (rm *Venue) VenueCheckin(email string) error

VenueCheckin is

type VenueEventCallback

type VenueEventCallback func(n *Note)

VenueEventCallback is

type VizColor

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

VizColor is

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

type VizEvent

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

VizEvent is

type VizUser

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

VizUser is

func (*VizUser) GetEmail

func (u *VizUser) GetEmail() string

GetEmail is

func (*VizUser) GetID

func (u *VizUser) GetID() interface{}

GetID is

func (*VizUser) GetPasswordHash

func (u *VizUser) GetPasswordHash() []byte

GetPasswordHash is

func (*VizUser) GetPasswordToken

func (u *VizUser) GetPasswordToken() (string, time.Time)

GetPasswordToken is

func (*VizUser) GetRoles

func (u *VizUser) GetRoles() []string

GetRoles is

func (*VizUser) GetState

func (u *VizUser) GetState() int

GetState is

func (*VizUser) GetVerificationID

func (u *VizUser) GetVerificationID() (string, time.Time)

GetVerificationID is

func (*VizUser) SetEmail

func (u *VizUser) SetEmail(email string)

SetEmail is

func (*VizUser) SetID

func (u *VizUser) SetID(id interface{})

SetID is

func (*VizUser) SetPasswordHash

func (u *VizUser) SetPasswordHash(hash []byte)

SetPasswordHash is

func (*VizUser) SetPasswordToken

func (u *VizUser) SetPasswordToken(id string, created time.Time)

SetPasswordToken is

func (*VizUser) SetState

func (u *VizUser) SetState(state int)

SetState is

func (*VizUser) SetVerificationID

func (u *VizUser) SetVerificationID(id string, created time.Time)

SetVerificationID is

type World

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

World is

func StartWorld

func StartWorld(name string, addr string) *World

StartWorld is

func (*World) AddVenue

func (h *World) AddVenue(name string, engine string) (*Venue, error)

AddVenue is

func (*World) GetVenue

func (h *World) GetVenue(name string) *Venue

GetVenue is

func (*World) GetVenueFromParameter

func (h *World) GetVenueFromParameter(method string, pmap map[string]string, create bool) (*Venue, error)

GetVenueFromParameter is

func (*World) Venues

func (h *World) Venues() map[string]*Venue

Venues is

func (*World) WaitTillDone

func (h *World) WaitTillDone()

WaitTillDone is

Jump to

Keyboard shortcuts

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