Class Synthesizer
- Namespace
- SunSharp
- Assembly
- SunSharp.dll
Project synthesizer, containing all the existing modules.
public class Synthesizer : ISynthesizer
- Inheritance
-
objectSynthesizer
- Implements
Properties
Output
public OutputModuleHandle Output { get; }
Property Value
Slot
Gets the slot this synthesizer belongs to.
public Slot Slot { get; }
Property Value
Methods
ConnectModule(SynthModuleHandle, SynthModuleHandle)
Connect the source module to the destination module.
public void ConnectModule(SynthModuleHandle source, SynthModuleHandle destination)
Parameters
sourceSynthModuleHandleSource module number (0-based).
destinationSynthModuleHandleDestination module number (0-based).
Remarks
Requires LockSlot(int) / UnlockSlot(int).
Calls sv_connect_module(int, int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
ConnectModule(int, int)
Connect the source module to the destination module.
public void ConnectModule(int sourceId, int destinationId)
Parameters
sourceIdintdestinationIdint
Remarks
Requires LockSlot(int) / UnlockSlot(int).
Calls sv_connect_module(int, int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
CreateModule(SynthModuleType, string, int, int, int)
Create a new module.
public SynthModuleHandle CreateModule(SynthModuleType type, string name, int x = 0, int y = 0, int z = 0)
Parameters
typeSynthModuleTypeType of module to create.
namestringName of the module.
xintX coordinate (0 to 1024, center: 512).
yintY coordinate (0 to 1024, center: 512).
zintLayer number (0 to 7).
Returns
- SynthModuleHandle
The identifier of the newly created module (0-based).
Remarks
Requires LockSlot(int) / UnlockSlot(int).
Calls sv_new_module(int, IntPtr, IntPtr, int, int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
- ArgumentNullException
Thrown if
typeis null.- ArgumentOutOfRangeException
Thrown when the module type is not valid.
DisconnectModule(SynthModuleHandle, SynthModuleHandle)
Disconnect the source module from the destination module.
public void DisconnectModule(SynthModuleHandle source, SynthModuleHandle destination)
Parameters
sourceSynthModuleHandleSource module number (0-based).
destinationSynthModuleHandleDestination module number (0-based).
Remarks
Requires LockSlot(int) / UnlockSlot(int).
Calls sv_disconnect_module(int, int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
DisconnectModule(int, int)
Disconnect the source module from the destination module.
public void DisconnectModule(int sourceId, int destinationId)
Parameters
sourceIdintdestinationIdint
Remarks
Requires LockSlot(int) / UnlockSlot(int).
Calls sv_disconnect_module(int, int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<SynthModuleHandle> GetEnumerator()
Returns
- IEnumerator<SynthModuleHandle>
An enumerator that can be used to iterate through the collection.
GetModule(int)
Returns a handle to the module with the specified ID. The underlying module may not exist.
public SynthModuleHandle GetModule(int moduleId)
Parameters
moduleIdint
Returns
GetModuleExists(int)
Check if a module exists.
public bool GetModuleExists(int moduleId)
Parameters
moduleIdintmodule number (0-based).
Returns
- bool
true if module exists.
Remarks
GetModuleFlags(int)
Get the module flags.
public ModuleFlags GetModuleFlags(int moduleId)
Parameters
moduleIdintmodule number (0-based).
Returns
- ModuleFlags
Module flags indicating existence, type, state, and connections.
Remarks
GetUpperModuleCount()
Get the upper limit of module count (one more than the highest module number).
public int GetUpperModuleCount()
Returns
- int
Upper limit of module count.
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
LoadModule(byte[], int, int, int)
Load a module or sample from memory. Supported file formats: sunsynth, xi, wav, aiff.
public SynthModuleHandle LoadModule(byte[] data, int x = 0, int y = 0, int z = 0)
Parameters
databyte[]Byte array with module data.
xintX coordinate (0 to 1024, center: 512).
yintY coordinate (0 to 1024, center: 512).
zintLayer number (0 to 7).
Returns
- SynthModuleHandle
The number of the loaded module.
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
- ArgumentNullException
Thrown if
datais null.
LoadModule(string, int, int, int)
Load a module or sample from file. Supported file formats: sunsynth, xi, wav, aiff.
public SynthModuleHandle LoadModule(string path, int x = 0, int y = 0, int z = 0)
Parameters
pathstringFile path (relative or absolute).
xintX coordinate (0 to 1024, center: 512).
yintY coordinate (0 to 1024, center: 512).
zintLayer number (0 to 7).
Returns
- SynthModuleHandle
The number of the loaded module.
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
- ArgumentNullException
Thrown if
pathis null.
RemoveModule(SynthModuleHandle)
Remove (delete) a module.
public void RemoveModule(SynthModuleHandle moduleHandle)
Parameters
moduleHandleSynthModuleHandle
Remarks
Requires LockSlot(int) / UnlockSlot(int).
Calls sv_remove_module(int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
RemoveModule(int)
Remove (delete) a module.
public void RemoveModule(int moduleId)
Parameters
moduleIdintmodule number (0-based).
Remarks
Requires LockSlot(int) / UnlockSlot(int).
Calls sv_remove_module(int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
TryGetModule(int, out SynthModuleHandle?)
Returns a handle to the module with the specified ID, if it exists.
public bool TryGetModule(int moduleId, out SynthModuleHandle? moduleHandle)
Parameters
moduleIdintmodule number (0-based).
moduleHandleSynthModuleHandle?
Returns
- bool
true if module exists.
Remarks
TryGetModule(string, out SynthModuleHandle?)
Find a module by name.
public bool TryGetModule(string name, out SynthModuleHandle? moduleHandle)
Parameters
namestringModule name to search for.
moduleHandleSynthModuleHandle?
Returns
- bool
module number (0-based) if found.
Remarks
Calls sv_find_module(int, IntPtr).
Exceptions
- SunVoxException
Thrown when an error occurs during the search.
- ArgumentNullException
Thrown if
nameis null.