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 ¶
func EncodeFile ¶
EncodeFile writes the binary encoding of pattern to a file named filename.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reads and decodes drum machine object fron an input stream.
func NewDecoder ¶
NewDecoder returns a new decoder that reads from r.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder writes binary-encoded Pattern to output stream.
func NewEncoder ¶
NewEncoder returns a new encoder that writes to w.
type Pattern ¶
type Pattern struct { // Pattern version information. Padding bytes are removed during UnmarshalBinary. Version string // Pattern tempo. Tempo float32 // Pattern tracks. Tracks []*Track // contains filtered or unexported fields }
Pattern is the high level representation of the drum pattern.
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.
func (*Pattern) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler.
func (*Pattern) TracksString ¶
TracksString repesents string of Pattern.Tracks.
func (*Pattern) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
type Steps ¶
type Steps [16]byte
Steps represents 16 steps in a pattern. A byte 0x01 means a sound being triggered, while 0x00 means no sound being played for that step. In string, 0x00 is represented with '-' and 0x01 is represented with 'x'.
type Track ¶
Track represents a single track in a pattern.
func (*Track) MarshalBinary ¶
MarshalBinary implements the binary.BinaryMarshaler.
func (*Track) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.