[L2Ork-dev] API for HTML5 Web Apps gsoc2018
Jonathan Wilkes
jon.w.wilkes at gmail.com
Tue Mar 13 00:15:48 EDT 2018
Hi Rohan Goel,
You can send messages to Pd in a few different ways.
For the current GUI in Purr Data the code is in purr-data/pd/nw/pdgui.js in
the very simple function `pdsend`. It just concatenates tokens with a
space (32) as a delimiter and terminates each message with a semicolon. Then it
sends the messages over a socket connection to the Pd engine which parses and
then evaluates them.
Pd has some global methods-- for instance, you can turn on DSP computation
for the entire running instance by sending `pd dsp;`. Most of these are found
in purr-data/pd/src/m_glob.c
Each Pd canvas also has a receiver which is its memory address formatted as a
string starting with "x". You can see this symbol when you have a Pd canvas open
in the GUI and go to "File->Message" in that canvas' menu. Messages sent to Pd
starting with that symbol will be forwarded to the canvas. If the next
tokens are
a valid method for the canvas class with the correct arg signature
(like "obj 20 20 print"
to create a new object), that canvas method will be invoked.
There are also user-facing objects [netsend] and [netreceive] that can
be used within
a running Pd program to send and receive messages over a tcp/udp connection.
To get messages from Pd to the GUI there is a fairly straightforward C API
described here:
https://git.purrdata.net/jwilkes/purr-data#gui-messaging-specification
Finally, there are some convenience functions at the top of
purr-data/pd/src/x_gui.c
that are supposed to abstract away the obvious problems that come from
trying to sync the Pd engine with the GUI over a socket. (They are currently
used to handle property/text editor windows for certain objects.)
-Jonathan
On Mon, Mar 12, 2018 at 9:50 PM, Rohan Goel <goelrohan6 at gmail.com> wrote:
> Hey,
> I am an undergraduate from India and a js freak and interested in working on
> API for HTML5 Web Apps.
>
> Can someone give me some context regarding this
> Where can I find already existing ability to send messages to Pd and
> interact with it
>
>
>
> --
> rohan
>
> _______________________________________________
> L2Ork-dev mailing list
> L2Ork-dev at disis.music.vt.edu
> https://disis.music.vt.edu/listinfo/l2ork-dev
More information about the L2Ork-dev
mailing list