Dumb-Proof Procedure To Adapt the Current SDK to Support Max5

Pierre Alexandre Tremblay's icon

Hello

If like me you have a very small memory, and you like dumb-proof procedure, here is one I've done for adding Max5 support back to the current SDK's simplemsp~ code.

Here it is in compressed HTML (because the forum refuses html itself)

notes on adapting the Max SDK.md.html.zip
application/zip 6.53 KB

I'll post the content in the next comment.

enjoy

p

Pierre Alexandre Tremblay's icon

The copy/paste loses code colouring but hey, in case you don't want to download 6.53kB...

Nov 2017 - SDK v7.3.3 + XCode 9.1

instructions to make your own project

  • copy the simpledsp~ folder, keeping it in the same folder (source/audio/)

  • change the name of the project file and its .c

  • launch the newly named XCode project

  • trash the missing .c in there

  • drag the renamed .c in there, accepting the default options

  • click on 'max-external' at the top of the window, and then manage schemes

  • delete the current theme with minus bottom left

  • click the top right button (autocreate schemes now)

  • close that window

  • open the .c file, and do a search and replace all, replacing 'simplemsp' by the new name of your external

  • compile - you should get an external bearing your new name, doing the basic simpledsp~ code (signal in is added to float in)

  • good idea to start a .git repos now.

instructions to make it work in 32bit

  • add the dsp message prototype (for the 32bit audio path support) and its dsp perform routine

  • in the method prototype section declare (replacing YOURNAME by your object name):void YOURNAME_dsp(t_YOURNAME *x, t_signal **sp);t_int *YOURNAME_perform(t_int *w);

  • then add use following code down:

  • // registers a function for the 64 bit signal chain in Maxvoid YOURNAME_dsp(t_YOURNAME *x, t_signal **sp){ dsp_add(YOURNAME_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); post("dsp32");}
    // perform 32bitt_int *YOURNAME_perform(t_int *w){ // transfer values from the object to local variables    t_YOURNAME *x = (t_YOURNAME *)(w[1]); // object pointer float *entree = (float *)(w[2]); // input pointer float *sortie = (float *)(w[3]); // output pointer int n = (int)(w[4]); while (n--) *sortie++ = *entree++ + x->offset; // you have to return the NEXT pointer in the array OR MAX WILL CRASH return w + 5;}

  • you need to change the declaration of the main function from
    void ext_main(void *r)
    to
    int C74_EXPORT main()

  • then you need to add the 'dsp' message declaration in the main function, just under the 'dsp64' one, like so:class_addmethod(c, (method)YOURNAME_dsp, "dsp",    A_CANT, 0);

Voilà! It should work in Max5 now.