module SunVox
Defined in:
note.crsunvox.cr
Constant Summary
-
BUFFER_SIZE =
1024
-
CURRENT_VERSION_MAJOR =
2
-
CURRENT_VERSION_MINOR =
1
-
CURRENT_VERSION_MINOR2 =
0
-
DEFAULT_CHANNELS =
2
-
DEFAULT_CONFIG =
""
-
DEFAULT_FREQ =
44100
-
MAX_SLOTS =
16
-
NO_MODULE =
-1
-
OUTPUT_MODULE =
0
Class Method Summary
-
.close_slot(slot : Slot)
Closes a slot.
-
.connect_module(slot : Slot, src, dest)
Connect a module
src
to a moduledest
. -
.disconnect_module(slot : Slot, src, dest)
Disconnect a module
src
from a moduledest
. -
.end_of_song?(slot : Slot) : Bool
Is the song over and the end has been reached?
- .export_to_wav(slot, song_len_frames, out_filename)
-
.find_module(slot : Slot, name)
Find a module in a
slot
byname
-
.find_pattern(slot : Slot, name)
Finds the pattern in
slot
byname
- .frequency_to_pitch(in_freq)
-
.get_current_line(slot : Slot)
The current line the playhead is at
-
.get_current_line2(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_current_signal_level(slot : Slot, channel)
Gets the current output signal level
-
.get_log(bytes : Int32)
Gets the debug log messages
-
.get_module_color(slot : Slot, module_num)
TODO Parse the color Get the color of a module in 0xBBGGRR format.
-
.get_module_ctl_name(slot : Slot, module_num, ctl_num)
Get the name of a module's controller.
-
.get_module_ctl_value(slot : Slot, module_num, ctl_num, scaled = false)
Get the value of a modules controller.
-
.get_module_curve(slot : Slot, module_num, curve_num, length)
Get the curve from a module
-
.get_module_finetune(slot : Slot, module_num)
Get module's finetune values.
-
.get_module_flags(slot : Slot, module_num)
TODO Parse the flags Get the flags set on a module
-
.get_module_inputs(slot : Slot, module_num)
A list of all the inputs a module has.
-
.get_module_inputs_number(slot : Slot, module_num)
The number of module inputs.
-
.get_module_name(slot : Slot, name)
Gets the name of a module.
-
.get_module_outputs(slot : Slot, module_num)
A list of all the outputs a module has.
-
.get_module_outputs_number(slot : Slot, module_num)
The number of module outputs.
-
.get_module_scope(slot : Slot, module_num, channel, samples_to_read)
TODO Not sure if this works right, and not sure how to check if it does....
-
.get_module_xy(slot : Slot, module_num)
Get the x, y positon of a module.
-
.get_number_of_module_ctls(slot : Slot, module_num)
Get the number of controllers a module has.
-
.get_number_of_modules(slot : Slot)
The number of modules in
slot
-
.get_number_of_patterns(slot : Slot)
Gets the number of patterns in a
slot
-
.get_pattern_data(slot : Slot, pattern_num)
Get the event data, seperated by tracks.
-
.get_pattern_lines(slot : Slot, pattern_num)
Gets the number of lines in a pattern
-
.get_pattern_name(slot : Slot, pattern_num)
Gets the pattern's name
-
.get_pattern_tracks(slot : Slot, pattern_num)
Get the number of track in the pattern.
-
.get_pattern_x(slot : Slot, pat_num)
Gets the pattern's starting line.
-
.get_pattern_y(slot : Slot, pat_num)
Gets the pattern's height.
-
.get_song_bpm(slot : Slot)
Gets the BPM of the song in
slot
-
.get_song_length(slot : Slot)
Get the length of the song in seconds
-
.get_song_length_frames(slot : Slot)
The total length in ticks of the song in
slot
s. -
.get_song_length_lines(slot : Slot)
The total song length in lines of
slot
. -
.get_song_name(slot : Slot)
Gets the name of the song in
slot
-
.get_song_tpl(slot : Slot)
Number of lines executed in a second in the song.
-
.load(slot : Slot, filename)
Loads a filename into a slot.
-
.load_module(slot : Slot, filename, x = 0, y = 0, z = 0)
Load a module from a file.
- .module_bypass?(slot : Slot, module_num)
- .module_effect?(slot : Slot, module_num)
- .module_exists?(slot : Slot, module_num)
- .module_mute?(slot : Slot, module_num)
- .module_solo?(slot : Slot, module_num)
-
.new_module(slot : Slot, type : ModuleType, name = "", x = 0, y = 0, z = 0)
Create a new module in
slot
. - .offline?
-
.open_slot(slot : Slot)
Opens a slot
-
.pattern_mute(slot : Slot, pattern_num, mute = true)
Mute/Unmute the pattern.
-
.pause(slot : Slot)
Pauses the playback at the current line.
- .pitch_to_frequency(in_pitch)
-
.play(slot : Slot)
Plays the current song from the current line.
-
.play_from_beginning(slot : Slot)
Plays the current song from the beginning.
-
.remove_module(slot : Slot, module_num)
Remove the module
module_num
inslot
. -
.repeats?(slot : Slot) : Bool
Returns whether or not a song will repeat when the end is reached.
-
.resume(slot : Slot)
Resumes playback from a paused state.
- .sample_rate
- .sample_size
-
.sampler_load(slot : Slot, sampler_module_num, filename, sample_slot = -1)
Loads a file into a sampler.
-
.send_event(slot : Slot, track_num, note : Note, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0)
Sends an event to SunVox.
-
.send_event(slot : Slot, track_num, note : Int32, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0)
Sends an event to SunVox.
-
.send_event(slot : Slot, track_num, event : Event)
Sends an event to SunVox.
-
.set_event_time(slot : Slot, timestamp : UInt32 = 0_u32, set = true)
Changes how SunVox processes
.send_event
. -
.set_module_curve(slot : Slot, module_num, curve_num, curve_data : Slice(Float32))
TODO Do I need to
Pointer.malloc
here? Set the curve data of a module -
.set_repeat(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)
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)
Starts up the SunVox Engine.
- .started?
-
.stop(slot : Slot)
Stops the current song from playing.
-
.stop_engine
Shuts down the engine.
-
.ticks : UInt32
The current tick
-
.ticks_per_second : UInt32
How many ticks happen per second
-
.time_map(slot : Slot, start_line, len, flags = 0)
Honestly, no idea how this one works.
- .update_input
-
.volume(slot : Slot, volume : UInt8)
Sets the output volume of the slot.
Class Method Detail
Closes a slot. Raises exception if the slot is closed or something goes wrong.
Connect a module src
to a module dest
.
Disconnect a module src
from a module dest
.
Is the song over and the end has been reached?
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
Gets the current output signal level
TODO Parse the color Get the color of a module in 0xBBGGRR format.
Get the name of a module's controller.
Get the value of a modules controller.
Get the curve from a module
TODO Parse the flags Get the flags set on a module
A list of all the inputs a module has.
The number of module inputs.
A list of all the outputs a module has.
The number of module outputs.
TODO Not sure if this works right, and not sure how to check if it does.... Maybe try to output to WAV or something.... Get the raw audio output values for a module.
Get the number of controllers a module has.
Get the event data, seperated by tracks.
Gets the number of lines in a pattern
Get the number of track in the pattern.
The total length in ticks of the song in slot
s.
Number of lines executed in a second in the song.
Load a module from a file. File can be sunsynth, xi, wav, or aiff.
Create a new module in slot
. Returns the number of the new module.
Mute/Unmute the pattern.
Plays the current song from the beginning.
Remove the module module_num
in slot
.
Returns whether or not a song will repeat when the end is reached.
Loads a file into a sampler. File must be xi, wav, or aiff.
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
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
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
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)
TODO Do I need to Pointer.malloc
here?
Set the curve data of a module
Sets whether or not a song will repeat when the end is reached.
Jumps the current position of the playhead to a line number.
Starts up the SunVox Engine. Hooks at_exit
to ensure .stop_engine
is run on close
Stops the current song from playing. 2 calls will stop all the synths and sounds.
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!