enum
SunVox::Slot
Overview
The slots SunVox can use. MAX: 16
Defined in:
slot.crEnum Members
-
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. -
.open(slot : Slot | Int = Slot::Zero) : Slot
Opens a slot (defaults to
Slot::Zero) and returns it.
Class Method Summary
-
.open(slot : Slot | Int = Slot::Zero, & : Slot -> )
Opens a slot, yields it to the block, and ensures it is closed afterwards.
Instance Method Summary
-
#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::Modulewrapper. -
#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. -
#autostop=(enabled : Bool) : Bool
Enables or disables autostop on this slot.
-
#autostop? : Bool
Returns true if autostop is enabled (song stops at end instead of looping).
-
#base_version : Int32
Gets the SunVox version used to create the project.
-
#bpm : Int32
Gets the project BPM (Beats Per Minute).
-
#close : Nil
Closes this slot in the SunVox engine.
-
#current_line : Int32
Gets the current line number on the timeline.
-
#current_line2 : Int32
Gets the current line number in fixed-point 27.5 format.
-
#current_line_float : Float64
Gets the current line number as a floating-point value.
-
#duration : Time::Span
Gets the approximate duration of the project.
-
#eight?
Returns
trueif this enum value equalsEight -
#eleven?
Returns
trueif this enum value equalsEleven -
#end_of_song? : Bool
Returns true if the song has stopped / finished playing.
-
#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). -
#fifteen?
Returns
trueif this enum value equalsFifteen -
#find_module(name : String) : Module | Nil
Finds a module by name and returns it, or
nilif not found. -
#find_pattern(name : String) : Pattern | Nil
Finds a pattern by name and returns it, or
nilif not found. -
#five?
Returns
trueif this enum value equalsFive -
#four?
Returns
trueif this enum value equalsFour -
#fourteen?
Returns
trueif this enum value equalsFourteen -
#from_int(in_int : Int) : Slot
Instance-level helper preserved for backwards compatibility.
-
#length_frames : UInt32
Gets the project length in audio frames.
-
#length_lines : UInt32
Gets the project length in tracker lines.
-
#load(filename : String | Path) : self
Loads a project file (
.sunvox,.mod,.xm) from disk into this slot. -
#load(data : Bytes) : self
Loads a project from a memory buffer (
Bytes) into this slot. -
#load_from_memory(data : Bytes) : self
Alias for
#load(data : Bytes). -
#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 aSunVox::Module. -
#load_module(data : Bytes, x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module
Loads a module or sample from memory (
Bytes) and returns aSunVox::Module. -
#load_module_from_memory(data : Bytes, x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module
Alias for
#load_module(data : Bytes, ...). -
#lock : Nil
Locks this slot for thread-safe access/modification.
-
#module(id : Int32) : Module
Returns a
SunVox::Modulehandle forid. -
#module(name : String) : Module
Finds a module by name and returns its
SunVox::Module, raising if not found. -
#module?(id : Int32) : Module | Nil
Returns a
SunVox::Moduleforidif it exists in this slot, ornil. -
#module?(name : String) : Module | Nil
Finds a module by name and returns it, or
nilif not found. -
#module_slots_count : Int32
Returns the number of module slots in the project (some slots may be empty).
-
#modules : Array(Module)
Returns all active modules currently existing in this slot.
-
#name : String
Gets the project/song name.
-
#name=(new_name : String) : String
Sets the project/song name.
-
#new_module(type : ModuleType | String, name : String = "", x : Int32 = 512, y : Int32 = 512, z : Int32 = 0) : Module
Alias for
#add_module. -
#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::Patternwrapper. -
#nine?
Returns
trueif this enum value equalsNine -
#one?
Returns
trueif this enum value equalsOne -
#open : self
Opens this slot in the SunVox engine.
-
#open? : Bool
Returns true if this slot is currently open.
-
#output : Module
Returns the built-in Output module (module 0) for this slot.
-
#pattern(id : Int32) : Pattern
Returns a
SunVox::Patternhandle forid. -
#pattern(name : String) : Pattern
Finds a pattern by name and returns its
SunVox::Pattern, raising if not found. -
#pattern?(id : Int32) : Pattern | Nil
Returns a
SunVox::Patternforidif it exists in this slot, ornil. -
#pattern?(name : String) : Pattern | Nil
Finds a pattern by name and returns it, or
nilif not found. -
#pattern_slots_count : Int32
Returns the number of pattern slots in the project (some slots may be empty).
-
#patterns : Array(Pattern)
Returns all active patterns currently existing in this slot.
-
#pause : self
Pauses the audio stream on this slot.
-
#play : self
Plays the current project from the current playhead position.
-
#play_from_beginning : self
Plays the current project from the beginning (line 0).
-
#playing? : Bool
Returns true if the song is currently playing.
-
#repeats=(repeat : Bool) : Bool
Sets whether the song repeats when the end is reached.
-
#repeats? : Bool
Returns whether the song repeats (i.e.
-
#reset_event_time : self
Resets event timing on this slot back to automatic mode.
-
#resume : self
Resumes the audio stream on this slot.
-
#rewind(line_num : Int32) : self
Jumps the playhead to
line_num. -
#save(filename : String | Path) : self
Saves the current project in this slot to a file on disk.
-
#save_to_bytes : Bytes
Saves the current project in this slot to a
Bytesbuffer in memory. -
#save_to_memory : Bytes
Alias for
#save_to_bytes. -
#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.
-
#send_event(track_num : Int32, event : Event) : self
Sends a
SunVox::Eventrecord totrack_numon this slot. -
#set_event_time(timestamp : UInt32 = 0_u32, set : Bool = true) : self
Sets the timestamp for subsequent events sent to this slot.
-
#seven?
Returns
trueif this enum value equalsSeven -
#signal_level(channel : Int32 = 0) : Int32
Gets the current real-time output signal level (0..255) for
channel(0 = left, 1 = right). -
#six?
Returns
trueif this enum value equalsSix -
#skip_to_line(line_num : Int32) : self
Alias for
#rewind. -
#song_name : String
Alias for
#name. -
#song_name=(new_name : String) : String
Alias for
#name=. -
#stop : self
Stops playback (second call puts all modules into standby mode).
-
#sync_resume : self
Waits for sync (pattern effect 0x33) and resumes the audio stream on this slot.
-
#synchronize(&)
Locks this slot, yields
self, and unlocks in anensureblock. -
#ten?
Returns
trueif this enum value equalsTen -
#thirteen?
Returns
trueif this enum value equalsThirteen -
#three?
Returns
trueif this enum value equalsThree -
#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
lenlines starting atstart_line. -
#tpl : Int32
Gets the project TPL (Ticks Per Line).
-
#twelve?
Returns
trueif this enum value equalsTwelve -
#two?
Returns
trueif this enum value equalsTwo -
#unlock : Nil
Unlocks this slot.
-
#volume(vol : Int) : Int32
Sets the volume of this slot (0..256) and returns the previous volume.
-
#volume : Int32
Gets the current volume of this slot (0..256).
-
#volume=(vol : Int)
Sets the volume of this slot (0..256).
-
#zero?
Returns
trueif this enum value equalsZero
Constructor Detail
Converts an integer index (0..15) into a Slot, raising if out of range.
Opens a slot (defaults to Slot::Zero) and returns it.
Class Method Detail
Opens a slot, yields it to the block, and ensures it is closed afterwards.
Instance Method Detail
Creates a new module in this slot and returns its SunVox::Module wrapper.
Alias for #new_pattern.
Exports the project in this slot to a WAV file (requires engine started with offline: true).
Finds a module by name and returns it, or nil if not found.
Finds a pattern by name and returns it, or nil if not found.
Instance-level helper preserved for backwards compatibility.
Loads a project file (.sunvox, .mod, .xm) from disk into this slot.
Loads a module or sample from a file (sunsynth, xi, wav, aiff, ogg, mp3, flac) and returns a SunVox::Module.
Loads a module or sample from memory (Bytes) and returns a SunVox::Module.
Alias for #load_module(data : Bytes, ...).
Finds a module by name and returns its SunVox::Module, raising if not found.
Returns a SunVox::Module for id if it exists in this slot, or nil.
Finds a module by name and returns it, or nil if not found.
Returns the number of module slots in the project (some slots may be empty).
Returns all active modules currently existing in this slot.
Alias for #add_module.
Creates a new pattern in this slot and returns its SunVox::Pattern wrapper.
Finds a pattern by name and returns its SunVox::Pattern, raising if not found.
Returns a SunVox::Pattern for id if it exists in this slot, or nil.
Finds a pattern by name and returns it, or nil if not found.
Returns the number of pattern slots in the project (some slots may be empty).
Returns all active patterns currently existing in this slot.
Saves the current project in this slot to a file on disk.
Sends a real-time event to this slot.
Sends a SunVox::Event record to track_num on this slot.
Sets the timestamp for subsequent events sent to this slot.
Gets the current real-time output signal level (0..255) for channel (0 = left, 1 = right).
Waits for sync (pattern effect 0x33) and resumes the audio stream on this slot.
Gets the project time map for len lines starting at start_line.
Sets the volume of this slot (0..256) and returns the previous volume.