class Haematite::MusFile
- Haematite::MusFile
- Haematite::SequencedFile
- Reference
- Object
Overview
Represents a MUS file.
Defined in:
haematite/musfile.crConstant Summary
-
MUS_COEFF_RAPTOR =
1 / 70
-
MUS_MAGIC =
Bytes['M'.ord.to_u8, 'U'.ord.to_u8, 'S'.ord.to_u8, 26_u8]
-
"Magic" bytes for the MUS format.
Constructors
-
.new(filename : String | Path, *, loopPoint : Int32 = 0, headerAlreadyRead : Bool = false, alternateTiming : Bool = false)
Creates a new
MusFile
instance by loading a MUS file from the given filename. -
.new(stream : IO, *, headerAlreadyRead : Bool = false, alternateTiming : Bool = false)
Creates a new
MusFile
instance by loading a MUS file from the given stream. -
.new(stream : IO, *, loopType : MidiFileLoopType, headerAlreadyRead : Bool = false, alternateTiming : Bool = false)
Creates a new
MusFile
instance by loading a MUS file from the given stream.
Class Method Summary
-
.validMusFile(io : IO) : Bool
Attempts to determine if the data in
io
is valid MUS data.
Instance Method Summary
-
#alternateTiming : Bool
When true, then alternative timing calculations were used when this file was loaded.
-
#instruments : Array(UInt16)
The list of instrument patches used by a loaded song.
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
Creates a new MusFile
instance by loading a MUS file from the given
filename. A loopPoint
greater than zero specifies the point in the MUS
file at which it should loop (otherwise it's assumed to loop at the end).
When #alternateTiming
is true, then the timings are calculated against a
70Hz tic rate, otherwise 140Hz is used. This alternate tic rate is used
only by the game Raptor: Call of The Shadows. All other games use the
140Hz tic rate.
Creates a new MusFile
instance by loading a MUS file from the given
stream.
When #alternateTiming
is true, then the timings are calculated against a
70Hz tic rate, otherwise 140Hz is used. This alternate tic rate is used
only by the game Raptor: Call of The Shadows. All other games use the
140Hz tic rate.
Creates a new MusFile
instance by loading a MUS file from the given
stream. loopType
specifies how any loop point messages are interpreted.
When #alternateTiming
is true, then the timings are calculated against a
70Hz tic rate, otherwise 140Hz is used. This alternate tic rate is used
only by the game Raptor: Call of The Shadows. All other games use the
140Hz tic rate.
Class Method Detail
Attempts to determine if the data in io
is valid MUS 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
When true, then alternative timing calculations were used when this file was loaded.