Documentation ¶
Index ¶
- Constants
- func CheckMIDIStatus(status uint8) bool
- func CheckMetaStatus(status uint8) bool
- func CheckMetaType(metaType uint8) bool
- func CheckSMTPE(SMTPEFrames int8) bool
- func CheckSingleMIDIEvent(status uint8) bool
- func CheckSysexStatus(status uint8) bool
- type Division
- type Event
- type MIDIEvent
- func (mEvent *MIDIEvent) GetChannel() uint8
- func (mEvent *MIDIEvent) GetDTime() uint32
- func (mEvent *MIDIEvent) GetData() []byte
- func (mEvent *MIDIEvent) GetMetaType() uint8
- func (mEvent *MIDIEvent) GetStatus() uint8
- func (mEvent *MIDIEvent) SetDtime(deltaTime uint32) error
- func (mEvent *MIDIEvent) String() string
- type MIDIFile
- type MetaEvent
- func (mEvent *MetaEvent) GetChannel() uint8
- func (mEvent *MetaEvent) GetDTime() uint32
- func (mEvent *MetaEvent) GetData() []byte
- func (mEvent *MetaEvent) GetMetaType() uint8
- func (*MetaEvent) GetStatus() uint8
- func (mEvent *MetaEvent) SetDtime(deltaTime uint32) error
- func (mEvent *MetaEvent) String() string
- type MidiError
- type SysexEvent
- func (sEvent *SysexEvent) GetChannel() uint8
- func (sEvent *SysexEvent) GetDTime() uint32
- func (sEvent *SysexEvent) GetData() []byte
- func (sEvent *SysexEvent) GetMetaType() uint8
- func (sEvent *SysexEvent) GetStatus() uint8
- func (sEvent *SysexEvent) SetDtime(deltaTime uint32) error
- func (sEvent *SysexEvent) String() string
- type Track
- type TrackIterator
Constants ¶
const ( NOSMTPE int8 = 0 SMTPE24 int8 = -24 SMTPE25 int8 = -25 SMTPE29 int8 = -29 SMTPE30 int8 = -30 )
SMTPE time division midi valid codes
const ( //TicksMaxValue midi division ticks max value with NOSMTPE TicksMaxValue uint16 = 0x7FFF //SMTPETicksMaxValue midi division ticks max value with SMTPE SMTPETicksMaxValue uint16 = 0xFF )
const ( MetaSequenceNumber uint8 = 0x00 MetaText uint8 = 0x01 MetaCopyrightNotice uint8 = 0x02 MetaSequenceTrackName uint8 = 0x03 MetaInstrumentName uint8 = 0x04 MetaLyric uint8 = 0x05 MetaMarker uint8 = 0x06 MetaCuePoint uint8 = 0x07 MetaMIDIChannelPrefix uint8 = 0x20 MetaMIDIPort uint8 = 0x21 MetaEndOfTrack uint8 = 0x2F MetaSetTempo uint8 = 0x51 MetaSMTPEOffset uint8 = 0x54 MetaTimeSignature uint8 = 0x58 MetaKeySignature uint8 = 0x59 MetaSequencerSpecific uint8 = 0x7F )
Meta events types
const ( NoteOffStatus uint8 = 0x80 NoteOnStatus uint8 = 0x90 PKPressureStatus uint8 = 0xA0 ControllerChangeStatus uint8 = 0xB0 ProgramChangeStatus uint8 = 0xC0 CKPressureStatus uint8 = 0xD0 PitchBendStatus uint8 = 0xE0 )
MIDI Event status
const ( MIDIDoubleEventSize uint32 = 3 MIDISingleEventSize uint32 = 2 )
MIDI Event sizes
const ( Format0 uint16 = 0 Format1 uint16 = 1 Format2 uint16 = 2 )
MIDI file formats
const ( SysexStatus uint8 = 0xF0 SysexDataStatus uint8 = 0xF7 )
SysexStatus and SysexDataStatus is two flavors of sysex_events
const MaxChannelNumber uint8 = 0x0F
MaxChannelNumber max number of channel
const MaxDataByteSize uint8 = 0x7F
MaxDataByteSize max size for event data
const MetaStatus uint8 = 0xFF
MetaStatus for all Meta events
Variables ¶
This section is empty.
Functions ¶
func CheckMIDIStatus ¶
CheckMIDIStatus checks is status MIDIEvent Status
func CheckMetaStatus ¶
CheckMetaStatus return true if status is MetaStatus
func CheckMetaType ¶
CheckMetaType return true if type is meta type
func CheckSMTPE ¶
CheckSMTPE return true if SMTPEFrames is valid values
func CheckSingleMIDIEvent ¶
CheckSingleMIDIEvent return true for one byte size events
func CheckSysexStatus ¶
CheckSysexStatus check is status SysexStatus
Types ¶
type Division ¶
type Division struct {
// contains filtered or unexported fields
}
Division represents time division struct
func NewDivision ¶
NewDivision creates new time division
type Event ¶
type Event interface { SetDtime(uint32) error GetDTime() uint32 GetStatus() uint8 GetData() []byte String() string GetChannel() uint8 GetMetaType() uint8 }
Event represent any type of midi events
type MIDIEvent ¶
type MIDIEvent struct {
// contains filtered or unexported fields
}
MIDIEvent struct
func NewMIDIEvent ¶
func NewMIDIEvent(deltaTime uint32, status uint8, channel uint8, firstDataByte uint8, secondDataByte uint8) (*MIDIEvent, error)
NewMIDIEvent create new midi event
func (*MIDIEvent) GetChannel ¶
GetChannel gets channel for MIDI event
func (*MIDIEvent) GetMetaType ¶ added in v1.0.2
GetMetaType get type for meta event
type MIDIFile ¶
type MIDIFile struct {
// contains filtered or unexported fields
}
MIDIFile file struct
func (*MIDIFile) GetDivision ¶
GetDivision return division for midi file
func (*MIDIFile) GetTracksNum ¶
GetTracksNum current number of tracks
func (*MIDIFile) RemoveTrack ¶
RemoveTrack remove track from midi
type MetaEvent ¶
type MetaEvent struct {
// contains filtered or unexported fields
}
MetaEvent struct
func NewMetaEvent ¶
NewMetaEvent Creates new meta event
func (*MetaEvent) GetChannel ¶
GetChannel get channel for event
func (*MetaEvent) GetMetaType ¶
GetMetaType get type for meta event
type MidiError ¶
type MidiError struct {
// contains filtered or unexported fields
}
MidiError error type for midi package
type SysexEvent ¶
type SysexEvent struct {
// contains filtered or unexported fields
}
SysexEvent for midi
func NewSysexEvent ¶
func NewSysexEvent(deltaTime uint32, status uint8, data []byte) (*SysexEvent, error)
NewSysexEvent creataes new SysexEvent
func (*SysexEvent) GetChannel ¶
func (sEvent *SysexEvent) GetChannel() uint8
GetChannel get channel for event
func (*SysexEvent) GetDTime ¶
func (sEvent *SysexEvent) GetDTime() uint32
GetDTime get delta time for event
func (*SysexEvent) GetMetaType ¶ added in v1.0.2
func (sEvent *SysexEvent) GetMetaType() uint8
GetMetaType get type for meta event
func (*SysexEvent) GetStatus ¶
func (sEvent *SysexEvent) GetStatus() uint8
GetStatus get status for event
func (*SysexEvent) SetDtime ¶
func (sEvent *SysexEvent) SetDtime(deltaTime uint32) error
SetDtime sets deltaTime for event
func (*SysexEvent) String ¶
func (sEvent *SysexEvent) String() string
String returns string representation of event
type Track ¶
type Track struct {
// contains filtered or unexported fields
}
Track midi track struct
func TrackFromArray ¶
TrackFromArray create track from events array
func (*Track) GetAllEvents ¶
GetAllEvents return array of all events in track
func (*Track) GetIterator ¶
func (t *Track) GetIterator() *TrackIterator
GetIterator return iterator for track
type TrackIterator ¶
type TrackIterator struct {
// contains filtered or unexported fields
}
TrackIterator used for iteration over track
func (*TrackIterator) GetValue ¶
func (iterator *TrackIterator) GetValue() Event
GetValue current value of iterator
func (*TrackIterator) MoveNext ¶
func (iterator *TrackIterator) MoveNext() bool
MoveNext iterate to next element return true if there next element