Friday, 6 July 2012

android/eclipse talks to pure data like this

This aint gona be any kind of tutorial but more of a quick breeze over what you need to know when making android apps with pure data patches embedded, using PdTest as an example.
assuming you have Eclipse set up with a project using the android version of libpd (pure data library) this includes PdTest.

in Eclipse, go to the project browser (left pannel) and open up PdTest > res > raw and you will see the pd patch.
double click the patch and it opens in pure data.

the basics is that the android/java code relating to button clicks and that in eclipse layout editor send a message to the pd patch. inside the patch these messages are received and trigger off whatever.

in the android code you give the message a name, and/or a value. in this case when you press button 1
case R.id.button1:
            PdBase.sendFloat("pitch", 65); //sends the number 65 to the receiver caleed pitch
            PdBase.sendBang("start");  //sends a bang to the receiver called start

in the pure data patch make a new object and trype 'r pitch', this creates the receiver for pitch.
make another and type r start. the 'r' makes it a receiver and 'start' is its name.
then connect them up to wherever you want.


 




No comments:

Post a Comment