Documentation ¶
Index ¶
Constants ¶
const LineTick = lineTick(false)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { // Perform acts on the given message and returns the result. // To allow note producing transformers, // Perform is called on every tick and // when there is no message on the tick, the message is LineTick. // This way the action can return messages on every tick // (if it wants to). Use case would be a looper or a metronome. Perform(Context, midi.Message) midi.Message }
Action acts on MIDI messages.
type ActionFunc ¶
type Condition ¶
type Condition interface { // IsMet returns whether the condition is met by the given midi.Message IsMet(msg midi.Message) bool }
Condition for a midi.Message
type ConditionFunc ¶
type Context ¶
type Context interface { // Resolution returns the ticks of a quarternote Resolution() uint32 // Tick returns the current absolute tick since the beginning Tick() uint64 // Track returns the current track // needed for SMF writers Track() uint32 // Bar returns the current bar number Bar() uint32 // Beat returns the current beat in 16ths distances of the start of the current bar Beat() uint8 // TempoBPM returns the current tempo in fractional BPM // needed for SMF writers TempoBPM() float64 // TimeSignature returns the current time signature // needed for SMF writers TimeSig() (num, denom uint8) // Schedule schedules the given message deltaticks in the future from now Schedule(deltaTicks uint32, msg midi.Message) }
type DuplicatedLineError ¶
type DuplicatedLineError string
func (DuplicatedLineError) Error ¶
func (e DuplicatedLineError) Error() string
func (DuplicatedLineError) LineName ¶
func (e DuplicatedLineError) LineName() string
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line has a slice of actions that will be called in order when the Run method is called.
type LineEmbeddingLoopError ¶
type LineEmbeddingLoopError string
func (LineEmbeddingLoopError) Error ¶
func (e LineEmbeddingLoopError) Error() string
func (LineEmbeddingLoopError) LoopPath ¶
func (e LineEmbeddingLoopError) LoopPath() string
type MultiMessage ¶
MultiMessage is a helper pseudo midi.Message that wraps multiple midi messages that should be sent at the same time. It can be returned from a callback to be able to make multiple midi messages from single ones.
func (MultiMessage) Raw ¶
func (m MultiMessage) Raw() []byte
Raw will panic if called. It must not be called and only exist to fullfill the midi.Message interface.
func (MultiMessage) String ¶
func (m MultiMessage) String() string
String inspects the MultiMessage for debugging
type PerformOption ¶
type PerformOption func(*performanceCxt)
func LogOutput ¶
func LogOutput() PerformOption
func PerformReaderOptions ¶
func PerformReaderOptions(opts ...mid.ReaderOption) PerformOption
PerformReaderOptions passes the given options (set/unset logging etc.) through to the mid.Reader that receives the midi messages before running through the Stack.
func StdErr ¶
func StdErr(w io.Writer) PerformOption
func StdOut ¶
func StdOut(w io.Writer) PerformOption
type Runner ¶
type Runner interface { // Run starts the engines and returns a stop channel // that a stop message can be send to and an error if it could not run successfully Run(*Line) (stop chan<- bool, err error) }
func Connect ¶
Connect returns a Runner that reads MIDI messages from the in port and writes them to the out port after they have been processed by the stack.
func ConnectSlim ¶
func Link ¶
func Link(inFile, outFile string, opts ...mid.ReaderOption) Runner
Link returns a Runner that reads MIDI messages from the SMF inFile writes them to the SMF outFile, after they have been processed by the stack.