drum

package
v0.0.0-...-e04bdec Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2015 License: BSD-3-Clause Imports: 5 Imported by: 0

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

View Source
const (
	TRACK_PADDING  = 3  // padding size used inside track data
	HEADER_PADDING = 12 // initial header padding
)

Variables

This section is empty.

Functions

func EncodeFile

func EncodeFile(pattern *Pattern, path string) error

EncodeFile encode the drum pattern to a file path specified in the argument

func NewDecoder

func NewDecoder(r io.ReadSeeker) *decoder

NewDecoder return a new decoder with the buffer specified.

Types

type HeaderInfo

type HeaderInfo struct {
	Size    uint16
	Version [32]byte
	Tempo   tempo
}

HeaderInfo contains header information of the .splice file.

func (HeaderInfo) String

func (h HeaderInfo) String() string

String returns the printable text of HeaderInfo.

type Pattern

type Pattern struct {
	Header HeaderInfo
	Tracks []Track
}

Pattern is the high level representation of the drum pattern contained in a .splice file.

func DecodeFile

func DecodeFile(path string) (*Pattern, error)

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

func (p Pattern) String() string

String returns the printable text of Pattern.

type Track

type Track struct {
	ID    uint8
	Name  []byte
	Steps [16]byte
}

Track represent a single track in a drum file.

func (Track) String

func (t Track) String() string

String returns the printable text of Track.

Jump to

Keyboard shortcuts

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