added simple cpp interface draft
authorPaul Brossier <piem@piem.org>
Tue, 4 Dec 2007 16:58:40 +0000 (17:58 +0100)
committerPaul Brossier <piem@piem.org>
Tue, 4 Dec 2007 16:58:40 +0000 (17:58 +0100)
Makefile.am
configure.ac
cpp/Makefile.am [new file with mode: 0644]
cpp/aubiocpp.cpp [new file with mode: 0644]
cpp/aubiocpp.h [new file with mode: 0644]

index ab6963d2d35b9972cdf4338d097bd97e5978673e..3993669acc55d5fca27e45050da447b709d61a5e 100644 (file)
@@ -9,7 +9,7 @@ PYTHONDIR = python
 endif
 endif
 
-SUBDIRS = src ext examples sounds plugins $(PYTHONDIR) $(SWIGDIR) $(DOC)
+SUBDIRS = src ext cpp examples sounds plugins $(PYTHONDIR) $(SWIGDIR) $(DOC)
 EXTRA_DIST = bootstrap VERSION
 
 docs:
index fd55df04498e04391871bed3e1d98f26deea4c22..d085555d05fbcb2dc454bfb1ebabaadd86dab5a5 100644 (file)
@@ -248,6 +248,7 @@ AC_OUTPUT([
     Makefile
     src/Makefile
     ext/Makefile
+    cpp/Makefile
     examples/Makefile
     tests/Makefile
     tests/src/Makefile
diff --git a/cpp/Makefile.am b/cpp/Makefile.am
new file mode 100644 (file)
index 0000000..2bc064d
--- /dev/null
@@ -0,0 +1,7 @@
+pkginclude_HEADERS = aubiocpp.h
+
+lib_LTLIBRARIES = libaubiocpp.la 
+libaubiocpp_la_SOURCES = aubiocpp.cpp
+AM_CFLAGS = -I$(top_srcdir)/src @AUBIO_CFLAGS@ @FFTWLIB_CFLAGS@ @SAMPLERATE_CFLAGS@
+libaubiocpp_la_LIBADD  = -laubio -L${top_builddir}/src @FFTWLIB_LIBS@ @SAMPLERATE_LIBS@ @LTLIBOBJS@
+libaubiocpp_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
diff --git a/cpp/aubiocpp.cpp b/cpp/aubiocpp.cpp
new file mode 100644 (file)
index 0000000..314298d
--- /dev/null
@@ -0,0 +1,28 @@
+#include "aubio.h"
+#include "aubiocpp.h"
+
+namespace aubio {
+
+  fvec::fvec(uint_t length, uint_t channels) {
+        self = new_fvec(length, channels);
+  }
+
+  fvec::~fvec() {
+    del_fvec(self);
+  }
+
+  smpl_t* fvec::operator[]( uint_t channel ) {
+    return self->data[channel];
+  }
+
+  cvec::cvec(uint_t length, uint_t channels) {
+    self = new_cvec(length, channels);
+    norm = self->norm;
+    phas = self->phas;
+  }
+
+  cvec::~cvec() {
+    del_cvec(self);
+  }
+
+}
diff --git a/cpp/aubiocpp.h b/cpp/aubiocpp.h
new file mode 100644 (file)
index 0000000..d2c0848
--- /dev/null
@@ -0,0 +1,31 @@
+#include "aubio.h"
+
+namespace aubio {
+
+  class fvec {
+
+    private:
+      fvec_t * self;
+
+    public:
+      fvec(uint_t length, uint_t channels);
+      ~fvec();
+      smpl_t* operator[]( uint_t channel );
+
+  };
+
+  class cvec {
+
+    private:
+      cvec_t * self;
+
+    public:
+      smpl_t ** norm;
+      smpl_t ** phas;
+
+      cvec(uint_t length, uint_t channels);
+      ~cvec();
+
+  };
+
+}