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: 6 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

This section is empty.

Variables

This section is empty.

Functions

func DecodeBinaryString

func DecodeBinaryString(r io.Reader, n int) (string, error)

DecodeBinaryString reads n bytes from r and extracts the string from those bytes. It therefore determines the first occurence of a nullbyte, which terminates the string.

Types

type Header struct {
	Identifier  [identifierLen]byte
	PayloadSize int64 //Size of Payload in bytes (excluding Header)
}

Header contains those information that are contained in a .splice file that are not part of the Payload.

type Pattern

type Pattern struct {
	Header  Header
	Payload Payload
}

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 Payload

type Payload struct {
	Version string
	Tempo   float32
	Tracks  []Track
}

Payload contains the actual Payload contained in a .splice file.

type Track

type Track struct {
	ID    int32
	Name  string
	Steps []int8
}

Track is part of the Payload of a .splice file.

func (*Track) String

func (t *Track) String() string

Jump to

Keyboard shortcuts

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