struct SunVox::Pattern

Overview

High-level wrapper around a tracker pattern inside a SunVox::Slot.

Defined in:

pattern.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(slot : Slot, id : Int32) #

[View source]

Instance Method Detail

def [](track : Int32, line : Int32) : SunVox::Event #

Reads the SunVox::Event at (track, line).


[View source]
def []=(track : Int32, line : Int32, event : SunVox::Event) : SunVox::Event #

Writes #event to the cell at (track, line).


[View source]
def data : Array(Array(SunVox::Event)) #

Returns all pattern events organized by track (Array(Array(SunVox::Event))).


[View source]
def event(track : Int32, line : Int32) : SunVox::Event #

Reads the full SunVox::Event at (track, line).


[View source]
def exists? : Bool #

Returns true if this pattern slot is non-empty (lines > 0).


[View source]
def get_event_field(track : Int32, line : Int32, column : PatternColumn | Int32) : Int32 #

Reads a single column value from the cell at (track, line).


[View source]
def id : Int32 #

[View source]
def lines : Int32 #

Gets the number of lines in this pattern.


[View source]
def lines=(new_lines : Int32) : Int32 #

Sets the number of lines in this pattern.


[View source]
def mute!(mute : Bool = true) : Bool #

Mutes (or unmutes) this pattern and returns its previous mute state.


[View source]
def muted=(mute : Bool) : Bool #

Sets the mute state of this pattern.


[View source]
def muted? : Bool #

Returns true if this pattern is currently muted.


[View source]
def name : String #

Gets the pattern's name.


[View source]
def name=(new_name : String) : String #

Sets the pattern's name.


[View source]
def raw_data : Slice(LibSunVox::Event) #

Returns a direct mutable Slice(LibSunVox::Event) into the underlying SunVox pattern buffer.


[View source]
def remove! : Nil #

Removes this pattern from its slot.


[View source]
def set_event(track : Int32, line : Int32, note : Note | Int32 = -1, velocity : Int32 = -1, mod : Module | Int32 = -1, ctl : Int32 = -1, effect : Int32 = -1, ctl_value : Int32 = -1) : self #

Writes fields to a cell at (track, line). Negative arguments leave the corresponding field unchanged.


[View source]
def set_event(track : Int32, line : Int32, event : SunVox::Event) : self #

Writes a full SunVox::Event to the cell at (track, line).


[View source]
def set_size(tracks : Int32 = -1, lines : Int32 = -1) : self #

Resizes this pattern (-1 leaves a dimension unchanged).


[View source]
def set_xy(x : Int32, y : Int32) : self #

Sets the pattern's (x, y) coordinates on the timeline.


[View source]
def slot : Slot #

[View source]
def to_i : Int32 #

Returns the integer pattern ID.


[View source]
def tracks : Int32 #

Gets the number of tracks in this pattern.


[View source]
def tracks=(new_tracks : Int32) : Int32 #

Sets the number of tracks in this pattern.


[View source]
def unmute! : Bool #

Unmutes this pattern and returns its previous mute state.


[View source]
def x : Int32 #

Gets the pattern's X position (start line number on the timeline).


[View source]
def x=(new_x : Int32) : Int32 #

Sets the pattern's X coordinate (start line on timeline).


[View source]
def xy : NamedTuple(x: Int32, y: Int32) #

Gets the pattern's {x, y} coordinates on the timeline.


[View source]
def y : Int32 #

Gets the pattern's Y position (vertical position on the timeline).


[View source]
def y=(new_y : Int32) : Int32 #

Sets the pattern's Y coordinate on the timeline.


[View source]