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 215 additions and 142 deletions
......@@ -56,7 +56,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_macosx)
EXTENSION = pd_darwin
OS = iphoneos
......@@ -80,9 +80,9 @@ ifeq ($(UNAME),Darwin)
OS = macosx
OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
FAT_FLAGS = -arch i386 -arch ppc -mmacosx-version-min=10.4
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
......
......@@ -417,7 +417,7 @@ ifeq ($(system), Darwin)
/Applications/Pd-extended*.app/Contents/Resources/include/pdextended \
/Applications/Pd*.app/Contents/Resources/src))
extension = pd_darwin
cpp.flags := -DUNIX -DMACOSX -I /sw/include
cpp.flags := -DUNIX -DMACOSX
c.flags :=
c.ldflags := -undefined suppress -flat_namespace -bundle
c.ldlibs := -lc
......
Subproject commit 3046fa0248999819c4709b9e53679c6824bd0168
Subproject commit 03b0722d7c9f09d12cc5043abd4d2094c3d0114f
......@@ -6,8 +6,6 @@ class.sources = disis_phasor~.c
disis_munger~.class.sources = disis_munger.c ADSR.c
define forLinux
class.sources += disis_netsend.c disis_netreceive.c
disis_wiimote.class.sources = disis_wiimote.c
disis_wiimote.class.ldlibs = $(CWIID_LIB_STATIC) -lbluetooth -lpthread
endef
define forDarwin
class.sources += disis_netsend.c disis_netreceive.c
......
......@@ -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
......
......@@ -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
......
......@@ -77,7 +77,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
......@@ -107,8 +107,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
......
#include "ext13.h"
#include "m_pd.h"
/* Just go ahead and include the private header since the author wants it.
Anyway, I think this can be handled natively now so it should only be here
for compatibility purposes anyway. */
#include "m_imp.h"
/*
#ifndef PD_MAJOR_VERSION
#include "s_stuff.h"
......
......@@ -67,7 +67,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,8 +97,8 @@ 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
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
......
......@@ -92,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
......@@ -130,7 +130,7 @@ ifeq ($(UNAME),Darwin)
FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=$(macos_target)
endif
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) -headerpad_max_install_names -bundle $(BUNDLE_LOADER) \
......
......@@ -523,7 +523,7 @@ ifeq ($(system), Darwin)
/Applications/Pd-extended*.app/Contents/Resources/include/pdextended \
/Applications/Pd*.app/Contents/Resources/src))
extension = pd_darwin
cpp.flags := -DUNIX -DMACOSX -I /sw/include
cpp.flags := -DUNIX -DMACOSX
c.flags :=
c.ldflags := -undefined suppress -flat_namespace -bundle
c.ldlibs := -lc
......
......@@ -6,6 +6,10 @@
#include <fluidsynth.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
// needed to get S_IRUSR etc. in msys2
#include <sys/stat.h>
#include "m_pd.h"
......@@ -52,9 +56,12 @@ static void fluid_help(void)
"fluid~: a soundfont external for Pd and Max/MSP\n"
"options:\n"
"-smmf: enable SMMF mode (https://bitbucket.org/agraef/pd-smmf)\n"
"-g 1: set the synth.gain value (0-10, default is 1)\n"
"-v: verbose mode (post startup messages to Pd console)\n"
"any other symbol: soundfont file to load on object creation\n"
"messages:\n"
"load /path/to/soundfont.sf2 --- Loads a Soundfont\n"
"gain 1 --- Change the gain value (0-10)\n"
"note 0 0 0 --- Play note, arguments:\n"
" channel-# note-# veloc-#\n"
"n 0 0 0 --- Play note, same as above\n"
......@@ -260,6 +267,15 @@ static void fluid_sysex(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
}
}
static void fluid_gain(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
{
t_float gain = atom_getfloatarg(0, argc, argv);
// clamp the value to fluidsynths 0-10 range
if (gain < 0.0) gain = 0.0;
if (gain > 10.0) gain = 10.0;
fluid_settings_setnum(x->x_settings, "synth.gain", gain);
}
static void fluid_load(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
{
if (x->x_synth == NULL)
......@@ -297,6 +313,17 @@ static void fluid_load(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
}
}
// Where to put the temporary log file (see below). The only place we can
// safely assume to be writable is the user's configuration directory, so
// that's where it goes.
#ifdef _WIN32
#define USER_CONFIG_DIR "AppData/Roaming/Purr-Data"
#else
#define USER_CONFIG_DIR ".purr-data"
#endif
#define maxline 1024
static void fluid_init(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
{
if (x->x_synth) delete_fluid_synth(x->x_synth);
......@@ -304,6 +331,55 @@ static void fluid_init(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
float sr = sys_getsr();
// Gain value. Fluidsynth's default gain is absurdly low, so we use a
// larger but still moderate value (range is 0-10). I find 1.0 to be a
// good default, YMMV. (Original fluid~ had 0.6 here, but I found that too
// low with most soundfonts.) This value can be changed by the user with
// the -g option, see below.
float gain = 1.0;
// check the options
int vflag = 0;
while (argc > 0) {
const char* arg = atom_getsymbolarg(0, argc, argv)->s_name;
if (strcmp(arg, "-smmf") == 0) {
// SMMF mode
x->smmf_mode = 1; argc--; argv++;
} else if (strcmp(arg, "-v") == 0) {
// verbose mode (capture stderr, see below)
vflag = 1; argc--; argv++;
} else if (strcmp(arg, "-g") == 0) {
// default gain value ("synth.gain")
argc--; argv++;
if (argc > 0) {
gain = atom_getfloatarg(0, argc, argv);
// clamp the value to fluidsynths 0-10 range
if (gain < 0.0) gain = 0.0;
if (gain > 10.0) gain = 10.0;
argc--; argv++;
}
} else {
break;
}
}
// Some drivers (e.g. ALSA) are very chatty and will print a lot of log
// messages to stderr while fluidsynth is being initialized. We can
// capture stderr and redirect it to the Pd console, or just get rid of
// it, depending on the user's choice. To these ends we temporarily
// redirect stderr while running the intialization.
char logfile[FILENAME_MAX], *homedir = getenv("HOME");
snprintf(logfile, FILENAME_MAX,
"%s/" USER_CONFIG_DIR "/fluidtmp.log", homedir);
int saved_stderr = dup(STDERR_FILENO);
int fd;
if (!vflag) {
fd = open("/dev/null", O_RDWR);
} else {
fd = open(logfile, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
}
dup2(fd, STDERR_FILENO);
x->x_settings = new_fluid_settings();
if (x->x_settings == NULL)
......@@ -312,15 +388,20 @@ static void fluid_init(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
}
else
{
// fluid_settings_setstr(settings, "audio.driver", "float");
// settings:
fluid_settings_setnum(x->x_settings, "synth.midi-channels", 16);
fluid_settings_setnum(x->x_settings, "synth.polyphony", 256);
fluid_settings_setnum(x->x_settings, "synth.gain", 0.600000);
fluid_settings_setnum(x->x_settings, "synth.sample-rate", 44100.000000);
fluid_settings_setstr(x->x_settings, "synth.chorus.active", "no");
fluid_settings_setstr(x->x_settings, "synth.reverb.active", "no");
fluid_settings_setstr(x->x_settings, "synth.ladspa.active", "no");
// ag: fluidsynth defaults are: 0.2, 16, 256, 44100.0, 1, 1, 0.
fluid_settings_setnum(x->x_settings, "synth.gain", gain);
#if 0
// Crufty old defaults which we don't use any more. Except for the
// gain, we really want to keep things as close to the defaults as
// possible, so that fluid~ sounds *exactly* like the stand-alone
// program.
fluid_settings_setint(x->x_settings, "synth.midi-channels", 16);
fluid_settings_setint(x->x_settings, "synth.polyphony", 256);
fluid_settings_setnum(x->x_settings, "synth.sample-rate", 44100.0);
fluid_settings_setint(x->x_settings, "synth.chorus.active", 0);
fluid_settings_setint(x->x_settings, "synth.reverb.active", 0);
fluid_settings_setint(x->x_settings, "synth.ladspa.active", 0);
#endif
if (sr != 0)
{
......@@ -332,12 +413,6 @@ static void fluid_init(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
{
pd_error(x, "fluid~: couldn't create synth");
}
// check for SMMF mode
const char* arg = atom_getsymbolarg(0, argc, argv)->s_name;
if (strcmp(arg, "-smmf") == 0)
{
x->smmf_mode = 1; argc--; argv++;
}
// try to load argument as soundfont
fluid_load(x, gensym("load"), argc, argv);
......@@ -345,6 +420,26 @@ static void fluid_init(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
if (x->x_synth)
post("-- fluid~ for Pd%s --", x->smmf_mode?" (SMMF mode)":"");
}
// Restore stderr.
if (!vflag) {
dup2(saved_stderr, STDERR_FILENO);
close(fd);
} else {
lseek(fd, 0, SEEK_SET);
// read stuff, post it (it's more convenient to do this with a FILE*)
FILE *fp = fdopen(fd, "r+");
char buf[maxline];
if (fp) {
while (fgets(buf, maxline, fp)) {
int n = strlen(buf);
if (n > 0 && buf[n-1] == '\n') buf[n-1] = '\0';
if (*buf) post("%s", buf);
}
}
fclose(fp);
dup2(saved_stderr, STDERR_FILENO);
unlink(logfile);
}
}
static void *fluid_tilde_new(t_symbol *s, int argc, t_atom *argv)
......@@ -358,7 +453,12 @@ static void *fluid_tilde_new(t_symbol *s, int argc, t_atom *argv)
fluid_init(x, gensym("init"), argc, argv);
return (void *)x;
}
static void fluid_log_cb(int level, const char *message, void *data)
{
post("fluid~ [%d]: %s", level, message);
}
void fluid_tilde_setup(void)
{
fluid_tilde_class = class_new(gensym("fluid~"),
......@@ -425,10 +525,21 @@ void fluid_tilde_setup(void)
class_addmethod(fluid_tilde_class, (t_method)fluid_sysex, gensym("sysex"),
A_GIMME, 0);
class_addmethod(fluid_tilde_class, (t_method)fluid_gain, gensym("gain"),
A_GIMME, 0);
// Simulate Flext's help message
class_addmethod(fluid_tilde_class, (t_method)fluid_help, gensym("help"),
0);
class_addmethod(fluid_tilde_class,
(t_method)fluid_tilde_dsp, gensym("dsp"), A_CANT, 0);
// Set up logging. We don't want to have too much noise here, and we also
// want to see the important stuff in the Pd console rather than the
// terminal.
fluid_set_log_function(FLUID_PANIC, fluid_log_cb, NULL);
fluid_set_log_function(FLUID_ERR, fluid_log_cb, NULL);
fluid_set_log_function(FLUID_WARN, fluid_log_cb, NULL);
fluid_set_log_function(FLUID_DBG, NULL, NULL);
}
......@@ -523,7 +523,7 @@ ifeq ($(system), Darwin)
/Applications/Pd-extended*.app/Contents/Resources/include/pdextended \
/Applications/Pd*.app/Contents/Resources/src))
extension = pd_darwin
cpp.flags := -DUNIX -DMACOSX -I /sw/include
cpp.flags := -DUNIX -DMACOSX
c.flags :=
c.ldflags := -undefined suppress -flat_namespace -bundle
c.ldlibs := -lc
......
......@@ -27,8 +27,12 @@
#include "g_canvas.h"
#include "g_all_guis.h"
/* This really should be part of g_all_guis.h... */
EXTERN int gfxstub_haveproperties(void *key);
#include <math.h>
#ifdef WIN32
#include <io.h>
#else
......@@ -297,15 +301,15 @@ static void knob_getrect(t_gobj *z, t_glist *glist,
static void knob_save(t_gobj *z, t_binbuf *b)
{
t_knob *x = (t_knob *)z;
int bflcol[3];
t_symbol *bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
binbuf_addv(b, "ssiisiiffiisssiiiisssii;", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
atom_getsymbol(binbuf_getvec(x->x_gui.x_obj.te_binbuf)),
x->x_gui.x_h, x->x_gui.x_h,
(float)x->x_min, (float)x->x_max,
(t_float)x->x_min, (t_float)x->x_max,
x->x_lin0_log1, iem_symargstoint(&x->x_gui),
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
......@@ -528,7 +532,7 @@ static void knob_click(t_knob *x, t_floatarg xpos, t_floatarg ypos,
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
knob_bang(x);
glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)knob_motion,
0, 0, xpos, ypos);
0, xpos, ypos);
}
static int knob_newclick(t_gobj *z, struct _glist *glist,
......
......@@ -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
......
......@@ -104,14 +104,9 @@ case "$host" in
*-darwin* | *-macos10*)
EXTENSION=pd_darwin
LDFLAGS="$LDFLAGS -bundle -undefined dynamic_lookup"
# Check for DarwinPorts and/or Fink on Mac OS X/Darwin
if test -d /sw ; then
# Fink
PATH="/sw/bin:/sw/sbin:$PATH"
INCLUDES="$INCLUDES -I/sw/include"
LIBS="$LIBS -L/sw/lib"
elif test -d /opt/local ; then
# DarwinPorts
# Check for MacPorts on Mac OS X/Darwin
if test -d /opt/local ; then
# MacPorts
PATH="/opt/local/bin:/opt/local/sbin:$PATH"
INCLUDES="$INCLUDES -I/opt/local/include"
LIBS="$LIBS -L/opt/local/lib"
......
......@@ -74,7 +74,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
......@@ -104,8 +104,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
......
......@@ -23,11 +23,13 @@ typedef struct _image
int x_img_height;
int x_gop_spill;
int x_click;
//t_float x_clicked;
t_symbol* x_fname;
t_symbol* x_receive;
//int x_selected;
//t_symbol* send;
#if 0 // TODO?
t_float x_clicked;
int x_selected;
t_symbol* send;
#endif
} t_image;
/* widget helper functions */
......@@ -97,19 +99,12 @@ static void image_drawme(t_image *x, t_glist *glist, int firstime)
x,
x,
"center");
//sys_vgui("catch {.x%zx.c delete %xS}\n", glist_getcanvas(glist), x);
//sys_vgui(".x%x.c create image %d %d -tags %xS\n",
// glist_getcanvas(glist),text_xpix(&x->x_obj, glist),
// text_ypix(&x->x_obj, glist), x);
gui_vmess("gui_image_size_callback", "xxs",
glist_getcanvas(glist), x, x->x_receive->s_name);
}
else
{
// move the gobj
//sys_vgui(".x%x.c coords %xS %d %d\n",
// glist_getcanvas(glist), x,
// text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
gui_vmess("gui_image_coords", "xxii",
glist_getcanvas(glist),
x,
......@@ -127,9 +122,6 @@ static void image_drawme(t_image *x, t_glist *glist, int firstime)
static void image_erase(t_image* x,t_glist* glist)
{
gui_vmess("gui_gobj_erase", "xx", glist_getcanvas(glist), x);
//sys_vgui("catch {.x%x.c delete %xS}\n",glist_getcanvas(glist), x);
//sys_vgui("catch {image delete $img%x}\n", x);
//sys_vgui("catch {.x%x.c delete %xSEL}\n",glist_getcanvas(glist), x);
}
static t_symbol *get_filename(t_int argc, t_atom *argv)
......@@ -188,14 +180,15 @@ static void image_getrect(t_gobj *z, t_glist *glist,
if ((glist_getcanvas(glist) != glist && !x->x_click) || (!glist->gl_edit && !x->x_click))
{
*xp2 = *xp1;
// only if we have an image loaded and we are placed within a GOP obliterate the height
//if (glist_getcanvas(glist) != glist && (x->x_img_width + x->x_img_height) >= 2)
//{
//printf("blah\n");
//*yp2 = *yp1;
//}
// only if we have an image loaded and we are placed within a GOP
// obliterate the height
#if 0
if (glist_getcanvas(glist) != glist && (x->x_img_width + x->x_img_height) >= 2)
{
*yp2 = *yp1;
}
#endif
}
//fprintf(stderr,"image_getrect %d %d %d %d\n", *xp1, *yp1, *xp2, *yp2);
}
static void image_displace(t_gobj *z, t_glist *glist,
......@@ -216,12 +209,6 @@ static void image_displace_wtag(t_gobj *z, t_glist *glist,
t_image *x = (t_image *)z;
x->x_obj.te_xpix += dx;
x->x_obj.te_ypix += dy;
/*sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n",
glist_getcanvas(glist), x,
text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height);
image_drawme(x, glist, 0);*/
canvas_fixlinesfor(glist,(t_text*) x);
}
......@@ -234,42 +221,13 @@ static void image_select(t_gobj *z, t_glist *glist, int state)
if (x->x_glist == glist_getcanvas(glist))
{
//x->x_selected = state;
if (!x->x_gop_spill && (x->x_img_width + x->x_img_height) >= 2)
{
sys_vgui(".x%x.c create prect %d %d %d %d \
-tags %xSEL -strokewidth 1 -stroke $pd_colors(selection)\n",
glist_getcanvas(glist),
text_xpix(&x->x_obj, glist) - x->x_img_width/2,
text_ypix(&x->x_obj, glist) - x->x_img_height/2,
text_xpix(&x->x_obj, glist) + x->x_img_width/2,
text_ypix(&x->x_obj, glist) + x->x_img_height/2, x);
}
else
{
sys_vgui(".x%x.c create prect %d %d %d %d \
-tags %xSEL -strokewidth 1 -stroke $pd_colors(selection)\n",
glist_getcanvas(glist),
text_xpix(&x->x_obj, glist) - x->x_width/2,
text_ypix(&x->x_obj, glist) - x->x_height/2,
text_xpix(&x->x_obj, glist) + x->x_width/2,
text_ypix(&x->x_obj, glist) + x->x_height/2, x);
}
gui_vmess("gui_image_toggle_border", "xxi", glist_getcanvas(glist),
x, 1);
}
gui_vmess("gui_gobj_select", "xx", glist_getcanvas(glist), x);
//if (glist->gl_owner && !glist_istoplevel(glist))
//sys_vgui(".x%x.c addtag selected withtag %xS\n", glist_getcanvas(glist), x);
//sys_vgui(".x%x.c addtag selected withtag %xMT\n", glist_getcanvas(glist), x);
//sys_vgui(".x%x.c addtag selected withtag %xSEL\n", glist_getcanvas(glist), x);
}
else
{
//sys_vgui("catch {.x%x.c delete %xSEL}\n",
//glist_getcanvas(glist), x);
//if (glist->gl_owner && !glist_istoplevel(glist))
//sys_vgui(".x%zx.c dtag %xS selected\n", glist_getcanvas(glist), x);
//sys_vgui(".x%zx.c dtag %xMT selected\n", glist_getcanvas(glist), x);
gui_vmess("gui_image_toggle_border", "xxi", glist_getcanvas(glist),
x, 0);
gui_vmess("gui_gobj_deselect", "xx", glist_getcanvas(glist), x);
......@@ -278,12 +236,14 @@ static void image_select(t_gobj *z, t_glist *glist, int state)
static void image_activate(t_gobj *z, t_glist *glist, int state)
{
/*fprintf(stderr,"activate...\n");
#if 0 // TODO?
fprintf(stderr,"activate...\n");
t_text *x = (t_text *)z;
t_rtext *y = glist_findrtext(glist, x);
rtext_activate(y, state);
t_image *i = (t_image *)z;
canvas_redraw(i->x_glist);*/
canvas_redraw(i->x_glist);
#endif
}
static void image_delete(t_gobj *z, t_glist *glist)
......@@ -307,27 +267,37 @@ static void image_vis(t_gobj *z, t_glist *glist, int vis)
static void image_save(t_gobj *z, t_binbuf *b)
{
t_image *x = (t_image *)z;
binbuf_addv(b, "ssiissi", gensym("#X"), gensym("obj"),
x->x_obj.te_xpix, x->x_obj.te_ypix,
atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
x->x_fname, x->x_gop_spill);
// ag: unless we need it, avoid adding the gop-spill argument which isn't
// compatible with vanilla ggee
if (x->x_gop_spill)
binbuf_addv(b, "ssiissi", gensym("#X"), gensym("obj"),
x->x_obj.te_xpix, x->x_obj.te_ypix,
atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
x->x_fname, x->x_gop_spill);
else
binbuf_addv(b, "ssiiss", gensym("#X"), gensym("obj"),
x->x_obj.te_xpix, x->x_obj.te_ypix,
atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
x->x_fname);
binbuf_addv(b, ";");
}
static t_widgetbehavior image_widgetbehavior;
/*void image_size(t_image* x,t_floatarg w,t_floatarg h) {
#if 0 // TODO?
static void image_size(t_image* x,t_floatarg w,t_floatarg h) {
x->x_width = w;
x->x_height = h;
image_displace((t_gobj*)x, x->x_glist, 0.0, 0.0);
}*/
}
/*void image_color(t_image* x,t_symbol* col)
static void image_color(t_image* x,t_symbol* col)
{
//outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang ..
//so color black does the same as bang, but doesn't forward the bang
}*/
}
#endif
static int image_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
......@@ -337,15 +307,6 @@ static int image_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, i
outlet_bang(x->x_obj.ob_outlet);
// LATER: figure out how to do click on and click off
// and provide a toggle button behavior instead
/*{
x->x_clicked = 1;
outlet_float(x->x_obj.ob_outlet, x->x_clicked);
}
else if (x->x_clicked)
{
x->x_clicked = 0;
outlet_float(x->x_obj.ob_outlet, x->x_clicked);
}*/
return(1);
}
......@@ -426,11 +387,11 @@ static void image_imagesize_callback(t_image *x, t_float w, t_float h) {
}
else
{
//sys_vgui("catch {.x%x.c delete %xMT}\n", glist_getcanvas(x->x_glist), x);
// reselect if we are on a toplevel canvas to adjust the selection rectangle, if necessary
#if 0
/* ico@vt.edu: this does not work for the spill mode, so we will have to
draw the select box on demand
draw the select box on demand */
gui_vmess("gui_image_draw_border", "xxiiii",
glist_getcanvas(x->x_glist),
x,
......@@ -438,7 +399,7 @@ static void image_imagesize_callback(t_image *x, t_float w, t_float h) {
0 - x->x_img_height/2,
x->x_img_width,
x->x_img_height);
*/
#endif
if (glist_isselected(x->x_glist, (t_gobj *)x) && glist_getcanvas(x->x_glist) == x->x_glist)
{
......@@ -463,14 +424,11 @@ static void image_setwidget(void)
static void image_free(t_image *x)
{
//sys_vgui("image delete img%x\n", x);
gui_vmess("gui_image_free", "x", x);
if (x->x_receive)
{
pd_unbind(&x->x_obj.ob_pd,x->x_receive);
}
//sys_vgui(".x%x.c delete %xSEL\n", x);
//sys_vgui(".x%x.c delete %xS\n", x);
}
static void *image_new(t_symbol *s, t_int argc, t_atom *argv)
......@@ -515,12 +473,12 @@ void image_setup(void)
image_class = class_new(gensym("image"),
(t_newmethod)image_new, (t_method)image_free,
sizeof(t_image),0, A_GIMME,0);
/*
#if 0 // TODO?
class_addmethod(image_class, (t_method)image_size, gensym("size"),
A_FLOAT, A_FLOAT, 0);
class_addmethod(image_class, (t_method)image_color, gensym("color"),
A_SYMBOL, 0);
*/
#endif
class_addmethod(image_class, (t_method)image_click, gensym("click"),
A_DEFFLOAT, 0);
class_addmethod(image_class, (t_method)image_open, gensym("open"),
......
......@@ -529,9 +529,10 @@ void envgen_key(t_envgen *x, t_floatarg f)
}
}
static int envgen_newclick(t_envgen *x, struct _glist *glist,
static int envgen_newclick(t_gobj *z, struct _glist *glist,
int xpos, int ypos, int shift, int alt, int dbl, int doit)
{
t_envgen *x = (t_envgen *)z;
/* check if user wants to resize */
float wxpos = text_xpix(&x->x_obj, glist);
float wypos = (int) (text_ypix(&x->x_obj,glist) + x->w.height);
......@@ -541,7 +542,7 @@ static int envgen_newclick(t_envgen *x, struct _glist *glist,
envgen_next_doodle(x, glist, xpos, ypos);
glist_grab(x->w.glist, &x->x_obj.te_g, (t_glistmotionfn) envgen_motion,
(t_glistkeyfn) envgen_key, 0, xpos, ypos);
(t_glistkeyfn) envgen_key, xpos, ypos);
x->resizing = 0;
if (x->resizeable && (xpos > wxpos + x->w.width) &&
......
......@@ -49,7 +49,7 @@
extern int close(int);
#endif
extern void sys_rmpollfn(int fd);
extern sys_addpollfn(int fd, void* fn, void *ptr);
extern int sys_addpollfn(int fd, void* fn, void *ptr);
static void sys_sockerror(char *s)
{
......