Usine SDK  HH6
Create user modules for Usine Software
Classes | Functions
Global functions

Classes

class  UserModuleBase
 Base class for every User's module. A User module is a class inherited from UserModuleBase, providing complete communication with Usine and all the necessary stuff to customize the module behaviour.
In addition, this base class provides a ton of utility functions to help you integrate your data in the module. More...
 

Functions

 UserModuleBase::UserModuleBase ()
 Implementation of the abstract class provided to derive user modules from. More...
 
TColorAhsl sdkColorArgbToColorAhsl (TColorArgb c1)
 Various helpers around colors. More...
 
TColorArgb sdkColorAhslToColorArgb (TColorAhsl c1)
 Calculate RGB from HSL, reverse of RGB2HSL() More...
 
TUsineColor sdkColorArgbToAlphaColor (TColorArgb c1)
 RGB color to Usine color format.
 
TColorArgb sdkAlphaColorToColorArgb (TUsineColor c1)
 Usine color format to RGB color.
 
TUsineColor sdkColorAhslToAlphaColor (TColorAhsl c1)
 HSL color to Usine color format.
 
TColorAhsl sdkAlphaColorToColorAhsl (TUsineColor c1)
 Usine color format to HSL color.
 
TColorArgb sdkColorAgrb (float r, float g, float b, float a=1.0)
 RGB color constructor.
 
TColorAhsl sdkColorAhsl (float h, float s, float l, float a=1.0)
 HSL color constructor. More...
 
TUsineColor sdkAlphaColor (float r, float g, float b, float a=1.0)
 Usine color constructor. More...
 
TUsineColor sdkAlphaColor (int r, int g, int b, int a=255)
 Usine color constructor. More...
 
TPointF sdkPointF (float x, float y)
 Construct a TPointF. More...
 
bool sdkPointInRect (int X, int Y, TPointI LeftTop, TPointI RightBottom)
 Test if coordinate is in a rect bound. More...
 
bool sdkPointInRect (TPointI Coords, TPointI LeftTop, TPointI RightBottom)
 Test if coordinate is in a rect bound. More...
 
TPointF sdkBezier4 (TPointF p1, TPointF p2, TPointF p3, TPointF p4, float mu)
 Four control point Bezier interpolation. More...
 
float sdkBezier4 (float p1, float p2, float p3, float p4, float mu)
 Four control float Bezier interpolation. More...
 

Mandatory Functions

Usine need them to instantiate and destroy the module.

void CreateModule (void *&pModule, AnsiCharPtr optionalString, LongBool Flag, TMasterInfo *pMasterInfo, AnsiCharPtr optionalContent)
 Called by Usine to instantiate the User Module When opening the Browser section where is stored the module. When adding the module in a patch. When loading a saved workspace or patch. More...
 
void DestroyModule (void *pModule)
 Called by Usine to destroy the User Module When clearing a workspace or patch. Before recreate module. When closing Usine. More...
 
void GetBrowserInfo (TModuleInfo *pModuleInfo)
 Called by usine to get module informations for the browser When the browser open the folder where the module is stored.
 

Module Constants

Used by usine to populate browser infos and module infos.

static const AnsiCharPtr UserModuleBase::MODULE_NAME
 
static const AnsiCharPtr UserModuleBase::MODULE_DESC
 
static const AnsiCharPtr UserModuleBase::MODULE_VERSION
 

Mandatory Callbacks

Usine need them to collect mandatory infos and update the module.

virtual void UserModuleBase::onGetModuleInfo (TMasterInfo *pMasterInfo, TModuleInfo *pModuleInfo)=0
 Usine call it to obtain the module characteristics. You have to fill the TModuleInfo structure with infos describing the module. TMasterInfo can be used to obtain some useful infos but always test if the handle is valid as it can be nullptr. More...
 
virtual void UserModuleBase::onGetParamInfo (int ParamIndex, TParamInfo *pParamInfo)=0
 Usine call it for each parameters of the module to obtain it's characteristics. More...
 
virtual void UserModuleBase::onSetEventAddress (int ParamIndex, UsineEventPtr pEvent)
 Usine call it for each parameters of the module to obtain the event handle of the parameter. Deprecated in HH3, use TModuleInfo::EventPtr. More...
 
virtual void UserModuleBase::onCallBack (TUsineMessage *Message)
 Usine call it to inform the module something happened. More...
 

Query System Callbacks

Needed if Query system is used.

virtual int UserModuleBase::onGetNumberOfParams (int queryResult1, int queryResult2)
 Usine call it to obtain the number of parameters of the module depending of the query result. More...
 
virtual void UserModuleBase::onAfterQuery (TMasterInfo *pMasterInfo, TModuleInfo *pModuleInfo, int queryResult1, int queryResult2)
 Usine call it after the query pop-up is closed. It let you do some things depending of the query choice. More...
 

Real-time Audio and Data Callback

Usine call it if TModuleInfo::DontProcess is not set to TRUE in onGetModuleInfo.

virtual void UserModuleBase::onProcess ()
 Be careful here because it's called from the audio thread at each audio tick of the audio engine. Keep it optimized and try to avoid any memory allocation. More...
 

Real-time Video processing

Called by the the video thread to process video frames only for TModuleInfo::ModuleType == mtVideo Don't process video outside this procedure.

See also
TModuleInfo::ModuleType
virtual void UserModuleBase::onProcessVideo ()
 

Load and Save Chunk System

Implement them if the module need to save some additional info. A chunk is a memory block containing some binary data. Usine store those chunk in patch and workspace files and use them to store/restore presets.

virtual int UserModuleBase::onGetChunkLen (LongBool Preset)
 To get the chunk length estimation. More...
 
virtual void UserModuleBase::onGetChunk (void *chunk, LongBool Preset)
 Provide a chunk handle to fill with additional info's. More...
 
