shithub: aubio

Download patch

ref: c60d684ebe44c6d8aa22f574fdac7a938c7da7cf
parent: 45f1f0619e5ab0f80611af832f6cc6283f643773
author: Paul Brossier <[email protected]>
date: Tue Dec 4 12:58:40 EST 2007

added simple cpp interface draft

--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,7 @@
 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:
--- a/configure.ac
+++ b/configure.ac
@@ -248,6 +248,7 @@
     Makefile
     src/Makefile
     ext/Makefile
+    cpp/Makefile
     examples/Makefile
     tests/Makefile
     tests/src/Makefile
--- /dev/null
+++ b/cpp/Makefile.am
@@ -1,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@
--- /dev/null
+++ b/cpp/aubiocpp.cpp
@@ -1,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);
+  }
+
+}
--- /dev/null
+++ b/cpp/aubiocpp.h
@@ -1,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();
+
+  };
+
+}