First     Previous     Next

Principles


What's in the sdk ?
There are 3 core files in the sdk:
FP_PlugClass (.pas / .h) contains the structure and class definitions, as well as the constants required when creating Fruity plugins.
FP_Def (.pas / .h) contains some types and constants that can be used in your plugins.
FP_Extra (.pas/.h) has some extra type definitions, constants and functions

There's also a helper class defined, that derives from TFruityPlug and defines some handy functions. This is TDelphiFruityPlug for Delphi (FP_DelphiClass.pas) and TCPPFruityPlug for C++ (FP_CPlug.h). It's best to derive your own plugin class from one of these (depending on the programming language you use).


The plugin class
A plugin has to be implemented inside a class. The base class for this is TFruityPlug.


TFruityPlugInfo
FL Studio gets its information about a plugin from the TFruityPlugInfo structure. Therefore it's important to know how to fill this in. From this structure, FL Studio retrieves the type of the plugin, whether it supports an editor, what its unique name is and so on.

FL Studio looks for the TFruityPlugInfo in the Info member of TFruityPlug. This is a pointer to a TFruityPlugInfo structure and it needs to be set by the plugin to point to a valid structure. In the examples this is done in the constructor of the plugin class.

Be sure to always set SDKVersion to CurrentSDKVersion. The plugin name should be as unique as possible (see Guidelines). Also don't forget to set NumParams to the number of parameters your plugin has.

Flags is a bitfield (see Working with bitfields). It contains any combination of plugin flags. It can contain a number of flags, some describing the type of plugin (see below). Most of the defined flags are not used yet. See the plugin flag constants for a complete list.


Plugin Types
There are two main types of Fruity plugins : effects and generators.

Effects receive audio data from FL Studio. They do something to this data (apply an effect) and give the resulting data back to FL Studio. You specify an effect plugin by leaving out FPF_Generator from the Flags member of TFruityPlugInfo. Processing for an effect occurs in Eff_Render (see Processing data).

Generators on the other hand do not receive audio data from FL Studio. They create entirely new data (generate) and send that to the host. To create a generator plugin, include FPF_Generator in the Flags member of TFruityPlugInfo. Generators are divided into two more categories : full and hybrid generators. There are shortcut flags for creating full and hybrid generators. To make a full generator, you can use FPF_Type_FullGen. For a hybrid generator, you would use FPF_Type_HybridGen instead.

Full generators create their audio data when Gen_Render is called (see Processing data). They are responsible for doing everything related to creating the audio data. So they might process their own envelope, for example. The big difference with a hybrid generator is that a full generator has to mix all the voices that were created itself, inside Gen_Render.

Hybrid generators on the other hand implement the Voice_Render function to generate their audio (see Working with voices). A hybrid generator is created by including FPF_UseSampler in the Flags member of TFruityPlugInfo. A hybrid generator has less work: it just needs to create a sound and FL Studio will take care of the rest. The hybrid generator doesn't need to mix its voices, it's just asked by FL Studio to render each voice separately in Voice_Render.