virtual void UserModuleBase::onSetChunk (const void *chunk, int sizeInBytes, LongBool Preset)
 Provide a chunk handle filled by Usine to restore them into the module. More...
 
virtual void UserModuleBase::onAfterLoading ()
 Called after the module is loaded in Usine.
 

Settings Callbacks

Implement them if the module need to add some entries in the Settings Panel.

virtual void UserModuleBase::onCreateSettings ()
 To add some entries in the Settings panel. Typical use is some calls to Settings options functions.
 
virtual void UserModuleBase::onSettingsHasChanged ()
 Called when something change in one of entries.
 

Graphics Canvas Callbacks

Implement them if the module type is mtControl.

virtual void UserModuleBase::onResize (float contentWidth, float contentHeight)
 Called when Usine resize the Graphic canvas. More...
 
virtual void UserModuleBase::onPaint ()
 Called before Usine draw the module canvas Use it to draw the module canvas. More...
 

Contextual Menu Callback

Implement it if the module need to add some entries in the Contextual Menu.

virtual void UserModuleBase::onCreateCommands ()
 To add some entries in the Contextual Menu. Typical use is some calls to Contextual Menus commands.
 

Automation Recording Callback

Usine call it if TModuleInfo::CanRecord is set to TRUE in onGetModuleInfo.

virtual void UserModuleBase::onSetRecordedValue (TPrecision X, TPrecision Y, TPrecision Z)
 Usine call it when replaying recorded curves. The module have to affect those values to the concerned variables. More...
 

Randomize Callback

Implement it to respond to a randomize command from Usine.

virtual void UserModuleBase::onRandomize ()
 Activate it with pModuleInfo->CanBeRandomized = TRUE in onGetModuleInfo.
 

Reset Callback

Implement it to respond to a reset command from Usine.

virtual void UserModuleBase::onReset ()
 Activate it with pModuleInfo->CanBeReset = TRUE in onGetModuleInfo.
 

SetQuickColor Callback

Implement it to respond to a Set quick colorfrom Usine.

Parameters
colorchoosen color in the quick color menu.
virtual void UserModuleBase::onSetQuickColor (TUsineColor color)
 

onMouseMove

Called by Usine when the mouse moves on the control

virtual void UserModuleBase::onMouseMove (TShiftState Shift, float X, float Y)
 
virtual void UserModuleBase::onMouseDown (TMouseButton MouseButton, TShiftState Shift, float X, float Y)
 Called by Usine when the mouse is clicked down on the control.
 
virtual void UserModuleBase::onMouseUp (TMouseButton MouseButton, TShiftState Shift, float X, float Y)
 Called by Usine when the mouse is clicked up on the control.
 
virtual void UserModuleBase::onMouseWheel (TShiftState Shift, int WheelDelta)
 Called by Usine when the mouse wheel is moved on the control.
 
virtual void UserModuleBase::onMouseMoveMulti (TShiftState Shift, UsineEventPtr X, UsineEventPtr Y, UsineEventPtr Pressed)
 Called by Usine when control receives a touch-screen move event.
 
virtual void UserModuleBase::onMouseMoveMulti (TShiftState Shift, UsineEventClass *X, UsineEventClass *Y, UsineEventClass *Pressed)
 Called by Usine when control receives a touch-screen move event.
 
virtual void UserModuleBase::onMouseDownMulti (TMouseButton MouseButton, TShiftState Shift, UsineEventPtr X, UsineEventPtr Y, UsineEventPtr Pressed)
 Called by Usine when control receives a touch-screen down event.
 
virtual void UserModuleBase::onMouseDownMulti (TMouseButton MousButton, TShiftState Shift, UsineEventClass *X, UsineEventClass *Y, UsineEventClass *Pressed)
 Called by Usine when control receives a touch-screen down event.
 
virtual void UserModuleBase::onMouseUpMulti (TMouseButton MouseButton, TShiftState Shift, UsineEventPtr X, UsineEventPtr Y, UsineEventPtr Pressed)
 Called by Usine when control receives a touch-screen up event.
 
virtual void UserModuleBase::onMouseUpMulti (TMouseButton MouseButton, TShiftState Shift, UsineEventClass *X, UsineEventClass *Y, UsineEventClass *Pressed)
 

Optional Callbacks

virtual void UserModuleBase::onInitModule (TMasterInfo *pMasterInfo, TModuleInfo *pModuleInfo)
 Usine call it after onGetModuleInfo. It let you initialising some stuff. More...
 
virtual void UserModuleBase::onBlocSizeChange (int BlocSize)
 Usine call it when the Usine BlockSize is changed. More...
 
virtual void UserModuleBase::onSampleRateChange (double SampleRate)
 Usine call it when the SampleRate is changed. More...
 

Child Window Callbacks

Implement them if the module implement a child window.

See also
Module child window
virtual void UserModuleBase::onOpenEditor ()
 
virtual void UserModuleBase::onBringToFront ()
 
virtual void UserModuleBase::onCloseEditor ()
 
virtual void UserModuleBase::onResizeEditor (int width, int height)
 

MIDI Out Callbacks

Usine call them to send MIDI messages to a Midi Out Device. Not for public use.

virtual void UserModuleBase::onMidiSendOut (int DeviceID, TUsineMidiCode Code)
 Send one midi code. More...
 
virtual void UserModuleBase::onMidiSendOutArray (int DeviceID, TUsineMidiCode **arrayCode, int arraySize)
 Send a block of midi code. More...
 
virtual void UserModuleBase::onMidiSysexSendOut (int DeviceID, char **Sysex, int sysexSize)
 Send a Sysex message. More...
 

ILDA Out Callback

Usine call it to send ILDA frame to a ILDA Out Device. Not for public use.

virtual void UserModuleBase::onLaserSendOut (int DeviceID, TUsineILDAPoint **arrayPoint, int arraySize, int speedPPS)
 Send an Laser frame. More...
 

