Documentation ¶
Overview ¶
Package drum is supposed to implement the decoding of .splice drum machine files. See golang-challenge.com/go-challenge1/ for more information
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern is the high level representation of the drum pattern contained in a .splice file.
func DecodeFile ¶
DecodeFile decodes the drum machine file found at the provided path and returns a pointer to a parsed pattern which is the entry point to the rest of the data.
type PatternHeader ¶
type PatternHeader struct { Version [32]byte Tempo float32 // contains filtered or unexported fields }
A PatternHeader refers to the boilerplate above the musical notes in a pattern file.
func (*PatternHeader) GetTempo ¶
func (ph *PatternHeader) GetTempo() Tempo
GetTempo returns a Tempo.
func (*PatternHeader) GetVersion ¶
func (ph *PatternHeader) GetVersion() Version
GetVersion returns a Version which has been parsed and trimmed for further consumption.
type PatternHeaderParser ¶
type PatternHeaderParser struct{}
A PatternHeaderParser is responsible for parsing a PatternHeader.
func NewPatternHeaderParser ¶
func NewPatternHeaderParser() *PatternHeaderParser
NewPatternHeaderParser creates and returns a PatternHeaderParser.
func (*PatternHeaderParser) Parse ¶
func (php *PatternHeaderParser) Parse(b []byte) (PatternHeader, error)
Parse returns a parsed PatternHeader given a valid byte slice.
type PatternParser ¶
type PatternParser struct {
// contains filtered or unexported fields
}
A PatternParser is responsible for parsing the individual pieces of a pattern file.
func NewPatternParser ¶
func NewPatternParser() *PatternParser
NewPatternParser returns an initialized PatternParser.
type PatternReader ¶
type PatternReader struct {
// contains filtered or unexported fields
}
A PatternReader reads a file and takes the appropriate actions to begin parsing.
func NewPatternReader ¶
func NewPatternReader(filePath string) *PatternReader
NewPatternReader creates and returns a PatternReader given a file path to a pattern file.
func (*PatternReader) Read ¶
func (pr *PatternReader) Read() (*Pattern, error)
Read pulls in a file and starts the parsing process, returning a complete Pattern if successful.
type PatternTracksParser ¶
type PatternTracksParser struct{}
A PatternTracksParser is responsible for parsing the musical section of a pattern file.
func NewPatternTracksParser ¶
func NewPatternTracksParser() *PatternTracksParser
NewPatternTracksParser creates and returns a PatternTracksParser.
func (*PatternTracksParser) Parse ¶
func (ptp *PatternTracksParser) Parse(b []byte) Tracks
Parse parses the given byte slice and returns a list of found tracks.
type Steps ¶
type Steps struct {
Bars [4]Bar
}
Steps refers to a collection of bars combined to create a track.
type Tempo ¶
type Tempo float64
A Tempo is the number of beats-per-minute used when playing tracks from a given pattern.