class Haematite::MidiFile

Overview

Represents a Standard MIDI File.

Defined in:

haematite/midifile.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Haematite::SequencedFile

length : Int64 length, messages : Array(Message) messages, times : Array(Int64) times

Constructor methods inherited from class Haematite::SequencedFile

load(path : String | Path) : SequencedFile load

Constructor Detail

def self.new(filename : String | Path, *, loopPoint : Int32 = 0, headerAlreadyRead : Bool = false) #

Creates a new MidiFile instance by loading a MIDI file from the given filename. A loopPoint greater than zero specifies the point in the MIDI file at which it should loop (otherwise it's assumed to loop at the end).


def self.new(stream : IO, *, headerAlreadyRead : Bool = false) #

Creates a new MidiFile instance by loading a MIDI file from the given stream.


def self.new(stream : IO, *, loopType : MidiFileLoopType, headerAlreadyRead : Bool = false) #

Creates a new MidiFile instance by loading a MIDI file from the given stream. loopType specifies how any loop point messages are interpreted.


Class Method Detail

def self.validMidiFile(io : IO) : Bool #

Attempts to determine if the data in io is valid MIDI data. If it is, this returns true, otherwise it returns false.

If this is true, then the header in the io has already been read, and you should pass headerAlreadyRead: true when calling one of the constructors.


Instance Method Detail

def resolution : Int16 #

The timing resolution.


def trackCount : Int16 #

The number of tracks in the sequence.