DMX Out Callback

Usine call it to send DMX packet to a Dmx Out Device. Not for public use.

virtual void UserModuleBase::onDMXSendOut (int deviceId, char *ByteArray, int len, int universeNum=1)
 Send a Dmx message. More...
 

Graphic Canvas

Use them in the onPaint callback to draw into a module canvas.

void UserModuleBase::sdkDrawPoint (TPointF point, TUsineColor color, float pointSize, LongBool rounded)
 Draw a point.
 
void UserModuleBase::sdkDrawLine (TPointF p1, TPointF p2, TUsineColor color, float strokeThickness)
 Draw a line.
 
void UserModuleBase::sdkDrawPolyLine (TPointFPtr points, int numOfPoints, TUsineColor color, float strokeThickness)
 Draw a polygon, points are stored in an array.
 
void UserModuleBase::sdkFillPolyLine (TPointFPtr points, int numOfPoints, TUsineColor color)
 Fille a polygon, points are stored in an array.
 
void UserModuleBase::sdkFillRect (TRectF rect, TUsineColor color, float roundRadius, TUsineColor borderColor, float borderWith)
 Fill a round rectangle.
 
void UserModuleBase::sdkFillText (TRectF rect, AnsiCharPtr text, TUsineColor textColor, float fontSize, LongBool isBold=FALSE, LongBool isWordWrap=FALSE, TTextAlign alignHorizontal=taCenter, TTextAlign alignVertical=taCenter, LongBool isVertical=FALSE)
 Fill a text.
 
void UserModuleBase::sdkBitBlit (TUsinePixelPtr pArray, int W, int H, TRectF destRect)
 Draw an array of pixels. More...
 

Graphic Path

Example of constructing a path
// begin draw path sequence
sdkDrawPathStart ();
// move to where we want to start the path
sdkDrawPathMoveTo (sdkPointF(0.25, 0.25));
// add a line
sdkDrawPathLineTo (sdkPointF(0.75, 0.25));
// add a curve
sdkDrawPathQuadCurveTo (sdkPointF(0.75, 0.75), sdkPointF(0.25, 0.75));
// close the path
sdkDrawPathClose ();
// end the command sequence and ask to draw the path
sdkDrawPathDraw (colorTrajectory, thicknessTrajectory);
void UserModuleBase::sdkDrawPathStart ()
 Tell Usine to start a path sequence. A path must begin with this function, followed by a sequence of command describing the path structure and finally drawn or filled.
 
void UserModuleBase::sdkDrawPathMoveTo (TPointF point)
 Move the current position inside the path. More...
 
void UserModuleBase::sdkDrawPathLineTo (TPointF point)
 Add a line to the path, from the current position to the point provided. More...
 
void UserModuleBase::sdkDrawPathQuadCurveTo (TPointF control, TPointF point)
 Add a quadratic curve to the path, from the current position to the point provided. The curve don't pass by the control point. More...
 
void UserModuleBase::sdkDrawPathClose ()
 Add a line to close the path, from the current position to the first point of the path. More...
 
void UserModuleBase::sdkDrawPathDraw (TUsineColor color, float strokeThickness)
 Draw the current path with the color and thickness provided. More...
 
void UserModuleBase::sdkDrawPathFill (TUsineColor color)
 Fill a valid path with the color and thickness provided. More...
 
void UserModuleBase::sdkRepaintPanel (void)
 Ask Usine to repaint the module Panel. The result is a call to the onPaint callback.
 

Automation Recording

To record some values for the Automation Recording system.

void UserModuleBase::sdkStopRecord ()
 Stops the recording.
 
void UserModuleBase::sdkProcessRecord (TPrecision X, TPrecision Y, TPrecision Z)
 Start the recording process if it is not started and processes the recording. to stop the recording use sdkStopRecord. More...
 

Settings options

Use them in onCreateSettings to add some entries in the Settings Panel.

void UserModuleBase::sdkAddSettingLineCaption (AnsiCharPtr tab, AnsiCharPtr caption="", TUsineColor color=0, LongBool Translate=FALSE)
 To add a text entry in a Tab of the Settings Panel.
 
void UserModuleBase::sdkAddSettingLineColor (AnsiCharPtr tab, TUsineColor *pVal, AnsiCharPtr Caption, LongBool Translate=FALSE)
 To add a color selector entry in a Tab of the Settings Panel.
 
void UserModuleBase::sdkAddSettingLineBoolean (AnsiCharPtr tab, LongBool *pVal, AnsiCharPtr Caption, LongBool Translate=FALSE)
 To add a boolean entry in a Tab of the Settings Panel.
 
void UserModuleBase::sdkAddSettingLineInteger (AnsiCharPtr tab, int *pVal, AnsiCharPtr Caption, int min, int max, TScale scale, AnsiCharPtr symbol, int defaultValue, LongBool Translate=FALSE)
 To add an integer entry in a Tab of the Settings Panel.
 
void UserModuleBase::sdkAddSettingLineSingle (AnsiCharPtr tab, float *pVal, AnsiCharPtr caption, float min, float max, TScale scale, AnsiCharPtr symbol, AnsiCharPtr format, float defaultValue, LongBool Translate=FALSE)
 To add a decimal number entry in a Tab of the Settings Panel.
 
void UserModuleBase::sdkAddSettingLineCombobox (AnsiCharPtr tab, int *pVal, AnsiCharPtr caption, AnsiCharPtr commaText, LongBool Translate=FALSE)
 To add a combo box entry in a Tab of the Settings Panel.
 
void UserModuleBase::sdkAddSettingsLineString (AnsiCharPtr tab, AnsiCharPtr pVal, AnsiCharPtr caption, LongBool Translate=FALSE)
 To add a string entry in a Tab of the Settings Panel.
 
