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

Represents a note MIDI event. More...

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

Public Member Functions

 NoteEvent (BinaryReader br)
 Reads a NoteEvent from a stream of MIDI data.
 
 NoteEvent (long absoluteTime, int channel, MidiCommandCode commandCode, int noteNumber, int velocity)
 Creates a MIDI Note Event with specified parameters.
 
override int GetAsShortMessage ()
 Gets the short message representation of the note event.
 
override string ToString ()
 Returns a formatted string representing the note's name and velocity.
 
override void Export (ref long absoluteTime, BinaryWriter writer)
 Exports the note number and velocity to a binary writer.
 
- Public Member Functions inherited from NAudio.Midi.MidiEvent
 MidiEvent (long absoluteTime, int channel, MidiCommandCode commandCode)
 Creates a MIDI event with specified parameters.
 
virtual MidiEvent Clone ()
 Creates a new object that is a copy of the current instance.
 
override string ToString ()
 Returns a string representation of the current Midi event.
 

Properties

virtual int NoteNumber [get, set]
 The MIDI note number.
 
int Velocity [get, set]
 The note velocity.
 
string NoteName [get]
 The note name.
 
- 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

int noteNumber
 
int velocity
 

Static Private Attributes

static readonly string[] NoteNames = new string[] { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }
 

Additional Inherited Members

- 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 inherited from NAudio.Midi.MidiEvent
 MidiEvent ()
 Default constructor.
 

Detailed Description

Represents a note MIDI event.

Constructor & Destructor Documentation

◆ NoteEvent() [1/2]

NAudio.Midi.NoteEvent.NoteEvent ( BinaryReader br)
inline

Reads a NoteEvent from a stream of MIDI data.

Parameters
brBinary Reader for the stream
Here is the caller graph for this function:

◆ NoteEvent() [2/2]

NAudio.Midi.NoteEvent.NoteEvent ( long absoluteTime,
int channel,
MidiCommandCode commandCode,
int noteNumber,
int velocity )
inline

Creates a MIDI Note Event with specified parameters.

Parameters
absoluteTimeAbsolute time of this event
channelMIDI channel number
commandCodeMIDI command code
noteNumberMIDI Note Number
velocityMIDI Note Velocity

Member Function Documentation

◆ Export()

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

Exports the note number and velocity to a binary writer.

Parameters
absoluteTimeThe absolute time of the event.
writerThe binary writer to which the note number and velocity will be exported.

This method exports the note number and velocity to the specified binary writer.

Reimplemented from NAudio.Midi.MidiEvent.

◆ GetAsShortMessage()

override int NAudio.Midi.NoteEvent.GetAsShortMessage ( )
inlinevirtual

Gets the short message representation of the note event.

Returns
The short message representation of the note event.

This method calculates the short message representation of the note event by combining the base short message with the note number and velocity. The note number is shifted left by 8 bits and the velocity is shifted left by 16 bits before being added to the base short message.

Reimplemented from NAudio.Midi.MidiEvent.

◆ ToString()

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

Returns a formatted string representing the note's name and velocity.

Returns
A string containing the note's name and velocity, formatted as "{base.ToString()} {this.NoteName} Vel:{this.Velocity}"

Member Data Documentation

◆ NoteNames

readonly string [] NAudio.Midi.NoteEvent.NoteNames = new string[] { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }
staticprivate

◆ noteNumber

int NAudio.Midi.NoteEvent.noteNumber
private

◆ velocity

int NAudio.Midi.NoteEvent.velocity
private

Property Documentation

◆ NoteName

string NAudio.Midi.NoteEvent.NoteName
get

The note name.

◆ NoteNumber

virtual int NAudio.Midi.NoteEvent.NoteNumber
getset

The MIDI note number.

◆ Velocity

int NAudio.Midi.NoteEvent.Velocity
getset

The note velocity.


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