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

Represents a MIDI patch change event. More...

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

Public Member Functions

 PatchChangeEvent (BinaryReader br)
 Reads a new patch change event from a MIDI stream.
 
 PatchChangeEvent (long absoluteTime, int channel, int patchNumber)
 Creates a new patch change event.
 
override string ToString ()
 Returns a string that represents the current object, including the patch name.
 
override int GetAsShortMessage ()
 Adds the patch value shifted by 8 bits to the result of the base class's short message.
 
override void Export (ref long absoluteTime, BinaryWriter writer)
 Exports the object's data to a binary writer, including the patch value.
 
- 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.
 

Static Public Member Functions

static string GetPatchName (int patchNumber)
 Retrieves the patch name corresponding to the given patch number.
 
- 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.
 

Properties

int Patch [get, set]
 The Patch Number.
 
- 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

byte patch
 

Static Private Attributes

static readonly string[] patchNames
 

Additional Inherited Members

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

Detailed Description

Represents a MIDI patch change event.

Constructor & Destructor Documentation

◆ PatchChangeEvent() [1/2]

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

Reads a new patch change event from a MIDI stream.

Parameters
brBinary reader for the MIDI stream

◆ PatchChangeEvent() [2/2]

NAudio.Midi.PatchChangeEvent.PatchChangeEvent ( long absoluteTime,
int channel,
int patchNumber )
inline

Creates a new patch change event.

Parameters
absoluteTimeTime of the event
channelChannel number
patchNumberPatch number

Member Function Documentation

◆ Export()

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

Exports the object's data to a binary writer, including the patch value.

Parameters
absoluteTimeThe absolute time reference for the export operation.
writerThe binary writer to which the data is exported.

This method exports the object's data to the specified binary writer, including the patch value. It first calls the base class's Export method to export any base class data, and then writes the patch value to the binary writer.

Reimplemented from NAudio.Midi.MidiEvent.

◆ GetAsShortMessage()

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

Adds the patch value shifted by 8 bits to the result of the base class's short message.

Returns
The sum of the base class's short message and the patch value shifted by 8 bits.

Reimplemented from NAudio.Midi.MidiEvent.

◆ GetPatchName()

static string NAudio.Midi.PatchChangeEvent.GetPatchName ( int patchNumber)
inlinestatic

Retrieves the patch name corresponding to the given patch number.

Parameters
patchNumberThe number representing the patch.
Returns
The name of the patch corresponding to the given patchNumber .
Here is the caller graph for this function:

◆ ToString()

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

Returns a string that represents the current object, including the patch name.

Returns
A string that combines the base object's string representation with the patch name.
Here is the call graph for this function:

Member Data Documentation

◆ patch

byte NAudio.Midi.PatchChangeEvent.patch
private

◆ patchNames

readonly string [] NAudio.Midi.PatchChangeEvent.patchNames
staticprivate
Initial value:
= new string[]
{
"Acoustic Grand","Bright Acoustic","Electric Grand","Honky-Tonk","Electric Piano 1","Electric Piano 2","Harpsichord","Clav",
"Celesta","Glockenspiel","Music Box","Vibraphone","Marimba","Xylophone","Tubular Bells","Dulcimer",
"Drawbar Organ","Percussive Organ","Rock Organ","Church Organ","Reed Organ","Accoridan","Harmonica","Tango Accordian",
"Acoustic Guitar(nylon)","Acoustic Guitar(steel)","Electric Guitar(jazz)","Electric Guitar(clean)","Electric Guitar(muted)","Overdriven Guitar","Distortion Guitar","Guitar Harmonics",
"Acoustic Bass","Electric Bass(finger)","Electric Bass(pick)","Fretless Bass","Slap Bass 1","Slap Bass 2","Synth Bass 1","Synth Bass 2",
"Violin","Viola","Cello","Contrabass","Tremolo Strings","Pizzicato Strings","Orchestral Strings","Timpani",
"String Ensemble 1","String Ensemble 2","SynthStrings 1","SynthStrings 2","Choir Aahs","Voice Oohs","Synth Voice","Orchestra Hit",
"Trumpet","Trombone","Tuba","Muted Trumpet","French Horn","Brass Section","SynthBrass 1","SynthBrass 2",
"Soprano Sax","Alto Sax","Tenor Sax","Baritone Sax","Oboe","English Horn","Bassoon","Clarinet",
"Piccolo","Flute","Recorder","Pan Flute","Blown Bottle","Skakuhachi","Whistle","Ocarina",
"Lead 1 (square)","Lead 2 (sawtooth)","Lead 3 (calliope)","Lead 4 (chiff)","Lead 5 (charang)","Lead 6 (voice)","Lead 7 (fifths)","Lead 8 (bass+lead)",
"Pad 1 (new age)","Pad 2 (warm)","Pad 3 (polysynth)","Pad 4 (choir)","Pad 5 (bowed)","Pad 6 (metallic)","Pad 7 (halo)","Pad 8 (sweep)",
"FX 1 (rain)","FX 2 (soundtrack)","FX 3 (crystal)","FX 4 (atmosphere)","FX 5 (brightness)","FX 6 (goblins)","FX 7 (echoes)","FX 8 (sci-fi)",
"Sitar","Banjo","Shamisen","Koto","Kalimba","Bagpipe","Fiddle","Shanai",
"Tinkle Bell","Agogo","Steel Drums","Woodblock","Taiko Drum","Melodic Tom","Synth Drum","Reverse Cymbal",
"Guitar Fret Noise","Breath Noise","Seashore","Bird Tweet","Telephone Ring","Helicopter","Applause","Gunshot"
}

Property Documentation

◆ Patch

int NAudio.Midi.PatchChangeEvent.Patch
getset

The Patch Number.


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