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 ¶
const (
DrumVersion string = "0.616-alpha"
)
const (
SoundPath string = "sounds/"
)
Variables ¶
This section is empty.
Functions ¶
func EncodePattern ¶
EncodePattern encodes the pattern to binary format and saves it to a file. Pretty much the opposite of `DecodeFile`.
Types ¶
type Pattern ¶
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.
func (*Pattern) ClearSteps ¶
func (p *Pattern) ClearSteps()
Turn off all the steps of the Pattern (but keeps everything else intact).
type Player ¶
type Player struct { Sounds []*mix.Chunk Shuffle float64 // contains filtered or unexported fields }
A Player plays back a Pattern using the provided WAV files and SDL2.
func (*Player) AddCallback ¶
Add a callback function to be called on each step.
func (*Player) Free ¶
func (pl *Player) Free()
Frees all the chunks (loaded WAVs) and closes the SDL-mixer.
func (*Player) TogglePlay ¶
func (pl *Player) TogglePlay()
Starts playing if not playing, and stops playing if playing.