Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arg ¶
Arg represents the various knobs and dials and twiddles on a synth module, and the value it should be set to, such as `Volume: 11` on a mixer module
type DoubledUpJacksError ¶
type DoubledUpJacksError struct {
// contains filtered or unexported fields
}
DoubledUpJacksError returns when one or more jacks exist in many patches yet shouldn't.
This error may be incorrect for a number of reasons, including:
- Not all jacks on a module have a unique name, such as the sequencer on a POM-400
- You're using a stacking jack, or a splitter, or a multiplier
In these instances the solution is to:
- Artificially number each jack, like 'output1', 'output2'
- Set `StackedPatches: true` in the synthdown.ValidationConfiguration struct
passed to (SynthdownFile).Validate()
func (DoubledUpJacksError) Error ¶
func (e DoubledUpJacksError) Error() string
Error returns a message indicating the number of errors found, plus the location of each individual error
type FirstPatchHasInputError ¶
type FirstPatchHasInputError struct {
// contains filtered or unexported fields
}
FirstPatchHasInputError is an error signifying that the patch starts with an input, which is a logical absurdity; if it has an input from _somewhere_ then it cannot be the start of a patch unless it plugs into its self, or is a snippet.
Neither of which are supported, and wont be until we suddenly realise it should be
func (FirstPatchHasInputError) Error ¶
func (e FirstPatchHasInputError) Error() string
Error satisifies the `error` interface, returning a message explaining where the errant initial input lives
type LastPatchHasOutputError ¶
type LastPatchHasOutputError struct {
// contains filtered or unexported fields
}
LastPatchHasOutputError is an error signifying that the patch starts with an output, which is a logical absurdity; if it has an output from _somewhere_ then it cannot be the start of a patch unless it plugs into its self, or is a snippet.
Neither of which are supported, and wont be until we suddenly realise it should be
func (LastPatchHasOutputError) Error ¶
func (e LastPatchHasOutputError) Error() string
Error satisifies the `error` interface, returning a message explaining where the errant initial output lives
type MissingInputError ¶
type MissingInputError struct {
// contains filtered or unexported fields
}
MissingInputError is raised where a module should have an input, but doesn't
func (MissingInputError) Error ¶
func (e MissingInputError) Error() string
Error returns an explanation of which module is missing an input jack
type MissingOutputError ¶
type MissingOutputError struct {
// contains filtered or unexported fields
}
MissingOutputError is raised where a module should have an output, but doesn't
func (MissingOutputError) Error ¶
func (e MissingOutputError) Error() string
Error returns an explanation of which module is missing an output jack
type Module ¶
type Module struct { Pos lexer.Position Input *Jack `parser:"@@?"` Name string `parser:"@Ident"` Args []Arg `parser:"'[' @@* (',' @@)* ']'"` Output *Jack `parser:"@@?"` }
Module represents a modular synthesiser 'module', such as a Square Wave generator, or an Envelope Filter.
Modules contain:
- An input- an audio or control voltage jack (except the first module in a patch which mustn't contain an input)
- A name for the module (so 'Sine', or 'VCA', or whatever)
- Arguments, such as A/D/S/R for an Envelope
- An output jack (except the last module which must omit the final output)
This, effectively, allows us to represent the pertinent information to draw a patch diagram
type Patch ¶
Patch represents a set of modules cabled together from jack to jack which hopefully makes an interesting noise
type SynthdownFile ¶
SynthdownFile contains a list of Patches, which describe how modular synth modules are wired to one another.
func New ¶
func New(fn string) (p *SynthdownFile, err error)
New takes a filename containing, hopefully, valid synthdown notation. It returns a SynthdownFile type when such a file is found, or one of a series of errors, including:
- `fs.ErrNotExist` - the specified file does not exist
- `*participle.UnexpectedTokenError` - the synthdown notation is invalid
- `FirstPatchHasInputError` - the first module in a patch has an input, which is an absurdity
func (SynthdownFile) Validate ¶
func (sf SynthdownFile) Validate(config *ValidationConfiguration) (err error)
Validate runs through a fully read synthdown file in order to:
- Run Patch.Validate() on each patch
- Ensure inputs and outputs aren't reused
Note: checking input/ output reuse can be disabled when multipliers and/or stacking patch cables are used. See the configuration struct passed to this function for more information
type ValidationConfiguration ¶
type ValidationConfiguration struct { // StackedPatches implies the use of multipliers/ splitter // cables/ stacking plugs which allows us to, effectively, // reuse input/output jacks on a module StackedPatches bool }
ValidationConfiguration holds options for enabling/ disabling certain validation options.
The default behaviour of any validation is to enable _every_ validation, which is why this struct is only ever passed as a reference.
type Value ¶
type Value struct { Str *string `parser:"@String"` Float *float64 `parser:"| @Float"` Int *int `parser:"| @Int"` }
Value represents, typically, the value part of an arg. Or, for example, the `3` in the args `[A: 3]`.
Because an argument can typically be an integer, float, or a string we must support each type.
The zero value (ie: when none of the inner values are set) is a 0