Table of Contents

Class LrcWriteOptions

Namespace
ModernLrc
Assembly
ModernLrc.dll

Configuration for a write operation.

public sealed record LrcWriteOptions : IEquatable<LrcWriteOptions>
Inheritance
LrcWriteOptions
Implements
Inherited Members

Examples

// Emit a UTF-8 BOM and use CRLF line endings (Windows-friendly).
var winFriendly = new LrcWriteOptions
{
    EmitByteOrderMark = true,
    LineEnding = LrcLineEnding.Crlf,
};

// Millisecond precision and alphabetical metadata.
var precise = new LrcWriteOptions
{
    TimestampPrecision = LrcTimestampPrecision.Milliseconds,
    MetadataOrdering = LrcMetadataOrdering.Alphabetical,
};

// Emit one timestamp per line instead of collapsing into [t1][t2]text groups.
var verbose = new LrcWriteOptions { CollapseIdenticalLines = false };

Properties

CollapseIdenticalLines

Collapse consecutive lines with identical content (text + voice + line type) into a single multi-timestamp line ([t1][t2]text). Default true — this is the round-trip mechanism for inputs originally written as multi-timestamp groups, since the parser fans them out into one line per timestamp.

public bool CollapseIdenticalLines { get; init; }

Property Value

bool

Default

Default options.

public static LrcWriteOptions Default { get; }

Property Value

LrcWriteOptions

EmitByteOrderMark

Sole BOM control. true prepends GetPreamble(); false emits no preamble regardless of the encoding's natural BOM. Default false.

public bool EmitByteOrderMark { get; init; }

Property Value

bool

EmitVoiceMarkers

Emit voice markers (default true). When false, voice metadata is dropped.

public bool EmitVoiceMarkers { get; init; }

Property Value

bool

Encoding

Output encoding for byte sinks (default UTF-8 with no BOM).

public Encoding Encoding { get; init; }

Property Value

Encoding

InitialBufferSize

Floor for the initial output buffer (chars for char sinks, bytes for byte sinks). Must be ≥ 16. Default 4096. The string, TextWriter, TryWrite, and Stream sinks may stage into a larger buffer when the document's estimated size exceeds this value, so they don't waste cycles doubling-and-copying through several growth steps on a large render. The IBufferWriter<T> sinks honor this value verbatim, since the buffer is caller-owned.

public int InitialBufferSize { get; init; }

Property Value

int

LineEnding

Line-ending style (default Lf).

public LrcLineEnding LineEnding { get; init; }

Property Value

LrcLineEnding

MetadataOrdering

Ordering policy for the metadata block.

public LrcMetadataOrdering MetadataOrdering { get; init; }

Property Value

LrcMetadataOrdering

TimestampPrecision

Timestamp precision (default centiseconds).

public LrcTimestampPrecision TimestampPrecision { get; init; }

Property Value

LrcTimestampPrecision

TrailingNewline

Append a final newline (default true).

public bool TrailingNewline { get; init; }

Property Value

bool

VoiceMarkerOnChangeOnly

Only emit a voice marker on transition (default true); when false, every line carrying a non-default voice receives an explicit marker.

public bool VoiceMarkerOnChangeOnly { get; init; }

Property Value

bool