Interface ISlot
- Namespace
- SunSharp
- Assembly
- SunSharp.dll
Represents a SunVox slot.
public interface ISlot
Properties
Id
Gets the slot ID.
int Id { get; }
Property Value
- int
IsOpen
Gets a value indicating whether the slot is currently open.
bool IsOpen { get; }
Property Value
- bool
SunVox
SunVox instance this slot belongs to.
ISunVox SunVox { get; }
Property Value
Synthesizer
Project synthesizer, containing all the existing modules.
ISynthesizer Synthesizer { get; }
Property Value
Timeline
Project timeline, containing all the existing patterns.
ITimeline Timeline { get; }
Property Value
VirtualPattern
Virtual, 16-track pattern for sending events to the engine.
IVirtualPattern VirtualPattern { get; }
Property Value
Methods
AcquireLock()
IDisposable AcquireLock()
Returns
- IDisposable
Close()
Closes the slot. Uses the shared slot management lock for thread safety.
void Close()
Remarks
Calls sv_close_slot(int).
GetAutomaticStop()
Get the autostop mode. When false, the project loops endlessly.
bool GetAutomaticStop()
Returns
- bool
true if automatic stop is enabled.
Remarks
Calls sv_get_autostop(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
GetCurrentLine()
Get the current line number on the timeline.
int GetCurrentLine()
Returns
- int
Current line number (playback position).
Remarks
Calls sv_get_current_line(int).
GetCurrentLineWithTenthPart()
Get current line in fixed point format (with tenth part).
int GetCurrentLineWithTenthPart()
Returns
- int
Current line number in fixed point format.
Remarks
Calls sv_get_current_line2(int).
GetCurrentSignalLevel(AudioChannel)
Get the current signal level from the Output module.
int GetCurrentSignalLevel(AudioChannel channel = AudioChannel.Left)
Parameters
channelAudioChannelAudio channel.
Returns
- int
Signal level (0 to 255).
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
GetSongBpm()
Get the project BPM (Beats Per Minute).
int GetSongBpm()
Returns
- int
Remarks
The value can be set using pattern effects.
Calls sv_get_song_bpm(int).Exceptions
- SunVoxException
Thrown when the operation fails.
- See Also
-
GetSongTpl(int)
GetSongLengthInFrames()
Get the project length in frames.
uint GetSongLengthInFrames()
Returns
- uint
Remarks
A frame is a pair of samples for stereo audio, or a single sample for mono audio.
Calls sv_get_song_length_frames(int).GetSongLengthInLines()
Get the project length in lines.
uint GetSongLengthInLines()
Returns
- uint
Remarks
GetSongName()
Get the project name.
string? GetSongName()
Returns
- string
Project name, or null if unavailable.
Remarks
Calls sv_get_song_name(int).
GetSongTpl()
Get the project TPL (Ticks Per Line).
int GetSongTpl()
Returns
- int
Remarks
The value can be set using pattern effects.
Calls sv_get_song_tpl(int).Exceptions
- SunVoxException
Thrown when the operation fails.
GetTimeMapFrames(int, int)
Get the project time map.
uint[] GetTimeMapFrames(int startLine, int length)
Parameters
startLineintFirst line to read (usually 0).
lengthintNumber of lines to read.
Returns
- uint[]
Array with frame counts for each line.
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
GetTimeMapSpeed(int, int)
Get the project time map.
Speed[] GetTimeMapSpeed(int startLine, int length)
Parameters
startLineintFirst line to read (usually 0).
lengthintNumber of lines to read.
Returns
- Speed[]
Array with information about speed for each line.
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
GetVolume()
Set the project volume.
int GetVolume()
Returns
- int
Previous volume (0 to 256).
Remarks
Calls sv_volume(int, int).
Exceptions
- SunVoxException
Thrown when the operation fails.
IsPlaying()
Check if the project is currently playing.
bool IsPlaying()
Returns
- bool
Remarks
Calls sv_end_of_song(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
Load(byte[])
Load a SunVox project from memory.
void Load(byte[] data)
Parameters
databyte[]Byte array with project data.
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
Load(string)
Load a SunVox project from file.
void Load(string path)
Parameters
pathstringFile path (relative or absolute).
Remarks
Calls sv_load(int, IntPtr).
Exceptions
- SunVoxException
Thrown when the operation fails.
- ArgumentNullException
Thrown if
pathis null.
Lock()
Lock the slot for thread-safe access. Use when reading/modifying SunVox data from different threads on the same slot. Some functions require lock/unlock. Remember to call UnlockSlot(int)!
void Lock()
Remarks
The library uses a recursive mutex, so the same thread may call LockSlot(int) multiple times without deadlocking itself.
Calls sv_lock_slot(int).Exceptions
- SunVoxException
Thrown when the operation fails.
Open()
Opens the slot for use. Uses the shared slot management lock for thread safety.
void Open()
Remarks
Calls sv_open_slot(int).
PauseAudioStream()
Pause the audio stream from a slot.
void PauseAudioStream()
Remarks
Calls sv_pause(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
ResumeAudioStream()
Resume the audio stream from a slot.
void ResumeAudioStream()
Remarks
Calls sv_resume(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
ResumeStreamOnSyncEffect()
Wait for sync (pattern effect 0x33 in any slot) and resume the audio stream.
void ResumeStreamOnSyncEffect()
Remarks
Calls sv_sync_resume(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
Rewind(int)
Jump to the specified line on the timeline.
void Rewind(int lineNumber)
Parameters
lineNumberint
Remarks
Calls sv_rewind(int, int).
Exceptions
- SunVoxException
Thrown when the operation fails.
SaveToFile(string)
Save the SunVox project to a file.
void SaveToFile(string path)
Parameters
pathstringFile path where the project will be saved.
Remarks
Calls sv_save(int, IntPtr).
Exceptions
- SunVoxException
Thrown when the operation fails.
- ArgumentNullException
Thrown if
pathis null.
SetAutomaticStop(bool)
Set autostop mode. When OFF, the project loops endlessly.
void SetAutomaticStop(bool enable)
Parameters
enablebooltrue - stop at the end.
Remarks
Calls sv_set_autostop(int, int).
Exceptions
- SunVoxException
Thrown when the operation fails.
SetSongName(string)
Set the project name.
void SetSongName(string value)
Parameters
valuestringNew project name.
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
SetVolume(int)
Set the project volume.
void SetVolume(int value)
Parameters
valueint
Remarks
Calls sv_volume(int, int).
Exceptions
- SunVoxException
Thrown when the operation fails.
StartPlayback()
Play from the current position.
void StartPlayback()
Remarks
Calls sv_play(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
StartPlaybackFromBeginning()
Play from the beginning (line 0).
void StartPlaybackFromBeginning()
Remarks
Calls sv_play_from_beginning(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
StopPlayback()
Stop playing. First call stops playback. The sound engine continues working (e.g., reverb tail may be heard). Second call resets all activity and enters standby mode.
void StopPlayback()
Remarks
Calls sv_stop(int).
Exceptions
- SunVoxException
Thrown when the operation fails.
Unlock()
Unlock the slot. Must be called after LockSlot(int).
void Unlock()
Remarks
Calls sv_unlock_slot(int).
Exceptions
- SunVoxException
Thrown when the operation fails.