From c60d684ebe44c6d8aa22f574fdac7a938c7da7cf Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 4 Dec 2007 17:58:40 +0100 Subject: [PATCH] added simple cpp interface draft --- Makefile.am | 2 +- configure.ac | 1 + cpp/Makefile.am | 7 +++++++ cpp/aubiocpp.cpp | 28 ++++++++++++++++++++++++++++ cpp/aubiocpp.h | 31 +++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 cpp/Makefile.am create mode 100644 cpp/aubiocpp.cpp create mode 100644 cpp/aubiocpp.h diff --git a/Makefile.am b/Makefile.am index ab6963d2..3993669a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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: diff --git a/configure.ac b/configure.ac index fd55df04..d085555d 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 00000000..2bc064dc --- /dev/null +++ b/cpp/Makefile.am @@ -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 index 00000000..314298d5 --- /dev/null +++ b/cpp/aubiocpp.cpp @@ -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 index 00000000..d2c08484 --- /dev/null +++ b/cpp/aubiocpp.h @@ -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(); + + }; + +} -- 2.26.2