Constants

These are the constants used in Fruity plugins. Unless otherwise specified, they're defined in FP_PlugClass (.pas /.h).

Name
Value
Explanation
General
 
 
CurrentSDKVersion
1
The version of the SDK.
MIDIMsg_PortMask
FFFFFF
(FP_Def)
Use this constant to get at rid of the port in a midi message sent by FL Studio (see the MIDIIn function). If you AND the message sent by FL Studio with this value, you'll get a genuine MIDI message (meaning the fourth byte will be zero)
MIDIMsg_Null
FFFFFFFF
(FP_Def)
In MIDIIn, you can kill the midi message sent by FL Studio by setting it to this value
WaveT_Size
16384
(FP_Def)
This is the number of samples in the wavetables provided by the host (see TFruityPlugHost)
WaveT_Shift
18
(FP_Def)
18 bit shift for full DWORD conversion
 
   
 
Plugin Flags
 
(shl mean "shift left", the << operator in C/C++)
FPF_Generator
1
The plugin is a generator (as opposed to an effect).
FPF_RenderVoice
1 shl 1
(not used yet) The generator plugin will render voices seperately in VoiceRender. When this flag is specified, the host will call VoiceRender to actually create the sound.
FPF_UseSampler
1 shl 2
The generator plugin will stream into the host sampler (Voice_Render)
FPF_GetChanCustomShape
1 shl 3
The plugin will use a sample that the user loads into the plugin's channel.
FPF_GetNoteInput
1 shl 4
(not used yet) The plugin reacts to note events.
FPF_WantNewTick
1 shl 5
The plugin will be notified on each tick & be able to control params (like a built-in MIDI controller)
FPF_NoProcess
1 shl 6
The plugin won't process buffers at all (FPF_WantTick, or special visual plugins (Fruity NoteBook))
FPF_NoWindow
1 shl 10
The plugin's editor window should be shown inside the channel properties window
FPF_Interfaceless
1 shl 11
(not used yet) The plugin doesn't provide its own interface, but relies on the host to create one
FPF_TimeWarp
1 shl 13
(not used yet) The plugin supports timewarps, that is can be told to change the playing position in a voice (direct from disk music tracks, ...)
FPF_MidiOut
1 shl 14
The plugin will send MIDI out messages. Only plugins specifying this flag will be enabled when rendering to a midi file.
FPF_DemoVersion
1 shl 15
The plugin is a demo version. Practically this means the host won't save its automation
FPF_CanSend
1 shl 16
The plugin has access to the send tracks, so it can't be dropped into a send track or into the master
FPD_MsgOut
1 shl 17
The plugin will send delayed messages to itself (will require the internal sync clock to be enabled)
FPF_HybridCanRelease
1 shl 18
The plugin is a hybrid generator & can release its envelope by itself. If the host's volume envelope is disabled, then the sound will keep going when the voice is stopped, until the plugin has finished its own release
FPF_GetChanSample
1 shl 19
This plugin as a generator will use the sample loaded in its parent channel (see FPD_ChanSampleChanged)
FPF_WantFitTime
1 shl 20
Fit to time selector will appear in channel settings window (see FPD_SetFitTime)
FPF_NewVoiceParams
1 shl 21
This must be used (for new plugins). It tells the host to use floating point values for Pitch and Pan in TVoiceParams.
FPF_IsDelphi
1 shl 22
(FL 7.0) Tell the host if EditorHandle is a Delphi-made window, that can receive Delphi special messages (like CN_KeyDown for popup menus)
FPF_CantSmartDisable
1 shl 23
(FL 7.0) Tells the host that this plugin can't be smart disabled
     
Predefined Flag Combinations    
FPF_Type_Effect   Use this if you're making an effect (Eff_Render gets called by the host)
This is just zero
FPF_Type_FullGen   Use this to create a standalone generator (Gen_Render gets called by the host)
This is a combination of FPF_Generator and FPF_NoteInput
FPF_Type_HybridGen   Use this to make a hybrid generator (Voice_Render is called to generate a voice)
This is a combination of FPF_Type_FullGen and FPF_UseSampler
FPF_Type_Visual   Use this to define a purely visual plugin, that doesn't process any audio data
This is the same as FPF_NoProcess
 
   
  
Plugin Dispatcher IDs
 
(called from the GUI thread unless specified otherwise)
FPD_ShowEditor
0
If Value is zero, the editor has to be hidden
If Value is not zero, the editor has to be shown. In this case, Value contains the handle of the parent window
FPD_ProcessMode
1
Change the processing mode flags. This can be ignored. See Processing Mode Flags
The new flags are in Value
FPD_Flush
2
The continuity of processing is broken. This means that the user has jumped ahead or back in the playlist, for example. When this happens, the plugin needs to clear all buffers and start like new
Warning: this can be called from the mixer thread!
FPD_SetBlockSize
3
This changes the maximum processing length, expressed in samples.
The new length is in Value
FPD_SetSampleRate
4
This changes the sample rate. For the time being, this is fixed to 44100Hz.
Value holds the new sample rate
FPD_WindowMinMax
5
This allows the plugin to define how the editor window should be resized.
Index will hold a pointer to a rectangle for the minimum (Left and Top) and maximum (Right and Bottom) width and height of the window
Value holds a pointer to a point structure that defines by how much the window size should change horizontally and vertically when the user drags the border
FPD_KillAVoice
6
(not used yet) The host has noticed that too much processing power is used and asks the plugin to kill its weakest voice. The plugin has return 1 if it did anything, 0 otherwise
FPD_UseVoiceLevels
7
Only full generators have to respond to this message. It's meant to allow the cutoff and resonance parameters of a voice to be used for other purposes, if the generator doesn't use them as cutoff and resonance.
- return 0 if the plugin doesn't support the default per-voice level Index
- return 1 if the plugin supports the default per-voice level Index (filter cutoff (0) or filter resonance (1))
- return 2 if the plugin supports the per-voice level Index, but for another function (then check FPN_VoiceLevel to provide your own names)
FPD_SetPreset
9
Called when the user selects a preset.
Index tells you which one to set
FPD_ChanSampleChanged
10
A sample has been loaded into the parent channel. This is given to the plugin as a wavetable, in the same format as the WaveTables member of TFruityPlugin. Also see FPF_GetChanCustomShape.
Value holds a pointer to the new shape
FPD_SetEnabled
11
The host has enabled/disabled the plugin.
Value will contain the new state (0 for disabled, 1 for enabled)
Warning: this can be called from the mixer thread!
FPD_SetPlaying
12
The host is playing (song pos info is valid when playing) or stopped (state in Value)
FPD_SongPosChanged
13
The song position has jumped from one position to another non-consecutive position
FPD_SetTimeSig
14
The time signature has changed.
Value holds a pointer to a TTimeSigInfo structure (PTimeSigInfo) with the new information
FPD_CollectFile
15
This is called to let the plugin tell the host which files need to be collected or put in zip files. The name of the file is passed to the host as a pchar/char* in the result of the dispatcher function. The host keeps calling this until the plugin returns zero.
Index holds the file #, which starts at 0
FPD_SetNumSends
17
This tells the plugin how many send tracks there are (fixed to 4, but could be set by the user at any time in a future update)
Value holds the number of send tracks
FPD_LoadFile
18
Called when a file has been dropped onto the parent channel's button.
Value holds filename. It should be cast to a pchar/char *
FPD_SetFitTime
19
Set fit to time in beats
Value holds the time. This is a single/float value that needs to be typecast from the integer/int
FPD_SetSamplesPerTick
20
Sets the number of samples in each tick. This value changes when the tempo, ppq or sample rate have changed.
Value holds the new value. This is a floating point value, so it has to be typecast to an integer first!
Warning: this can be called from the mixer thread!
FPD_SetIdleTime
21
Sets the frequency at which Idle is called.
Value holds the new time (milliseconds)
FPD_SetFocus
22
(FL 7.0) The host has focused/unfocused the editor (focused in Value) (plugin can use this to steal keyboard focus)
FPD_Transport
23
(FL 8.0) This is sent by the host for special transport messages, from a controller.
Index is the type of message (see transport types)
Result should be 1 if handled, 0 otherwise
FPD_MIDIIn
24
(FL 8.0) Live MIDI input preview. This allows the plugin to steal messages (mostly for transport purposes). Must return 1 if handled.
Value has the packed MIDI message. Only note on/off for now.
Result should be 1 if handled, 0 otherwise
 
 
 
GetName
 
 
FPN_Param
0
Retrieve the name of a parameter.
Index specifies which parameter
FPN_ParamValue
1
Retrieve the text representation of the value of a parameter for use in the event editor.
Index specifies which parameter
FPN_Semitone
2
Retrieve the name of a semitone.
Index specifies which semitone
Value specifies the color (or MIDI channel)
FPN_Patch
3
(not used yet) Retrieve the name of a patch.
Index specifies which patch.
FPN_VoiceLevel
4
(optional) Retrieve the name of a per-voice parameter, specified by Index. Default is filter cutoff (Index=0) & resonance (Index=1)
FPN_VoiceLevelHint
5
Longer description for per-voice parameter (works like FPN_VoiceLevel)
FPN_Preset
6
This is called when the host wants to know the name of a preset, for plugins that support presets (see FHD_SetNumPresets below).
Index specifies for which preset the name is needed
FPN_OutCtrl
7
For plugins that output controllers, retrieve the name of output controller Index
 
 
 
Processing Mode Flags
 
 
PM_Normal
0
Realtime rendering
PM_HQ_Realtime
1
Realtime rendering with a higher quality
PM_HQ_NonRealtime
2
Non realtime processing (CPU does not matter, quality does) (normally set when rendering only)
PM_IsRendering
16
FL is rendering to file if this flag is set
PM_IPMask
7 shl 8
(changed in FL 7.0) 3 bits value for interpolation quality
(0=none (obsolete), 1=linear, 2=6 point hermite (default), 3=32 points sinc, 4=64 points sinc, 5=128 points sinc, 6=256 points sinc)
 
 
 
ProcessParam Flags
 
 
REC_UpdateValue
1
Update the value of the parameter
REC_GetValue
2
Return the value of the parameter as the result of the function
REC_ShowHint
4
Update the hint if there is one
REC_UpdateControl
16
Update the parameter control (wheel, slider, ...)
REC_FromMIDI
32
A value between 0 and 65536 has to be translated to the range of the parameter control.
Note that you should also return the translated value, even if REC_GetValue isn't included.
REC_NoLink
1024
(internal) Don't check if wheels are linked
REC_InternalCtrl
2048
Sent by an internal controller. Internal controllers should pay attention to these, to avoid Feedback of controller changes
REC_PlugReserved
4096
This flag is free to be used by the plugin as it wishes
     
Event IDs
 
 
FPE_Tempo
0
The tempo has changed.
EventValue holds the tempo, it needs to be typecast to a float/single value
Flags holds the average samples per tick, as a DWORD
FPE_MaxPoly
1
The maximum polyphony has changed. This is only of intrest to standalone generators.
EventValue will hold the new maximum polyphony. A value <= 0 will mean infinite polyphony
FPE_MIDI_Pan
2
The MIDI channel panning has changed.
EventValue holds the new pan (0..127)
FPE_MIDI_Vol
3
The MIDI channel volume has changed.
EventValue holds the new volume (0..127)
Flags also holds the new volume, but you first need to typecast it to a floating point value (single / float). It's in the range 0..1
FPE_MIDI_Pitch
4
The MIDI channel pitch has changed.
EventValue will hold the new value in *cents*. This has to be translated according to the current pitch bend range.
 
 
 
Voice Handles
 
 
FVH_Null
-1
A null (unused) handle
 
 
 
TFruityPlug Voice Event IDs
 
 
FPV_Retrigger
0
(not used yet) Monophonic mode can retrigger releasing voices
     
TFruityPlugHost Voice Event IDs    
FPV_GetLength
1
Retrieve the note length in ticks. The result is not reliable.
Result will hold the length of the note, or -1 if it's not defined.
FPV_GetColor
2
Retrieve the color for a note. A note can currently have up to 16 colors in the pianoroll. This can be mapped to a MIDI channel.
Result will hold the note color (0..15)
FPV_GetVelocity
3
(FL 7.0) Retrieve note on velocity. This is computed from InitLevels.Vol. This should be called from TriggerVoice.
Result will hold the velocity. Typecast it as a float (0..1)
FPV_GetRelVelocity
4
(FL 7.0) Retrieve release velocity (0..1) in Result. Use this if some release velocity mapping is involved. This should be called from Voice_Release.
Result will hold the velocity. Typecast it as a float (0..1) (to be called from Voice_Release) ()
FPV_GetRelTime
5
(FL 7.0) Retrieve release time multiplicator. Use this for direct release multiplicator. This should be called from Voice_Release.
Result will hold the value. Typecast it as a float (0..2)
FPV_SetLinkVelocity
6
(FL 7.0) Call this to set if velocity is linked to volume or not. The default is on.
EventValue should hold the switch (0=off, 1=on).
 
 
 
Voice_Render Function Results
 
 
FVR_Ok
0
No problems
FVR_NoMoreData
1
There is no more sample data to fill any more buffers. The voice will be killed by the host
 
 
 
Host Dispatcher IDs
 
 
FHD_ParamMenu
0
Tells the host that the user has clicked an item of the control popup menu
Index holds the parameter index
Value holds the popup item index (see FHP_EditEvents)
FHD_GetParamMenuFlags
1
(OBSOLETE)
FHD_EditorResized
2
Notify the host that the editor has been resized.
FHD_NoteNamesChanged
3
Notify the host that the note names have changed (see FPN_SemiTome)
FHD_ActivateMIDI
4
This makes the host enable its MIDI output. This is useful when a MIDI out plugin is created (a plugin which will send midi messages to external midi hardware, most likely)
FHD_WantMIDIInput
5
The plugin either wants to be notified about MIDI messages (for processing or filtering), or wants to stop being notified about them.
Value tells the host whether the plugin want to be notified or not (1 to be added to the list of plugins that are notified, 0 to be removed from the list)
FHD_WantMIDITick
6
(not used yet) The plugin wants to receive MIDITick events, allowing MIDI out plugins
FHD_KillAutomation
8
Ask the host to kill the automation linked to the plugin. This can for example be used for a demo version of the plugin. The host will kill all automation information in the range Index..Value. So to kill the automation for all parameters, you'd call the dispatcher with Index = 0 and Value = paramcount-1.
Index is the first parameter for which to kill the automation
Value is the last parameter for which to kill the automation (inclusive)
FHD_SetNumPresets
9
This tells the host how many presets are supported by the plugin (this is mainly used by the wrapper plugin).
Value holds the number of presets
FHD_SetNewName
10
Sets a new short name for the parent.
Value is the new name, a pointer to a null terminated string (pchar / char *)
FHD_SelectChanSample
12
Ask the host to open a selector for its channel sample (Also see FPF_UseChanSample)
FHD_WantIdle
13
Tell the host that the plugin wants to receive the idle message (or not). Idle messages are received by default.
Value=1 for adding the plugin to the idle list, Value=0 for removing it from the list
FHD_LocateDataFile
14
Ask the host to search for a file in its search paths
Value should hold the simple filename (pchar / char *)
The full path is returned as result of the function (pchar / char *). This result doesn't live long so copy it as soon as possible.
FHD_TicksToTime
16
Translate tick time into Bar:Step:Tick (warning: it's *not* Bar:Beat:Tick)
Value should hold the tick time to translate
Index should contain a pointer to a TSongTime structure (PSongTime)
FHD_AddNotesToPR
17
Ask the host to add one or more notes to the piano roll
Value should hold a pointer to a TNotesParams structure (PNotesParams), describing all the notes to be added
FHD_GetParamMenuEntry
18
Before the popup menu is shown, you must fill it with the entries set by the host. You use this dispatcher code to find out which those are.
Index is the parameter index
Value holds the popup item index (starting from 0)
The result will be a pointer to a TParamMenuEntry structure, or a null pointer if there are no more entries to add
FHD_ShowMsg
19
This will make fruity show a message box.
Index must be set to a pointer to the text to be shown (cast as an integer). The format for this is Title|Message. For example : "My Message|Hey look at this!".
Value must hold the flags (MB_OkCancel, MB_IconWarning, etc.)
The function will return the result of the messagebox, IDOk, IDCancel format (as in TApplication.MessageBox in Delphi)
FHD_NoteOn
20
Turn on a preview note
Index should hold the semitone in the low word, and the color (or MIDI channel) in the high word
Value contains the velocity
FHD_NoteOff
21
Turn a preview note off
Pass the semitone in Index
FHD_OnHint_Direct
22
This shows a hint message in the FL hint area. It's the same as OnHint, but shows it immediately (to show a progress while you're doing something)
Value holds a PChar/char * containing the text to show
FHD_SetNewColor
23
Use this code to set a new color for the parent
Value holds the color
(also see FHD_SetNewName)
FHD_GetInstance
24
This returns the module instance of the host in Windows. This could be an exe or a DLL, so it won't be the process itself
FHD_KillIntCtrl
25
Ask the host to kill anything linked to an internal controller. This is used when undeclaring internal controllers.
Index is the first internal controller to kill
Value is the last internal controller to kill
FHD_SetNumParams
27
Call this to override the number of parameters that this plugin instance has. This is meant for plugins that have a different set of parameters per instance.
Value holds the new number of parameters
FHD_PackDataFile
28
Ask the host to create a filename relative to the FL Studio data folder. This makes it much faster to look for this file (samples, for example) when the song is loaded again.
Value holds the pointer to the full filename
Result will hold a pointer to the packed filename. Copy it immediately!
FHD_GetProgPath
29
Ask the host where the FL Studio engine dll is. This may be different from the location of the executable. It can be used to discover the location of the FL Studio data path.
Result will hold a pointer to the path. Copy it immediately!
FHD_SetLatency
30
Set the plugin latency, if any.
Value holds the latency in samples.
FHD_CallDownloader
31
(FL 6.0) Ask the host to show the preset downloader/selector for this plugin.
FHD_EditSample
32
(FL 7.0) Edits sample in Edison
Value holds the sample filename (pchar/char* typecast to integer)
Index should be 1 if an existing instance of Edison can be re-used
FHD_SetThreadSafe
33
(FL 7.0) Call this to let FL know that this plugin is thread-safe (or not). The default is not. You should do your own thread-sync using LockMix_Shared
Value holds the switch (0=off, 1=on)
Important: this should only be used from a generator plugin!
FHD_SmartDisable
34
(FL 7.0) The plugin asks FL to enable or disable smart disabling. This is mainly for generators, so they can get MIDI input (if applicable)
Value holds the switch (0=off, 1=on)
FHD_SetUID
35
(FL 8.0) Sets the unique identifying string for this plugin. This will be used to save/restore custom data related to this plugin. Handy for wrapper plugins.
Value is the identifying string (cast to an integer from a pchar/char*)
FHD_GetMixingTime
36
(FL 8.0) Get the mixer time, relative to the current time.
Index is the time format required (0: Beats, 1: absolute ms, 2: running ms)
Value is a pointer to a TFPTime, which is filled with an optional offset in samples
FHD_GetPlaybackTime
37
(FL 8.0) Get playback time. See FHD_GetMixingTime for details.
FHD_GetSelTime
38
(FL 8.0) Get selection time in the t and t2 fields of TFPTime. See FHD_GetMixingTime for details.
Result is 0 if there is no selection. t and t2 are then filled with full song length.
FHD_GetTimeMul
39
(FL 8.0) Get the current tempo multiplicator. This is not part of the song but used for fast-forward.
FHD_Captionize
40
(FL 8.0) Captionize the plugin. This can be useful when dragging.
Value is 1 for captionized or 0 otherwise
FHD_SendSysEx
41

