Usine SDK  HH6
Create user modules for Usine Software
Public Member Functions | List of all members
UserModuleBase Class Referenceabstract

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...

Public Member Functions

 UserModuleBase ()
 Implementation of the abstract class provided to derive user modules from. More...
 

Module Constants

Used by usine to populate browser infos and module infos.

static const AnsiCharPtr MODULE_NAME
 
static const AnsiCharPtr MODULE_DESC
 
static const AnsiCharPtr MODULE_VERSION
 

Mandatory Callbacks

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

virtual void 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 onGetParamInfo (int ParamIndex, TParamInfo *pParamInfo)=0
 Usine call it for each parameters of the module to obtain it's characteristics. More...
 
virtual void 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 onCallBack (TUsineMessage *Message)
 Usine call it to inform the module something happened. More...
 

Query System Callbacks

Needed if Query system is used.

virtual int 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 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 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 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 onGetChunkLen (LongBool Preset)
 To get the chunk length estimation. More...
 
virtual void onGetChunk (void *chunk, LongBool Preset)
 Provide a chunk handle to fill with additional info's. More...
 
virtual void onSetChunk (const void *chunk, int sizeInBytes, LongBool Preset)
 Provide a chunk handle filled by Usine to restore them into the module. More...
 
virtual void 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 onCreateSettings ()
 To add some entries in the Settings panel. Typical use is some calls to Settings options functions.
 
virtual void onSettingsHasChanged ()
 Called when something change in one of entries.
 

Graphics Canvas Callbacks

Implement them if the module type is mtControl.

virtual void onResize (float contentWidth, float contentHeight)
 Called when Usine resize the Graphic canvas. More...
 
virtual void 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 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 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 onRandomize ()
 Activate it with pModuleInfo->CanBeRandomized = TRUE in onGetModuleInfo.
 

Reset Callback

Implement it to respond to a reset command from Usine.

virtual void 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 onSetQuickColor (TUsineColor color)
 

onMouseMove

Called by Usine when the mouse moves on the control

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

Optional Callbacks

virtual void onInitModule (TMasterInfo *pMasterInfo, TModuleInfo *pModuleInfo)
 Usine call it after onGetModuleInfo. It let you initialising some stuff. More...
 
virtual void onBlocSizeChange (int BlocSize)
 Usine call it when the Usine BlockSize is changed. More...
 
virtual void 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 onOpenEditor ()
 
virtual void onBringToFront ()
 
virtual void onCloseEditor ()
 
virtual void 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 onMidiSendOut (int DeviceID, TUsineMidiCode Code)
 Send one midi code. More...
 
virtual void onMidiSendOutArray (int DeviceID, TUsineMidiCode **arrayCode, int arraySize)
 Send a block of midi code. More...
 
virtual void 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 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 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 sdkDrawPoint (TPointF point, TUsineColor color, float pointSize, LongBool rounded)
 Draw a point.
 
void sdkDrawLine (TPointF p1, TPointF p2, TUsineColor color, float strokeThickness)
 Draw a line.
 
void sdkDrawPolyLine (TPointFPtr points, int numOfPoints, TUsineColor color, float strokeThickness)
 Draw a polygon, points are stored in an array.
 
void sdkFillPolyLine (TPointFPtr points, int numOfPoints, TUsineColor color)
 Fille a polygon, points are stored in an array.
 
void sdkFillRect (TRectF rect, TUsineColor color, float roundRadius, TUsineColor borderColor, float borderWith)
 Fill a round rectangle.
 
void 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 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
// move to where we want to start the path
// add a line
// add a curve
sdkDrawPathQuadCurveTo (sdkPointF(0.75, 0.75), sdkPointF(0.25, 0.75));
// close the path
// end the command sequence and ask to draw the path
sdkDrawPathDraw (colorTrajectory, thicknessTrajectory);
void 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 sdkDrawPathMoveTo (TPointF point)
 Move the current position inside the path. More...
 
void sdkDrawPathLineTo (TPointF point)
 Add a line to the path, from the current position to the point provided. More...
 
void 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 sdkDrawPathClose ()
 Add a line to close the path, from the current position to the first point of the path. More...
 
void sdkDrawPathDraw (TUsineColor color, float strokeThickness)
 Draw the current path with the color and thickness provided. More...
 
void sdkDrawPathFill (TUsineColor color)
 Fill a valid path with the color and thickness provided. More...
 
void 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 sdkStopRecord ()
 Stops the recording.
 
