enum

SunVox::Slot

Inherits Enum < Comparable < Value < Object

The slots SunVox can use. MAX: 16

Constants

Zero = 0
One = 1
Two = 2
Three = 3
Four = 4
Five = 5
Six = 6
Seven = 7
Eight = 8
Nine = 9
Ten = 10
Eleven = 11
Twelve = 12
Thirteen = 13
Fourteen = 14
Fifteen = 15

Constructors

from_int(in_int : Int) : Slot

Converts an integer index (0..15) into a Slot, raising if out of range.

Source
open(slot : Slot | Int = Slot::Zero) : Slot

Opens a slot (defaults to Slot::Zero) and returns it.

Source

Class methods

open(slot : Slot | Int = Slot::Zero, & : Slot -> )

Opens a slot, yields it to the block, and ensures it is closed afterwards.

Source

Instance methods

add_module(type : ModuleType | String, name : String = "", x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module

Creates a new module in this slot and returns its SunVox::Module wrapper.

Source
add_pattern(lines : Int32 = 32, tracks : Int32 = 4, x : Int32 = 0, y : Int32 = 0, name : String = "", clone : Pattern | Int32 = -1, icon_seed : Int32 = 0) : Pattern

Alias for #new_pattern.

Source
autostop=(enabled : Bool) : Bool

Enables or disables autostop on this slot.

Source
autostop?

Returns true if autostop is enabled (song stops at end instead of looping).

Source
base_version

Gets the SunVox version used to create the project.

Source
bpm

Gets the project BPM (Beats Per Minute).

Source
close

Closes this slot in the SunVox engine.

Source
current_line

Gets the current line number on the timeline.

Source
current_line2

Gets the current line number in fixed-point 27.5 format.

Source
current_line_float

Gets the current line number as a floating-point value.

Source
duration

Gets the approximate duration of the project.

Source
eight?

Returns true if this enum value equals Eight

Source
eleven?

Returns true if this enum value equals Eleven

Source
end_of_song?

Returns true if the song has stopped / finished playing.

Source
export_to_wav(out_filename : String | Path, song_len_frames : Int = length_frames) : self

Exports the project in this slot to a WAV file (requires engine started with offline: true).

Source
fifteen?

Returns true if this enum value equals Fifteen

Source
find_module(name : String) : Module | Nil

Finds a module by name and returns it, or nil if not found.

Source
find_pattern(name : String) : Pattern | Nil

Finds a pattern by name and returns it, or nil if not found.

Source
five?

Returns true if this enum value equals Five

Source
four?

Returns true if this enum value equals Four

Source
fourteen?

Returns true if this enum value equals Fourteen

Source
from_int(in_int : Int) : Slot

Instance-level helper preserved for backwards compatibility.

Source
length_frames

Gets the project length in audio frames.

Source
length_lines

Gets the project length in tracker lines.

Source
load(filename : String | Path) : self

Loads a project file (.sunvox, .mod, .xm) from disk into this slot.

Source
load(data : Bytes) : self

Loads a project from a memory buffer (Bytes) into this slot.

Source
load_from_memory(data : Bytes) : self

Alias for #load(data : Bytes).

Source
load_module(filename : String | Path, x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module

Loads a module or sample from a file (sunsynth, xi, wav, aiff, ogg, mp3, flac) and returns a SunVox::Module.

Source
load_module(data : Bytes, x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module

Loads a module or sample from memory (Bytes) and returns a SunVox::Module.

Source
load_module_from_memory(data : Bytes, x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module

Alias for #load_module(data : Bytes, ...).

Source
lock

Locks this slot for thread-safe access/modification.

Source
module(id : Int32) : Module

Returns a SunVox::Module handle for id.

Source
module(name : String) : Module

Finds a module by name and returns its SunVox::Module, raising if not found.

Source
module?(id : Int32) : Module | Nil

Returns a SunVox::Module for id if it exists in this slot, or nil.

Source
module?(name : String) : Module | Nil

Finds a module by name and returns it, or nil if not found.

Source
module_slots_count

Returns the number of module slots in the project (some slots may be empty).

Source
modules

Returns all active modules currently existing in this slot.

Source
name

Gets the project/song name.

Source
name=(new_name : String) : String

Sets the project/song name.

Source
new_module(type : ModuleType | String, name : String = "", x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module

Alias for #add_module.

Source
new_pattern(lines : Int32 = 32, tracks : Int32 = 4, x : Int32 = 0, y : Int32 = 0, name : String = "", clone : Pattern | Int32 = -1, icon_seed : Int32 = 0) : Pattern

Creates a new pattern in this slot and returns its SunVox::Pattern wrapper.

Source
nine?

Returns true if this enum value equals Nine

Source
one?

Returns true if this enum value equals One

Source
open

Opens this slot in the SunVox engine.

Source
open?

Returns true if this slot is currently open.

Source
output

Returns the built-in Output module (module 0) for this slot.

Source
pattern(id : Int32) : Pattern

Returns a SunVox::Pattern handle for id.

Source
pattern(name : String) : Pattern

Finds a pattern by name and returns its SunVox::Pattern, raising if not found.

Source
pattern?(id : Int32) : Pattern | Nil

Returns a SunVox::Pattern for id if it exists in this slot, or nil.

Source
pattern?(name : String) : Pattern | Nil

Finds a pattern by name and returns it, or nil if not found.

Source
pattern_slots_count

Returns the number of pattern slots in the project (some slots may be empty).

Source
patterns

Returns all active patterns currently existing in this slot.

Source
pause

Pauses the audio stream on this slot.

Source
play

Plays the current project from the current playhead position.

Source
play_from_beginning

Plays the current project from the beginning (line 0).

Source
playing?

Returns true if the song is currently playing.

Source
repeats=(repeat : Bool) : Bool

Sets whether the song repeats when the end is reached.

Source
repeats?

Returns whether the song repeats (i.e. autostop is disabled).

Source
reset_event_time

Resets event timing on this slot back to automatic mode.

Source
resume

Resumes the audio stream on this slot.

Source
rewind(line_num : Int32) : self

Jumps the playhead to line_num.

Source
save(filename : String | Path) : self

Saves the current project in this slot to a file on disk.

Source
save_to_bytes

Saves the current project in this slot to a Bytes buffer in memory.

Source
save_to_memory

Alias for #save_to_bytes.

Source
send_event(track_num : Int32, note : Note | Int32 = Note::None, velocity : Int32 = 0, mod : Module | Int32 = -1, ctl : Int32 = 0, effect : Int32 = 0, ctl_value : Int32 = 0) : self

Sends a real-time event to this slot.

Source
send_event(track_num : Int32, event : Event) : self

Sends a SunVox::Event record to track_num on this slot.

Source
set_event_time(timestamp : UInt32 = 0_u32, set : Bool = true) : self

Sets the timestamp for subsequent events sent to this slot.

Source
seven?

Returns true if this enum value equals Seven

Source
signal_level(channel : Int32 = 0) : Int32

Gets the current real-time output signal level (0..255) for channel (0 = left, 1 = right).

Source
six?

Returns true if this enum value equals Six

Source
skip_to_line(line_num : Int32) : self

Alias for #rewind.

Source
song_name

Alias for #name.

Source
song_name=(new_name : String) : String

Alias for #name=.

Source
stop

Stops playback (second call puts all modules into standby mode).

Source
sync_resume

Waits for sync (pattern effect 0x33) and resumes the audio stream on this slot.

Source
synchronize

Locks this slot, yields self, and unlocks in an ensure block.

Source
ten?

Returns true if this enum value equals Ten

Source
thirteen?

Returns true if this enum value equals Thirteen

Source
three?

Returns true if this enum value equals Three

Source
time_map(start_line : Int32 = 0, len : Int32 = length_lines.to_i, flags : TimeMapFlags | Int32 = TimeMapFlags::Speed) : Slice(UInt32)

Gets the project time map for len lines starting at start_line.

Source
tpl

Gets the project TPL (Ticks Per Line).

Source
twelve?

Returns true if this enum value equals Twelve

Source
two?

Returns true if this enum value equals Two

Source
unlock

Unlocks this slot.

Source
volume(vol : Int) : Int32

Sets the volume of this slot (0..256) and returns the previous volume.

Source
volume

Gets the current volume of this slot (0..256).

Source
volume=(vol : Int)

Sets the volume of this slot (0..256).

Source
zero?

Returns true if this enum value equals Zero

Source