Class MidiChunk
Represents a chunk of Standard MIDI file.
Assembly: Melanchall.DryWetMidi.dll
Syntax
public abstract class MidiChunk
Constructors
MidiChunk(string)
Initializes a new instance of the
MidiChunk with the specified ID.
Declaration
protected MidiChunk(string id)
Parameters
Type |
Name |
Description |
string |
id |
The type of the chunk. |
Exceptions
Fields
IdLength
The length of a chunk's ID. This field is constant.
Declaration
public const int IdLength = 4
Field Value
Properties
ChunkId
Gets 4-character ID of the chunk which specifies its type.
Declaration
public string ChunkId { get; }
Property Value
Methods
Clone()
Clones chunk by creating a copy of it.
Declaration
public abstract MidiChunk Clone()
Returns
Type |
Description |
MidiChunk |
Copy of the chunk. |
Equals(MidiChunk, MidiChunk)
Determines whether two specified
MidiChunk objects have the same content.
Declaration
public static bool Equals(MidiChunk chunk1, MidiChunk chunk2)
Parameters
Type |
Name |
Description |
MidiChunk |
chunk1 |
The first chunk to compare, or null . |
MidiChunk |
chunk2 |
The second chunk to compare, or null . |
Returns
Type |
Description |
bool |
true if the chunk1 is equal to the chunk2 ;
otherwise, false . |
Equals(MidiChunk, MidiChunk, MidiChunkEqualityCheckSettings)
Determines whether two specified
MidiChunk objects have the same content.
Declaration
public static bool Equals(MidiChunk chunk1, MidiChunk chunk2, MidiChunkEqualityCheckSettings settings)
Parameters
Returns
Type |
Description |
bool |
true if the chunk1 is equal to the chunk2 ;
otherwise, false . |
Equals(MidiChunk, MidiChunk, MidiChunkEqualityCheckSettings, out string)
Determines whether two specified
MidiChunk objects have the same content using
the specified comparison settings.
Declaration
public static bool Equals(MidiChunk chunk1, MidiChunk chunk2, MidiChunkEqualityCheckSettings settings, out string message)
Parameters
Type |
Name |
Description |
MidiChunk |
chunk1 |
The first chunk to compare, or null . |
MidiChunk |
chunk2 |
The second chunk to compare, or null . |
MidiChunkEqualityCheckSettings |
settings |
Settings according to which chunks should be compared. |
string |
message |
Message containing information about what exactly is different in
chunk1 and chunk2 . |
Returns
Type |
Description |
bool |
true if the chunk1 is equal to the chunk2 ;
otherwise, false . |
Equals(MidiChunk, MidiChunk, out string)
Determines whether two specified
MidiChunk objects have the same content.
Declaration
public static bool Equals(MidiChunk chunk1, MidiChunk chunk2, out string message)
Parameters
Type |
Name |
Description |
MidiChunk |
chunk1 |
The first chunk to compare, or null . |
MidiChunk |
chunk2 |
The second chunk to compare, or null . |
string |
message |
Message containing information about what exactly is different in
chunk1 and chunk2 . |
Returns
Type |
Description |
bool |
true if the chunk1 is equal to the chunk2 ;
otherwise, false . |
GetContentSize(WritingSettings)
Gets size of chunk's content as number of bytes required to write it according to specified
WritingSettings.
Declaration
protected abstract uint GetContentSize(WritingSettings settings)
Parameters
Type |
Name |
Description |
WritingSettings |
settings |
Settings according to which the chunk's content will be written. |
Returns
Type |
Description |
uint |
Number of bytes required to write chunk's content. |
GetStandardChunkIds()
Returns array of IDs of standard chunks.
Declaration
public static string[] GetStandardChunkIds()
Returns
Type |
Description |
string[] |
Array of IDs of standard chunks. |
Remarks
ReadContent(MidiReader, ReadingSettings, uint)
Reads content of a chunk. Content is a part of chunk's data without its header (ID and size).
Declaration
protected abstract void ReadContent(MidiReader reader, ReadingSettings settings, uint size)
Parameters
Type |
Name |
Description |
MidiReader |
reader |
Reader to read the chunk's content with. |
ReadingSettings |
settings |
Settings according to which the chunk's content must be read. |
uint |
size |
Expected size of the content taken from the chunk's header. |
WriteContent(MidiWriter, WritingSettings)
Writes content of a chunk. Content is a part of chunk's data without its header (ID and size).
Declaration
protected abstract void WriteContent(MidiWriter writer, WritingSettings settings)
Parameters
Type |
Name |
Description |
MidiWriter |
writer |
Writer to write the chunk's content with. |
WritingSettings |
settings |
Settings according to which the chunk's content must be written. |
Extension Methods