Xeno-rat
Loading...
Searching...
No Matches
NAudio.Midi.MetaEvent Class Reference

Represents a MIDI meta event. More...

Inheritance diagram for NAudio.Midi.MetaEvent:
Collaboration diagram for NAudio.Midi.MetaEvent:

Public Member Functions

 MetaEvent (MetaEventType metaEventType, int metaDataLength, long absoluteTime)
 Custom constructor for use by derived types, who will manage the data themselves.
 
override MidiEvent Clone ()
 Clones the current MidiEvent and returns the cloned instance.
 
override string ToString ()
 Returns a string representation of the object, combining the AbsoluteTime and metaEvent properties.
 
override void Export (ref long absoluteTime, BinaryWriter writer)
 Exports the meta event and its associated data to a binary writer.
 
- Public Member Functions inherited from NAudio.Midi.MidiEvent
virtual int GetAsShortMessage ()
 Returns the short message value calculated based on the channel and command code.
 
 MidiEvent (long absoluteTime, int channel, MidiCommandCode commandCode)
 Creates a MIDI event with specified parameters.
 
override string ToString ()
 Returns a string representation of the current Midi event.
 

Static Public Member Functions

static MetaEvent ReadMetaEvent (BinaryReader br)
 Reads a meta event from the provided BinaryReader and returns the corresponding MetaEvent object.
 
- Static Public Member Functions inherited from NAudio.Midi.MidiEvent
static MidiEvent FromRawMessage (int rawMessage)
 Converts a raw MIDI message to a MidiEvent object.
 
static MidiEvent ReadNextEvent (BinaryReader br, MidiEvent previous)
 Reads the next MIDI event from the BinaryReader and returns the corresponding MidiEvent.
 
static bool IsNoteOff (MidiEvent midiEvent)
 Checks if the given MIDI event represents a Note Off message.
 
static bool IsNoteOn (MidiEvent midiEvent)
 Checks if the provided MIDI event is a Note On event and returns true if the velocity is greater than 0.
 
static bool IsEndTrack (MidiEvent midiEvent)
 Checks if the provided MIDI event is an end track event.
 
static int ReadVarInt (BinaryReader br)
 Reads a variable-length encoded integer from the provided BinaryReader and returns the result.
 
static void WriteVarInt (BinaryWriter writer, int value)
 Writes a variable-length encoded integer to the specified BinaryWriter.
 

Protected Member Functions

 MetaEvent ()
 Empty constructor.
 
- Protected Member Functions inherited from NAudio.Midi.MidiEvent
 MidiEvent ()
 Default constructor.
 

Properties

MetaEventType MetaEventType [get]
 Gets the type of this meta event.
 
- Properties inherited from NAudio.Midi.MidiEvent
virtual int Channel [get, set]
 The MIDI Channel Number for this event (1-16)
 
int DeltaTime [get]
 The Delta time for this event.
 
long AbsoluteTime [get, set]
 The absolute time for this event.
 
MidiCommandCode CommandCode [get]
 The command code for this event.
 

Private Attributes

MetaEventType metaEvent
 

Detailed Description

Represents a MIDI meta event.

Constructor & Destructor Documentation

◆ MetaEvent() [1/2]

NAudio.Midi.MetaEvent.MetaEvent ( )
inlineprotected

Empty constructor.

Here is the caller graph for this function:

◆ MetaEvent() [2/2]

NAudio.Midi.MetaEvent.MetaEvent ( MetaEventType metaEventType,
int metaDataLength,
long absoluteTime )
inline

Custom constructor for use by derived types, who will manage the data themselves.

Parameters
metaEventTypeMeta event type
metaDataLengthMeta data length
absoluteTimeAbsolute time

Member Function Documentation

◆ Clone()

override MidiEvent NAudio.Midi.MetaEvent.Clone ( )
virtual

Clones the current MidiEvent and returns the cloned instance.

Returns
A new instance of MidiEvent that is a clone of the current instance.

Reimplemented from NAudio.Midi.MidiEvent.

Reimplemented in NAudio.Midi.RawMetaEvent, NAudio.Midi.SequencerSpecificEvent, NAudio.Midi.SmpteOffsetEvent, NAudio.Midi.TempoEvent, NAudio.Midi.TextEvent, NAudio.Midi.TimeSignatureEvent, and NAudio.Midi.TrackSequenceNumberEvent.

◆ Export()

override void NAudio.Midi.MetaEvent.Export ( ref long absoluteTime,
BinaryWriter writer )
inlinevirtual

Exports the meta event and its associated data to a binary writer.

Parameters
absoluteTimeThe absolute time of the event.
writerThe binary writer to which the event and its data will be exported.

This method exports the meta event and its associated data to the specified binary writer. It first calls the base class's Export method to export the absolute time, then writes the meta event as a byte, followed by writing the length of the meta data using variable-length encoding.

Reimplemented from NAudio.Midi.MidiEvent.

Reimplemented in NAudio.Midi.RawMetaEvent, NAudio.Midi.SequencerSpecificEvent, NAudio.Midi.SmpteOffsetEvent, NAudio.Midi.TempoEvent, NAudio.Midi.TextEvent, NAudio.Midi.TimeSignatureEvent, and NAudio.Midi.TrackSequenceNumberEvent.

Here is the call graph for this function:

◆ ReadMetaEvent()

static MetaEvent NAudio.Midi.MetaEvent.ReadMetaEvent ( BinaryReader br)
inlinestatic

Reads a meta event from the provided BinaryReader and returns the corresponding MetaEvent object.

Parameters
brThe BinaryReader used to read the meta event.
Returns
The MetaEvent object representing the meta event read from the BinaryReader.

This method reads a meta event from the provided BinaryReader and returns the corresponding MetaEvent object. It first reads the MetaEventType from the BinaryReader, then reads the length of the meta event using the ReadVarInt method. Based on the type of meta event, it creates and returns the corresponding MetaEvent object by instantiating the appropriate class. If the meta event is of type EndTrack, it checks if the length is 0 and throws a FormatException if it's not. If the meta event is of any other type, it reads the data for the meta event and returns a RawMetaEvent object with the meta event type, default long value, and the read data.

Exceptions
FormatExceptionThrown when the end track length is not 0 or when failed to read metaevent's data fully.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

override string NAudio.Midi.MetaEvent.ToString ( )
inline

Returns a string representation of the object, combining the AbsoluteTime and metaEvent properties.

Returns
A string containing the AbsoluteTime and metaEvent properties.

Member Data Documentation

◆ metaEvent

MetaEventType NAudio.Midi.MetaEvent.metaEvent
private

Property Documentation

◆ MetaEventType

MetaEventType NAudio.Midi.MetaEvent.MetaEventType
get

Gets the type of this meta event.


The documentation for this class was generated from the following file: