Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jwilkes/purr-data
  • aggraef/purr-data
  • samthursfield/purr-data
  • prakhar/purr-data
  • yadu05/purr-data
  • NegiAkash890/purr-data
  • prateekpardeshi/purr-data
  • Shruti3004/purr-data
  • hidimpu/purr-data
  • Atseosi/purr-data
  • piyushjasaiwal/purr-data
  • deveshprasad/purr-data
  • skm_7/purr-data
  • sankt/purr-data
  • ashim_tom/purr-data
  • dineshsoni02/purr-data
  • chaitanya1-coder/purr-data
  • Nitish0007/purr-data
  • nitin/purr-data
  • shuvam09/purr-data
  • gabrielabittencourt/purr-data
  • sivasai/purr-data
  • flachyjoe/purr-data
  • ishankaler/purr-data
  • prateek/purr-data
  • RukshanJS/purr-data
  • rajatshrm648/purr-data
  • Srashti/purr-data
  • Paarth/purr-data
  • AniruddhaGawali/purr-data
  • brittneyjuliet/purr-data
  • prakharagarwal1/purr-data
  • Shreyanshpaliwalcmsmn/purr-data
  • k_amrut/purr-data
  • AyushAnand/purr-data
  • Va16hav07/purr-data
36 results
Show changes
Showing
with 1472 additions and 86 deletions
......@@ -133,7 +133,7 @@ void *OpenHTMSocket(char *host, int portnumber)
* server that we want to send to.
*/
bzero((char *) &o->userv_addr, sizeof(o->userv_addr));
memset((char *) &o->userv_addr, 0, sizeof(o->userv_addr));
o->userv_addr.sun_family = AF_UNIX;
strcpy(o->userv_addr.sun_path, UNIXDG_PATH);
sprintf(o->userv_addr.sun_path+strlen(o->userv_addr.sun_path), "%d", portnumber);
......@@ -152,7 +152,7 @@ void *OpenHTMSocket(char *host, int portnumber)
* pathname, based on our process id.
*/
bzero((char *) &ucl_addr, sizeof(ucl_addr)); /* zero out */
memset((char *) &ucl_addr, 0, sizeof(ucl_addr)); /* zero out */
ucl_addr.sun_family = AF_UNIX;
strcpy(ucl_addr.sun_path, UNIXDG_TMP);
......@@ -183,7 +183,7 @@ void *OpenHTMSocket(char *host, int portnumber)
#ifdef WIN32
ZeroMemory((char *)&o->serv_addr, sizeof(o->serv_addr));
#else
bzero((char *)&o->serv_addr, sizeof(o->serv_addr));
memset((char *)&o->serv_addr, 0, sizeof(o->serv_addr));
#endif
o->serv_addr.sin_family = AF_INET;
......@@ -243,7 +243,7 @@ void *OpenHTMSocket(char *host, int portnumber)
o->serv_addr.sin_port = htons(portnumber);
o->addr = &(o->serv_addr);
if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
bzero((char *)&cl_addr, sizeof(cl_addr));
memset((char *)&cl_addr, 0, sizeof(cl_addr));
cl_addr.sin_family = AF_INET;
cl_addr.sin_addr.s_addr = htonl(INADDR_ANY);
cl_addr.sin_port = htons(0);
......
......@@ -302,7 +302,7 @@ OSCTimeTag ParseTimeTag(char *s) {
if (isdigit(*p) || (*p >= 'a' && *p <='f') || (*p >= 'A' && *p <='F')) {
/* They specified the 8-byte tag in hex */
OSCTimeTag tt;
if (sscanf(p, "%llx", &tt) != 1) {
if (sscanf(p, "%zx", &tt) != 1) {
complain("warning: couldn't parse time tag %s\n", s);
return OSCTT_Immediately();
}
......
......@@ -313,7 +313,7 @@ static void *dumpOSC_new(t_symbol *compatflag,
int t = 1;
mreq.imr_multiaddr.s_addr = inet_addr(castgroup->s_name);
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&t,sizeof(t)) < 0) {
if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,(char*)&t,sizeof(t)) < 0) {
sys_sockerror("setsockopt");
}
if (setsockopt(sockfd,IPPROTO_IP,IP_ADD_MEMBERSHIP,(char*)&mreq,sizeof(mreq)) < 0) {
......@@ -400,7 +400,7 @@ void dumpOSC_setup(void)
if((sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
return sockfd;
bzero((char *)&serv_addr, sizeof(serv_addr));
memset((char *)&serv_addr, 0, sizeof(serv_addr));
serv_addr.sun_family = AF_UNIX;
strcpy(serv_addr.sun_path, UNIXDG_PATH);
sprintf(serv_addr.sun_path+strlen(serv_addr.sun_path), "%d", chan);
......@@ -448,7 +448,7 @@ static int initudp(int chan)
if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
return sockfd;
bzero((char *)&serv_addr, sizeof(serv_addr));
memset((char *)&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(chan);
......
......@@ -154,7 +154,7 @@ void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL)
* server that we want to send to.
*/
bzero((char *) &o->userv_addr, sizeof(o->userv_addr));
memset((char *) &o->userv_addr, 0, sizeof(o->userv_addr));
o->userv_addr.sun_family = AF_UNIX;
strcpy(o->userv_addr.sun_path, UNIXDG_PATH);
sprintf(o->userv_addr.sun_path+strlen(o->userv_addr.sun_path), "%d", portnumber);
......@@ -173,7 +173,7 @@ void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL)
* pathname, based on our process id.
*/
bzero((char *) &ucl_addr, sizeof(ucl_addr)); /* zero out */
memset((char *) &ucl_addr, 0, sizeof(ucl_addr)); /* zero out */
ucl_addr.sun_family = AF_UNIX;
strcpy(ucl_addr.sun_path, UNIXDG_TMP);
......@@ -204,7 +204,7 @@ void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL)
#ifdef WIN32
ZeroMemory((char *)&o->serv_addr, sizeof(o->serv_addr));
#else
bzero((char *)&o->serv_addr, sizeof(o->serv_addr));
memset((char *)&o->serv_addr, 0, sizeof(o->serv_addr));
#endif
o->serv_addr.sin_family = AF_INET;
......@@ -290,7 +290,7 @@ void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL)
o->serv_addr.sin_port = htons(portnumber);
o->addr = &(o->serv_addr);
if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
bzero((char *)&cl_addr, sizeof(cl_addr));
memset((char *)&cl_addr, 0, sizeof(cl_addr));
cl_addr.sin_family = AF_INET;
cl_addr.sin_addr.s_addr = htonl(INADDR_ANY);
cl_addr.sin_port = htons(0);
......
......@@ -10,7 +10,11 @@ SOURCES =
# For objects that only build on certain platforms, add those to the SOURCES
# line for the right platforms.
SOURCES_macosx = ambient_light_sensor.c iodisplay.c keyboard_light.c sudden_motion_sensor.c smc.c keyboard_layout.c
#
# For some reason keyboard_layout.c doesn't work anymore. Even searching for
# some of the system function calls used returns zero results. So we disable
# building it below.
SOURCES_macosx = ambient_light_sensor.c iodisplay.c keyboard_light.c sudden_motion_sensor.c smc.c #keyboard_layout.c
SOURCES_iphoneos = multitouch.c
# list all pd objects (i.e. myobject.pd) files here, and their helpfiles will
......@@ -88,7 +92,7 @@ ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CPU := $(shell uname -p)
ifeq ($(CPU),arm) # iPhone/iPod Touch
ifeq ($(CPU),arm-iphone) # iPhone/iPod Touch
SOURCES += $(SOURCES_iphoneos)
EXTENSION = pd_darwin
SHARED_EXTENSION = dylib
......@@ -121,10 +125,10 @@ ifeq ($(UNAME),Darwin)
FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=$(macos_target)
SOURCES += $(SOURCES_iphoneos)
endif
ALL_CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include
ALL_CFLAGS += $(FAT_FLAGS) -fPIC
# if the 'pd' binary exists, check the linking against it to aid with stripping
BUNDLE_LOADER = $(shell test ! -e $(PD_PATH)/bin/pd || echo -bundle_loader $(PD_PATH)/bin/pd)
ALL_LDFLAGS += $(FAT_FLAGS) -bundle $(BUNDLE_LOADER) -undefined dynamic_lookup -L/sw/lib
ALL_LDFLAGS += $(FAT_FLAGS) -bundle $(BUNDLE_LOADER) -undefined dynamic_lookup
SHARED_LDFLAGS += $(FAT_FLAGS) -dynamiclib -undefined dynamic_lookup \
-install_name @loader_path/$(SHARED_LIB) -compatibility_version 1 -current_version 1.0
ALL_LIBS += -lc $(LIBS_macosx)
......
......@@ -72,7 +72,7 @@ ORIGDIR=pd-$(LIBRARY_NAME)_$(LIBRARY_VERSION)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CPU := $(shell uname -p)
ifeq ($(CPU),arm) # iPhone/iPod Touch
ifeq ($(CPU),arm-iphone) # iPhone/iPod Touch
SOURCES += $(SOURCES_iphoneos)
EXTENSION = pd_darwin
OS = iphoneos
......@@ -101,9 +101,9 @@ ifeq ($(UNAME),Darwin)
FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=$(macos_target)
SOURCES += $(SOURCES_iphoneos)
endif
CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \
CFLAGS += $(FAT_FLAGS) -fPIC \
-I/Applications/Pd-extended.app/Contents/Resources/include
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup
# if the 'pd' binary exists, check the linking against it to aid with stripping
LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
LIBS += -lc
......
......@@ -70,7 +70,7 @@ ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CPU := $(shell uname -p)
ifeq ($(CPU),arm) # iPhone/iPod Touch
ifeq ($(CPU),arm-iphone) # iPhone/iPod Touch
SOURCES += $(SOURCES_iphoneos)
EXTENSION = pd_darwin
OS = iphoneos
......@@ -100,9 +100,9 @@ ifeq ($(UNAME),Darwin)
FAT_FLAGS = -arch i386 -arch x86_64 -mmacosx-version-min=$(macos_target)
SOURCES += $(SOURCES_iphoneos)
endif
CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \
CFLAGS += $(FAT_FLAGS) -fPIC \
-I/Applications/Pd-extended.app/Contents/Resources/include
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/opt/local/lib
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup
# if the 'pd' binary exists, check the linking against it to aid with stripping
LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
LIBS += -lc
......
An auto-tuning PD External, based on
autotalent an auto-tuning LADSPA plugin and an older port by Maxus Germanus
Free software by Thomas A. Baran.
http://web.mit.edu/tbaran/www/autotune.html
VERSION 0.2
Autotalent v0.2
Free software (GPLv2) by Thomas A. Baran.
http://tombaran.info/autotalent.html
Ivica Ico Bukvic <ico.bukvic.net>
VERSION 0.9.1
......
......@@ -71,7 +71,7 @@ ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CPU := $(shell uname -p)
ifeq ($(CPU),arm) # iPhone/iPod Touch
ifeq ($(CPU),arm-iphone) # iPhone/iPod Touch
SOURCES += $(SOURCES_iphoneos)
EXTENSION = pd_darwin
OS = iphoneos
......@@ -101,8 +101,8 @@ ifeq ($(UNAME),Darwin)
FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=$(macos_target)
SOURCES += $(SOURCES_iphoneos)
endif
CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib
CFLAGS += $(FAT_FLAGS) -fPIC
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup
# if the 'pd' binary exists, check the linking against it to aid with stripping
LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
LIBS += -lc
......
......@@ -311,7 +311,7 @@ static void bassemu_list(t_bassemu *x, t_symbol *s, int argc, t_atom *argv)
}
if (argc >= 1)
{
if(argv[0].a_type = A_FLOAT && (atom_getfloatarg(0,argc,argv) != -1))
if(argv[0].a_type == A_FLOAT && (atom_getfloatarg(0,argc,argv) != -1))
{ // note
x->thisnote = atom_getfloatarg(0,argc,argv)-57;
x->vco_inc = ((x->tune/x->sr)*pow(2, (x->thisnote)*(1.0/12.0)) / 2.);
......
......@@ -133,32 +133,32 @@ static void set_tk_widget_ids(t_entry *x, t_canvas *canvas)
x->x_canvas = canvas;
/* Tk ID for the current canvas that this object is drawn in */
sprintf(buf,".x%lx.c", (long unsigned int) canvas);
sprintf(buf,".x%zx.c", (t_uint) canvas);
x->canvas_id = getbytes(strlen(buf) + 1);
strcpy(x->canvas_id, buf);
/* Tk ID for the "frame" the other things are drawn in */
sprintf(buf,"%s.frame%lx", x->canvas_id, (long unsigned int)x);
sprintf(buf,"%s.frame%zx", x->canvas_id, (t_uint)x);
x->frame_id = getbytes(strlen(buf) + 1);
strcpy(x->frame_id, buf);
sprintf(buf,"%s.text%lx", x->frame_id, (long unsigned int)x);
sprintf(buf,"%s.text%zx", x->frame_id, (t_uint)x);
x->text_id = getbytes(strlen(buf) + 1);
strcpy(x->text_id, buf); /* Tk ID for the "text", the meat! */
sprintf(buf,"%s.window%lx", x->canvas_id, (long unsigned int)x);
sprintf(buf,"%s.window%zx", x->canvas_id, (t_uint)x);
x->window_tag = getbytes(strlen(buf) + 1);
strcpy(x->window_tag, buf); /* Tk ID for the resizing "window" */
sprintf(buf,"%s.handle%lx", x->canvas_id, (long unsigned int)x);
sprintf(buf,"%s.handle%zx", x->canvas_id, (t_uint)x);
x->handle_id = getbytes(strlen(buf) + 1);
strcpy(x->handle_id, buf); /* Tk ID for the resizing "handle" */
sprintf(buf,"%s.scrollbar%lx", x->frame_id, (long unsigned int)x);
sprintf(buf,"%s.scrollbar%zx", x->frame_id, (t_uint)x);
x->scrollbar_id = getbytes(strlen(buf) + 1);
strcpy(x->scrollbar_id, buf); /* Tk ID for the optional "scrollbar" */
sprintf(buf,"all%lx", (long unsigned int)x);
sprintf(buf,"all%zx", (t_uint)x);
x->all_tag = getbytes(strlen(buf) + 1);
strcpy(x->all_tag, buf); /* Tk ID for the optional "scrollbar" */
}
......@@ -273,7 +273,7 @@ static void create_widget(t_entry *x)
DEBUG(post("create_widget"););
/* I guess this is for fine-tuning of the rect size based on width and height? */
sys_vgui("namespace eval entry%lx {} \n", x);
sys_vgui("namespace eval entry%zx {} \n", x);
/* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/
sys_vgui("destroy %s\n", x->frame_id);
......@@ -298,7 +298,7 @@ static void create_widget(t_entry *x)
static void entry_drawme(t_entry *x, t_glist *glist, int firsttime)
{
DEBUG(post("entry_drawme: firsttime %d canvas %lx glist %lx", firsttime, x->x_canvas, glist););
DEBUG(post("entry_drawme: firsttime %d canvas %zx glist %zx", firsttime, x->x_canvas, glist););
set_tk_widget_ids(x,glist_getcanvas(glist));
if (firsttime)
{
......@@ -321,7 +321,7 @@ static void entry_drawme(t_entry *x, t_glist *glist, int firsttime)
static void entry_erase(t_entry* x,t_glist* glist)
{
DEBUG(post("entry_erase: canvas %lx glist %lx", x->x_canvas, glist););
DEBUG(post("entry_erase: canvas %zx glist %zx", x->x_canvas, glist););
set_tk_widget_ids(x,glist_getcanvas(glist));
erase_inlets(x);
......@@ -348,7 +348,7 @@ static void entry_getrect(t_gobj *z, t_glist *owner,
static void entry_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
t_entry *x = (t_entry *)z;
DEBUG(post("entry_displace: canvas %lx glist %lx", x->x_canvas, glist););
DEBUG(post("entry_displace: canvas %zx glist %zx", x->x_canvas, glist););
x->x_obj.te_xpix += dx;
x->x_obj.te_ypix += dy;
if (glist_isvisible(glist))
......@@ -369,7 +369,7 @@ static void entry_displace(t_gobj *z, t_glist *glist, int dx, int dy)
static void entry_select(t_gobj *z, t_glist *glist, int state)
{
t_entry *x = (t_entry *)z;
DEBUG(post("entry_select: canvas %lx glist %lx state %d", x->x_canvas, glist, state););
DEBUG(post("entry_select: canvas %zx glist %zx state %d", x->x_canvas, glist, state););
if( (state) && (!x->x_selected))
{
......@@ -422,7 +422,7 @@ static void entry_activate(t_gobj *z, t_glist *glist, int state)
static void entry_delete(t_gobj *z, t_glist *glist)
{
DEBUG(post("entry_delete: glist %lx", glist););
DEBUG(post("entry_delete: glist %zx", glist););
t_text *x = (t_text *)z;
canvas_deletelinesfor(glist, x);
}
......@@ -431,7 +431,7 @@ static void entry_delete(t_gobj *z, t_glist *glist)
static void entry_vis(t_gobj *z, t_glist *glist, int vis)
{
t_entry *x = (t_entry*)z;
DEBUG(post("entry_vis: vis %d canvas %lx glist %lx", vis, x->x_canvas, glist););
DEBUG(post("entry_vis: vis %d canvas %zx glist %zx", vis, x->x_canvas, glist););
if (vis) {
entry_drawme(x, glist, 1);
}
......@@ -760,7 +760,7 @@ static void *entry_new(t_symbol *s, int argc, t_atom *argv)
x->x_data_outlet = outlet_new(&x->x_obj, &s_float);
x->x_status_outlet = outlet_new(&x->x_obj, &s_symbol);
sprintf(buf,"entry%lx",(long unsigned int)x);
sprintf(buf,"entry%zx",(t_uint)x);
x->tcl_namespace = getbytes(strlen(buf) + 1);
strcpy(x->tcl_namespace, buf);
......
......@@ -76,13 +76,13 @@ static void draw_inlets(t_popup *x, t_glist *glist, int firsttime, int nin, int
{
int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH) * i / nplus;
if (firsttime)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxo%d %lxo}\n",
sys_vgui(".x%zx.c create rectangle %d %d %d %d -tags {%zxo%d %zxo}\n",
glist_getcanvas(glist),
onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1,
x, i, x);
else
sys_vgui(".x%lx.c coords %lxo%d %d %d %d %d\n",
sys_vgui(".x%zx.c coords %zxo%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1);
......@@ -94,13 +94,13 @@ static void draw_inlets(t_popup *x, t_glist *glist, int firsttime, int nin, int
{
int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH) * i / nplus;
if (firsttime)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxi%d %lxi}\n",
sys_vgui(".x%zx.c create rectangle %d %d %d %d -tags {%zxi%d %zxi}\n",
glist_getcanvas(glist),
onset, text_ypix(&x->x_obj, glist)-2,
onset + IOWIDTH, text_ypix(&x->x_obj, glist)-1,
x, i, x);
else
sys_vgui(".x%lx.c coords %lxi%d %d %d %d %d\n",
sys_vgui(".x%zx.c coords %zxi%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
onset, text_ypix(&x->x_obj, glist),
onset + IOWIDTH, text_ypix(&x->x_obj, glist)-1);
......@@ -116,14 +116,14 @@ static void draw_handle(t_popup *x, t_glist *glist, int firsttime) {
int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH);
if (firsttime) {
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxhandle\n",
sys_vgui(".x%zx.c create rectangle %d %d %d %d -tags %zxhandle\n",
glist_getcanvas(glist),
onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12,
onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4,
x);
}
else {
sys_vgui(".x%lx.c coords %lxhandle %d %d %d %d\n",
sys_vgui(".x%zx.c coords %zxhandle %d %d %d %d\n",
glist_getcanvas(glist), x,
onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12,
onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4);
......@@ -155,19 +155,19 @@ static void create_widget(t_popup *x, t_glist *glist)
/* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/
if(x->initialized)
{
sys_vgui("destroy .x%lx.c.s%lx\n",glist_getcanvas(glist),x);
sys_vgui("destroy .x%zx.c.s%zx\n",glist_getcanvas(glist),x);
sys_vgui("set %lxw .x%lx.c.s%lx ; menubutton $%lxw -relief raised -background \"%s\" -text \"%s\" -direction flush -menu $%lxw.menu ; menu $%lxw.menu -tearoff 0\n",
sys_vgui("set %zxw .x%zx.c.s%zx ; menubutton $%zxw -relief raised -background \"%s\" -text \"%s\" -direction flush -menu $%zxw.menu ; menu $%zxw.menu -tearoff 0\n",
x,canvas,x,x,x->x_colour->s_name,temp_name->s_name,x,x);
for(i=0 ; i<x->x_num_options ; i++)
{
sys_vgui(".x%lx.c.s%lx.menu add command -label \"%s\" -command {.x%lx.c.s%lx configure -text \"%s\" ; popup_sel%lx \"%d\"} \n",
sys_vgui(".x%zx.c.s%zx.menu add command -label \"%s\" -command {.x%zx.c.s%zx configure -text \"%s\" ; popup_sel%zx \"%d\"} \n",
canvas, x, x->x_options[i]->s_name, canvas, x, x->x_options[i]->s_name, x, i);
}
}
DEBUG(post("id: .x%lx.c.s%lx", canvas, x);)
DEBUG(post("id: .x%zx.c.s%zx", canvas, x);)
DEBUG(post("create_widget end");)
}
......@@ -181,21 +181,21 @@ static void popup_drawme(t_popup *x, t_glist *glist, int firsttime)
DEBUG(post("drawme %d",firsttime);)
if (firsttime) {
DEBUG(post("glist %lx canvas %lx",x->x_glist,canvas);)
DEBUG(post("glist %zx canvas %zx",x->x_glist,canvas);)
create_widget(x,glist);
x->x_glist = canvas;
sys_vgui(".x%lx.c create window %d %d -width %d -height %d -anchor nw -window .x%lx.c.s%lx -tags %lxS\n",
sys_vgui(".x%zx.c create window %d %d -width %d -height %d -anchor nw -window .x%zx.c.s%zx -tags %zxS\n",
canvas,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), x->x_width, x->x_height, x->x_glist,x,x);
}
else {
sys_vgui(".x%lx.c coords %lxS %d %d\n",
sys_vgui(".x%zx.c coords %zxS %d %d\n",
canvas, x,
text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
}
draw_inlets(x, glist, firsttime, 2,2);
// draw_handle(x, glist, firsttime);
sys_vgui(".x%lx.c.s%lx configure -state \"%s\"\n", canvas, x, x->x_disabled?"disabled":"active");
sys_vgui(".x%zx.c.s%zx configure -state \"%s\"\n", canvas, x, x->x_disabled?"disabled":"active");
// Output a bang to first outlet when we're ready to receive float messages the first time!.
......@@ -212,15 +212,15 @@ static void popup_erase(t_popup* x,t_glist* glist)
DEBUG(post("erase start");)
if(x->initialized){
sys_vgui("destroy .x%lx.c.s%lx\n",glist_getcanvas(glist),x);
sys_vgui("destroy .x%zx.c.s%zx\n",glist_getcanvas(glist),x);
sys_vgui(".x%lx.c delete %lxS\n",glist_getcanvas(glist), x);
sys_vgui(".x%zx.c delete %zxS\n",glist_getcanvas(glist), x);
/* inlets and outlets */
sys_vgui(".x%lx.c delete %lxi\n",glist_getcanvas(glist),x); /* Added tag for all inlets of one instance */
sys_vgui(".x%lx.c delete %lxo\n",glist_getcanvas(glist),x); /* Added tag for all outlets of one instance */
sys_vgui(".x%lx.c delete %lxhandle\n",glist_getcanvas(glist),x,0);
sys_vgui(".x%zx.c delete %zxi\n",glist_getcanvas(glist),x); /* Added tag for all inlets of one instance */
sys_vgui(".x%zx.c delete %zxo\n",glist_getcanvas(glist),x); /* Added tag for all outlets of one instance */
sys_vgui(".x%zx.c delete %zxhandle\n",glist_getcanvas(glist),x,0);
}
DEBUG(post("erase end");)
......@@ -258,7 +258,7 @@ static void popup_displace(t_gobj *z, t_glist *glist,
x->x_obj.te_ypix += dy;
if (glist_isvisible(glist))
{
if(x->initialized)sys_vgui(".x%lx.c coords %lxSEL %d %d %d %d\n",
if(x->initialized)sys_vgui(".x%zx.c coords %zxSEL %d %d %d %d\n",
glist_getcanvas(glist), x,
text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
text_xpix(&x->x_obj, glist) + x->x_rect_width, text_ypix(&x->x_obj, glist) + x->x_rect_height-2);
......@@ -276,15 +276,15 @@ static void popup_select(t_gobj *z, t_glist *glist, int state)
t_popup *x = (t_popup *)z;
if(x->initialized){
if (state) {
sys_vgui(".x%lx.c create rectangle \
%d %d %d %d -tags %lxSEL -outline blue\n",
sys_vgui(".x%zx.c create rectangle \
%d %d %d %d -tags %zxSEL -outline blue\n",
glist_getcanvas(glist),
text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
text_xpix(&x->x_obj, glist) + x->x_rect_width, text_ypix(&x->x_obj, glist) + x->x_rect_height-2,
x);
}
else {
sys_vgui(".x%lx.c delete %lxSEL\n",
sys_vgui(".x%zx.c delete %zxSEL\n",
glist_getcanvas(glist), x);
}
}
......@@ -389,7 +389,7 @@ static void popup_options(t_popup* x, t_symbol *s, int argc, t_atom *argv)
x->x_num_options = argc;
/* delete old menu items */
if(visible)sys_vgui(".x%lx.c.s%lx.menu delete 0 end \n", x->x_glist, x);
if(visible)sys_vgui(".x%zx.c.s%zx.menu delete 0 end \n", x->x_glist, x);
if(argc>x->x_maxoptions){
/* resize the options-array */
......@@ -401,7 +401,7 @@ static void popup_options(t_popup* x, t_symbol *s, int argc, t_atom *argv)
for(i=0 ; i<argc ; i++)
{
x->x_options[i] = atom_getsymbol(argv+i);
if(visible)sys_vgui(".x%lx.c.s%lx.menu add command -label \"%s\" -command {.x%lx.c.s%lx configure -text \"%s\" ; popup_sel%lx \"%d\"} \n",
if(visible)sys_vgui(".x%zx.c.s%zx.menu add command -label \"%s\" -command {.x%zx.c.s%zx configure -text \"%s\" ; popup_sel%zx \"%d\"} \n",
x->x_glist, x, x->x_options[i]->s_name, x->x_glist, x, x->x_options[i]->s_name, x, i);
}
......@@ -415,7 +415,7 @@ static void popup_bgcolour(t_popup* x, t_symbol* col)
DEBUG(post("bgcolour start");)
x->x_colour = col;
if(visible)sys_vgui(".x%lx.c.s%lx configure -background \"%s\"\n", x->x_glist, x, col->s_name);
if(visible)sys_vgui(".x%zx.c.s%zx configure -background \"%s\"\n", x->x_glist, x, col->s_name);
}
/* Function to change name of popup */
......@@ -425,7 +425,7 @@ static void popup_name(t_popup* x, t_symbol *name)
DEBUG(post("name start");)
x->x_name = name;
if(visible)sys_vgui(".x%lx.c.s%lx configure -text \"%s\"\n", x->x_glist, x, name->s_name);
if(visible)sys_vgui(".x%zx.c.s%zx configure -text \"%s\"\n", x->x_glist, x, name->s_name);
}
/* Function to select a menu option by inlet */
......@@ -437,7 +437,7 @@ static void popup_iselect(t_popup* x, t_floatarg item)
int i=(int)item;
if( i<x->x_num_options && i>=0)
{
if(visible)sys_vgui(".x%lx.c.s%lx configure -text \"%s\" ; popup_sel%lx \"%d\" \n",
if(visible)sys_vgui(".x%zx.c.s%zx configure -text \"%s\" ; popup_sel%zx \"%d\" \n",
glist_getcanvas(x->x_glist), x, x->x_options[i]->s_name,x, i);
else popup_output(x, i);
......@@ -459,7 +459,7 @@ static void popup_symselect(t_popup* x, t_symbol *s)
{
if(x->x_options[i]->s_name == s->s_name)
{
if(visible)sys_vgui(".x%lx.c.s%lx configure -text \"%s\" ; popup_sel%lx \"%d\" \n",
if(visible)sys_vgui(".x%zx.c.s%zx configure -text \"%s\" ; popup_sel%zx \"%d\" \n",
glist_getcanvas(x->x_glist), x, x->x_options[i]->s_name,x, i);
else popup_output(x, i);
match = 1;
......@@ -485,7 +485,7 @@ static void popup_set(t_popup* x, t_symbol *S, int argc, t_atom*argv)
{
x->current_selection = i;
if(visible)
sys_vgui(".x%lx.c.s%lx configure -text \"%s\"\n",
sys_vgui(".x%zx.c.s%zx configure -text \"%s\"\n",
glist_getcanvas(x->x_glist), x, x->x_options[i]->s_name);
} else {
error("popup: Valid menu selections are from %d to %d\npopup: You entered %d.", 0, x->x_num_options-1, i);
......@@ -500,7 +500,7 @@ static void popup_set(t_popup* x, t_symbol *S, int argc, t_atom*argv)
if(x->x_options[i]->s_name == s->s_name)
{
x->current_selection = i;
if(visible)sys_vgui(".x%lx.c.s%lx configure -text \"%s\"\n",
if(visible)sys_vgui(".x%zx.c.s%zx configure -text \"%s\"\n",
glist_getcanvas(x->x_glist), x, x->x_options[i]->s_name);
return;
}
......@@ -541,7 +541,7 @@ static void popup_append(t_popup* x, t_symbol *s, int argc, t_atom *argv)
for(i=x->x_num_options ; i<new_limit ; i++)
{
x->x_options[i] = atom_getsymbol(argv+i-x->x_num_options);
if(visible)sys_vgui(".x%lx.c.s%lx.menu add command -label \"%s\" -command {.x%lx.c.s%lx configure -text \"%s\" ; popup_sel%lx \"%d\"} \n",
if(visible)sys_vgui(".x%zx.c.s%zx.menu add command -label \"%s\" -command {.x%zx.c.s%zx configure -text \"%s\" ; popup_sel%zx \"%d\"} \n",
x->x_glist, x, x->x_options[i]->s_name, x->x_glist, x, x->x_options[i]->s_name, x, i);
}
......@@ -554,7 +554,7 @@ static void popup_disable(t_popup*x, t_float f){
x->x_disabled=(f>0.f);
if(x->x_glist && glist_isvisible(x->x_glist)){
t_canvas *canvas=glist_getcanvas(x->x_glist);
sys_vgui(".x%lx.c.s%lx configure -state \"%s\"\n", canvas, x, x->x_disabled?"disabled":"active");
sys_vgui(".x%zx.c.s%zx configure -state \"%s\"\n", canvas, x, x->x_disabled?"disabled":"active");
}
}
......@@ -620,13 +620,13 @@ static void *popup_new(t_symbol *s, int argc, t_atom *argv)
break;
}
/* Bind the recieve "popup%lx" to the widget outlet*/
sprintf(buf,"popup%lx", (long unsigned int)x);
/* Bind the recieve "popup%zx" to the widget outlet*/
sprintf(buf,"popup%zx", (t_uint)x);
x->x_sym = gensym(buf);
pd_bind(&x->x_obj.ob_pd, x->x_sym);
/* define proc in tcl/tk where "popup%p" is the receive, "output" is the method, and "$index" is an argument. */
sys_vgui("proc popup_sel%lx {index} {\n pd [concat %s output $index \\;]\n }\n",
sys_vgui("proc popup_sel%zx {index} {\n pd [concat %s output $index \\;]\n }\n",
x, buf);
/* Add symbol inlet (hard to say how this actually works?? */
......
......@@ -68,7 +68,7 @@ ORIGDIR=pd-$(LIBRARY_NAME)_$(LIBRARY_VERSION)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CPU := $(shell uname -p)
ifeq ($(CPU),arm) # iPhone/iPod Touch
ifeq ($(CPU),arm-iphone) # iPhone/iPod Touch
SOURCES += $(SOURCES_iphoneos)
EXTENSION = pd_darwin
OS = iphoneos
......@@ -97,9 +97,9 @@ ifeq ($(UNAME),Darwin)
FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4
SOURCES += $(SOURCES_iphoneos)
endif
CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \
CFLAGS += $(FAT_FLAGS) -fPIC \
-I/Applications/Pd-extended.app/Contents/Resources/include
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup
# if the 'pd' binary exists, check the linking against it to aid with stripping
LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
LIBS += -lc
......
MIT License
Copyright (c) 2020 Albert Gräf
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
lib.name = bendinfix
class.sources = bendinfix.c
datafiles = bendinfix-help.pd LICENSE README.md
include Makefile.pdlibbuilder.revised
This diff is collapsed.
# bendinfix
This external provides a helper object to maintain compatibility between the bendin value ranges of different Pd flavors (specifically, vanilla Pd, pd-l2ork version 1, and purr-data a.k.a. pd-l2ork version 2+).
Pd has a long-standing [bug](https://sourceforge.net/p/pure-data/bugs/1262/) in that its bendin object produces an unsigned value range of 0 thru 16383, while the bendout object expects a signed range of -8192 thru +8191. Which means that you have to translate the values when routing pitch bends from MIDI input to MIDI output. It also makes it harder to translate pitch bend input to frequency offsets. This bug has been there for such a long time that it now can't be fixed any more, to maintain backwards compatibility.
However, other Pd flavors have in fact fixed this bug, specifically pd-l2ork and its successor purr-data. This actually made matters worse, though, since now Pd programmers have to cope with a variety of bendin implementations, which makes it hard to maintain interoperability between the different flavors if you need to process MIDI pitch bend events.
The bendinfix external provides a solution that (1) provides a quick way to check which bendin implementation you have, (2) takes the output of the bendin object and translates it to the correct (signed) range, and (3) is binary-compatible with all modern Pd flavors.
## Synopsis
`[bendin]` takes signed or unsigned pitch bend values and translates them to signed values.
- inlet #1: signed or unsigned pitch bend values, depending on your Pd flavor
- outlet #1: output values are always signed, in the -8192 ... 8191 range
- arguments: none
## Usage
(1) Passing 0 to bendinfix yields the value -8192 for a vanilla-compatible bendin, and 0 otherwise. Thus comparing the result against 0 gives you a flag determining whether you have a signed implementation:
`[0( --- [bendinfix] --- [== 0]` yields 1 if signed, 0 if unsigned bendin implementation
You can then use the computed flag in a patch to set it up for the pitch bend implementation at hand.
(2) Simply routing the output of bendin into bendinfix yields the correct signed pitch bend values:
`[bendin] --- [bendinfix]` yields signed bendin values in the -8192 ... 8191 range
These can then be routed to bendout without further translation, or you can divide, e.g., by 4096, add a MIDI note number, and route the result through mtof to get a pitch bend range of +/- 2 semitones.
Or, if you prefer to work with unsigned values, just add 8192 to the result of bendinfix. This will always give you unsigned values, even if your Pd flavor has a signed bendin implementation.
## See Also
- the infamous [bug #1262](https://sourceforge.net/p/pure-data/bugs/1262/)
- doc/5.reference, midi (and bendin) help patches
#N canvas 696 372 460 365 12;
#X obj 22 263 bendinfix;
#X floatatom 22 292 5 0 0 0 - - -, f 5;
#X msg 78 233 0;
#X obj 22 233 bendin;
#X text 21 321 corrected pitch bend value (-8192 - 8191 range);
#X text 22 206 pitch bend input;
#X text 113 234 Passing 0 as input gives the amount by which the result
is shifted. This will be -8192 for a vanilla-compatible bendin implementation
\, 0 otherwise., f 46;
#N canvas 477 282 494 344 META 0;
#X text 12 5 KEYWORDS control MIDI;
#X text 12 25 LICENSE MIT;
#X text 12 85 INLET_0 float;
#X text 12 105 OUTLET_0 float;
#X text 12 129 AUTHOR Albert Gräf;
#X text 12 149 WEBSITE https://agraef.github.io/purr-data/;
#X text 12 169 RELEASE_DATE 2020;
#X text 12 192 HELP_PATCH_AUTHORS Albert Gräf;
#X text 12 45 DESCRIPTION translate bendin output to signed values
for all Pd flavors;
#X restore 380 335 pd META;
#X text 18 2 bendinfix - correct bendin values for all Pd flavors;
#X text 17 41 Background: Pd has a long-standing bug (which won't be
fixed due to backward compatibility concerns) in that its bendin range
(0 - 16383) doesn't match its bendout range (-8192 - 8191). The former
is what MIDI readily yields \, while the latter is more convenient
for translating pitch bends into frequency offsets. The bendinfix object
translates bendin's output to the correct (signed) range \, and works
across all Pd flavors \, including Pd-L2ork and Purr Data where bendin
returns a signed result by default.;
#X connect 0 0 1 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
// To compile on Linux: gcc --shared -fPIC -o bendinfix.pd_linux bendinfix.c
#include <m_pd.h>
static t_class *bendinfix_class;
static int *legacy, *legacy_bendin;
static void (*nw_gui_vmess)(const char *sel, char *fmt, ...);
typedef struct _bendinfix {
t_object x_obj;
} t_bendinfix;
void bendinfix_float(t_bendinfix *x, t_floatarg f)
{
// vanilla default:
t_float g = 8192;
// exported symbols by the different Pd flavors:
// nw_gui_vmess => purr-data only
// legacy => pd-l2ork and purr-data
// legacy_bendin => purr-data with revised bendin implementation
if (legacy_bendin)
// signed bendin unless legacy_bendin is set
g = *legacy_bendin?8192:0;
else if (legacy)
// we always have a signed bendin with classic pd-l2ork (!nw_gui_vmess),
// whereas for purr-data without the revised bendin implementation
// (!legacy_bendin) bendin is signed, unless legacy is set
g = !nw_gui_vmess?0:*legacy?8192:0;
outlet_float(x->x_obj.ob_outlet, f-g);
}
void *bendinfix_new(void)
{
t_bendinfix *x = (t_bendinfix *)pd_new(bendinfix_class);
outlet_new(&x->x_obj, &s_float);
return (void *)x;
}
#ifdef WIN32
#include <windows.h>
#else
#define __USE_GNU // to get RTLD_DEFAULT
#include <dlfcn.h> // for dlsym
#ifndef RTLD_DEFAULT
/* If RTLD_DEFAULT still isn't defined then just passing NULL will hopefully
do the trick. */
#define RTLD_DEFAULT NULL
#endif
#endif
void bendinfix_setup(void) {
bendinfix_class = class_new(gensym("bendinfix"),
(t_newmethod)bendinfix_new,
0, sizeof(t_bendinfix),
CLASS_DEFAULT, 0);
class_addfloat(bendinfix_class, bendinfix_float);
#ifdef WIN32
legacy = (void*)GetProcAddress(GetModuleHandle("pd.dll"), "sys_legacy");
legacy_bendin = (void*)GetProcAddress(GetModuleHandle("pd.dll"), "sys_legacy_bendin");
nw_gui_vmess = (void*)GetProcAddress(GetModuleHandle("pd.dll"), "gui_vmess");
#else
legacy = dlsym(RTLD_DEFAULT, "sys_legacy");
legacy_bendin = dlsym(RTLD_DEFAULT, "sys_legacy_bendin");
nw_gui_vmess = dlsym(RTLD_DEFAULT, "gui_vmess");
#endif
}
......@@ -72,7 +72,7 @@ ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CPU := $(shell uname -p)
ifeq ($(CPU),arm) # iPhone/iPod Touch
ifeq ($(CPU),arm-iphone) # iPhone/iPod Touch
SOURCES += $(SOURCES_iphoneos)
EXTENSION = pd_darwin
OS = iphoneos
......@@ -102,8 +102,8 @@ ifeq ($(UNAME),Darwin)
FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=$(macos_target)
SOURCES += $(SOURCES_iphoneos)
endif
CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib
CFLAGS += $(FAT_FLAGS) -fPIC
LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup
# if the 'pd' binary exists, check the linking against it to aid with stripping
LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
LIBS += -lc
......