module SunVox
#
Constants#
CURRENT_VERSION_MAJOR = 1
#
1
CURRENT_VERSION_MINOR = 9
#
9
CURRENT_VERSION_MINOR2 = 6
#
6
DEFAULT_CHANNELS = 2
#
2
DEFAULT_CONFIG = ""
#
""
DEFAULT_FREQ = 44100
#
44100
MAX_SLOTS = 16
#
16
NO_MODULE = -1
#
-1
OUTPUT_MODULE = 0
#
0
Class methods#
.close_slot(slot : Slot)
#
(slot : Slot)
Closes a slot. Raises exception if the slot is closed or something goes wrong.
.frequency_to_pitch(in_freq)
#
(in_freq)
.get_current_line2(slot : Slot)
#
(slot : Slot)
THe current line the play head is at in a fractional form (not sure how this works) https://warmplace.ru/soft/sunvox/sunvox_lib.php#sv_get_current_line2
.get_log(bytes : Int32)
#
(bytes : Int32)
Gets the debug log messages
.get_module_ctl_value(slot : Slot, module_num, ctl_num, scaled = false)
#
(slot : Slot, module_num, ctl_num, scaled = false)
Get the value of a modules controller.
.get_module_scope(slot : Slot, module_num, channel, samples_to_read)
#
(slot : Slot, module_num, channel, samples_to_read)
Get the raw audio output values for a module.
.load_module(slot : Slot, filename, x = 0, y = 0, z = 0)
#
(slot : Slot, filename, x = 0, y = 0, z = 0)
Load a module from a file. File can be sunsynth, xi, wav, or aiff.
.new_module(slot : Slot, type : ModuleType, name = "", x = 0, y = 0, z = 0)
#
(slot : Slot, type : ModuleType, name = "", x = 0, y = 0, z = 0)
Create a new module in slot
. Returns the number of the new module.
.pitch_to_frequency(in_pitch)
#
(in_pitch)
.sample_rate
#
.sampler_load(slot : Slot, sampler_module_num, filename, sample_slot = -1)
#
(slot : Slot, sampler_module_num, filename, sample_slot = -1)
Loads a file into a sampler. File must be xi, wav, or aiff.
.send_event(slot : Slot, track_num, note : Int32, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0)
#
(slot : Slot, track_num, note : Int32, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0)
Sends an event to SunVox. Can be used to send notes, change ctl values, or set note effects. A module_num
of 0
causes no effect, so any module you would like to actually use must have 1
added to it
.send_event(slot : Slot, track_num, event : Event)
#
(slot : Slot, track_num, event : Event)
Sends an event to SunVox. Can be used to send notes, change ctl values, or set note effects. A module_num
of 0
causes no effect, so any module you would like to actually use must have 1
added to it
.send_event(slot : Slot, track_num, note : Note, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0)
#
(slot : Slot, track_num, note : Note, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0)
Sends an event to SunVox. Can be used to send notes, change ctl values, or set note effects. A module_num
of 0
causes no effect, so any module you would like to actually use must have 1
added to it
.set_event_time(slot : Slot, timestamp : UInt32 = 0_u32, set = true)
#
(slot : Slot, timestamp : UInt32 = 0_u32, set = true)
Changes how SunVox processes send_event
. Instead of playing the event as soon as it's called, this allows send_event
to be delayed by a number of ticks. When setting set
to false
it will reset the timing method back to immediate. When used timestamp
should generally be SunVox.ticks + (SunVox.ticks_per_second/1000 * delay_milliseconds)
.set_module_curve(slot : Slot, module_num, curve_num, curve_data : Slice(Float32))
#
(slot : Slot, module_num, curve_num, curve_data : Slice(Float32))
Set the curve data of a module
.set_repeat(slot : Slot, bool) : Nil
#
(slot : Slot, bool) : Nil
Sets whether or not a song will repeat when the end is reached.
.skip_to_line(slot : Slot, line_num : Int32)
#
(slot : Slot, line_num : Int32)
Jumps the current position of the playhead to a line number.
.start_engine(config = DEFAULT_CONFIG, freq = DEFAULT_FREQ, channels = DEFAULT_CHANNELS, no_debug_output = false, offline = false, sample_type = SampleType::Int16, one_thread = false)
#
(config = DEFAULT_CONFIG, freq = DEFAULT_FREQ, channels = DEFAULT_CHANNELS, no_debug_output = false, offline = false, sample_type = SampleType::Int16, one_thread = false)
Starts up the SunVox Engine. Hooks at_exit
to ensure stop_engine
is run on close
.started?
#
.stop(slot : Slot)
#
(slot : Slot)
Stops the current song from playing. 2 calls will stop all the synths and sounds.
.stop_engine
#
Shuts down the engine.
.ticks : UInt32
#
: UInt32
The current tick
.ticks_per_second : UInt32
#
: UInt32
How many ticks happen per second
.time_map(slot : Slot, start_line, len, flags = 0)
#
(slot : Slot, start_line, len, flags = 0)
Honestly, no idea how this one works. Seems like it should be useful if someone who isn't me wants to figure it out lol: https://warmplace.ru/soft/sunvox/sunvox_lib.php#sv_get_time_map Good Luck!
.update_input
#