void UserModuleBase::sdkSetSettingValue (AnsiCharPtr settingName, UsineEventPtr settingEvent)
 Setter for an existing setting line entry.
 
UsineEventPtr UserModuleBase::sdkGetSettingValue (AnsiCharPtr settingName)
 Getter for an existing setting line entry.
 

Contextual Menus commands

Use them in the onCreateCommands callback to add commands in the module Contextual Menu.

void UserModuleBase::sdkAddCommand (AnsiCharPtr name, NativeInt CallbackId, LongBool Translate=FALSE)
 To add a Command entry in the module Contextual Menu.
 
void UserModuleBase::sdkAddCommandSeparator (AnsiCharPtr name, LongBool Translate=FALSE)
 To add a named separator in the module Contextual Menu.
 

Video Frame manipulation

Utils functions to help manipulate video frames

void UserModuleBase::sdkGetInputFrame (int numInput, TUsineFramePtr frame)
 Get incoming video Frames.
 
void UserModuleBase::sdkSetOutputFrame (int numOutput, TUsineFramePtr frame)
 Set outgoing video Frames.
 
void UserModuleBase::sdkClearFrame (TUsineFramePtr frame, TUsineColor color)
 Clear, fill a frame with a color.
 
void UserModuleBase::sdkGetNewFrame (TUsineFramePtr frame, int width, int height, LongBool permanent)
 Get a new frame. More...
 
void UserModuleBase::sdkReleaseFrame (TUsineFramePtr frame)
 Release permanent frames.
 
void UserModuleBase::sdkCopyFrame (TUsineFramePtr srcFrame, TUsineFramePtr destFrame)
 Copy a frame into another.
 
void UserModuleBase::sdkSetDimmerFrame (TUsineFramePtr frame, float dimmer)
 Apply a dimmer in the range [0..1] to a frame.
 
void UserModuleBase::sdkSetPixel (TUsineFramePtr frame, int X, int Y, TUsinePixel pixel)
 Set a pixel at position X,Y in the frame.
 
TUsinePixel UserModuleBase::sdkGetPixel (TUsineFramePtr frame, int X, int Y)
 Get a pixel at position X,Y in the frame.
 
TUsinePixel UserModuleBase::sdkColorToPixel (TUsineColor color)
 Transforms a TUsineColor into a TUsinePixel.
 
TUsineColor UserModuleBase::sdkPixelToColor (TUsinePixel pixel)
 Transforms a TUsinePixel into a TUsineColor.
 

Critical Sections

Critical sections functions to protect patches calculation.

void UserModuleBase::sdkLockPatch ()
 Lock the execution of the current patch to prevent memory access conflicts between the audio thread and other threads like IDLE, video, etc.
 
void UserModuleBase::sdkUnLockPatch ()
 UnLock the execution of the current patch.
 
void UserModuleBase::sdkCriticalSectionLock (TCriticalSectionPtr pCriticalSection, UINT32 timeout=0)
 Lock a critical section. More...
 
LongBool UserModuleBase::sdkCriticalSectionTryLock (TCriticalSectionPtr pCriticalSection)
 TryLock a critical section.
 
void UserModuleBase::sdkCriticalSectionUnLock (TCriticalSectionPtr pCriticalSection)
 UnLock a critical section.
 
TCriticalSectionPtr UserModuleBase::sdkCriticalSectionCreate (AnsiCharPtr name, LongBool shared=FALSE)
 Create a critical section. More...
 
void UserModuleBase::sdkCriticalSectionDestroy (TCriticalSectionPtr pCriticalSection)
 Destroy a critical section.
 

Threads

Threads for multi-threading

TThreadPtr UserModuleBase::sdkThreadCreate (AnsiCharPtr name, FuncThreadProcess ProcessThreadProc, TThreadPriority priority, UINT32 timeout)
 Create a thread. More...
 
void UserModuleBase::sdkThreadDestroy (TThreadPtr pThread)
 Destroy a thread.
 
void UserModuleBase::sdkThreadRestart (TThreadPtr pThread)
 restart a thread.
 
void UserModuleBase::sdkThreadSetTimeOut (TThreadPtr pThread, UINT32 timeout)
 set timeout of a thread. More...
 

Parameters setters

Utils functions to update some Parameter property other than the Event data.

void UserModuleBase::sdkSetListBoxCommaText (int numParam, AnsiCharPtr commaText)
 If the parameter is of type ptListBox, change the comma text defining the list content. More...
 
void UserModuleBase::sdkSetParamCaption (int numParam, AnsiCharPtr caption)
 Change the name of a parameter. It's the name showed in Usine. More...
 
void UserModuleBase::sdkSetParamVisible (int numParam, LongBool visible)
 Set a parameter visible or not. More...
 
void UserModuleBase::sdkRecreateParam (int numParam, TParamInfo *pParamInfo)
 Recreate a parameter with new settings. More...
 
void UserModuleBase::sdkSetParamValueText (int numParam, AnsiCharPtr valueText)
 If the parameter is of type ptTextField, change the text content. More...
 
void UserModuleBase::sdkRepaintParam (int numParam)
 Ask Usine to Update the parameter. Usually used after one of the function above. More...
 

Usine Objects functions

void UserModuleBase::sdkUsineObjectSetFloat (AnsiCharPtr name, TPrecision floatValue)
 Set the float value of an Usine-Object.
 
void UserModuleBase::sdkUsineObjectSetInteger (AnsiCharPtr name, int integerValue)
 Set the integer value of an Usine-Object.
 
void UserModuleBase::sdkUsineObjectSetArray (AnsiCharPtr name, int index, TPrecision floatValue)
 Set the float value of an Usine-Object array at the index position.
 
void UserModuleBase::sdkUsineObjectSetMIDI (AnsiCharPtr name, int index, TUsineMidiCode midiValue)
 Set the Midi value of an Usine-Object array at the index position.
 
