Page 1 of 1
Posted: 24 Dec 2008, 17:53
by martignasse
I'll do my best to answer you're questions and feedbacks.
Posted: 31 Dec 2008, 16:37
by Vincent
Hello Martin,
I've donwloaded and unpacked this SDK V2, and I'm very desappointed 'cause I cann't open any solution with my version of Visual C++ Express (
the free one )!
cheers
Posted: 31 Dec 2008, 16:52
by martignasse
hi vincent,
It's very strange, I've made the SDK V2 on VC++ Express, exactly on this version :

.
what kind of message VC Express bring you ?
Posted: 02 Jan 2009, 18:10
by Vincent
OK!!!!
Not strange at all!
I don't know how I did this, but I run a Visual C++ 2005!
Tell me pleazzze: where did you dwnload this C++ 2008?!
Thanks and sorry for this stupid post!
I'm impatient to start!
cheers
Posted: 02 Jan 2009, 18:20
by nay-seven
Posted: 02 Jan 2009, 18:36
by Vincent
Hello Yan,
Thanks for the link. Google doesn't like me and makes some jokes I don't appreciate!
I had to know that there was a 2008 edition and ask for it...
Now, let's go!
cheers
Posted: 02 Jan 2009, 19:55
by martignasse
ok, good news,
let us know your 'not coder' feeling about it

Posted: 02 Jan 2009, 20:05
by Vincent
martignasse wrote:let us know your 'not coder' feeling about it

'Not coder', exactly. I'll talk, don't worry!
Posted: 03 Jan 2009, 00:07
by Vincent
Evrything works fine now.
Thanks Yan for the right link.
I had a look in the user modules.
Looks simple, but unfortunately for me, all what I know in coding is in Visual Basic (VB 2008 is nice!).
With Visual C++, I have to spend some time to re-learn...
And time, you know...
Yeah, I'll take it, every day.
cheers
Posted: 03 Jan 2009, 00:47
by martignasse
Even if it's not directly related to Usine,
i'll try to put some links to CPP basics on the WIKI, as it can help to understand the syntaxe, and how to manipulate data.
Can't promise you 'll become a master, but you should arrive to make some user module pretty easly.
A+
Posted: 03 Jan 2009, 03:45
by Vincent
Thanks, Martin.
Yes, I think I'll be able to have some good time!
Anyway, I won't make modules just as a game, I think that when I'll have do what I need, I'll comme back to Usine.
cheers
Posted: 04 Jan 2009, 16:19
by Vincent
Bouh...
C++ give me headaches. I understand absolutely nothing, it seems *very* different from VB that I now know a little...
Architecture is different, concepts are different, ways of conception and ways to build... I'm just lost.
And the MSDN in this release is so poor! 2/3 help files are missing. I've tryed to download the whole ISO stuff, but download is bugged here. Maybe with Firefox... I'll try.
Could you please give me a couple of links toward efficient french tutos for newbleubite?
I had a clear project for a sync module, I think it will wait a while. But when I'll be somewhat ready, i'll come back for tons of questions!
Thanks for this SDK, Martin, it is really a good stuff.
cheers
Posted: 04 Jan 2009, 16:42
by martignasse
Vincent wrote:Could you please give me a couple of links toward efficient french tutos for newbleubite?
Quick answer :
Apprenez à programmer en C !
Apprenez à programmer en C++ !
they are french tutorials from 'le site du zero' so, especially for 'newbleubite'

.
C++ is built on top of C language, so it's recommended to read the C one before, has it speak about very basic and important things to understand C++.
PS : I'll add those links on the WIKI when i'll make the french pages.
Hope it help
Posted: 04 Jan 2009, 16:48
by Vincent
Yes it helps! Anything helps where I am. Well, let's have a drink...
Thanks Martin.
I'll come back later.
Posted: 12 Jan 2009, 20:19
by Vincent
Yes! Tremendously.
Nice tutos, clears and realy well thought.
I don't specialy like Bible, but actually...
Posted: 13 Jan 2009, 15:54
by martignasse
hello Vincent,
you are in ideal position to make a 'User module tutorial for C++ newbie'

Posted: 16 Jan 2009, 20:23
by Vincent
martignasse wrote:you are in ideal position to make a 'User module tutorial for C++ newbie'

