Table of Contents

Interface IPatternHandle

Namespace
SunSharp
Assembly
SunSharp.dll

Represents a handle to a pattern. The handle may be invalid if the pattern does not exist.

public interface IPatternHandle

Properties

Id

Gets the pattern ID.

int Id { get; }

Property Value

int

Methods

GetData()

Get the pattern data (all events).

(PatternEvent[] data, int tracks, int lines)? GetData()

Returns

(PatternEvent[] data, int tracks, int lines)?

Tuple containing event data array, number of tracks, and number of lines if pattern exists.

Remarks

GetEventValue(int, int, Column)

Get a specific column value from a pattern event.

int GetEventValue(int track, int line, Column column)

Parameters

track int

Track number.

line int

Line number.

column Column

Column to read.

Returns

int

Column value.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

GetExists()

Check if a pattern exists.

bool GetExists()

Returns

bool

true if pattern exists; false otherwise.

Remarks

GetLength()

Get the number of lines in the pattern. Can be used to check if a pattern exists (lines > 0).

int GetLength()

Returns

int

Number of lines.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

GetMuted()

Get the pattern mute state.

bool GetMuted()

Returns

bool

true if pattern is muted; false otherwise.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

GetName()

Get the pattern name.

string? GetName()

Returns

string

Pattern name, or null if unavailable.

Remarks

GetPosition()

Get the pattern position on the timeline.

(int x, int y) GetPosition()

Returns

(int x, int y)

Tuple containing X and Y coordinates.

Remarks

GetTrackCount()

Get the number of tracks in the pattern.

int GetTrackCount()

Returns

int

Number of tracks.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SetData(PatternEvent[], int, int)

Set the pattern data (all events). Resizes the pattern and sets all event data.

void SetData(PatternEvent[] data, int tracks, int lines)

Parameters

data PatternEvent[]

Event data array (length must equal tracks * lines).

tracks int

Number of tracks.

lines int

Number of lines.

Remarks

Exceptions

ArgumentOutOfRangeException

Thrown if tracks or lines are negative.

ArgumentException

Thrown if data length doesn't match tracks * lines.

SunVoxException

Thrown when the operation fails or pattern doesn't exist.

ArgumentNullException

Thrown if data is null.

SetEvent(int, int, PatternEvent)

Set a pattern event at a specific location.

void SetEvent(int track, int line, PatternEvent patternEvent)

Parameters

track int

Track number.

line int

Line number.

patternEvent PatternEvent

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SetEvent(int, int, int, int, int, int, int)

Set a pattern event at a specific location.

void SetEvent(int track, int line, int nn, int vv, int mm, int ccee, int xxyy)

Parameters

track int

Track number.

line int

Line number.

nn int

Note: 0 - nothing; 1 to 127 - note; 128 - note off; 129+ - see NOTECMD_*.

vv int

Velocity: 1 to 129; 0 - default.

mm int

Module: 0 (empty) or module number + 1 (1 to 65535).

ccee int

Controller/effect: 0xCCEE. CC - controller (1 to 255); EE - effect.

xxyy int

Value: 0xXXYY. Controller value (0 to 32768) or effect parameter (0 to 65535).

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SetMuted(bool)

Set the pattern mute state.

void SetMuted(bool mute)

Parameters

mute bool

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SetName(string)

Set the pattern name.

void SetName(string name)

Parameters

name string

New pattern name.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

ArgumentNullException

Thrown if name is null.

SetPatternSize(int?, int?)

Set the pattern size (number of tracks and/or lines).

void SetPatternSize(int? tracks = null, int? lines = null)

Parameters

tracks int?

Number of tracks (null to keep current).

lines int?

Number of lines (null to keep current).

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SetPosition(int, int)

Set the pattern position on the timeline.

void SetPosition(int x, int y)

Parameters

x int

Line number on which the pattern starts.

y int

Y coordinate on timeline.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.