void UserModuleBase::sdkUsineObjectSetColor (AnsiCharPtr name, TUsineColor colorValue)
 Set the color value of an Usine-Object.
 
void UserModuleBase::sdkUsineObjectSetArrayColor (AnsiCharPtr name, int index, TUsineColor colorValue)
 Set the color value of an Usine-Object array at the index position.
 
void UserModuleBase::sdkUsineObjectSetTrigger (AnsiCharPtr name)
 Set a trigger value of an Usine-Object.
 
void UserModuleBase::sdkUsineObjectSetAnsiChar (AnsiCharPtr name, AnsiCharPtr v)
 Set the text value of an Usine-Object.
 
TPrecision UserModuleBase::sdkUsineObjectGetFloat (AnsiCharPtr name)
 Get the float value of an Usine-Object.
 
int UserModuleBase::sdkUsineObjectGetInteger (AnsiCharPtr name)
 Get the integer value of an Usine-Object.
 
TPrecision UserModuleBase::sdkUsineObjectGetArray (AnsiCharPtr name, int index)
 Get the float value of an Usine-Object array at the index position.
 
TUsineMidiCode UserModuleBase::sdkUsineObjectGetMIDI (AnsiCharPtr name, int index)
 Get the Midi value of an Usine-Object array at the index position.
 
TUsineColor UserModuleBase::sdkUsineObjectGetColor (AnsiCharPtr name)
 Get the color value of an Usine-Object.
 
TUsineColor UserModuleBase::sdkUsineObjectGetArrayColor (AnsiCharPtr name, int index)
 Get the array value of an Usine-Object array at the index position.
 
AnsiCharPtr UserModuleBase::sdkUsineObjectGetAnsiChar (AnsiCharPtr name)
 Get the text value of an Usine-Object.
 
int UserModuleBase::sdkUsineObjectGetLength (AnsiCharPtr name)
 Get the size of the Event associated to an Usine-Object.
 
void UserModuleBase::sdkUsineObjectSetLength (AnsiCharPtr name, int l)
 Set the size of the Event associated to an Usine-Object.
 
AnsiCharPtr UserModuleBase::sdkUsineObjectFind (AnsiCharPtr name)
 Returns the list (as a comma-text) of all Usine-Objects that match with the name parameter.
 
LongBool UserModuleBase::sdkUsineObjectExists (AnsiCharPtr name)
 Returns TRUE if the Usine-Objects exists.
 
AnsiCharPtr UserModuleBase::sdkUsineObjectListHash ()
 Returns the Hash of all Usine-Objects. This allows to determines if the list of all the Usine-Objects has changed.
 

Usine Core infos and services

void UserModuleBase::sdkSendUsineMsg (AnsiCharPtr Msg)
 Usine internal messages.
 
void UserModuleBase::sdkNotifyUsine (NativeInt Target, NativeInt Msg, NativeInt WParam=0, NativeInt LParam=0, int Delay=0)
 Usine notification. More...
 
TVstTimeInfoUserModuleBase::sdkGetVstTimeInfo ()
 To access the current TVstTimeInfo structure of Usine.
 
double UserModuleBase::sdkGetTimeMs ()
 To get the Usine global time in millisecond, precision up to nanoseconde.
 
LongBool UserModuleBase::sdkPatchIsRunning ()
 To check if the patch containing the module is running.
 
LongBool UserModuleBase::sdkPatchLoading ()
 To check if the patch containing the module is loading.
 
LongBool UserModuleBase::sdkPatchJustActivated ()
 To check if the patch has just started.
 
LongBool UserModuleBase::sdkRefreshSpeedClock ()
 Gets a tick clock at the refresh-speed of Usine, generally every 25 ms. this can reduce the cpu load for non priority tasks. More...
 
LongBool UserModuleBase::sdkSlowClock ()
 Gets a tick clock at the slow-speed of Usine, generally every second. this can reduce the cpu load for very low priority tasks. More...
 
void * UserModuleBase::sdkGetUsineUserModule ()
 To get the pointer of the Usine module. Do not use directly.
 
AnsiCharPtr UserModuleBase::sdkGetUsineVersionNum ()
 To get the version number of Usine as a string.
 
void UserModuleBase::sdkSetModuleUserName (AnsiCharPtr name)
 set the name of the module (as it appear in the patch, on the module title)
 
AnsiCharPtr UserModuleBase::sdkGetModuleUserName ()
 get the name of the module (as it appear in the patch, on the module title)
 

Module child window

A User module can create and manage an independent child window for it's own use. Note that only one child window at a time per module is possible.

See also
Child Window Callbacks
void * UserModuleBase::sdkCreateDeskWindow ()
 
void UserModuleBase::sdkDestroyDeskWindow ()
 
void * UserModuleBase::sdkShowDeskWindow ()
 
void UserModuleBase::sdkHideDeskWindow ()
 
void UserModuleBase::sdkSetDeskWindowClientSize (int clientWidth, int clientHeight)
 
void UserModuleBase::sdkSetDeskWindowCaption (TModuleInfo *pModuleInfo, AnsiCharPtr name)
 

Converter utils

Useful to convert between pixel coord and graphic canvas unit.

 
float UserModuleBase::sdkPixelToHeightPercent (float pixel)
 Transform the Y position in pixels into [0..1].
 
float UserModuleBase::sdkPixelToWidthPercent (float pixel)
 Transform the X position in pixels into [0..1].
 
float UserModuleBase::sdkHeightPercentToPixel (float percent)
 Transform [0..1] percent Y position into the position in pixels.
 
float UserModuleBase::sdkWidthPercentToPixel (float percent)
 Transform [0..1] percent X position into the position in pixels.
 

Detailed Description

Function Documentation

§ CreateModule()

void CreateModule ( void *&  pModule,
AnsiCharPtr  optionalString,
LongBool  Flag,
TMasterInfo pMasterInfo,
AnsiCharPtr  optionalContent 
)

