Welcome to %s forums

BrainModular Users Forum

Login Register

where are the 'user modules' ?

Create your own modules in C++
Post Reply
ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 21 Sep 2014, 13:46

"[13:33:38] Load User Module : IndexOfChangingArray.usr-osx32"

..but it is nowhere to be found in the browser. I finally get it written, built, compiled, and actually loading in Usine.. and then can't figure out how to test it :(

Anyway, I will write down my learnings of this first time with the SDK (and C++, for that matter) and share them soon.

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 21 Sep 2014, 14:04

But now I realized it was being copied into the 'Devices' folder! Whew. So more 'Build' twiddling which sucks, but I've never used Xcode before so that is somewhat to be expected.

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 21 Sep 2014, 14:57

Is it possible to use things like std::vector and other STL things with the SDK? I'm getting memory access violations and I'm not sure where to begin.

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 22 Sep 2014, 01:48

hi ceasless,

congrats for your first module :)
But now I realized it was being copied into the 'Devices' folder!
did you start from an existing project and modified it, like one of the device modules ?
Is it possible to use things like std::vector and other STL things with the SDK?
yes, of course. you just have to include the appropriate header of the STL
for example, all the matrix module heavily use the vector class
I'm getting memory access violations and I'm not sure where to begin
when your project is correctly configured, you can start usine from xcode and debug the module to track things like that.

so your on mac, what version of xcode are you using ?
i'll try to help you to configure the project, some options should be pretty obscure
Anyway, I will write down my learnings of this first time with the SDK (and C++, for that matter) and share them soon.
thanks for that, feedback are very important for us, especially from a new user of the sdk
it could help us to make it better ;)
Martin FLEURENT - Usine Developer - SDK maintainer

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 22 Sep 2014, 09:28

Ah, I was thinking that the way I was debugging was way too painful! Glad to know that there is a better way to do it..

Here is a gist of my code so far. Judging from the 'DelayArray' module code, it should be working just fine. However it dies whenever I try to access an event pointer (for example sdkGetEvtSize( arrInArray )). https://gist.github.com/ab5tract/572094637be4a106a290

I'm on Xcode 5.0.1. I already had some fighting with the build stuff at the beginning (but I am brand new to Xcode). Thanks for your help!

I started from the template module, but for the build target I started from DeviceAudio. I think I've got that part all sorted out though -- it gives the right name, generates the right object, and puts it in the right folder now. (Did I mention that I am new to Xcode? I'm a dynamic languages person, so my IDE is always Vim and a REPL :)

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 22 Sep 2014, 14:08

ceasless wrote:Ah, I was thinking that the way I was debugging was way too painful! Glad to know that there is a better way to do it..
to dynamic debug your module, you have to edit the project scheme, in the "Run" section, choose the debug build + set the executable to the Usine.app.
this way, when you hit "run" (up left corner) xcode start usine and load the debug version of your module, leting you debugging it :)

Here is a gist of my code so far. Judging from the 'DelayArray' module code, it should be working just fine. However it dies whenever I try to access an event pointer (for example sdkGetEvtSize( arrInArray )). https://gist.github.com/ab5tract/572094637be4a106a290
mmmm, seems like your pEvents are never initialised,
i think it's because your "onGetNumberOfParams" (line 59) is returning 0. it should return 3

but as you dont use the query system nor the initmodule fonction, i suggest to just delete them (line 57 to line 62) and there definition in the include file too

let me know if it do the trick
I'm on Xcode 5.0.1. I already had some fighting with the build stuff at the beginning (but I am brand new to Xcode). Thanks for your help!

I started from the template module, but for the build target I started from DeviceAudio. I think I've got that part all sorted out though -- it gives the right name, generates the right object, and puts it in the right folder now.
ok, the deviceaudio build target was why your module ended up in the devices folder ;)
so you have found the copy file build phase where xcode copy the final dylib in your installed usine distrib
Martin FLEURENT - Usine Developer - SDK maintainer

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 22 Sep 2014, 19:12

