PURE DATA forum~

...that deal with pure data

You are not logged in.

#1 2010-01-12 22:07:50

tomprice
Member

Puzzling anomaly

So I have code here for a rather simple pd extern "myclass". It appears to me that what a myclass object should do upon receiving a bang message is post 0 (num gets set to 0 in the constructor, then it justs posts num). However it always posts 1. Does anyone see what could be going wrong here? Thank you very much in advance.

Code:

#include "m_pd.h"

static t_class *myclass;

typedef struct _myclass {
  t_object  x_obj;
  t_int num;
} t_myclass;

void myclass_bang(t_myclass *x)
{
  post("%d", x->num);
}

void *myclass_new(void)
{
  t_myclass *x = (t_myclass *)pd_new(myclass);
  x->num = 0;
  return (void *)x;
}

void myclass_setup(void) {
  myclass = class_new(gensym("myclass"),
        (t_newmethod)myclass_new,
        0, sizeof(t_myclass),
        CLASS_DEFAULT, 0);
  class_addbang(myclass, myclass_bang);
}

Offline

 

#2 2010-01-15 10:03:10

tomprice
Member

Re: Puzzling anomaly

The above problem occurred while I was using my extern on Windows 7. Today I tried it on Ubuntu and it worked fine. I guess this is some sort of bug with pd for Windows.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson


pd.webring info