On Fri, Sep 25, 2009 at 03:51:06PM -0400, Mathieu Bouchard wrote:
> On Thu, 24 Sep 2009, Damien Henry wrote:
>
>> Where can I find documentation about pd.lib ? Does anyone on the list
>> turn pd into a library ? for creating a DSP engine for instance ?
>
> Bah, j'ai fait ça (libpd.so, libpd.dylib ...) sous forme d'un petit
> changement de makefile, mais je n'ai rien fait de concret avec ça.
> j'avais juste espéré que ça inspire quelqu'un.
>
> Il y a d'autres gens qui en ont fait une bibliothèque aussi, mais à ce
> que je sache, pas quelque chose de générique comme libpd.so, plutôt
> quelque chose pour faire de Pd un greffon dans un autre logiciel en
> particulier ou au mieux une interface générique qui n'est pas <m_pd.h>
> (par exemple VST...). Personnellement, j'ai pas regardé.
Well I think it would be of great benefit to Pd if we all stopped doing it in
our own once off, implementation specific, half-arsed way and did it properly
and robustly and submitted the code back to Miller. I already submitted some
half-arsed code for this to him (see the attached patch against Makefile.in),
but I think my chances aren't that great for getting it accepted, since it
stinks! :)
Damien, if you want you can try with that patch and something like this:
void* launchpd(void* arg)
{
char* args[2] = {"pd", "-nogui"};
sys_printhook = (t_printhook)my_printhook;
sys_main(2, args);
}
I think a lot of people dream of a libpd which is independent of all the GUI
code and the driver-specific audio code. It would be awesome if I could go:
t_pd* mypd = launchpd();
while (1) {
mypd->getBuffer(mybuffer);
}
It would certainly make it easier to make stuff like browser plugins. I dream
of a day when we post the libpd code to the whatwg list and it gets accepted by
all the major browsers, and then we have in-browser procedural audio for our
web apps.
Chris.
-------------------
http://mccormick.cx
--- ../../pd-0.42-5/src/makefile.in 2008-12-29 19:08:26.000000000 +0000
+++ makefile.in 2009-07-15 13:44:11.000000000 +0100
@@ -2,6 +2,7 @@
OBJ_DIR = ../obj
BIN_DIR = ../bin
PDEXEC = $(BIN_DIR)/pd
+LIBPD = $(BIN_DIR)/libpd.a
EXT= @EXT@
GUINAME= @GUINAME@
@@ -26,7 +27,7 @@
GLIB = @LIBS@
LDFLAGS = @LDFLAGS@
-LIB = @PDLIB@
+LIB = @LIBPD@
WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
-Wno-unused -Wno-parentheses -Wno-switch
@@ -42,14 +43,14 @@
ASIOOBJ = $(ASIOSRC:.cpp=.o)
-SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
+LSRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \
m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
m_conf.c m_glob.c m_sched.c \
s_main.c s_inter.c s_file.c s_print.c \
- s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
+ s_loader.c s_path.c s_audio.c s_midi.c \
d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
d_math.c d_fft.c d_array.c d_global.c \
d_delay.c d_resample.c \
@@ -57,7 +58,12 @@
x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c x_list.c d_soundfile.c \
$(SYSSRC)
-OBJ = $(SRC:.c=.o)
+# the main() file isn't required by libpd
+SRC = $(LSRC) s_entry.c
+
+OBJ = $(SRC:.c=.o)
+
+LOBJ = $(LSRC:.c=.o)
GSRC = @GUISRC@
@@ -123,6 +129,15 @@
$(PDEXEC): $(OBJ) $(BIN_DIR)
cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
+libpd: $(LOBJ) $(BIN_DIR)
+ cd ../obj; $(AR) r $(LIBPD) $(LOBJ)
+ @# linux
+ @#cd ../obj; $(CC) -shared -Wl,-soname,libpd.so.1 -o libpd.so.$(PD_VERSION) $(LOBJ)
+ @# mac OS
+ @#cd ../obj; $(CC) -Wl,-dylib_install_name -Wl,libpd.dylib.$(PD_VERSION) -o libpd.dylib $(LOBJ)
+ @# windows
+ @#???
+
$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) $(GLIB)
--- ../../pd-0.42-5/src/makefile.in 2008-12-29 19:08:26.000000000 +0000
+++ makefile.in 2009-07-15 14:16:53.000000000 +0100
@@ -2,6 +2,7 @@
OBJ_DIR = ../obj
BIN_DIR = ../bin
PDEXEC = $(BIN_DIR)/pd
+LIBPD = $(BIN_DIR)/libpd.a
EXT= @EXT@
GUINAME= @GUINAME@
@@ -42,14 +43,14 @@
ASIOOBJ = $(ASIOSRC:.cpp=.o)
-SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
+LSRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \
m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
m_conf.c m_glob.c m_sched.c \
s_main.c s_inter.c s_file.c s_print.c \
- s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
+ s_loader.c s_path.c s_audio.c s_midi.c \
d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
d_math.c d_fft.c d_array.c d_global.c \
d_delay.c d_resample.c \
@@ -57,7 +58,12 @@
x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c x_list.c d_soundfile.c \
$(SYSSRC)
-OBJ = $(SRC:.c=.o)
+# the main() file isn't required by libpd
+SRC = $(LSRC) s_entry.c
+
+OBJ = $(SRC:.c=.o)
+
+LOBJ = $(LSRC:.c=.o)
GSRC = @GUISRC@
@@ -123,6 +129,15 @@
$(PDEXEC): $(OBJ) $(BIN_DIR)
cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
+libpd: $(LOBJ) $(BIN_DIR)
+ cd ../obj; $(AR) r $(LIBPD) $(LOBJ)
+ @# linux
+ @#cd ../obj; $(CC) -shared -Wl,-soname,libpd.so.1 -o libpd.so.$(PD_VERSION) $(LOBJ)
+ @# mac OS
+ @#cd ../obj; $(CC) -Wl,-dylib_install_name -Wl,libpd.dylib.$(PD_VERSION) -o libpd.dylib $(LOBJ)
+ @# windows
+ @#???
+
$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) $(GLIB)
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list