Documentation
¶
Overview ¶
Package player provides an easy way to play a SMF (Standard MIDI File).
Create a new Player with SMF(). Use PlayAll() to write to a MIDI out port.
See the CLI player in the example folder.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player is a SMF (MIDI file) player.
func SMF ¶
SMF creates a new Player for the given file. If you need to pass an opened file, use New.
func (*Player) GetMessages ¶
GetMessages calls the given callback for each midi message and passes the sleeping time until that message is to be played as well as the track number and the message itself. The callback is called until there are no midi messages left.
func (*Player) PlayAll ¶
PlayAll is a shortcut for PlayAllTo when using a MIDI port as output. It stops hanging notes before returning and when stopping. If you need to pass a specific midi.Writer, use PlayAllTo.
func (*Player) PlayAllTo ¶
PlayAllTo plays all tracks to the given midi.Writer until there are no messages left or a boolean is inserted into the given stop channel. When the function returns, the playing has finished. It stops hanging notes, when finished / stopped. If you need to play to different writers per track or channel, use GetMessages and define your own playing style.