(FL 8.0) Send a SysEx string, without delay. Do not abuse this!
Index is the port to send to
Value is a pointer to the data to send. The first 32bit integer is the length of the string, the rest is the data

FHD_LoadAudioClip
42
(FL 8.0) Send an audio file to the playlist as an audio clip, starting at the playlist selection (mainly for Edison)
Value is the filename (pchar/char* cast to integer)
FHD_LoadInChannel
43
(FL 8.0) Send a file to the selected channel(s) (mainly for Edison)
Value is the filename (pchar/char* cast to integer)
FHD_ShowInBrowser
44
(FL 8.0) Locates the specified file in the browser and jumps to it. This also adds the file's folder to the browser search paths if necessary.
Value is the filename (pchar/char* cast to integer)
 
 
 
Parameter Popup Menu Item Indexes
 
 These are the same order as the parameter menu in FL Studio. It can be a popup menu or anything else. They are all obsolete now, replaced by FHD_GetParamMenuEntry.
FHP_Edit
0
(OBSOLETE)
Edit events
FHP_EditNewWindow
1
(OBSOLETE)
Edit events in a new window
FHP_Init
2
(OBSOLETE)
Initialize with this position
FHP_Link
3
(OBSOLETE)
Link to a MIDI controller
 
 
 
Parameter Popup Menu Item Flags
 
 
FHP_Disabled
1
The item is disabled
FHP_Checked
2
The item is checked
     
