Class VirtualPattern
- Namespace
- SunSharp
- Assembly
- SunSharp.dll
Virtual, 16-track pattern for sending events to the engine.
public sealed class VirtualPattern : IVirtualPattern
- Inheritance
-
objectVirtualPattern
- Implements
Properties
Slot
Gets the slot this virtual pattern belongs to.
public Slot Slot { get; }
Property Value
Methods
GetTicks()
Get the current system tick counter.
public uint GetTicks()
Returns
- uint
Remarks
SunVox engine uses system-provided time space, measured in system ticks (don't confuse it with the project ticks). System ticks are used for timing in functions like AudioCallback(float[], AudioChannels, int, uint) and SetEventTiming(int, int).
Calls sv_get_ticks().GetTicksPerSecond()
Get the number of system ticks per second.
public uint GetTicksPerSecond()
Returns
- uint
Remarks
Calls sv_get_ticks_per_second().
ResetEventTiming()
Reset the timestamp of events sent by SendEvent(int, int, PatternEvent). If timestamp is zero: event is heard as quickly as possible.
public void ResetEventTiming()
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.
SendEvent(int, PatternEvent)
Send an event to the SunVox engine. Sends the specified pattern event to the given track. The event will be processed according to the last set timing.
public void SendEvent(int track, PatternEvent e)
Parameters
trackintTrack number within the virtual pattern.
ePatternEvent
Remarks
- See Also
SendEvent(int, int, int, int, int, int)
Send an event to the SunVox engine. Sends the specified pattern event to the given track. The event will be processed according to the last set timing.
public void SendEvent(int track, int nn = 0, int vv = 0, int mm = 0, int ccee = 0, int xxyy = 0)
Parameters
trackintTrack number within the virtual pattern.
nnintNote.
vvintVelocity.
mmintModule.
cceeintController and effect.
xxyyintValue.
Remarks
Consider using PatternEvent and the overload that accepts it for better readability.
Calls sv_send_event(int, int, int, int, int, int, int).Exceptions
- SunVoxException
Thrown when the operation fails.
SetEventTiming(int)
Set the timestamp of events sent by SendEvent(int, int, PatternEvent). Every event has a timestamp (when it was generated, e.g., key press time). If nonzero: event is heard at timestamp + sound latency * 2.
public void SetEventTiming(int timestamp)
Parameters
timestampintTimestamp (in system ticks) for future events. If not zero, must be ≥ previous value for same slot. See GetTicks() and GetTicksPerSecond().
Remarks
Exceptions
- SunVoxException
Thrown when the operation fails.