Not yet!
I'm still with C++ learning tutos and I positively understand nothing in all your threads about SDK and user modules.
In some words: i'm not as good as a newbie and it seems to me that i'm far to be!
Posted: 26 Jan 2009, 17:37
by antwan
Hi,
Just checking:
Are all the projects included in the CPP SDK supposed to build succesfully?
With UserDrawPad I get:
1>UseDrawPad.cpp
1>c:audiousine sdkcppusine cpp sdk v2auserdrawpadexampleusedrawpad.cpp(300) : error C2664: 'DrawTextW' : cannot convert parameter 2 from 'LPSTR' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://c:audioUsine SDKCPPUsine CPP SDK V2aUserDrawPadExampleDebugBuildLog.htm"
1>UserDrawPadExample - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
With TemplateModule I get:
1>------ Build started: Project: TemplateModule, Configuration: Debug Win32 ------
1>Compiling...
1>TemplateModule.cpp
1>c:audiousine sdkcppusine cpp sdk v2atemplateprojecttemplatemodule.cpp(59) : warning C4065: switch statement contains 'default' but no 'case' labels
1>c:audiousine sdkcppusine cpp sdk v2atemplateprojecttemplatemodule.cpp(83) : warning C4065: switch statement contains 'default' but no 'case' labels
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1> Creating library DebugTemplateModuleCPP_D.lib and object DebugTemplateModuleCPP_D.exp
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
1>C:audioUsine SDKCPPUsine CPP SDK V2abinTemplateModuleCPP_D.usr : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:audioUsine SDKCPPUsine CPP SDK V2aTemplateProjectDebugBuildLog.htm"
1>TemplateModule - 3 error(s), 3 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
UserPrototypeExample builds succesfully...
I thought I'd just ask before getting any deeper into this world
Thanks,
antwan
Posted: 27 Jan 2009, 13:11
by martignasse
Hi antwan,
Normally, all projects should build without errors, in release and debug mode...
But the fact is, there are some inconsistence in projects properties between release and debug configs.
So, will go for a V2b update shortly...
In the mean time, i can explain what is wrong to let you play with the SDK
for the DrawPad | Debug :
1>c:audiousine sdkcppusine cpp sdk v2auserdrawpadexampleusedrawpad.cpp(300) : error C2664: 'DrawTextW' : cannot convert parameter 2 from 'LPSTR' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://c:audioUsine SDKCPPUsine CPP SDK V2aUserDrawPadExampleDebugBuildLog.htm"
1>UserDrawPadExample - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
In Project properties(Debug), you have to change the
Configuration Properties->Ceneral->Character Set to
No Set instead of Unicode, which cause this invalid cast.
For the ModuleTemplate | Debug :
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
1>C:audioUsine SDKCPPUsine CPP SDK V2abinTemplateModuleCPP_D.usr : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:audioUsine SDKCPPUsine CPP SDK V2aTemplateProjectDebugBuildLog.htm"
1>TemplateModule - 3 error(s), 3 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
In Project properties(Debug), you have to change the
Configuration Properties->C/C++->Runtime Library to
Multi-threaded Debug (/MTd) instead of Multi-threaded (/MT), which cause this libs conflict.
Note that the ModuleTemplate is here as a base to make new project easier, even if it should build
out of the box, it miss some important code to be functional. You have to add at least what mentioned in code comments.
The best solution would be to make a VC wizard for new user module... if someone can do that, it will be perfect
Anyway, thanks a lot for the feedback, and sorry for these troubles, i haven't test enough before release :/
Posted: 27 Jan 2009, 16:43
by antwan
Hi Martin,
Thanks for the clarification. That'll get me started. Though I'm still a bit scared of it all
antwan
Posted: 27 Jan 2009, 23:56
by antwan
Hello once again,
Okay, so I got these things to compile okay.
But how do I actually get from compiling/building to having an actual module in usine? I can't find any usr-file etc. created as a result of the release-build.
Cheers,
antwan
Posted: 28 Jan 2009, 10:32
by martignasse
hi,
Normally, the result of compilation for all projects are in the bin folder, named like the project and with a '_D' for debug version and a '.usr' extension.
If it's not the case, you have to check in the project properties (for Release and Debug mode) Configuration Properties->General->Output Directory it should be $(SolutionDir)bin. If it's something else, follow the path to find the file.
Those files should be copied or moved in the Usine folder installFilesModulesUser to be visible in the Usine Browser->Modules->User and usable.
Let me know if you get it right.
Posted: 28 Jan 2009, 10:41
by antwan
Ah, of course the bin-folder! Found it.
Sorry I was looking in the ProjectDir/Release-folder... Silly me.
All good. Thanks,
antwan
Posted: 28 Jan 2009, 11:06
by martignasse
no problems,
The Release and Debug folders of each projects are user for intermediates files in the compilation process (and there a few...).
I decided to 'centralize' the place where to found finales files.... in a bin folder. It will be more praticable when you'll have tones of users modules projects
Have fun
Posted: 04 Mar 2009, 10:43
by Gizzeta
hallo!
thanks for the c++ SDK.
Is there a way to create or communicate with an audio buffer?
thanks
Posted: 05 Mar 2009, 08:51
by martignasse
Hi gizzeta,
What do you mean by audio buffer ?
If you make an audio input parameter in your module, you have access to his audio blocks as usine inject them in the module.
(assuming there is an effective connexion with some audio flux)
Also, you can create some audio blocks inside your module and put them in an audio output parameter too.
The related structure in the SDK is TEVT, which contain the event data of your parameter.
In fact, i believe the SDK work quite similar as the VST SDK V2.4.
Hope it help
Posted: 06 Mar 2009, 12:56
by Gizzeta
Hi Martin,
I come from MaxMSP and within it there is a buffer object to store sounds or big datas.I can acces it from the C++ module programming.
In Usine, if I need to store for examle a 60 seconds incoming sound inside my module, have I to do a memory allocation myself?
Or there's a function to acces at, to create a 4Mb buffer?
thanks
Posted: 08 Mar 2009, 09:40
by senso
you have to manage memory yourself:
allocate in the create procedure and free it in the 'destroy'
Posted: 08 Mar 2009, 13:16
by Gizzeta
i'll try, thanks!
Posted: 09 Mar 2009, 11:01
by Gizzeta
hem....what kind of allocation?
an array of 7.000.000 floats elements? Or there's something better?

Posted: 09 Mar 2009, 15:24
by senso
yes, it a good starting point to create an array of float; it's the easiest way.
you also have the possibility to allocate a PCHAR pointer (7.000.000 x sizeof(float)) and deal with pointers, often more efficient.
but allocating such a buffer can take a long time so don't do that in the main 'audio proceed' function.
try to do that in
- during the creation procedure
- the callback procedure
Posted: 10 Mar 2009, 18:52
by Gizzeta
ok, thank you
and is there a function to print from an user module on the Usine console? (for debugging purpose...)
Posted: 10 Mar 2009, 19:05
by senso
Actually no way, except to create a text outlet and connect it to a 'trace' module
It's a good suggestion I'll try to add this fuction as soon as possible.
Also Usine contains around 350.000 lines of reusable code. Maybe I could start to find a way to have an access to those functions.
For example reading audio samples from the hard disk, midi tools, etc.
Posted: 19 Mar 2009, 13:57
by pansoul
hello
martignasse , in the CPPQuickStartEN.pdf and in french version too, you say :
"The last thing to do is to replace, in these two files, the world TemplateProject by
the name of your module (be sure to uncheck the Match case and Match whole
word options to replace all occurences)."
but i can't find the word "TemplateProject" in this two files, do you rather mean the word "TemplateModule" is to changed
with the project name ?
thanks
Posted: 19 Mar 2009, 17:50
by martignasse
pansoul wrote:but i can't find the word "TemplateProject" in this two files, do you rather mean the word "TemplateModule" is to changed with the project name ?
Yes, you are totally right it's "TemplateModule" that should be replaced by "MyModule" or what ever.
Excuse me for the typo, i'll correct this for the next release.
Posted: 23 Mar 2009, 02:02
by pansoul
hello
correct me if i am wrong, in your example you use win api to code the graphical part of your draw pad.
i have read the two tutorial about c and c++ on le site du zero and i am not able to understand correctly your code.
is a tutorial like
http://www.siteduzero.com/tutoriel-3-87 ... ndows.html pertinent for a good undertanding ?
if you are thinking to others ressources...
thanks
Vincent
Posted: 23 Mar 2009, 19:05
by pansoul
i try to add some an new output (data, midi or anything else) on a patch inspired by drawpad and prototype example.
compilation works but when a put my .usr file into usine, i can't connect it to others modules.
i suppose that i did a mistake but i don't find where
i add some line code in :
- get param info method (i add a new case)
-set event adress (new case too)
- i changed the number of params in get module info and try to change the value of pModuleInfo->ModuleType
anyone no what is to change to add output or have others sources codes available to see how they works ?
thanks
Vincent
Posted: 23 Mar 2009, 19:59
by martignasse
pansoul wrote:in your example you use win api to code the graphical part of your draw pad.
Partialy right, in fact, the 'simplest' way to code the graphical part is to use the GDI or the GDI+ (who are really little part of the Windows API), has they are used by Usine itself.
The difference between those is that GDI+ has OOP interface, and has more polished graphical result, but is slower than GDI, who is typical C interface.
The UserDrawPad example use the GDI library.
The link you provided seems to generic about the whole Windos API, here some specific resources for GDI and GDI+ :
MSDN for GDI+
MSDN for GDI
(added to the wiki)
You'll find a lot of tutorials with google for GDI+, less for GDI, don't hesitate to add them to the wiki.
as a note, you have to know that in theory, it's possible to draw the graphical part with DirextX or OpenGL, it's just that no one have made it for now. I even wanted to make test for vector graphic with SVG or OpenVG....but really no time for that theses days.
Hope it help
Posted: 23 Mar 2009, 20:08
by martignasse
pansoul wrote:i try to add some an new output (data, midi or anything else) on a patch inspired by drawpad and prototype example.
compilation works but when a put my .usr file into usine, i can't connect it to others modules.
i suppose that i did a mistake but i don't find where
i add some line code in :
- get param info method (i add a new case)
-set event adress (new case too)
- i changed the number of params in get module info and try to change the value of pModuleInfo->ModuleType
anyone no what is to change to add output or have others sources codes available to see how they works ?
thanks
Vincent
Seems ok, but did you add the corresponding TEVT* pointer in the include file ?
Code: Select all
// DrawPad class
class TDrawPad : public TUserModule
{
public:
TEVT* pButtonClear; // ClearButton Event pointer
TEVT* pPointsCount; // PointsCount Event pointer
TEVT* pMyNewOutput; // <----------------HERE
...
If it's not that, source code is needed to find what's wrong
Posted: 27 Mar 2009, 18:23
by Gizzeta
Hi,
I've tried, but i didn't find how to create a text outlet. Can you help me?
thanks
Posted: 11 Apr 2009, 18:28
by Gizzeta
Another question:
how can I get the Usine sample rate?
thanks
Posted: 11 Apr 2009, 23:24
by martignasse
Hi Gizzeta,
Sorry, seems like i forget you'r last question...
Gizzeta wrote:I've tried, but i didn't find how to create a text outlet. Can you help me?
Well, after testing, it seems like the text field param is always shown as inlet, whatever the IsInput/IsOutput values, which is anormal. I have to see with senso.
As a workaround for now, you can always extend the module in usine (the little white square in topleft) to access the outlet part.
Gizzeta wrote:Another question:
how can I get the Usine sample rate?
Something like should do the trick (not tested) :
Code: Select all
double sampleRate = pMasterInfo->VstTimeInfo->sampleRate;
Hope it help
Posted: 12 Apr 2009, 20:32
by senso
Gizzeta wrote:I've tried, but i didn't find how to create a text outlet. Can you help me?
Well, after testing, it seems like the text field param is always shown as inlet, whatever the IsInput/IsOutput values, which is anormal. I have to see with senso.
it's an usine pb fixed now.
next release very very soon!
Posted: 12 Apr 2009, 21:00
by martignasse
ok, cool
Posted: 22 Apr 2009, 02:04
by Gizzeta
martignasse wrote:Hi Gizzeta,
Something like should do the trick (not tested) :
Code: Select all
double sampleRate = pMasterInfo->VstTimeInfo->sampleRate;
thanks for your answers.
for the sampling rate I checked: it's not VstTimeInfo, but pTimeInfo.
Code: Select all
SampleRate = PointerToMyModule->pMasterInfo->pTimeInfo->sampleRate
Posted: 22 Apr 2009, 02:50
by martignasse
Gizzeta wrote:martignasse wrote:Hi Gizzeta,
Something like should do the trick (not tested) :
Code: Select all
double sampleRate = pMasterInfo->VstTimeInfo->sampleRate;
thanks for your answers.
for the sampling rate I checked: it's not VstTimeInfo, but pTimeInfo.
Code: Select all
SampleRate = PointerToMyModule->pMasterInfo->pTimeInfo->sampleRate
....nearly good...
Can you confirm if the textfield problem is solved with the new version 4.20 ?
Posted: 22 Apr 2009, 13:41
by Gizzeta
martignasse wrote:Can you confirm if the textfield problem is solved with the new version 4.20 ?
It's ok for the text outlet, it appears normally.
But how can I pass my text to the outlet?
througt DATA?(but it is an array of floats, not char...)
or througt the UserData pointer to void?
Have I to set TFlowType to ftEvtText?
...?
thanks
Posted: 23 Apr 2009, 00:49
by martignasse
Gizzeta wrote:It's ok for the text outlet, it appears normally.
cool
Gizzeta wrote:But how can I pass my text to the outlet?
througt DATA?(but it is an array of floats, not char...)
or througt the UserData pointer to void?
Have I to set TFlowType to ftEvtText?
In fact, i don't know
Seems there is no exposed method to access the text variable by code... or we lack some infos.
Have to ask to senso.
Posted: 27 Apr 2009, 00:06
by martignasse
Gizzeta wrote:But how can I pass my text to the outlet?
througt DATA?(but it is an array of floats, not char...)
or througt the UserData pointer to void?
Have I to set TFlowType to ftEvtText?
Ok so,
I have the solution (directly from the boss

)
the text data is stored in the DATA array, one char per float !
so the way you have to code your text is a bit tricky....you need to cast each char as float per DATA array element.
for example (tested OK), assuming 'PTextTest' is your textfiel param:
Code: Select all
char test[] = "hello";
for (i = 0; i < 5; i++) {
pPrototype->PTextTest->DATA[i] = (float)test[i];
}
pPrototype->PTextTest->len = 5;
I'll surely make an helper function for future release...
Hope it help
edit : I've updated the wiki with this precious info
here is the link, feedback are welcome.
Posted: 30 Apr 2009, 11:43
by Gizzeta
It works fine, thanks!
Posted: 01 May 2009, 13:42
by Gizzeta
hi,
need help again...
I create a module that fill a buffer with a waveform stored in an external file and read it as a loop (oscillator).
it works nice, but when I add a second instance of the same module (even if not connected) it affect the output of the first module (it sounds like a frequency modulation). WHY???
Normally all the variables and pointers are internals to every instance of the module(private)...or not?
Thanks for your help
Posted: 05 May 2009, 18:21
by martignasse
Gizzeta wrote:hi,
need help again...
I create a module that fill a buffer with a waveform stored in an external file and read it as a loop (oscillator).
it works nice, but when I add a second instance of the same module (even if not connected) it affect the output of the first module (it sounds like a frequency modulation). WHY???
Normally all the variables and pointers are internals to every instance of the module(private)...or not?
Thanks for your help
I opened a new thread for this question, for better visibility and because it's not directly SDK feedback, but more a technical question.
here it is
Posted: 18 May 2009, 12:10
by Gizzeta
Hi,
is there a way to get the "name" you can give to the module (when you right-click on a module)?
thanks
Posted: 18 May 2009, 12:54
by martignasse
hi Gizzeta,
is there a way to get the "name" you can give to the module (when you right-click on a module)?
No, it's not exposed on SDK level.
For what use do you need this ?
Posted: 18 May 2009, 13:11
by Gizzeta
I thaught about an "argument" for a module.
The "name" would be a good way to provide it.
just to know, but it's not really important.
thanks