Sample Loading Flags    
FHLS_ShowDialog
1
This tells the sample loader to show an open box, for the user to select a sample
FHLS_ForceReload
2
Force the sample to be reloaded, even if the filename is the same. This is handy in case you modified the sample, for example
FHLS_GetName
4
Don't load the sample, instead get its filename & make sure that the format is correct (useful after FPD_ChanSampleChanged)
FHLS_NoResampling
5
Don't resample to the host sample rate
     
TNotesParams Flags    
NPF_EmptyFirst
1
Delete everything currently on the piano roll before adding the notes (See also : FHD_AddNotesToPR)
NPF_UseSelection
2
Put the new notes in the piano roll selection, if there is one
     
Transport types (GenericTransport .pas/.h)    
FPT_Jog
0
(jog) generic jog (can be used to select stuff)
FPT_Jog2
1
(jog) alternate generic jog (can be used to relocate stuff)
FPT_Strip
2
touch-sensitive jog strip, value will be in -65536..65536 for leftmost..rightmost
FPT_StripJog
3
(jog) touch-sensitive jog in jog mode
FPT_StripHold
4
value will be 0 for release, 1,2 for 1,2 fingers centered mode, -1,-2 for 1,2 fingers jog mode (will then send FPT_StripJog)
FPT_Previous
5
(button)
FPT_Next
6
(button)
FPT_PreviousNext
7
(jog) generic track selection
FPT_MoveJog
8
(jog) used to relocate items
FPT_Play
10
(button) play/pause
FPT_Stop
11
(button)
FPT_Record
12
(button)
FPT_Rewind
13
(hold)
FPT_FastForward
14
(hold)
FPT_Loop
15
(button)
FPT_Mute
16
(button)
FPT_Mode
17
(button) generic or record mode
FPT_Undo
20
(button) undo/redo last, or undo down in history
FPT_UndoUp
21
(button) undo up in history (no need to implement if no undo history)
FPT_UndoJog
22
(jog) undo in history (no need to implement if no undo history)
FPT_Punch
30
(hold) live selection
FPT_PunchIn
31
(button)
FPT_PunchOut
32
(button)
FPT_AddMarker
33
(button)
FPT_AddAltMarker
34
(button) add alternate marker
FPT_MarkerJumpJog
35
(jog) marker jump
FPT_MarkerSelJog
36
(jog) marker selection
FPT_Up
40
(button)
FPT_Down
41
(button)
FPT_Left
42
(button)
FPT_Right
43
(button)
FPT_HZoomJog
44
(jog)
FPT_VZoomJog
45
(jog)
FPT_Snap
48
(button) snap on/off
FPT_SnapMode
49
(jog) snap mode
FPT_Cut
50
(button)
FPT_Copy
51
(button)
FPT_Paste
52
(button)
FPT_Insert
53
(button)
FPT_Delete
54
(button)
FPT_NextWindow
58
(button) TAB
FPT_WindowJog
59
(jog) window selection
FPT_F1
60
(button)
FPT_F2
61
(button)
FPT_F3
62
( button)
FPT_F4
63
(button)
FPT_F5
64
(button)
FPT_F6
65
(button)
FPT_F7
66
(button)
FPT_F8
67
(button)
FPT_F9
68
(button)
FPT_F10
69
(button)
FPT_Enter
80
(button) enter/accept
FPT_Escape
81
(button) escape/cancel
FPT_Yes
82
(button) yes
FPT_No
83
(button) no
FPT_Menu
90
(button) generic menu
FPT_ItemMenu
91
(button) item edit/tool/contextual menu
FPT_Save
92
(button)
FPT_SaveNew
93
(button) save as new version