Table of Contents

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

ISunVox

Synthesizer

Project synthesizer, containing all the existing modules.

ISynthesizer Synthesizer { get; }

Property Value

ISynthesizer

Timeline

Project timeline, containing all the existing patterns.

ITimeline Timeline { get; }

Property Value

ITimeline

VirtualPattern

Virtual, 16-track pattern for sending events to the engine.

IVirtualPattern VirtualPattern { get; }

Property Value

IVirtualPattern

Methods

AcquireLock()

Can be used instead of the Lock() and Unlock() methods, taking advantage of the using keyword.

IDisposable AcquireLock()

Returns

IDisposable

Close()

Closes the slot. Uses the shared slot management lock for thread safety.

void Close()

Remarks

GetAutomaticStop()

Get the autostop mode. When false, the project loops endlessly.

bool GetAutomaticStop()

Returns

bool

true if automatic stop is enabled.

Remarks

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

GetCurrentLineWithTenthPart()

Get current line in fixed point format (with tenth part).

int GetCurrentLineWithTenthPart()

Returns

int

Current line number in fixed point format.

Remarks

GetCurrentSignalLevel(AudioChannel)

Get the current signal level from the Output module.

int GetCurrentSignalLevel(AudioChannel channel = AudioChannel.Left)

Parameters

channel AudioChannel

Audio 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

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

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

startLine int

First line to read (usually 0).

length int

Number 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

startLine int

First line to read (usually 0).

length int

Number 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

Exceptions

SunVoxException

Thrown when the operation fails.

IsPlaying()

Check if the project is currently playing.

bool IsPlaying()

Returns

bool

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

Load(byte[])

Load a SunVox project from memory.

void Load(byte[] data)

Parameters

data byte[]

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

path string

File path (relative or absolute).

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

ArgumentNullException

Thrown if path is 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

PauseAudioStream()

Pause the audio stream from a slot.

void PauseAudioStream()

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

ResumeAudioStream()

Resume the audio stream from a slot.

void ResumeAudioStream()

Remarks

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

Exceptions

SunVoxException

Thrown when the operation fails.

Rewind(int)

Jump to the specified line on the timeline.

void Rewind(int lineNumber)

Parameters

lineNumber int

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SaveToFile(string)

Save the SunVox project to a file.

void SaveToFile(string path)

Parameters

path string

File path where the project will be saved.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

ArgumentNullException

Thrown if path is null.

SetAutomaticStop(bool)

Set autostop mode. When OFF, the project loops endlessly.

void SetAutomaticStop(bool enable)

Parameters

enable bool

true - stop at the end.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SetSongName(string)

Set the project name.

void SetSongName(string value)

Parameters

value string

New project name.

Remarks

Exceptions

SunVoxException

Thrown when the operation fails.

SetVolume(int)

Set the project volume.

void SetVolume(int value)

Parameters

value int

Remarks

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

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

Exceptions

SunVoxException

Thrown when the operation fails.