Called by Usine to instantiate the User Module When opening the Browser section where is stored the module. When adding the module in a patch. When loading a saved workspace or patch.

Parameters
pModuleHandle for the new instantiated module
optionalStringoptional string passed to the constructor ie. the plugin filename
Flagcompatibility flag must be FALSE on recent versions of Usine
pMasterInfoHandle to the TMasterInfo structure
optionalContent

§ DestroyModule()

void DestroyModule ( void *  pModule)

Called by Usine to destroy the User Module When clearing a workspace or patch. Before recreate module. When closing Usine.

Parameters
pModuleHandle for the new instantiated module

§ UserModuleBase()

UserModuleBase::UserModuleBase ( )

Implementation of the abstract class provided to derive user modules from.

Author
BrainModular team

2013/05/15 first release for Hollyhock CPP SDK 6.00.226

This file is part of the Usine CPP SDK Version 6

Please, report bugs and patch to Usine forum : suppo.nosp@m.rt@b.nosp@m.rainm.nosp@m.odul.nosp@m.ar.co.nosp@m.m

All dependencies are under there own licence.

Copyright (C) 2023 BrainModular, BeSpline, Adamson


§ onGetModuleInfo()

virtual void UserModuleBase::onGetModuleInfo ( TMasterInfo pMasterInfo,
TModuleInfo pModuleInfo 
)
pure virtual

Usine call it to obtain the module characteristics. You have to fill the TModuleInfo structure with infos describing the module. TMasterInfo can be used to obtain some useful infos but always test if the handle is valid as it can be nullptr.

Parameters
pMasterInfoThe TMasterInfo structure. can be null.
pModuleInfoThe TModuleInfo structure to describe the module characteristics

§ onGetParamInfo()

virtual void UserModuleBase::onGetParamInfo ( int  ParamIndex,
TParamInfo pParamInfo 
)
pure virtual

Usine call it for each parameters of the module to obtain it's characteristics.

Parameters
ParamIndexThe index of the parameter.
pParamInfoHandle to the info structure of the parameter.

§ onSetEventAddress()

virtual void UserModuleBase::onSetEventAddress ( int  ParamIndex,
UsineEventPtr  pEvent 
)
inlinevirtual

Usine call it for each parameters of the module to obtain the event handle of the parameter. Deprecated in HH3, use TModuleInfo::EventPtr.

Parameters
ParamIndexThe index of the parameter.
pEventHandle to the event of the parameter.

§ onCallBack()

virtual void UserModuleBase::onCallBack ( TUsineMessage Message)
inlinevirtual

Usine call it to inform the module something happened.

Parameters
MessageProvide various infos about what happened.

§ onGetNumberOfParams()

virtual int UserModuleBase::onGetNumberOfParams ( int  queryResult1,
int  queryResult2 
)
inlinevirtual

Usine call it to obtain the number of parameters of the module depending of the query result.

Parameters
queryIndexThe index of the choice made in the query popup
Returns
Number of parameters of the module

§ onAfterQuery()

virtual void UserModuleBase::onAfterQuery ( TMasterInfo pMasterInfo,
TModuleInfo pModuleInfo,
int  queryResult1,
int  queryResult2 
)
inlinevirtual

Usine call it after the query pop-up is closed. It let you do some things depending of the query choice.

Parameters
pMasterInfoThe TMasterInfo structure.
pModuleInfoThe TModuleInfo structure.
queryIndexThe index of the choice made in the query pop-up

§ onProcess()

virtual void UserModuleBase::onProcess ( )
inlinevirtual

Be careful here because it's called from the audio thread at each audio tick of the audio engine. Keep it optimized and try to avoid any memory allocation.

See also
TModuleInfo::DontProcess

§ onGetChunkLen()

virtual int UserModuleBase::onGetChunkLen ( LongBool  Preset)
inlinevirtual

To get the chunk length estimation.

Parameters
PresetTell if it's a preset or a patch chunk. TRUE = preset chunk, FALSE = .pat/.wkp chunk.
Returns
The estimated size of the chunk in byte.

§ onGetChunk()

virtual void UserModuleBase::onGetChunk ( void *  chunk,
LongBool  Preset 
)
inlinevirtual

Provide a chunk handle to fill with additional info's.

Parameters
chunkThe chunk pointer to fill.
PresetTell if it's a preset or a patch chunk. TRUE = preset chunk, FALSE = .pat/.wkp chunk.

§ onSetChunk()

virtual void UserModuleBase::onSetChunk ( const void *  chunk,
int  sizeInBytes,
LongBool  Preset 
)
inlinevirtual

Provide a chunk handle filled by Usine to restore them into the module.

Parameters
chunkThe chunk pointer to read from.
sizeInBytesThe size of the chunk.
PresetTell if it's a preset or a patch chunk. TRUE = preset chunk, FALSE = .pat/.wkp chunk.

§ onResize()

virtual void UserModuleBase::onResize ( float  contentWidth,
float  contentHeight 
)
inlinevirtual

Called when Usine resize the Graphic canvas.

Parameters
contentWidththe new width of the canvas.
contentHeightthe new height of the canvas.

§ onPaint()

virtual void UserModuleBase::onPaint ( )
inlinevirtual

Called before Usine draw the module canvas Use it to draw the module canvas.

See also
Graphic Canvas

§ onSetRecordedValue()

virtual void UserModuleBase::onSetRecordedValue ( TPrecision  X,
TPrecision  Y,
TPrecision  Z 
)
inlinevirtual

Usine call it when replaying recorded curves. The module have to affect those values to the concerned variables.

Parameters
XNew value of the first curve.
YNew value of the second curve.
ZNew value of the third curve.

§ onInitModule()

virtual void UserModuleBase::onInitModule ( TMasterInfo pMasterInfo,
TModuleInfo pModuleInfo 
)
inlinevirtual

Usine call it after onGetModuleInfo. It let you initialising some stuff.

Parameters
pMasterInfoThe TMasterInfo structure.
pModuleInfoThe TModuleInfo structure.

§ onBlocSizeChange()

virtual void UserModuleBase::onBlocSizeChange ( int  BlocSize)
inlinevirtual

Usine call it when the Usine BlockSize is changed.

Parameters
BlocSizeThe new BlocSize.

§ onSampleRateChange()

virtual void UserModuleBase::onSampleRateChange ( double  SampleRate)
inlinevirtual

Usine call it when the SampleRate is changed.

Parameters
SampleRateThe new SampleRate.

§ onMidiSendOut()

virtual void UserModuleBase::onMidiSendOut ( int  DeviceID,
TUsineMidiCode  Code 
)
inlinevirtual

Send one midi code.

Parameters
DeviceIDIndex of the device to address.
CodeThe midi message to send.

§ onMidiSendOutArray()

virtual void UserModuleBase::onMidiSendOutArray ( int  DeviceID,
TUsineMidiCode **  arrayCode,
int  arraySize 
)
inlinevirtual

Send a block of midi code.

Parameters
DeviceIDIndex of the device to address.
arrayCodeThe array of midi message to send.
arraySizeThe size of the array.

§ onMidiSysexSendOut()

virtual void UserModuleBase::onMidiSysexSendOut ( int  DeviceID,
char **  Sysex,
int  sysexSize 
)
inlinevirtual

Send a Sysex message.

Parameters
DeviceIDIndex of the device to address.
SysexThe Sysex message to send.
sysexSizeThe size of the Sysex message in byte.

§ onLaserSendOut()

virtual void UserModuleBase::onLaserSendOut ( int  DeviceID,
TUsineILDAPoint **  arrayPoint,
int  arraySize,
int  speedPPS 
)
inlinevirtual

Send an Laser frame.

Parameters
DeviceIDIndex of the device to address.
arrayPointThe array of ILDAPoints to send.
arraySizeThe size of the ILDAPoints array.

§ onDMXSendOut()

virtual void UserModuleBase::onDMXSendOut ( int  deviceId,
char *  ByteArray,
int  len,
int  universeNum = 1 
)
inlinevirtual

Send a Dmx message.

Parameters
deviceIdIndex of the device to address.
ByteArrayThe Dmx packet to send.
lenThe size of the Dmx packet in byte.
universeNumThe DMX universe to address, in case the device can manage more than one, start at 1, default value of 1.

§ sdkBitBlit()

void UserModuleBase::sdkBitBlit ( TUsinePixelPtr  pArray,
int  W,
int  H,
TRectF  destRect 
)
inline

Draw an array of pixels.

Parameters
pArraypointer to the first element of the pixels array
Wwidth of the pixels array
Hheight of the pixels array
destRectdestination rectangle in normalized coordinates (0..1). No verification of the pixels array size is made so be sure that W and H have the right values.

§ sdkDrawPathMoveTo()

void UserModuleBase::sdkDrawPathMoveTo ( TPointF  point)
inline

Move the current position inside the path.

See also
sdkDrawPathStart

§ sdkDrawPathLineTo()

void UserModuleBase::sdkDrawPathLineTo ( TPointF  point)
inline

Add a line to the path, from the current position to the point provided.

See also
sdkDrawPathStart

§ sdkDrawPathQuadCurveTo()

void UserModuleBase::sdkDrawPathQuadCurveTo ( TPointF  control,
TPointF  point 
)
inline

Add a quadratic curve to the path, from the current position to the point provided. The curve don't pass by the control point.

See also
sdkDrawPathStart

§ sdkDrawPathClose()

void UserModuleBase::sdkDrawPathClose ( )
inline

Add a line to close the path, from the current position to the first point of the path.

See also
sdkDrawPathStart

§ sdkDrawPathDraw()

void UserModuleBase::sdkDrawPathDraw ( TUsineColor  color,
float  strokeThickness 
)
inline

Draw the current path with the color and thickness provided.

See also
sdkDrawPathStart

§ sdkDrawPathFill()

void UserModuleBase::sdkDrawPathFill ( TUsineColor  color)
inline

Fill a valid path with the color and thickness provided.

See also
sdkDrawPathStart

§ sdkProcessRecord()

void UserModuleBase::sdkProcessRecord ( TPrecision  X,
TPrecision  Y,
TPrecision  Z 
)
inline

Start the recording process if it is not started and processes the recording. to stop the recording use sdkStopRecord.

See also
sdkStopRecord

§ sdkGetNewFrame()

void UserModuleBase::sdkGetNewFrame ( TUsineFramePtr  frame,
int  width,
int  height,
LongBool  permanent 
)
inline

Get a new frame.

Parameters
permanentDetermines if the frame has a short lifespan (FALSE) or an infinite (TRUE)

Permanent frames must be destroyed by sdkReleaseFrame

Non permanent frames are released automatically

See also
sdkReleaseFrame

§ sdkCriticalSectionLock()

void UserModuleBase::sdkCriticalSectionLock ( TCriticalSectionPtr  pCriticalSection,
UINT32  timeout = 0 
)
inline

Lock a critical section.

Parameters
timeoutmust be used with precautions

§ sdkCriticalSectionCreate()

TCriticalSectionPtr UserModuleBase::sdkCriticalSectionCreate ( AnsiCharPtr  name,
LongBool  shared = FALSE 
)
inline

Create a critical section.

Parameters
nameis a name givent to the CS for debug purposes

§ sdkThreadCreate()

TThreadPtr UserModuleBase::sdkThreadCreate ( AnsiCharPtr  name,
FuncThreadProcess  ProcessThreadProc,
TThreadPriority  priority,
UINT32  timeout 
)
inline

Create a thread.

