[PD] comparing symbols in external

2014-05-03 Thread Jaime E Oliver
Hi all, 

I am trying to compare two symbols, one incoming in a list into an external and 
the other one stored internally in the external.

It compiles fine, but I don't get a match.

c code is below. Ideas on what I'm missing?

J


void testtext_input(t_testtext *x, t_symbol *selector, int argcount, t_atom 
*argvec) {
int i;
const t_symbol *storedsymbol = gensym(mysymbol);
for (i = 0; i  argcount; i++) {
if (argvec[i].a_type == A_SYMBOL) {
if ( argvec[i].a_w.w_symbol-s_name == storedsymbol)
post(found match!);
}
}
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] comparing symbols in external

2014-05-03 Thread Miller Puckette
Strange things like this can happen if someone inadvertently writes
a new string into an existing symbol... i.e., never do this:
strcat(sym-s_name, cat).

MAybe there was already a symbol somewhere else whose name is cat and
then you'll have 2 symbols with teh same name but different addresses.
(I've seen people do this, in various ways, before).

cheers
Miller

On Sat, May 03, 2014 at 03:22:19AM -0400, Jaime E Oliver wrote:
 Hi all, 
 
 I am trying to compare two symbols, one incoming in a list into an external 
 and the other one stored internally in the external.
 
 It compiles fine, but I don't get a match.
 
 c code is below. Ideas on what I'm missing?
 
 J
 
 
 void testtext_input(t_testtext *x, t_symbol *selector, int argcount, t_atom 
 *argvec) {
   int i;
   const t_symbol *storedsymbol = gensym(mysymbol);
 for (i = 0; i  argcount; i++) {
   if (argvec[i].a_type == A_SYMBOL) {
   if ( argvec[i].a_w.w_symbol-s_name == storedsymbol)
 post(found match!);
   }
 }
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] comparing symbols in external

2014-05-03 Thread IOhannes m zmölnig
On 05/03/2014 09:22 AM, Jaime E Oliver wrote:
 Hi all, 
 
 I am trying to compare two symbols, one incoming in a list into an external 
 and the other one stored internally in the external.
 
 It compiles fine, but I don't get a match.
 
 c code is below. Ideas on what I'm missing

the whole idea about symbols is, that you can do a pointer comparision
of the *symbol*.

so it should be as simple as:
  if(argvec[i].a_type == A_SYMBOL   argvec[i].a_w.w_symbol ==
storedsymbol) post(found match);

   if (argvec[i].a_type == A_SYMBOL) {
   if ( argvec[i].a_w.w_symbol-s_name == storedsymbol)
 post(found match!);

the -s_name field of the symbol is the pointer to the actual C-string,
whereas storedsymbol is a pointer to the symbol.
so you are doing a compare ((const char*)cstr == (t_symbol*)sym), which
is clearly wrong.

fgmsadr
IOhannes




signature.asc
Description: OpenPGP digital signature
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] comparing symbols in external

2014-05-03 Thread Jaime E Oliver
Thanks to both, it makes sense and it works now.

J


On May 3, 2014, at 4:42 AM, IOhannes m zmölnig zmoel...@iem.at wrote:

 On 05/03/2014 09:22 AM, Jaime E Oliver wrote:
 Hi all, 
 
 I am trying to compare two symbols, one incoming in a list into an external 
 and the other one stored internally in the external.
 
 It compiles fine, but I don't get a match.
 
 c code is below. Ideas on what I'm missing
 
 the whole idea about symbols is, that you can do a pointer comparision
 of the *symbol*.
 
 so it should be as simple as:
  if(argvec[i].a_type == A_SYMBOL   argvec[i].a_w.w_symbol ==
 storedsymbol) post(found match);
 
  if (argvec[i].a_type == A_SYMBOL) {
  if ( argvec[i].a_w.w_symbol-s_name == storedsymbol)
 post(found match!);
 
 the -s_name field of the symbol is the pointer to the actual C-string,
 whereas storedsymbol is a pointer to the symbol.
 so you are doing a compare ((const char*)cstr == (t_symbol*)sym), which
 is clearly wrong.
 
 fgmsadr
 IOhannes
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] best format for send/receive between iOS and libPD

2014-05-03 Thread Billy Stiltner
:)


On Wed, Apr 30, 2014 at 5:57 AM, Miller Puckette m...@ucsd.edu wrote:

 Hi Matt -

 From Pd's perspective at least, it would be more efficient to handle the
 messages separately (some of Pd's list operations have to copy the list,
 which would be expensive if done iteratively over a long list).

 cheers
 Miller

 On Wed, Apr 30, 2014 at 01:37:05PM +0900, i go bananas wrote:
  I've got a six voice synth, each with about 20 variable parameters, and
  then sequence data, etc... and all of this data is being stored by the
  objective C front-end of my app.
 
  can someone tell me, hopefully from experience, what the best format is
 to
  send a lot of pattern data between obj C and libPD ???  should i package
  all the data as one huge list, or break it all into individual variables,
  or is it ok to organize it into groups for ease of management.
 
  my plan was to send messages like this from obj C:
 
  to [r instr1_pattern_data] :  [vol 0.8, pan 0.5, pitch 0.75, param1 0.99
  ... etc]
 
  actually, i'm not the one doing the C coding, i'm, just doing the pd
 side,
  but i have to prepare things on my end to make it flow as well as
 possible.
  Overall, i think there about 1400 values that need to be passed for every
  pattern, so it probably does need to be as well streamlined as possible.
 
  cheers for any help
 
  Matt

  ___
  Pd-list@iem.at mailing list
  UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list


 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] MobMuPlat - data from several iPads to one PC

2014-05-03 Thread Christian Fischer
Thanks Dan!

It worked so far with the help patch! Now I have just to see how it’s going 
with several iPads…
Thanks again!

chris

Am 03.05.2014 um 01:30 schrieb Daniel Iglesia daniel.igle...@gmail.com:

 (And for multiple devices into a pd patch, I usually have the user of each 
 device manually input a number identifying their identity, and then 
 filter/route based on this in the PC patch) 
 (If you choose to use LANdini, you'll want to get the standalone client (OSX 
 only, or supercollider code) for the hub computer)
 
 Sent from my iPhone
 
 On May 2, 2014, at 4:49 PM, Christian Fischer m...@c-m-fischer.de wrote:
 
 Hi there,
 
 not sure whether I can make out the forest for the trees after x hours of 
 fiddling…
 
 
 What would be the best way to send data (one way) from several iPads to one 
 master patch on PC, connected adhoc wireless?
 
 So far I tried only with one iPad, used MobMuPlat and simple ‚netsend' / 
 ‚netreceive'. For one iPad it worked pretty fine! Now I wonder what about 
 several iPads. Can’t test before Monday, but I would like to prepare 
 everything before…
 
 The idea is several people use the iPads as interfaces to manipulate a 
 master patch on a PC connected to interface, several speakers etc…
 They do not have to get any feedback from master patch. Data flows only one 
 way. 
 
 MobMuPlat does not take ‚packOSC‘. Would ‚LANdini‘ be better for several 
 iPads (could not get it running so far. still trying…) Or is there something 
 else? 
 Any experiences?
 
 Thanx  Best!
 chris
 
 
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list