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

Represents a MIDI message. More...

Collaboration diagram for NAudio.Midi.MidiMessage:

Public Member Functions

 MidiMessage (int status, int data1, int data2)
 Creates a new MIDI message.
 
 MidiMessage (int rawData)
 Creates a new MIDI message from a raw message.
 

Static Public Member Functions

static MidiMessage StartNote (int note, int volume, int channel)
 Starts a note with the specified parameters and returns the corresponding MIDI message.
 
static MidiMessage StopNote (int note, int volume, int channel)
 Stops the specified note on the given channel with the specified volume.
 
static MidiMessage ChangePatch (int patch, int channel)
 Changes the patch for the specified MIDI channel and returns the corresponding MIDI message.
 
static MidiMessage ChangeControl (int controller, int value, int channel)
 Changes the control value for a specific MIDI controller on the specified channel and returns the corresponding MIDI message.
 

Properties

int RawData [get]
 Returns the raw MIDI message data.
 

Static Private Member Functions

static void ValidateNoteParameters (int note, int volume, int channel)
 Validates the note, volume, and channel parameters for MIDI messages.
 
static void ValidateChannel (int channel)
 Validates the channel number to ensure it falls within the range of 1 to 16.
 

Private Attributes

int rawData
 

Detailed Description

Represents a MIDI message.

Constructor & Destructor Documentation

◆ MidiMessage() [1/2]

NAudio.Midi.MidiMessage.MidiMessage ( int status,
int data1,
int data2 )
inline

Creates a new MIDI message.

Parameters
statusStatus
data1Data parameter 1
data2Data parameter 2
Here is the caller graph for this function:

◆ MidiMessage() [2/2]

NAudio.Midi.MidiMessage.MidiMessage ( int rawData)
inline

Creates a new MIDI message from a raw message.

Parameters
rawDataA packed MIDI message from an MMIO function

Member Function Documentation

◆ ChangeControl()

static MidiMessage NAudio.Midi.MidiMessage.ChangeControl ( int controller,
int value,
int channel )
inlinestatic

Changes the control value for a specific MIDI controller on the specified channel and returns the corresponding MIDI message.

Parameters
controllerThe MIDI controller number to be changed.
valueThe new value for the MIDI controller.
channelThe MIDI channel on which the control change should occur.
Exceptions
ArgumentExceptionThrown when the specified MIDI channel is invalid.
Returns
A MIDI message representing the control change with the specified parameters.

This method validates the specified MIDI channel and creates a MIDI message for the control change using the provided controller number and value. The MIDI message is then returned for further processing or transmission.

Here is the call graph for this function:

◆ ChangePatch()

static MidiMessage NAudio.Midi.MidiMessage.ChangePatch ( int patch,
int channel )
inlinestatic

Changes the patch for the specified MIDI channel and returns the corresponding MIDI message.

Parameters
patchThe patch number to be changed.
channelThe MIDI channel on which the patch change should occur.
Exceptions
ArgumentExceptionThrown when the provided MIDI channel is not valid.
Returns
A MIDI message representing the patch change on the specified channel.

This method validates the provided MIDI channel using the ValidateChannel method to ensure it is within the valid range. It then creates and returns a new MIDI message with the appropriate command code, channel, and patch number.

Here is the call graph for this function:

◆ StartNote()

static MidiMessage NAudio.Midi.MidiMessage.StartNote ( int note,
int volume,
int channel )
inlinestatic

Starts a note with the specified parameters and returns the corresponding MIDI message.

Parameters
noteThe MIDI note number to be played.
volumeThe volume of the note to be played.
channelThe MIDI channel on which the note should be played.
Exceptions
ArgumentExceptionThrown when the note, volume, or channel parameters are invalid.
Returns
A MIDI message representing the start of the specified note with the given volume on the specified channel.

This method validates the input parameters using the ValidateNoteParameters method to ensure that the note, volume, and channel are within valid ranges. It then creates and returns a new MIDI message using the specified parameters, where the command code is NoteOn for the specified channel, followed by the note number and volume.

Here is the call graph for this function:

◆ StopNote()

static MidiMessage NAudio.Midi.MidiMessage.StopNote ( int note,
int volume,
int channel )
inlinestatic

Stops the specified note on the given channel with the specified volume.

Parameters
noteThe MIDI note number to stop.
volumeThe volume at which to stop the note.
channelThe MIDI channel on which to stop the note.
Exceptions
ArgumentExceptionThrown when the note, volume, or channel is not within the valid range.
Returns
A MIDI message to stop the specified note on the given channel with the specified volume.

This method validates the input parameters for note, volume, and channel using the ValidateNoteParameters method. It then creates and returns a MIDI message to stop the specified note on the given channel with the specified volume.

Here is the call graph for this function:

◆ ValidateChannel()

static void NAudio.Midi.MidiMessage.ValidateChannel ( int channel)
inlinestaticprivate

Validates the channel number to ensure it falls within the range of 1 to 16.

Parameters
channelThe channel number to be validated.
Exceptions
ArgumentOutOfRangeExceptionThrown when the channel number is not within the range of 1 to 16.

This method validates the input channel number to ensure it falls within the acceptable range of 1 to 16. If the channel number is not within the specified range, an ArgumentOutOfRangeException is thrown with a descriptive message indicating the invalid channel number.

Here is the caller graph for this function:

◆ ValidateNoteParameters()

static void NAudio.Midi.MidiMessage.ValidateNoteParameters ( int note,
int volume,
int channel )
inlinestaticprivate

Validates the note, volume, and channel parameters for MIDI messages.

Parameters
noteThe MIDI note number to be validated.
volumeThe velocity value to be validated.
channelThe MIDI channel number to be validated.
Exceptions
ArgumentOutOfRangeExceptionThrown when the note number is not in the range 0-127 or when the volume is not in the range 0-127.

This method validates the input parameters for MIDI messages. It checks if the note number is within the range 0-127 and if the volume value is within the range 0-127. If any of the parameters are invalid, an ArgumentOutOfRangeException is thrown with a descriptive message indicating the specific parameter that caused the exception.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ rawData

int NAudio.Midi.MidiMessage.rawData
private

Property Documentation

◆ RawData

int NAudio.Midi.MidiMessage.RawData
get

Returns the raw MIDI message data.


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