Unfortunately removing those lines does not address the error. I am still unable to get the length of the array input :(

It also didn't work if I explicitly set "return 3;" for 'onGetNumberOfParams' (instead of deleting) ...

I've updated the gist with the newest version: https://gist.github.com/ab5tract/572094637be4a106a290

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 22 Sep 2014, 20:25

mmm, i cant see other obvious problems

if you can put the include file on gist too, i'll can try to compile and hopefully find something

so you'r on mac, with the last SDK distrib exact ?
Martin FLEURENT - Usine Developer - SDK maintainer

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 22 Sep 2014, 20:39

From UsineDefinitions.h:

static int const SDK_VERSION = 602011;

Usine HH 1.1.009g

OS X 10.9.3 w/ Xcode 5.0.1


The include file should also be in the gist already :)

Thanks for taking a look!

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 22 Sep 2014, 22:24

I also noticed that the output parameters are not set to 0 when I inspect the module before wiring anything into it. It should come with the minimum value set, no?

I will also try upgrading my OS and Xcode, if you think that will help?

Ah, and I got the debugger running! This is great, it will really help in the future.

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 23 Sep 2014, 00:48

I also noticed that the output parameters are not set to 0 when I inspect the module before wiring anything into it. It should come with the minimum value set, no?
well, i dont know why, but it seems evident that your params event aren't initialised.
I will also try upgrading my OS and Xcode, if you think that will help?
shouldn't be necessary, for compatibility reason, the sdk is developped essentially on 10.6 with xcode 3.2.6
Ah, and I got the debugger running! This is great, it will really help in the future.
great, can you put a breakpoint at line 106, normally the debugger should stop three time (one for each params, so ParamIndex = 0, = 1, = 2) when you drop the module in a patch
if not, it's clear that arrInArray isn't initialised correctly


i made a quick test and replaced a simple module of the sdk (DelayArray for instance) with your code and it compile and run ok
so your code isn't the problem, i think some options at project level are... but to found them can be a nightmare

can you make the same test ?
Martin FLEURENT - Usine Developer - SDK maintainer

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 23 Sep 2014, 23:42

I already wrote in my note: DO NOT USE A DEVICE AS A TEMPLATE FOR A NON-DEVICE BUILD TARGET.

But now I see that it was even more true than I expected.

Image

With these build settings, the param pointers are initialized ( ... counts to 3 ... :D )

But still the build was weird and unhappy, the parameters never becoming interesting... lifeless.

The next switch I flipped was disabling 'DeviceAudio' in the 'Target Memnbership'. (so many places to change settings...).

I also tried copying into RollArray.. but it has the same issue.

1) When created, the module already has 'array in' of length 1 and the mininum values for the outputs are not set.
2) The outputs never update. I can see in the debugger that memoryBuffer and changedArray are more or less doing the right thing.

I've made a new gist: https://gist.github.com/ab5tract/94f7b4b88a186cec5651. One cool new thing is a debug function for TPrecision values :

Code: Select all

void IndexOfChangedArray::do_debug( std::string text, TPrecision value) {
    std::ostringstream debugs;
    debugs << text << value;
    std&#58;&#58;string what = debugs.str&#40;&#41;;
    char *help = new char&#91;what.length&#40;&#41; + 1&#93;;
    strcpy&#40;help, what.c_str&#40;&#41;&#41;;
    sdkTraceLogChar&#40; help &#41;;
    delete &#91;&#93; help;
&#125;

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 25 Sep 2014, 23:51

Does it work for you?

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 26 Sep 2014, 08:57

sorry for not responding... too busy on usine dev

i'll try to compil today and let you know
Martin FLEURENT - Usine Developer - SDK maintainer

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 06 Oct 2014, 21:37

Hey martignasse,

I don't want to distract you from Usine dev (esp. after senso's teasing of HH v2! some details on that would be awesome, but I know you folks like to surprise us).

But it is also pretty discouraging to write a module that should work but is broken somehow, in a way that makes sense to no one. So please let me know if you do find something.

Post Reply

Who is online

Users browsing this forum: No registered users and 112 guests