Parameters
prioritypriority of the thread : tpIDLE,tpLow,tpMedium,tpHigh
timeouttimeout of the thread (execution clock) in ms. if timeout is UINT32_MAX then the thread will wait until the sdkThreadRestart is called

§ sdkThreadSetTimeOut()

void UserModuleBase::sdkThreadSetTimeOut ( TThreadPtr  pThread,
UINT32  timeout 
)
inline

set timeout of a thread.

Parameters
timeouttimeout of the thread (execution clock) in ms

§ sdkSetListBoxCommaText()

void UserModuleBase::sdkSetListBoxCommaText ( int  numParam,
AnsiCharPtr  commaText 
)
inline

If the parameter is of type ptListBox, change the comma text defining the list content.

See also
onGetParamInfo;
Parameters
numParamthe param index.

§ sdkSetParamCaption()

void UserModuleBase::sdkSetParamCaption ( int  numParam,
AnsiCharPtr  caption 
)
inline

Change the name of a parameter. It's the name showed in Usine.

Parameters
numParamthe param index.

§ sdkSetParamVisible()

void UserModuleBase::sdkSetParamVisible ( int  numParam,
LongBool  visible 
)
inline

Set a parameter visible or not.

Parameters
numParamthe param index.

§ sdkRecreateParam()

void UserModuleBase::sdkRecreateParam ( int  numParam,
TParamInfo pParamInfo 
)
inline

Recreate a parameter with new settings.

Parameters
numParamthe param index.
pParamInfopointer to TParamInfo structure

§ sdkSetParamValueText()

void UserModuleBase::sdkSetParamValueText ( int  numParam,
AnsiCharPtr  valueText 
)
inline

If the parameter is of type ptTextField, change the text content.

See also
onGetParamInfo;
Parameters
numParamthe param index.

§ sdkRepaintParam()

void UserModuleBase::sdkRepaintParam ( int  numParam)
inline

Ask Usine to Update the parameter. Usually used after one of the function above.

Parameters
numParamthe param index.

§ sdkNotifyUsine()

void UserModuleBase::sdkNotifyUsine ( NativeInt  Target,
NativeInt  Msg,
NativeInt  WParam = 0,
NativeInt  LParam = 0,
int  Delay = 0 
)
inline

Usine notification.

Send a message to Usine, Usine's setup or this user module. A delay maybe specified.

§ sdkRefreshSpeedClock()

LongBool UserModuleBase::sdkRefreshSpeedClock ( )
inline

Gets a tick clock at the refresh-speed of Usine, generally every 25 ms. this can reduce the cpu load for non priority tasks.

if (sdkRefreshSpeedClock()) { doSomething(); }

§ sdkSlowClock()

LongBool UserModuleBase::sdkSlowClock ( )
inline

Gets a tick clock at the slow-speed of Usine, generally every second. this can reduce the cpu load for very low priority tasks.

if (sdkSlowClock()) { doSomething(); }

§ sdkColorArgbToColorAhsl()

TColorAhsl sdkColorArgbToColorAhsl ( TColorArgb  c1)

Various helpers around colors.

Calculates HSL from RGB.

Parameters
Hueis in degrees,
Lightnessis between 0 and 1,
Saturationis between 0 and 1.

§ sdkColorAhslToColorArgb()

TColorArgb sdkColorAhslToColorArgb ( TColorAhsl  c1)

Calculate RGB from HSL, reverse of RGB2HSL()

Parameters
Hueis in degrees
Lightnessis between 0 and 1
Saturationis between 0 and 1

§ sdkColorAhsl()

TColorAhsl sdkColorAhsl ( float  h,
float  s,
float  l,
float  a = 1.0 
)

HSL color constructor.

Parameters
h: float between 0 and 360
s: float between 0 and 1
l: float between 0 and 1
Returns
TColorHSL : the new created color

§ sdkAlphaColor() [1/2]

TUsineColor sdkAlphaColor ( float  r,
float  g,
float  b,
float  a = 1.0 
)

Usine color constructor.

Parameters
r: float between 0 and 1
g: float between 0 and 1
b: float between 0 and 1 TUsineColor : the new created color

§ sdkAlphaColor() [2/2]

TUsineColor sdkAlphaColor ( int  r,
int  g,
int  b,
int  a = 255 
)

Usine color constructor.

Parameters
r: int between 0 and 255
g: float between 0 and 255
b: float between 0 and 255 TUsineColor : the new created color

§ sdkPointF()

TPointF sdkPointF ( float  x,
float  y 
)

Construct a TPointF.

Parameters
xx coordinates
yy coordinates
Returns
The new point.

§ sdkPointInRect() [1/2]

bool sdkPointInRect ( int  X,
int  Y,
TPointI  LeftTop,
TPointI  RightBottom 
)

Test if coordinate is in a rect bound.

Parameters
Xx coordinates to test
Yy coordinates to test
LeftTopLeft top coordinates of the rect bound
RightBottomRight bottom coordinates of the rect bound.
Returns
true if is in rect

§ sdkPointInRect() [2/2]

bool sdkPointInRect ( TPointI  Coords,
TPointI  LeftTop,
TPointI  RightBottom 
)

Test if coordinate is in a rect bound.

Parameters
Coords: coordinates to test
LeftTop: left top coordinates of the rect bound
RightBottom: right bottom coordinates of the rect bound

§ sdkBezier4() [1/2]

TPointF sdkBezier4 ( TPointF  p1,
TPointF  p2,
TPointF  p3,
TPointF  p4,
float  mu 
)

Four control point Bezier interpolation.

Parameters
muranges from 0 to 1, start to end of curve

§ sdkBezier4() [2/2]

float sdkBezier4 ( float  p1,
float  p2,
float  p3,
float  p4,
float  mu 
)

Four control float Bezier interpolation.

Parameters
muranges from 0 to 1, start to end of curve