[PD] A way to query the current platform

Jonathan Wilkes jancsika at yahoo.com
Wed Sep 24 07:56:05 CEST 2014


On 09/24/2014 12:15 AM, Chris McCormick wrote:
> Hi Miller,
>
> Now that Pd is running on diverse platforms and variants, it would be
> very useful to have a generic interface that a patch can use to query
> the current platform. Something like sending a "getinfo" message to the
> pd object which would send back e.g.:

I've got [pdinfo] in Pd-l2ork which has a [version( method. Wouldn't be 
hard to add a symbol for the Pd distro, too.

As for OS-- what's the best way to do this?  (Both in terms of the 
possible strings to output and a way to distinguish them in the C code.)

>
> list osx vanilla pure-data
>
> list linux pd-l2ork pure-data
>
> list ios zengarden
>
> list android droidparty libpd pure-data
>
> The use-case for this is things like:
>
>   * On Android, audio latency is high and needs to be factored in by patches.
>
>   * A patch that wants to load a text file might need to use a different
> path delimiter on linux versus windows.

Do you have an example where this would be necessary?  I thought Pd was 
implemented in such a way that everyone just writes unix-style paths in 
their patches and Pd converts to the local path delimiters underneath.  
(At least that's the way the tutorials look, and they load 
soundfiles/textfiles correctly on all platforms.)

>
> What are your thoughts on this?
>
> I am assuming the Pd-l2ork fellows will pipe up with some already
> implemented solution. :)

[print(
|
[pdinfo]

prints this to the console:

audio-api: ALSA
audio-apilist: OSS ALSA
audio-apilist-raw: none ALSA OSS MMIO PortAudio JACK SGI
audio-inchannels: 2
audio-indev: 0 2
audio-indevlist: HDA Intel (hardware) HDA Intel (plug-in)
audio-multidev-support: 2
audio-outchannels: 2
audio-outdev: 0 2
audio-outdevlist: HDA Intel (hardware) HDA Intel (plug-in)
blocksize: 64
classtable: 254 classes loaded ("classtable" outputs the full list)
dir: /usr/local/bin/
dsp-status: 0
midi-api: ALSA
midi-apilist: OSS ALSA
midi-indev:
midi-indevlist:
midi-outdev:
midi-outdevlist:
pi: 3.14159
samplerate: 44100
version: 0 42 7

Each attribute is a method you can use to send the values to the outlet, 
like
[dir(--[pdinfo]--[set $1(--[/usr/local/bin/(

"pi" and "audio-apilist-raw" will probably be removed

There's also:

[print(
|
[canvasinfo]

which prints:

args:
boxtext:
coords: 0 0 0 0 0 0 0 0 0
dir: /home/pd/pd/src
dirty: 1
dollarzero: 1002
editmode: 0
filename: Untitled-1
hitbox: 0
name: .x98092c8
pointer: (pointer)
posonparent: 0 0
screenpos: 526 181 976 481
toplevel: 1
vis: 1

There's also
[classinfo]

and

[objectinfo]

which give info about class args, size, methods, object xlets, bbox, 
text, etc. and are still under development.

-Jonathan

>
> Cheers,
>
> Chris.
>




More information about the Pd-list mailing list