void 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 sdkAddSettingLineCaption (AnsiCharPtr tab, AnsiCharPtr caption="", TUsineColor color=0, LongBool Translate=FALSE)
 To add a text entry in a Tab of the Settings Panel.
 
void sdkAddSettingLineColor (AnsiCharPtr tab, TUsineColor *pVal, AnsiCharPtr Caption, LongBool Translate=FALSE)
 To add a color selector entry in a Tab of the Settings Panel.
 
void sdkAddSettingLineBoolean (AnsiCharPtr tab, LongBool *pVal, AnsiCharPtr Caption, LongBool Translate=FALSE)
 To add a boolean entry in a Tab of the Settings Panel.
 
void 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 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 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 sdkAddSettingsLineString (AnsiCharPtr tab, AnsiCharPtr pVal, AnsiCharPtr caption, LongBool Translate=FALSE)
 To add a string entry in a Tab of the Settings Panel.
 
void sdkSetSettingValue (AnsiCharPtr settingName, UsineEventPtr settingEvent)
 Setter for an existing setting line entry.
 
UsineEventPtr 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 sdkAddCommand (AnsiCharPtr name, NativeInt CallbackId, LongBool Translate=FALSE)
 To add a Command entry in the module Contextual Menu.
 
void 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 sdkGetInputFrame (int numInput, TUsineFramePtr frame)
 Get incoming video Frames.
 
void sdkSetOutputFrame (int numOutput, TUsineFramePtr frame)
 Set outgoing video Frames.
 
void sdkClearFrame (TUsineFramePtr frame, TUsineColor color)
 Clear, fill a frame with a color.
 
void sdkGetNewFrame (TUsineFramePtr frame, int width, int height, LongBool permanent)
 Get a new frame. More...
 
void sdkReleaseFrame (TUsineFramePtr frame)
 Release permanent frames.
 
void sdkCopyFrame (TUsineFramePtr srcFrame, TUsineFramePtr destFrame)
 Copy a frame into another.
 
void sdkSetDimmerFrame (TUsineFramePtr frame, float dimmer)
 Apply a dimmer in the range [0..1] to a frame.
 
void sdkSetPixel (TUsineFramePtr frame, int X, int Y, TUsinePixel pixel)
 Set a pixel at position X,Y in the frame.
 
TUsinePixel sdkGetPixel (TUsineFramePtr frame, int X, int Y)
 Get a pixel at position X,Y in the frame.
 
TUsinePixel sdkColorToPixel (TUsineColor color)
 Transforms a TUsineColor into a TUsinePixel.
 
TUsineColor sdkPixelToColor (TUsinePixel pixel)
 Transforms a TUsinePixel into a TUsineColor.
 

Critical Sections

Critical sections functions to protect patches calculation.

void 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 sdkUnLockPatch ()
 UnLock the execution of the current patch.
 
void sdkCriticalSectionLock (TCriticalSectionPtr pCriticalSection, UINT32 timeout=0)
 Lock a critical section. More...
 
LongBool sdkCriticalSectionTryLock (TCriticalSectionPtr pCriticalSection)
 TryLock a critical section.
 
void sdkCriticalSectionUnLock (TCriticalSectionPtr pCriticalSection)
 UnLock a critical section.
 
TCriticalSectionPtr sdkCriticalSectionCreate (AnsiCharPtr name, LongBool shared=FALSE)
 Create a critical section. More...
 
void sdkCriticalSectionDestroy (TCriticalSectionPtr pCriticalSection)
 Destroy a critical section.
 

Threads

Threads for multi-threading

TThreadPtr sdkThreadCreate (AnsiCharPtr name, FuncThreadProcess ProcessThreadProc, TThreadPriority priority, UINT32 timeout)
 Create a thread. More...
 
void sdkThreadDestroy (TThreadPtr pThread)
 Destroy a thread.
 
void sdkThreadRestart (TThreadPtr pThread)
 restart a thread.
 
void 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 sdkSetListBoxCommaText (int numParam, AnsiCharPtr commaText)
 If the parameter is of type ptListBox, change the comma text defining the list content. More...
 
void sdkSetParamCaption (int numParam, AnsiCharPtr caption)
 Change the name of a parameter. It's the name showed in Usine. More...
 
void sdkSetParamVisible (int numParam, LongBool visible)
 Set a parameter visible or not. More...
 
void sdkRecreateParam (int numParam, TParamInfo *pParamInfo)
 Recreate a parameter with new settings. More...
 
void sdkSetParamValueText (int numParam, AnsiCharPtr valueText)
 If the parameter is of type ptTextField, change the text content. More...
 
