Draft version, not updated to
SDK V5
As a powerful software to manipulate audio and midi data (and math, and time…), Usine is provided with a lot of modules to make dedicated tasks. More than that, there is an SDK (Software Developpement Kit) also provided to code new modules (usually called users modules).
As Usine is developed with the DELPHI language, the SDK is provided in C++.
Files are organized in a convenient way, let’s have a look :
TODO : files tree image
bin is the folder where are stored new compiled modules.
include Contain the ‘UserDefinition.h’ file. This is the only file you need to include in your modules projects.
TemplateProject is a minimal project folder to start from by duplicate it (see below).
UserDrawPadExample contain all specific files for the cpp drawpad example module (a Visual C++ project and some source and include files).
Additionnally, you’ll found a Release and/or Debug folder where are all intermediates file produced by Visual C++.
UserPrototypeExample is exactly the same than above, but for the cpp prototype example module.
Usine_SDKCPP_V2.sln is the Visual C++ solution containing user module projects.
Projects are configured to names modules with ‘usr’ extension, but they are in fact just dll.
What else to say…. UserDefinition.h file isn’t duplicated in every module project to make futur evolution easier, has there will be only one file to replace.
Now, it’s time to play with.
The simplest way, to create a new module, is to duplicate an existing project. For this, the TemplateProject folder is provided, here are the steps to follow :
Copy the TemplateProject folder to make a new one.
Rename it with a new name (your new module name is a good idea).
Open this folder and rename the TemplateModule.vcproj file with the same name.
In Visual C++, open the Usine_SDKCPP_V2.sln solution and add an existing project, select the freshly new renamed project file.
Now, you should have a TemplateProject project in the solution, rename it appropriately.
Expand this new project and rename the two files TemplateProject.h and TemplateProject.cpp (dont touch to the UserDefinition.h file).
The last thing to do is to replace, in these two files, the word TemplateModule by the name of your module (be sure to uncheck the Match case and Match whole word options to replace all occurrences).
That’s all, at this point, the Project should compile and produce a yourname.usr file in the bin folder. Of course, this module is not working yet, as it miss some important code, but you are ready to create a new killer user module.
Look at the two examples to see how things work. I’m sure that in near future, we’ll see some tutorials to go deeper in the user module world.
Has this
SDK communicate with a software coded in DELPHI, the most important thing is to set the
Structure Member alignment to 4 bytes. There is a #pragma directive at the beginning of the ‘UserDefinition.h’ for this, check the compatibility if you use another compiler.
User modules files have to be compiled as dll.
By default, User modules are compiled with static link to the Microsoft runtime library, ending up with a bigger file, but save the end user to install these runtime library.
Compiler and linker optimizations have not yet deep tested, feedback are welcome on this subject.
If your module have a panel, don’t forget to link the gdi32.lib and/or gdiplus.lib if they are used to paint the panel (in fact, you are free to choose the lib you want for that, but GDI is integrated in windows and and GDI+ is provided with Usine, who use both, so it seems logical to use them).
You are now ready to make some new ‘user module’ for Usine. Of course, this is just a first step, the real job is inside the module.
There is lots of things to say on the subject, Usine forum is our friend and now that we can code user modules in C++, knowledge will come along.
Don’t hesitate to ask questions and report bugs on the usine forum, module development section.
It’s up to you now, have fun and don’t forget to share your creations.