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

README

This is Gautam Dey's entry to the Go Challenge #1. Gautam Deygautam.dey77@gmail.com

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 (
	// The byte location of the content size
	ContentSizeLoc = 13
	// How big is each step in the system
	StepSize = 16

	// Size of the Version block in bytes
	VersionBlockSize = 32
)
View Source
const Header string = "SPLICE"

Header is the SPLICE magic number to indicate that the file is a splice file.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pattern

type Pattern struct {
	// Version of the Hardware the this pattern was saved on
	Version string
	// Tempo is the Beats per minute that the pattern should be played at
	Tempo float32
	// Tracks of the Pattern for each instrument
	Tracks Tracks
}

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

type Track

type Track struct {
	// Steps are when the beat needs to be played.
	Steps [StepSize]bool
	// The name of the Instrument Track
	Name string
	// The Id of the Track
	Id int
}

Tracks is a representation of the tracks contained in a Pattern

func (*Track) Decode

func (t *Track) Decode(r *bytes.Buffer) error

func (*Track) String

func (t *Track) String() string

type Tracks

type Tracks []*Track

func (Tracks) String

func (t Tracks) String() string

Jump to

Keyboard shortcuts

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