void sdkRepaintParam (int numParam)
 Ask Usine to Update the parameter. Usually used after one of the function above. More...
 

Usine Objects functions

void sdkUsineObjectSetFloat (AnsiCharPtr name, TPrecision floatValue)
 Set the float value of an Usine-Object.
 
void sdkUsineObjectSetInteger (AnsiCharPtr name, int integerValue)
 Set the integer value of an Usine-Object.
 
void sdkUsineObjectSetArray (AnsiCharPtr name, int index, TPrecision floatValue)
 Set the float value of an Usine-Object array at the index position.
 
void sdkUsineObjectSetMIDI (AnsiCharPtr name, int index, TUsineMidiCode midiValue)
 Set the Midi value of an Usine-Object array at the index position.
 
void sdkUsineObjectSetColor (AnsiCharPtr name, TUsineColor colorValue)
 Set the color value of an Usine-Object.
 
void sdkUsineObjectSetArrayColor (AnsiCharPtr name, int index, TUsineColor colorValue)
 Set the color value of an Usine-Object array at the index position.
 
void sdkUsineObjectSetTrigger (AnsiCharPtr name)
 Set a trigger value of an Usine-Object.
 
void sdkUsineObjectSetAnsiChar (AnsiCharPtr name, AnsiCharPtr v)
 Set the text value of an Usine-Object.
 
TPrecision sdkUsineObjectGetFloat (AnsiCharPtr name)
 Get the float value of an Usine-Object.
 
int sdkUsineObjectGetInteger (AnsiCharPtr name)
 Get the integer value of an Usine-Object.
 
TPrecision sdkUsineObjectGetArray (AnsiCharPtr name, int index)
 Get the float value of an Usine-Object array at the index position.
 
TUsineMidiCode sdkUsineObjectGetMIDI (AnsiCharPtr name, int index)
 Get the Midi value of an Usine-Object array at the index position.
 
TUsineColor sdkUsineObjectGetColor (AnsiCharPtr name)
 Get the color value of an Usine-Object.
 
TUsineColor sdkUsineObjectGetArrayColor (AnsiCharPtr name, int index)
 Get the array value of an Usine-Object array at the index position.
 
AnsiCharPtr sdkUsineObjectGetAnsiChar (AnsiCharPtr name)
 Get the text value of an Usine-Object.
 
int sdkUsineObjectGetLength (AnsiCharPtr name)
 Get the size of the Event associated to an Usine-Object.
 
void sdkUsineObjectSetLength (AnsiCharPtr name, int l)
 Set the size of the Event associated to an Usine-Object.
 
AnsiCharPtr sdkUsineObjectFind (AnsiCharPtr name)
 Returns the list (as a comma-text) of all Usine-Objects that match with the name parameter.
 
LongBool sdkUsineObjectExists (AnsiCharPtr name)
 Returns TRUE if the Usine-Objects exists.
 
AnsiCharPtr 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 sdkSendUsineMsg (AnsiCharPtr Msg)
 Usine internal messages.
 
void sdkNotifyUsine (NativeInt Target, NativeInt Msg, NativeInt WParam=0, NativeInt LParam=0, int Delay=0)
 Usine notification. More...
 
TVstTimeInfosdkGetVstTimeInfo ()
 To access the current TVstTimeInfo structure of Usine.
 
double sdkGetTimeMs ()
 To get the Usine global time in millisecond, precision up to nanoseconde.
 
LongBool sdkPatchIsRunning ()
 To check if the patch containing the module is running.
 
LongBool sdkPatchLoading ()
 To check if the patch containing the module is loading.
 
LongBool sdkPatchJustActivated ()
 To check if the patch has just started.
 
LongBool 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 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 * sdkGetUsineUserModule ()
 To get the pointer of the Usine module. Do not use directly.
 
AnsiCharPtr sdkGetUsineVersionNum ()
 To get the version number of Usine as a string.
 
void sdkSetModuleUserName (AnsiCharPtr name)
 set the name of the module (as it appear in the patch, on the module title)
 
AnsiCharPtr 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 * sdkCreateDeskWindow ()
 
void sdkDestroyDeskWindow ()
 
void * sdkShowDeskWindow ()
 
void sdkHideDeskWindow ()
 
void sdkSetDeskWindowClientSize (int clientWidth, int clientHeight)
 
void sdkSetDeskWindowCaption (TModuleInfo *pModuleInfo, AnsiCharPtr name)
 

Converter utils

Useful to convert between pixel coord and graphic canvas unit.

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

Detailed Description

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.


The documentation for this class was generated from the following files: