Class TimedObjectsWriter
Provides a wrapper around MidiTokensWriter to write objects to it keeping
low memory consumption. See
Lazy reading/writing article to learn more.
Implements
Inherited Members
Namespace: Melanchall.DryWetMidi.Interaction
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class TimedObjectsWriter : IDisposable
Constructors
TimedObjectsWriter(MidiTokensWriter)
Initializes a new instance of the TimedObjectsWriter with the specified
instance of MidiTokensWriter.
Declaration
public TimedObjectsWriter(MidiTokensWriter tokensWriter)
Parameters
| Type | Name | Description |
|---|---|---|
| MidiTokensWriter | tokensWriter | MidiTokensWriter that will be used to write objects. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | tokensWriter is null. |
Methods
Dispose()
Releases all resources used by the current TimedObjectsWriter
and also flushes all remaining data to the underlying stream.
Declaration
public void Dispose()
WriteObject(ITimedObject)
Writes the specified object with the underlying MidiTokensWriter.
Declaration
public void WriteObject(ITimedObject timedObject)
Parameters
| Type | Name | Description |
|---|---|---|
| ITimedObject | timedObject | Object to write. |
Remarks
Objects passed to each next call of the method must be ordered in non-descending
order by their times.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Object's time is less than the current time of the underlying writer. |
| IOException | An I/O error occurred while writing the object. |
| InvalidOperationException | A track chunk is not started (see StartTrackChunk()). |
WriteObjects(IEnumerable<ITimedObject>)
Writes the specified objects with the underlying MidiTokensWriter.
Declaration
public void WriteObjects(IEnumerable<ITimedObject> timedObjects)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITimedObject> | timedObjects | Objects to write. |
Remarks
Objects passed to each next call of the method must be ordered in non-descending
order by their times.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | An object's time is less than the current time of the underlying writer. |
| IOException | An I/O error occurred while writing the object. |
| InvalidOperationException | A track chunk is not started (see StartTrackChunk()). |