summaryrefslogtreecommitdiffstats
path: root/src/bindings
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-31 23:17:02 +0000
committerDavid Robillard <d@drobilla.net>2007-07-31 23:17:02 +0000
commit22395ab7d817dec53e2c2fff07de6d88db70492e (patch)
treee1b4d749e96bfe31f1ba545ad979ca4bbe8807c5 /src/bindings
parent012890277d8c3124bc8dd1df20b8e016c8d6d811 (diff)
downloadingen-22395ab7d817dec53e2c2fff07de6d88db70492e.tar.gz
ingen-22395ab7d817dec53e2c2fff07de6d88db70492e.tar.bz2
ingen-22395ab7d817dec53e2c2fff07de6d88db70492e.zip
Functional engine Python bindings (e.g. ingen -e -r patchomatic.py).
Rename window nitpick fix from Andrew Greenwood. git-svn-id: http://svn.drobilla.net/lad/ingen@663 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/Makefile.am11
-rw-r--r--src/bindings/ingen.i28
-rwxr-xr-xsrc/bindings/test_ingen.py16
3 files changed, 36 insertions, 19 deletions
diff --git a/src/bindings/Makefile.am b/src/bindings/Makefile.am
index 083cb5a6..48a5ad4f 100644
--- a/src/bindings/Makefile.am
+++ b/src/bindings/Makefile.am
@@ -1,22 +1,22 @@
FLAGS = @RAUL_CFLAGS@ @GLIBMM_CFLAGS@ -I$(top_srcdir)/ingen/src/common
-LIBS = @RAUL_LIBS@ @GLIBMM_LIBS@
+LIBS = @RAUL_LIBS@ @GLIBMM_LIBS@ -lpython2.4
AM_CXXFLAGS = -I/usr/include/python2.4 $(FLAGS)
-EXTRA_DIST = ingen.i ingen_test.py
+EXTRA_DIST = ingen.i test_ingen.py
if WITH_SWIG
bindingsdir = $(libdir)/ingen
bindings_LTLIBRARIES = libingen_bindings.la
libingen_bindings_la_LDFLAGS = -no-undefined -module -avoid-version
-libingen_bindings_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ ../libs/module/libingen_module.la
-libingen_bindings_la_SOURCES = ingen_wrap.cxx
+libingen_bindings_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ #../libs/module/libingen_module.la
+libingen_bindings_la_SOURCES = ingen_wrap.cxx ingen_bindings.cpp ingen_bindings.hpp
swig: ingen.i
swig -c++ -Wall $(FLAGS) -python ingen.i
ingen_wrap.cxx: swig
-libingen_bindings_la: swig ingen_wrap.cxx
+libingen_bindings_la: swig ingen_wrap.cxx ingen_bindings.cpp
all-local: swig
ln -sf .libs/libingen_bindings.so _ingen.so
@@ -28,3 +28,4 @@ clean-local:
rm -f *.cxx
rm -f *.so
rm -f *.o
+ rm -f ingen.py
diff --git a/src/bindings/ingen.i b/src/bindings/ingen.i
index e9a13dc3..dbf5ab10 100644
--- a/src/bindings/ingen.i
+++ b/src/bindings/ingen.i
@@ -4,16 +4,12 @@
#include "../common/interface/ClientInterface.hpp"
#include "../common/interface/EngineInterface.hpp"
#include "../libs/module/World.hpp"
-#include "../libs/module/module.h"
+/*#include "../libs/module/module.h"*/
+#include "ingen_bindings.hpp"
namespace Ingen { namespace Shared {
class World;
} }
-typedef Ingen::Shared::World World;
-/*struct World {
- World() { me = Ingen::Shared::get_world(); }
- Ingen::Shared::World* me;
-};*/
%}
/*%ignore Ingen::Shared::EngineInterface;*/
@@ -22,18 +18,28 @@ typedef Ingen::Shared::World World;
%include "../common/interface/EngineInterface.hpp"
/*%include "../libs/module/World.hpp"
%include "../libs/module/module.h"*/
-%include "../libs/module/module.h"
+%include "../libs/module/World.hpp"
+//%include "../libs/module/module.h"
+%include "ingen_bindings.hpp"
using namespace Ingen::Shared;
namespace Ingen { namespace Shared {
class World;
} }
-%typedef Ingen::Shared::World World;
-/*struct World {};*/
+typedef Ingen::Shared::World World;
+namespace Ingen { namespace Shared {
%extend World {
- World() { return Ingen::Shared::get_world(); }
+ World() {
+ if (!Ingen::Shared::ingen_world) {
+ fprintf(stderr, "ERROR: World uninitialized (running within Ingen?)\n");
+ abort();
+ } else {
+ return Ingen::Shared::ingen_world;
+ }
+ }
/*SLV2World slv2() { return $self->me->slv2_world; }*/
+};
+} }
/*SharedPtr<Ingen::Shared::EngineInterface> engine() { return $self->me->engine; }*/
-};
diff --git a/src/bindings/test_ingen.py b/src/bindings/test_ingen.py
index 93d524c6..794e51ba 100755
--- a/src/bindings/test_ingen.py
+++ b/src/bindings/test_ingen.py
@@ -1,8 +1,18 @@
#!/usr/bin/env python
import ingen
+import time
world = ingen.World()
-#w = ingen.get_world()
-print world
e = world.engine
-print e
+
+e.activate()
+e.create_port("/I", "ingen:midi", False)
+e.create_port("/made", "ingen:audio", False)
+e.create_port("/these", "ingen:audio", False)
+e.create_port("/in", "ingen:midi", True)
+e.create_port("/a", "ingen:audio", True)
+e.create_port("/script", "ingen:audio", True)
+
+while True:
+ time.sleep(1)
+