Class MidiEventToBytesConverter
Provides methods to convert an instance of the
MidiEvent to bytes.
Inheritance
MidiEventToBytesConverter
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class MidiEventToBytesConverter : IDisposable
Constructors
MidiEventToBytesConverter()
Declaration
public MidiEventToBytesConverter()
MidiEventToBytesConverter(int)
Declaration
public MidiEventToBytesConverter(int capacity)
Parameters
Type |
Name |
Description |
int |
capacity |
Initial capacity of the internal buffer. |
Exceptions
Properties
Gets or sets the format of target bytes layout. The default is
File.
Declaration
public BytesFormat BytesFormat { get; set; }
Property Value
Exceptions
Gets or sets collection of custom meta events types.
Declaration
public EventTypesCollection CustomMetaEventTypes { get; set; }
Property Value
NoteOffAsSilentNoteOn
Gets or sets a value indicating whether Note Off events should be written as Note On ones
with velocity of zero, or not. In conjunction with
UseRunningStatus set to
true
can give some compression of MIDI data. The default value is
false
.
Declaration
public bool NoteOffAsSilentNoteOn { get; set; }
Property Value
TextEncoding
Gets or sets an
Encoding that will be used to write the text of a
text-based meta event. The default is
ASCII.
Declaration
public Encoding TextEncoding { get; set; }
Property Value
UseRunningStatus
Gets or sets a value indicating whether 'running status' (to turn off writing of the status
bytes of consecutive events of the same type) should be used or not. The default value is false
.
Declaration
public bool UseRunningStatus { get; set; }
Property Value
WriteDeltaTimes
Gets or sets a value indicating whether delta-times of events must be written to bytes
array or not. The default value is false
.
Declaration
public bool WriteDeltaTimes { get; set; }
Property Value
Methods
Convert(MidiEvent)
Converts an instance of the
MidiEvent to bytes array.
Declaration
public byte[] Convert(MidiEvent midiEvent)
Parameters
Type |
Name |
Description |
MidiEvent |
midiEvent |
MIDI event to convert. |
Returns
Type |
Description |
byte[] |
Array of bytes representing midiEvent . |
Exceptions
Convert(MidiEvent, int)
Converts an instance of the
MidiEvent to bytes array using the specified
minimum size of resulting array.
Declaration
public byte[] Convert(MidiEvent midiEvent, int minSize)
Parameters
Type |
Name |
Description |
MidiEvent |
midiEvent |
MIDI event to convert. |
int |
minSize |
Minimum size of bytes array representing midiEvent . |
Returns
Type |
Description |
byte[] |
Array of bytes representing midiEvent . |
Exceptions
Convert(IEnumerable<MidiEvent>)
Converts collection of
MidiEvent to bytes array.
Declaration
public byte[] Convert(IEnumerable<MidiEvent> midiEvents)
Parameters
Returns
Type |
Description |
byte[] |
Array of bytes representing midiEvents . |
Exceptions
Dispose()
Declaration
Implements