aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--configure.ac7
-rw-r--r--examples/puredata/Makefile.am4
-rw-r--r--examples/simpletest/Makefile.am2
-rw-r--r--examples/simpletest/simpletest.c9
-rw-r--r--src/Makefile.am2
-rw-r--r--src/c-ringbuf/ringbuf.c354
-rw-r--r--src/c-ringbuf/ringbuf.h245
-rw-r--r--src/descriptors.c59
-rw-r--r--src/fft.h11
-rw-r--r--src/helper.c6
-rw-r--r--src/init.c48
-rw-r--r--src/libxtract.c2
-rw-r--r--src/scalar.c55
-rw-r--r--src/stateful.c93
-rw-r--r--src/vector.c10
-rw-r--r--swig/java/Makefile.am4
-rw-r--r--swig/python/Makefile.am4
-rw-r--r--swig/xtract.i11
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract.sln20
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.lastbuildstate2
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.pch.ib_tag0
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.ib_pdb_indexbin0 -> 105 bytes
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.idbbin0 -> 134144 bytes
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj126
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj.filters119
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/ReadMe.txt37
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/Release/LibXtract.lastbuildstate2
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/stdafx.cpp8
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/stdafx.h14
-rw-r--r--vc2012/LibXtract_static_dll/LibXtract/targetver.h8
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract.sln20
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.lastbuildstate2
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.pch.ib_tag0
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.ib_pdb_indexbin0 -> 105 bytes
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.idbbin0 -> 134144 bytes
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj126
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj.filters119
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/ReadMe.txt37
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/Release/LibXtract.lastbuildstate2
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/stdafx.cpp8
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/stdafx.h14
-rw-r--r--vc2012/LibXtract_static_llib/LibXtract/targetver.h8
-rw-r--r--xtract/libxtract.h10
-rw-r--r--xtract/xtract_helper.h11
-rw-r--r--xtract/xtract_scalar.h27
-rw-r--r--xtract/xtract_stateful.h67
47 files changed, 1662 insertions, 55 deletions
diff --git a/.gitignore b/.gitignore
index 92825f7..d092427 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,10 @@
*.pd_*
examples/simpletest/simpletest
+# VS files
+*.sdf
+*.tlog
+
# http://www.gnu.org/software/automake
Makefile.in
diff --git a/configure.ac b/configure.ac
index 2e6a1da..114b513 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ PACKAGE=libxtract
AC_INIT([libxtract], [libxtract_version], [libxtract-devel@lists.sourceforge.net])
AC_DEFINE(LIBXTRACT_VERSION, libxtract_version, [LibXtract Version])
-AM_INIT_AUTOMAKE(1.6)
+AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
@@ -126,8 +126,9 @@ AC_ARG_WITH(javac,
dnl If --enable-swig, make with java bindings
AC_ARG_WITH(java,
- [ --with-java If --enable-swig - make with java bindings (default=no) ],
- [with_java=true])
+ [ --with-java=no If --enable-swig - make with java bindings (default=no) ],
+ [with_java=true
+ ])
AM_CONDITIONAL(BUILD_JAVA, test "x${with_java}" = 'xtrue')
diff --git a/examples/puredata/Makefile.am b/examples/puredata/Makefile.am
index a86acb3..ee594d7 100644
--- a/examples/puredata/Makefile.am
+++ b/examples/puredata/Makefile.am
@@ -15,9 +15,7 @@ xtract_@PD_SUFFIX@_SOURCES = xtract~.c
pdincludedir = $(pddir)/src
-INCLUDES = -I$(top_srcdir)/src -I$(pdincludedir)
-
-AM_CFLAGS = @PD_CFLAGS@
+AM_CFLAGS = @PD_CFLAGS@ -I$(top_srcdir)/src -I$(pdincludedir)
AM_LDFLAGS = @PD_LDFLAGS@ -lxtract -L$(top_builddir)/src/
## Install the documentation.
diff --git a/examples/simpletest/Makefile.am b/examples/simpletest/Makefile.am
index c3ab176..d4d9230 100644
--- a/examples/simpletest/Makefile.am
+++ b/examples/simpletest/Makefile.am
@@ -1,7 +1,7 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_PROGRAMS = simpletest
-INCLUDES = -I$(top_srcdir)/src
+AM_CFLAGS = -I$(top_srcdir)/src
simpletest_SOURCES = simpletest.c
simpletest_LDADD = ../../src/libxtract.la
diff --git a/examples/simpletest/simpletest.c b/examples/simpletest/simpletest.c
index df068c2..50b45f8 100644
--- a/examples/simpletest/simpletest.c
+++ b/examples/simpletest/simpletest.c
@@ -96,6 +96,7 @@ int main(void)
{
double mean = 0.0;
double f0 = 0.0;
+ double midicents = 0.0;
double flux = 0.0;
double centroid = 0.0;
double lowest = 0.0;
@@ -113,7 +114,9 @@ int main(void)
int rv = XTRACT_SUCCESS;
xtract_mel_filter mel_filters;
- fill_wavetable(344.53125f, NOISE); // 344.53125f = 128 samples @ 44100 Hz
+ // fill_wavetable(344.53125f, NOISE); // 344.53125f = 128 samples @ 44100 Hz
+ fill_wavetable(344.53125f, SINE); // 344.53125f = 128 samples @ 44100 Hz
+
/*
print_wavetable();
*/
@@ -122,6 +125,10 @@ int main(void)
xtract[XTRACT_WAVELET_F0](wavetable, BLOCKSIZE, &samplerate, &f0);
printf("\nF0: %f\n", f0);
+ /* get the F0 as a MIDI note */
+ xtract[XTRACT_MIDICENT](NULL, 0, &f0, &midicents);
+ printf("\nMIDI cents: %f\n", midicents);
+
/* get the mean of the input */
xtract[XTRACT_MEAN](wavetable, BLOCKSIZE, NULL, &mean);
printf("\nInput mean = %.2f\n\n", mean); /* We expect this to be zero for a square wave */
diff --git a/src/Makefile.am b/src/Makefile.am
index 71f81ca..84cbb84 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,6 +16,8 @@ SOURCES = libxtract.c \
window.c \
fini.c \
helper.c \
+ stateful.c \
+ c-ringbuf/ringbuf.c \
dywapitchtrack/dywapitchtrack.c \
$(OOURA)
diff --git a/src/c-ringbuf/ringbuf.c b/src/c-ringbuf/ringbuf.c
new file mode 100644
index 0000000..048a622
--- /dev/null
+++ b/src/c-ringbuf/ringbuf.c
@@ -0,0 +1,354 @@
+/*
+ * ringbuf.c - C ring buffer (FIFO) implementation.
+ *
+ * Written in 2011 by Drew Hess <dhess-src@bothan.net>.
+ *
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to
+ * the public domain worldwide. This software is distributed without
+ * any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication
+ * along with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#include "ringbuf.h"
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <assert.h>
+
+/*
+ * The code is written for clarity, not cleverness or performance, and
+ * contains many assert()s to enforce invariant assumptions and catch
+ * bugs. Feel free to optimize the code and to remove asserts for use
+ * in your own projects, once you're comfortable that it functions as
+ * intended.
+ */
+
+struct ringbuf_t
+{
+ uint8_t *buf;
+ uint8_t *head, *tail;
+ size_t size;
+};
+
+ringbuf_t
+ringbuf_new(size_t capacity)
+{
+ ringbuf_t rb = malloc(sizeof(struct ringbuf_t));
+ if (rb) {
+
+ /* One byte is used for detecting the full condition. */
+ rb->size = capacity + 1;
+ rb->buf = malloc(rb->size);
+ if (rb->buf)
+ ringbuf_reset(rb);
+ else {
+ free(rb);
+ return 0;
+ }
+ }
+ return rb;
+}
+
+size_t
+ringbuf_buffer_size(const struct ringbuf_t *rb)
+{
+ return rb->size;
+}
+
+void
+ringbuf_reset(ringbuf_t rb)
+{
+ rb->head = rb->tail = rb->buf;
+}
+
+void
+ringbuf_free(ringbuf_t *rb)
+{
+ assert(rb && *rb);
+ free((*rb)->buf);
+ free(*rb);
+ *rb = 0;
+}
+
+size_t
+ringbuf_capacity(const struct ringbuf_t *rb)
+{
+ return ringbuf_buffer_size(rb) - 1;
+}
+
+/*
+ * Return a pointer to one-past-the-end of the ring buffer's
+ * contiguous buffer. You shouldn't normally need to use this function
+ * unless you're writing a new ringbuf_* function.
+ */
+static const uint8_t *
+ringbuf_end(const struct ringbuf_t *rb)
+{
+ return rb->buf + ringbuf_buffer_size(rb);
+}
+
+size_t
+ringbuf_bytes_free(const struct ringbuf_t *rb)
+{
+ if (rb->head >= rb->tail)
+ return ringbuf_capacity(rb) - (rb->head - rb->tail);
+ else
+ return rb->tail - rb->head - 1;
+}
+
+size_t
+ringbuf_bytes_used(const struct ringbuf_t *rb)
+{
+ return ringbuf_capacity(rb) - ringbuf_bytes_free(rb);
+}
+
+int
+ringbuf_is_full(const struct ringbuf_t *rb)
+{
+ return ringbuf_bytes_free(rb) == 0;
+}
+
+int
+ringbuf_is_empty(const struct ringbuf_t *rb)
+{
+ return ringbuf_bytes_free(rb) == ringbuf_capacity(rb);
+}
+
+const void *
+ringbuf_tail(const struct ringbuf_t *rb)
+{
+ return rb->tail;
+}
+
+const void *
+ringbuf_head(const struct ringbuf_t *rb)
+{
+ return rb->head;
+}
+
+/*
+ * Given a ring buffer rb and a pointer to a location within its
+ * contiguous buffer, return the a pointer to the next logical
+ * location in the ring buffer.
+ */
+static uint8_t *
+ringbuf_nextp(ringbuf_t rb, const uint8_t *p)
+{
+ /*
+ * The assert guarantees the expression (++p - rb->buf) is
+ * non-negative; therefore, the modulus operation is safe and
+ * portable.
+ */
+ assert((p >= rb->buf) && (p < ringbuf_end(rb)));
+ return rb->buf + ((++p - rb->buf) % ringbuf_buffer_size(rb));
+}
+
+size_t
+ringbuf_findchr(const struct ringbuf_t *rb, int c, size_t offset)
+{
+ const uint8_t *bufend = ringbuf_end(rb);
+ size_t bytes_used = ringbuf_bytes_used(rb);
+ if (offset >= bytes_used)
+ return bytes_used;
+
+ const uint8_t *start = rb->buf +
+ (((rb->tail - rb->buf) + offset) % ringbuf_buffer_size(rb));
+ assert(bufend > start);
+ size_t n = MIN(bufend - start, bytes_used - offset);
+ const uint8_t *found = memchr(start, c, n);
+ if (found)
+ return offset + (found - start);
+ else
+ return ringbuf_findchr(rb, c, offset + n);
+}
+
+size_t
+ringbuf_memset(ringbuf_t dst, int c, size_t len)
+{
+ const uint8_t *bufend = ringbuf_end(dst);
+ size_t nwritten = 0;
+ size_t count = MIN(len, ringbuf_buffer_size(dst));
+ int overflow = count > ringbuf_bytes_free(dst);
+
+ while (nwritten != count) {
+
+ /* don't copy beyond the end of the buffer */
+ assert(bufend > dst->head);
+ size_t n = MIN(bufend - dst->head, count - nwritten);
+ memset(dst->head, c, n);
+ dst->head += n;
+ nwritten += n;
+
+ /* wrap? */
+ if (dst->head == bufend)
+ dst->head = dst->buf;
+ }
+
+ if (overflow) {
+ dst->tail = ringbuf_nextp(dst, dst->head);
+ assert(ringbuf_is_full(dst));
+ }
+
+ return nwritten;
+}
+
+void *
+ringbuf_memcpy_into(ringbuf_t dst, const void *src, size_t count)
+{
+ const uint8_t *u8src = src;
+ const uint8_t *bufend = ringbuf_end(dst);
+ int overflow = count > ringbuf_bytes_free(dst);
+ size_t nread = 0;
+
+ while (nread != count) {
+ /* don't copy beyond the end of the buffer */
+ assert(bufend > dst->head);
+ size_t n = MIN(bufend - dst->head, count - nread);
+ memcpy(dst->head, u8src + nread, n);
+ dst->head += n;
+ nread += n;
+
+ /* wrap? */
+ if (dst->head == bufend)
+ dst->head = dst->buf;
+ }
+
+ if (overflow) {
+ dst->tail = ringbuf_nextp(dst, dst->head);
+ assert(ringbuf_is_full(dst));
+ }
+
+ return dst->head;
+}
+
+ssize_t
+ringbuf_read(int fd, ringbuf_t rb, size_t count)
+{
+ const uint8_t *bufend = ringbuf_end(rb);
+ size_t nfree = ringbuf_bytes_free(rb);
+
+ /* don't write beyond the end of the buffer */
+ assert(bufend > rb->head);
+ count = MIN(bufend - rb->head, count);
+ ssize_t n = read(fd, rb->head, count);
+ if (n > 0) {
+ assert(rb->head + n <= bufend);
+ rb->head += n;
+
+ /* wrap? */
+ if (rb->head == bufend)
+ rb->head = rb->buf;
+
+ /* fix up the tail pointer if an overflow occurred */
+ if (n > nfree) {
+ rb->tail = ringbuf_nextp(rb, rb->head);
+ assert(ringbuf_is_full(rb));
+ }
+ }
+
+ return n;
+}
+
+void *
+ringbuf_memcpy_from(void *dst, ringbuf_t src, size_t count, bool destroy)
+{
+ size_t bytes_used = ringbuf_bytes_used(src);
+ if (count > bytes_used)
+ return 0;
+
+ uint8_t *u8dst = dst;
+ const uint8_t *bufend = ringbuf_end(src);
+ uint8_t *tail = src->tail;
+ size_t nwritten = 0;
+ while (nwritten != count) {
+ assert(bufend > src->tail);
+ size_t n = MIN(bufend - src->tail, count - nwritten);
+ memcpy(u8dst + nwritten, src->tail, n);
+ src->tail += n;
+ nwritten += n;
+
+ /* wrap ? */
+ if (src->tail == bufend)
+ src->tail = src->buf;
+ }
+
+ if (!destroy)
+ {
+ src->tail = tail;
+ }
+
+ assert(count + ringbuf_bytes_used(src) == bytes_used);
+ return src->tail;
+}
+
+ssize_t
+ringbuf_write(int fd, ringbuf_t rb, size_t count)
+{
+ size_t bytes_used = ringbuf_bytes_used(rb);
+ if (count > bytes_used)
+ return 0;
+
+ const uint8_t *bufend = ringbuf_end(rb);
+ assert(bufend > rb->head);
+ count = MIN(bufend - rb->tail, count);
+ ssize_t n = write(fd, rb->tail, count);
+ if (n > 0) {
+ assert(rb->tail + n <= bufend);
+ rb->tail += n;
+
+ /* wrap? */
+ if (rb->tail == bufend)
+ rb->tail = rb->buf;
+
+ assert(n + ringbuf_bytes_used(rb) == bytes_used);
+ }
+
+ return n;
+}
+
+void *
+ringbuf_copy(ringbuf_t dst, ringbuf_t src, size_t count)
+{
+ size_t src_bytes_used = ringbuf_bytes_used(src);
+ if (count > src_bytes_used)
+ return 0;
+ int overflow = count > ringbuf_bytes_free(dst);
+
+ const uint8_t *src_bufend = ringbuf_end(src);
+ const uint8_t *dst_bufend = ringbuf_end(dst);
+ size_t ncopied = 0;
+ while (ncopied != count) {
+ assert(src_bufend > src->tail);
+ size_t nsrc = MIN(src_bufend - src->tail, count - ncopied);
+ assert(dst_bufend > dst->head);
+ size_t n = MIN(dst_bufend - dst->head, nsrc);
+ memcpy(dst->head, src->tail, n);
+ src->tail += n;
+ dst->head += n;
+ ncopied += n;
+
+ /* wrap ? */
+ if (src->tail == src_bufend)
+ src->tail = src->buf;
+ if (dst->head == dst_bufend)
+ dst->head = dst->buf;
+ }
+
+ assert(count + ringbuf_bytes_used(src) == src_bytes_used);
+
+ if (overflow) {
+ dst->tail = ringbuf_nextp(dst, dst->head);
+ assert(ringbuf_is_full(dst));
+ }
+
+ return dst->head;
+}
diff --git a/src/c-ringbuf/ringbuf.h b/src/c-ringbuf/ringbuf.h
new file mode 100644
index 0000000..e971317
--- /dev/null
+++ b/src/c-ringbuf/ringbuf.h
@@ -0,0 +1,245 @@
+#ifndef INCLUDED_RINGBUF_H
+#define INCLUDED_RINGBUF_H
+
+/*
+ * ringbuf.h - C ring buffer (FIFO) interface.
+ *
+ * Written in 2011 by Drew Hess <dhess-src@bothan.net>.
+ *
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to
+ * the public domain worldwide. This software is distributed without
+ * any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication
+ * along with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+/*
+ * A byte-addressable ring buffer FIFO implementation.
+ *
+ * The ring buffer's head pointer points to the starting location
+ * where data should be written when copying data *into* the buffer
+ * (e.g., with ringbuf_read). The ring buffer's tail pointer points to
+ * the starting location where data should be read when copying data
+ * *from* the buffer (e.g., with ringbuf_write).
+ */
+
+#include <stddef.h>
+#include <sys/types.h>
+#include <stdbool.h>
+
+typedef struct ringbuf_t *ringbuf_t;
+
+/*
+ * Create a new ring buffer with the given capacity (usable
+ * bytes). Note that the actual internal buffer size may be one or
+ * more bytes larger than the usable capacity, for bookkeeping.
+ *
+ * Returns the new ring buffer object, or 0 if there's not enough
+ * memory to fulfill the request for the given capacity.
+ */
+ringbuf_t
+ringbuf_new(size_t capacity);
+
+/*
+ * The size of the internal buffer, in bytes. One or more bytes may be
+ * unusable in order to distinguish the "buffer full" state from the
+ * "buffer empty" state.
+ *
+ * For the usable capacity of the ring buffer, use the
+ * ringbuf_capacity function.
+ */
+size_t
+ringbuf_buffer_size(const struct ringbuf_t *rb);
+
+/*
+ * Deallocate a ring buffer, and, as a side effect, set the pointer to
+ * 0.
+ */
+void
+ringbuf_free(ringbuf_t *rb);
+
+/*
+ * Reset a ring buffer to its initial state (empty).
+ */
+void
+ringbuf_reset(ringbuf_t rb);
+
+/*
+ * The usable capacity of the ring buffer, in bytes. Note that this
+ * value may be less than the ring buffer's internal buffer size, as
+ * returned by ringbuf_buffer_size.
+ */
+size_t
+ringbuf_capacity(const struct ringbuf_t *rb);
+
+/*
+ * The number of free/available bytes in the ring buffer. This value
+ * is never larger than the ring buffer's usable capacity.
+ */
+size_t
+ringbuf_bytes_free(const struct ringbuf_t *rb);
+
+/*
+ * The number of bytes currently being used in the ring buffer. This
+ * value is never larger than the ring buffer's usable capacity.
+ */
+size_t
+ringbuf_bytes_used(const struct ringbuf_t *rb);
+
+int
+ringbuf_is_full(const struct ringbuf_t *rb);
+
+int
+ringbuf_is_empty(const struct ringbuf_t *rb);
+
+/*
+ * Const access to the head and tail pointers of the ring buffer.
+ */
+const void *
+ringbuf_tail(const struct ringbuf_t *rb);
+
+const void *
+ringbuf_head(const struct ringbuf_t *rb);
+
+/*
+ * Locate the first occurrence of character c (converted to an
+ * unsigned char) in ring buffer rb, beginning the search at offset
+ * bytes from the ring buffer's tail pointer. The function returns the
+ * offset of the character from the ring buffer's tail pointer, if
+ * found. If c does not occur in the ring buffer, the function returns
+ * the number of bytes used in the ring buffer.
+ *
+ * Note that the offset parameter and the returned offset are logical
+ * offsets from the tail pointer, not necessarily linear offsets.
+ */
+size_t
+ringbuf_findchr(const struct ringbuf_t *rb, int c, size_t offset);
+
+/*
+ * Beginning at ring buffer dst's head pointer, fill the ring buffer
+ * with a repeating sequence of len bytes, each of value c (converted
+ * to an unsigned char). len can be as large as you like, but the
+ * function will never write more than ringbuf_buffer_size(dst) bytes
+ * in a single invocation, since that size will cause all bytes in the
+ * ring buffer to be written exactly once each.
+ *
+ * Note that if len is greater than the number of free bytes in dst,
+ * the ring buffer will overflow. When an overflow occurs, the state
+ * of the ring buffer is guaranteed to be consistent, including the
+ * head and tail pointers; old data will simply be overwritten in FIFO
+ * fashion, as needed. However, note that, if calling the function
+ * results in an overflow, the value of the ring buffer's tail pointer
+ * may be different than it was before the function was called.
+ *
+ * Returns the actual number of bytes written to dst: len, if
+ * len < ringbuf_buffer_size(dst), else ringbuf_buffer_size(dst).
+ */
+size_t
+ringbuf_memset(ringbuf_t dst, int c, size_t len);
+
+/*
+ * Copy n bytes from a contiguous memory area src into the ring buffer
+ * dst. Returns the ring buffer's new head pointer.
+ *
+ * It is possible to copy more data from src than is available in the
+ * buffer; i.e., it's possible to overflow the ring buffer using this
+ * function. When an overflow occurs, the state of the ring buffer is
+ * guaranteed to be consistent, including the head and tail pointers;
+ * old data will simply be overwritten in FIFO fashion, as
+ * needed. However, note that, if calling the function results in an
+ * overflow, the value of the ring buffer's tail pointer may be
+ * different than it was before the function was called.
+ */
+void *
+ringbuf_memcpy_into(ringbuf_t dst, const void *src, size_t count);
+
+/*
+ * This convenience function calls read(2) on the file descriptor fd,
+ * using the ring buffer rb as the destination buffer for the read,
+ * and returns the value returned by read(2). It will only call
+ * read(2) once, and may return a short count.
+ *
+ * It is possible to read more data from the file descriptor than is
+ * available in the buffer; i.e., it's possible to overflow the ring
+ * buffer using this function. When an overflow occurs, the state of
+ * the ring buffer is guaranteed to be consistent, including the head
+ * and tail pointers: old data will simply be overwritten in FIFO
+ * fashion, as needed. However, note that, if calling the function
+ * results in an overflow, the value of the ring buffer's tail pointer
+ * may be different than it was before the function was called.
+ */
+ssize_t
+ringbuf_read(int fd, ringbuf_t rb, size_t count);
+
+/*
+ * Copy n bytes from the ring buffer src, starting from its tail
+ * pointer, into a contiguous memory area dst. Returns the value of
+ * src's tail pointer after the copy is finished.
+ *
+ * Note if the destroy flag is set to true this copy is destructive with
+ * respect to the ring buffer:
+ * the n bytes copied from the ring buffer are no longer available in
+ * the ring buffer after the copy is complete, and the ring buffer
+ * will have n more free bytes than it did before the function was
+ * called.
+ *
+ * This function will *not* allow the ring buffer to underflow. If
+ * count is greater than the number of bytes used in the ring buffer,
+ * no bytes are copied, and the function will return 0.
+ */
+void *
+ringbuf_memcpy_from(void *dst, ringbuf_t src, size_t count, bool destroy);
+
+/*
+ * This convenience function calls write(2) on the file descriptor fd,
+ * using the ring buffer rb as the source buffer for writing (starting
+ * at the ring buffer's tail pointer), and returns the value returned
+ * by write(2). It will only call write(2) once, and may return a
+ * short count.
+ *
+ * Note that this copy is destructive with respect to the ring buffer:
+ * any bytes written from the ring buffer to the file descriptor are
+ * no longer available in the ring buffer after the copy is complete,
+ * and the ring buffer will have N more free bytes than it did before
+ * the function was called, where N is the value returned by the
+ * function (unless N is < 0, in which case an error occurred and no
+ * bytes were written).
+ *
+ * This function will *not* allow the ring buffer to underflow. If
+ * count is greater than the number of bytes used in the ring buffer,
+ * no bytes are written to the file descriptor, and the function will
+ * return 0.
+ */
+ssize_t
+ringbuf_write(int fd, ringbuf_t rb, size_t count);
+
+/*
+ * Copy count bytes from ring buffer src, starting from its tail
+ * pointer, into ring buffer dst. Returns dst's new head pointer after
+ * the copy is finished.
+ *
+ * Note that this copy is destructive with respect to the ring buffer
+ * src: any bytes copied from src into dst are no longer available in
+ * src after the copy is complete, and src will have 'count' more free
+ * bytes than it did before the function was called.
+ *
+ * It is possible to copy more data from src than is available in dst;
+ * i.e., it's possible to overflow dst using this function. When an
+ * overflow occurs, the state of dst is guaranteed to be consistent,
+ * including the head and tail pointers; old data will simply be
+ * overwritten in FIFO fashion, as needed. However, note that, if
+ * calling the function results in an overflow, the value dst's tail
+ * pointer may be different than it was before the function was
+ * called.
+ *
+ * It is *not* possible to underflow src; if count is greater than the
+ * number of bytes used in src, no bytes are copied, and the function
+ * returns 0.
+ */
+void *
+ringbuf_copy(ringbuf_t dst, ringbuf_t src, size_t count);
+
+#endif /* INCLUDED_RINGBUF_H */
diff --git a/src/descriptors.c b/src/descriptors.c
index 044f3d4..2bfdd35 100644
--- a/src/descriptors.c
+++ b/src/descriptors.c
@@ -42,7 +42,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
f = F = XTRACT_FEATURES;
- fd = malloc(XTRACT_FEATURES * sizeof(xtract_function_descriptor_t));
+ fd = (xtract_function_descriptor_t*)malloc(XTRACT_FEATURES * sizeof(xtract_function_descriptor_t));
/* FIX - this file probably needs a rewrite for readability */
@@ -88,6 +88,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_F0:
case XTRACT_FAILSAFE_F0:
case XTRACT_WAVELET_F0:
+ case XTRACT_MIDICENT:
*argv_min = XTRACT_SR_LOWER_LIMIT;
*argv_max = XTRACT_SR_UPPER_LIMIT;
*argv_def = XTRACT_SR_DEFAULT;
@@ -128,7 +129,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
*(argv_min + 1) = 0.0;
*(argv_max + 1) = 1.0 ;
*(argv_def + 1) = .1 ;
- *(argv_unit + 1) = XTRACT_NONE;
+ *(argv_unit + 1) = (xtract_unit_t)XTRACT_NONE;
break;
case XTRACT_NOISINESS:
case XTRACT_SKEWNESS:
@@ -139,11 +140,11 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
*argv_min = XTRACT_NONE;
*argv_max = XTRACT_NONE;
*argv_def = XTRACT_NONE;
- *argv_unit = XTRACT_NONE;
+ *argv_unit = (xtract_unit_t)XTRACT_NONE;
*(argv_min + 1) = XTRACT_NONE;
*(argv_max + 1) = XTRACT_NONE;
*(argv_def + 1) = XTRACT_NONE;
- *(argv_unit + 1) = XTRACT_NONE;
+ *(argv_unit + 1) = (xtract_unit_t)XTRACT_NONE;
break;
/* argc = 4 */
case XTRACT_SPECTRUM:
@@ -154,29 +155,29 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
*(argv_min + 1) = 0;
*(argv_max + 1) = 3 ;
*(argv_def + 1) = 0;
- *(argv_unit + 1) = XTRACT_NONE;
+ *(argv_unit + 1) = (xtract_unit_t)XTRACT_NONE;
*(argv_min + 2) = 0;
*(argv_max + 2) = 1;
*(argv_def + 2) = 0;
- *(argv_unit + 2) = XTRACT_NONE;
+ *(argv_unit + 2) = (xtract_unit_t)XTRACT_NONE;
*(argv_min + 3) = 0;
*(argv_max + 3) = 1;
*(argv_def + 3) = 0;
- *(argv_unit + 3) = XTRACT_NONE;
+ *(argv_unit + 3) = (xtract_unit_t)XTRACT_NONE;
break;
case XTRACT_SUBBANDS:
*argv_min = XTRACT_ANY;
*argv_max = XTRACT_ANY;
*argv_def = XTRACT_MEAN;
- *argv_unit = XTRACT_NONE;
+ *argv_unit = (xtract_unit_t)XTRACT_NONE;
*(argv_min + 1) = 1;
*(argv_max + 1) = 16384;
*(argv_def + 1) = 4;
- *(argv_unit + 1) = XTRACT_NONE;
+ *(argv_unit + 1) = (xtract_unit_t)XTRACT_NONE;
*(argv_min + 2) = 0;
*(argv_max + 2) = 32;
*(argv_def + 2) = 0;
- *(argv_unit + 2) = XTRACT_NONE;
+ *(argv_unit + 2) = (xtract_unit_t)XTRACT_NONE;
*(argv_min + 3) = 0;
*(argv_max + 3) = XTRACT_ANY;
*(argv_def + 3) = 0;
@@ -190,7 +191,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
*argv_min = XTRACT_NONE;
*argv_max = XTRACT_NONE;
*argv_def = XTRACT_NONE;
- *argv_unit = XTRACT_NONE;
+ *argv_unit = (xtract_unit_t)XTRACT_NONE;
break;
}
@@ -230,6 +231,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_F0:
case XTRACT_FAILSAFE_F0:
case XTRACT_WAVELET_F0:
+ case XTRACT_MIDICENT:
*argv_donor = XTRACT_ANY;
break;
case XTRACT_MFCC:
@@ -380,6 +382,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
break;
case XTRACT_ATTACK_TIME:
case XTRACT_DECAY_TIME:
+ case XTRACT_MIDICENT:
default:
*data_format = XTRACT_NO_DATA;
break;
@@ -440,7 +443,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_LPCC:
case XTRACT_WINDOWED:
case XTRACT_SUBBANDS:
- *data_unit = XTRACT_ANY;
+ *data_unit = (xtract_unit_t)XTRACT_ANY;
break;
case XTRACT_SPECTRAL_MEAN:
case XTRACT_SPECTRAL_VARIANCE:
@@ -620,6 +623,13 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
"Extract the fundamental frequency of an audio signal (wavelet method)");
strcpy(author, "Antoine Schmitt");
break;
+ case XTRACT_MIDICENT:
+ strcpy(name, "midicent");
+ strcpy(p_name, "Frequency to MIDI Cent conversion");
+ strcpy(desc, "Convert frequency in Hertz to Pitch in MIDI cents");
+ strcpy(p_desc, "Convert frequency in Hertz to Pitch in MIDI cents");
+ strcpy(author, "Jamie Bullock");
+ break;
case XTRACT_TONALITY:
strcpy(name, "tonality");
strcpy(p_name, "Tonality");
@@ -993,6 +1003,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_F0:
case XTRACT_FAILSAFE_F0:
case XTRACT_WAVELET_F0:
+ case XTRACT_MIDICENT:
case XTRACT_FLATNESS_DB:
case XTRACT_TONALITY:
*argc = 1;
@@ -1117,6 +1128,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_F0:
case XTRACT_FAILSAFE_F0:
case XTRACT_WAVELET_F0:
+ case XTRACT_MIDICENT:
case XTRACT_FLUX:
case XTRACT_LNORM:
case XTRACT_NONZERO_COUNT:
@@ -1195,6 +1207,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_F0:
case XTRACT_FAILSAFE_F0:
case XTRACT_WAVELET_F0:
+ case XTRACT_MIDICENT:
case XTRACT_NONZERO_COUNT:
case XTRACT_AUTOCORRELATION:
case XTRACT_AMDF:
@@ -1238,7 +1251,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_LNORM:
case XTRACT_NONZERO_COUNT:
case XTRACT_WINDOWED:
- *result_unit = XTRACT_ANY;
+ *result_unit = (xtract_unit_t)XTRACT_ANY;
*result_min = XTRACT_ANY;
*result_max = XTRACT_ANY;
break;
@@ -1251,7 +1264,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_TRISTIMULUS_3:
case XTRACT_NOISINESS:
case XTRACT_SMOOTHNESS:
- *result_unit = XTRACT_NONE;
+ *result_unit = (xtract_unit_t)XTRACT_NONE;
*result_min = XTRACT_ANY; /* FIX: need to check these */
*result_max = XTRACT_ANY;
break;
@@ -1270,13 +1283,17 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
*result_min = 0.0;
*result_max = XTRACT_SR_UPPER_LIMIT / 2.0;
break;
+ case XTRACT_MIDICENT:
+ *result_unit = XTRACT_MIDI_CENT;
+ *result_min = 0.0;
+ *result_max = 12700;
case XTRACT_ZCR:
*result_unit = XTRACT_HERTZ;
*result_min = 0.0;
*result_max = XTRACT_ANY;
break;
case XTRACT_ODD_EVEN_RATIO:
- *result_unit = XTRACT_NONE;
+ *result_unit = (xtract_unit_t)XTRACT_NONE;
*result_min = 0.0;
*result_max = 1.0;
break;
@@ -1296,7 +1313,7 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_LPC:
case XTRACT_LPCC:
default:
- *result_unit = XTRACT_UNKNOWN;
+ *result_unit = (xtract_unit_t)XTRACT_UNKNOWN;
*result_min = XTRACT_UNKNOWN;
*result_max = XTRACT_UNKNOWN;
break;
@@ -1319,11 +1336,11 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
case XTRACT_SUBBANDS:
case XTRACT_WINDOWED:
*result_format = XTRACT_ARBITRARY_SERIES;
- *result_unit = XTRACT_ANY;
+ *result_unit = (xtract_unit_t)XTRACT_ANY;
break;
case XTRACT_BARK_COEFFICIENTS:
*result_format = XTRACT_BARK_COEFFS;
- *result_unit = XTRACT_UNKNOWN; /* FIX: check */
+ *result_unit = (xtract_unit_t)XTRACT_UNKNOWN; /* FIX: check */
break;
case XTRACT_PEAK_SPECTRUM:
case XTRACT_SPECTRUM:
@@ -1335,15 +1352,15 @@ xtract_function_descriptor_t *xtract_make_descriptors(void)
break;
case XTRACT_MFCC:
*result_format = XTRACT_MEL_COEFFS;
- *result_unit = XTRACT_UNKNOWN; /* FIX: check */
+ *result_unit = (xtract_unit_t)XTRACT_UNKNOWN; /* FIX: check */
break;
case XTRACT_LPC:
*result_format = XTRACT_LPC_COEFFS;
- *result_unit = XTRACT_UNKNOWN;
+ *result_unit = (xtract_unit_t)XTRACT_UNKNOWN;
break;
case XTRACT_LPCC:
*result_format = XTRACT_LPCC_COEFFS;
- *result_unit = XTRACT_UNKNOWN;
+ *result_unit = (xtract_unit_t)XTRACT_UNKNOWN;
break;
default:
break;
diff --git a/src/fft.h b/src/fft.h
index 22d6166..790ebe0 100644
--- a/src/fft.h
+++ b/src/fft.h
@@ -28,7 +28,16 @@
#include <config.h>
#endif
-#include <stdbool.h>
+#ifdef _MSC_VER
+ #define USE_OOURA
+ #ifndef __cplusplus
+ typedef int bool;
+ #define false 0
+ #define true 1
+ #endif
+#else
+ #include <stdbool.h>
+#endif
#ifdef USE_OOURA
#include "ooura/fftsg.h"
diff --git a/src/helper.c b/src/helper.c
index 182276f..5b7155f 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -75,7 +75,8 @@ int xtract_features_from_subframes(const double *data, const int N, const int fe
}
-inline int xtract_is_denormal(double const d)
+//inline int xtract_is_denormal(double const d)
+int xtract_is_denormal(double const d)
{
if(sizeof(d) != 2 * sizeof(int))
fprintf(stderr, "libxtract: Error: xtract_is_denormal() detects inconsistent wordlength for type 'double'\n");
@@ -84,7 +85,8 @@ inline int xtract_is_denormal(double const d)
return (l&0x7ff00000) == 0 && d!=0; //Check for 0 may not be necessary
}
-inline bool xtract_is_poweroftwo(unsigned int x)
+//inline bool xtract_is_poweroftwo(unsigned int x)
+bool xtract_is_poweroftwo(unsigned int x)
{
return ((x != 0) && !(x & (x - 1)));
}
diff --git a/src/init.c b/src/init.c
index 10c5535..f7962fa 100644
--- a/src/init.c
+++ b/src/init.c
@@ -43,7 +43,7 @@
#ifdef USE_OOURA
void xtract_init_ooura_data(xtract_ooura_data *ooura_data, unsigned int N)
{
- ooura_data->ooura_ip = (int *)calloc(2 + sqrt(N), sizeof(int));
+ ooura_data->ooura_ip = (int *)calloc(2 + sqrt((double)N), sizeof(int));
ooura_data->ooura_w = (double *)calloc(N * 5 / 4, sizeof(double));
ooura_data->initialised = true;
}
@@ -251,19 +251,53 @@ int xtract_init_mfcc(int N, double nyquist, int style, double freq_min, double f
fft_peak = NULL;
norm = 1;
+ if (freq_bands <= 1)
+ {
+ return XTRACT_ARGUMENT_ERROR;
+ }
+
mel_freq_max = 1127 * log(1 + freq_max / 700);
mel_freq_min = 1127 * log(1 + freq_min / 700);
freq_bw_mel = (mel_freq_max - mel_freq_min) / freq_bands;
mel_peak = (double *)malloc((freq_bands + 2) * sizeof(double));
/* +2 for zeros at start and end */
+
+ if (mel_peak == NULL)
+ {
+ perror("error");
+ return XTRACT_MALLOC_FAILED;
+ }
+
lin_peak = (double *)malloc((freq_bands + 2) * sizeof(double));
+
+ if (lin_peak == NULL)
+ {
+ perror("error");
+ free(mel_peak);
+ return XTRACT_MALLOC_FAILED;
+ }
+
fft_peak = (int *)malloc((freq_bands + 2) * sizeof(int));
+
+ if (fft_peak == NULL)
+ {
+ perror("error");
+ free(mel_peak);
+ free(lin_peak);
+ return XTRACT_MALLOC_FAILED;
+ }
+
height_norm = (double *)malloc(freq_bands * sizeof(double));
-
- if(mel_peak == NULL || height_norm == NULL ||
- lin_peak == NULL || fft_peak == NULL)
+
+ if (height_norm == NULL)
+ {
+ perror("error");
+ free(mel_peak);
+ free(lin_peak);
+ free(fft_peak);
return XTRACT_MALLOC_FAILED;
+ }
M = N >> 1;
@@ -272,7 +306,7 @@ int xtract_init_mfcc(int N, double nyquist, int style, double freq_min, double f
fft_peak[0] = lin_peak[0] / nyquist * M;
- for (n = 1; n < freq_bands + 2; n++)
+ for (n = 1; n < (freq_bands + 2); ++n)
{
//roll out peak locations - mel, linear and linear on fft window scale
mel_peak[n] = mel_peak[n - 1] + freq_bw_mel;
@@ -363,7 +397,7 @@ double *xtract_init_window(const int N, const int type)
{
double *window;
- window = malloc(N * sizeof(double));
+ window = (double*)malloc(N * sizeof(double));
switch (type)
{
@@ -410,7 +444,7 @@ void xtract_free_window(double *window)
#ifdef __GNUC__
__attribute__((constructor)) void init()
#else
-void _init()·
+void _init()
#endif
{
#ifdef USE_OOURA
diff --git a/src/libxtract.c b/src/libxtract.c
index 99162fb..624e8cd 100644
--- a/src/libxtract.c
+++ b/src/libxtract.c
@@ -36,7 +36,6 @@ int(*xtract[])(const double *, const int, const void *, double *) =
xtract_spectral_mean,
xtract_spectral_variance,
xtract_spectral_standard_deviation,
- /* xtract_spectral_average_deviation, */
xtract_spectral_skewness,
xtract_spectral_kurtosis,
xtract_spectral_centroid,
@@ -69,6 +68,7 @@ int(*xtract[])(const double *, const int, const void *, double *) =
xtract_f0,
xtract_failsafe_f0,
xtract_wavelet_f0,
+ xtract_midicent,
/* xtract_delta.h */
xtract_lnorm,
xtract_flux,
diff --git a/src/scalar.c b/src/scalar.c
index becf341..74d6cee 100644
--- a/src/scalar.c
+++ b/src/scalar.c
@@ -889,8 +889,8 @@ int xtract_f0(const double *data, const int N, const void *argv, double *result)
if(sr == 0)
sr = 44100.0;
- input = (double *)malloc(bytes = N * sizeof(double));
- input = memcpy(input, data, bytes);
+ input = (double*)malloc(bytes = N * sizeof(double));
+ input = (double*)memcpy(input, data, bytes);
/* threshold_peak = *((double *)argv+1);
threshold_centre = *((double *)argv+2);
printf("peak: %.2\tcentre: %.2\n", threshold_peak, threshold_centre);*/
@@ -1000,4 +1000,55 @@ int xtract_wavelet_f0(const double *data, const int N, const void *argv, double
return XTRACT_SUCCESS;
}
+int xtract_midicent(const double *data, const int N, const void *argv, double *result)
+{
+ double f0 = *(double *)argv;
+ double note = 0.0;
+
+ note = 69 + log(f0 / 440.f) * 17.31234;
+ note *= 100;
+ note = floor( 0.5f + note ); // replace -> round(note);
+
+ *result = note;
+
+ if (note > 12700 || note < 0)
+ {
+ return XTRACT_ARGUMENT_ERROR;
+ }
+
+ return XTRACT_SUCCESS;
+}
+
+int xtract_peak(const double *data, const int N, const void *argv, double *result)
+{
+ double threshold = *(double *)argv;
+ double current = data[N - 1];
+ double average = 0.0;
+ double maximum = -DBL_MAX;
+
+ for (uint32_t n = 0; n < N; ++n)
+ {
+ average += data[n];
+ if (data[n] > maximum)
+ {
+ maximum = data[n];
+ }
+ }
+
+ average /= (double)N;
+
+ if (current != maximum)
+ {
+ return XTRACT_NO_RESULT;
+ }
+
+ if (current < average + threshold)
+ {
+ return XTRACT_NO_RESULT;
+ }
+
+ return XTRACT_SUCCESS;
+
+}
+
diff --git a/src/stateful.c b/src/stateful.c
new file mode 100644
index 0000000..501db45
--- /dev/null
+++ b/src/stateful.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2012 Jamie Bullock
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+/* stateful.c: declares functions that extract features that require stateful data to be retained between frames */
+
+#include "../xtract/xtract_stateful.h"
+#include "../xtract/libxtract.h"
+
+#include "c-ringbuf/ringbuf.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <float.h>
+
+struct xtract_last_n_state_
+{
+ ringbuf_t ringbuf;
+};
+
+
+xtract_last_n_state *xtract_last_n_state_new(size_t N)
+{
+ xtract_last_n_state *last_n_state = malloc(sizeof(xtract_last_n_state));
+
+ if (last_n_state == NULL)
+ {
+ perror("could not allocate memory for xtract_last_n_state");
+ return NULL;
+ }
+
+ last_n_state->ringbuf = ringbuf_new(N * sizeof(double));
+
+ if (last_n_state->ringbuf)
+ {
+ perror("could not allocate memory for xtract_last_n_state->ringbuf");
+ }
+
+ return last_n_state;
+}
+
+void xtract_last_n_state_delete(xtract_last_n_state *last_n_state)
+{
+ ringbuf_free(&last_n_state->ringbuf);
+ free(last_n_state);
+}
+
+int xtract_last_n(const xtract_last_n_state *state, const double *data, const int N, const void *argv, double *result)
+{
+ double *current = (double *)argv;
+ size_t N_bytes = N * sizeof(double);
+
+ if (N_bytes != ringbuf_capacity(state->ringbuf))
+ {
+ fprintf(stderr, "libxtract: error: xtract_last_n(): inconsitent size");
+ return XTRACT_BAD_STATE;
+ }
+
+ ringbuf_memcpy_into(state->ringbuf, current, sizeof(double));
+ size_t used = ringbuf_bytes_used(state->ringbuf);
+ ringbuf_memcpy_from(result, state->ringbuf, used, false);
+
+ if (used < N_bytes)
+ {
+ /* zero pad */
+ for (size_t n = used / sizeof(double); n < N; ++n)
+ {
+ result[n] = 0.0;
+ }
+ }
+
+ return XTRACT_SUCCESS;
+}
+
diff --git a/src/vector.c b/src/vector.c
index 5074b65..9c49c2c 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -83,7 +83,7 @@ int xtract_spectrum(const double *data, const int N, const void *argv, double *r
* the output format is
* a[0] - DC, a[1] - nyquist, a[2...N-1] - remaining bins
*/
- fft = malloc(N * sizeof(double));
+ fft = (double*)malloc(N * sizeof(double));
assert(fft != NULL);
memcpy(fft, data, N * sizeof(double));
@@ -375,7 +375,7 @@ int xtract_dct(const double *data, const int N, const void *argv, double *result
int n;
int m;
- double *temp = calloc(N, sizeof(double));
+ double *temp = (double*)calloc(N, sizeof(double));
for (n = 0; n < N; ++n)
{
@@ -502,7 +502,7 @@ int xtract_peak_spectrum(const double *data, const int N, const void *argv, doub
bytes = N * sizeof(double);
if(input != NULL)
- input = memcpy(input, data, bytes);
+ input = (double*)memcpy(input, data, bytes);
else
return XTRACT_MALLOC_FAILED;
@@ -562,8 +562,8 @@ int xtract_harmonic_spectrum(const double *data, const int N, const void *argv,
if(freqs[n])
{
ratio = freqs[n] / f0;
- nearest = round(ratio);
- distance = fabs(nearest - ratio);
+ nearest = floor( 0.5f + ratio); // replace -> nearest = round(ratio);
+ distance = fabs(nearest - ratio);
if(distance > threshold)
result[n] = result[M + n] = 0.0;
else
diff --git a/swig/java/Makefile.am b/swig/java/Makefile.am
index e45d297..8205201 100644
--- a/swig/java/Makefile.am
+++ b/swig/java/Makefile.am
@@ -64,11 +64,11 @@ javaclasses = \
xtract_vector_t.class \
xtract_window_types_.class
-BUILT_SOURCES = $(srcdir)/xtract_wrap.c
+BUILT_SOURCES = xtract_wrap.c
SWIG_SOURCES = jxtract.i
lib_LTLIBRARIES = libjxtract.la
-libjxtract_la_SOURCES = $(srcdir)/xtract_wrap.c $(SWIG_SOURCES)
+libjxtract_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES)
libjxtract_la_CFLAGS = $(SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src
libjxtract_la_LDFLAGS = -lxtract
libjxtract_la_LIBADD = $(top_srcdir)/src/libxtract.la
diff --git a/swig/python/Makefile.am b/swig/python/Makefile.am
index 92f8b00..833c2f3 100644
--- a/swig/python/Makefile.am
+++ b/swig/python/Makefile.am
@@ -1,11 +1,11 @@
MAINTAINERCLEANFILES = xtract.py xtract_wrap.c Makefile.in _xtract.so
-BUILT_SOURCES = $(srcdir)/xtract_wrap.c
+BUILT_SOURCES = xtract_wrap.c
SWIG_SOURCES = ../xtract.i
pkgpython_PYTHON = xtract.py __init__.py
pkgpyexec_LTLIBRARIES = _xtract.la
-_xtract_la_SOURCES = $(srcdir)/xtract_wrap.c $(SWIG_SOURCES)
+_xtract_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES)
_xtract_la_CFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src
_xtract_la_LDFLAGS = -module
_xtract_la_LIBADD = $(top_srcdir)/src/libxtract.la
diff --git a/swig/xtract.i b/swig/xtract.i
index 226aa2b..49169c0 100644
--- a/swig/xtract.i
+++ b/swig/xtract.i
@@ -3,6 +3,7 @@
#ifndef SWIGJAVA
%include carrays.i
#endif
+%include stdint.i
%{
#include "xtract/xtract_scalar.h"
@@ -10,9 +11,11 @@
#include "xtract/xtract_helper.h"
#include "xtract/xtract_macros.h"
#include "xtract/xtract_delta.h"
+#include "xtract/xtract_stateful.h"
#include "xtract/libxtract.h"
%}
+
/* Helper functions */
%inline %{
@@ -78,6 +81,12 @@
%ignore xtract;
+/* For now ignore stateful functions */
+%ignore xtract_last_n;
+%ignore xtract_last_n_state_new;
+%ignore xtract_last_n_state_delete;
+
+
%include "xtract/xtract_scalar.h"
/* We have to put xtract_delta declarations inline because it contains a mixture of vector and scalar functions */
@@ -96,7 +105,9 @@
%}
+
%include "xtract/xtract_vector.h"
+%include "xtract/xtract_stateful.h"
%include "xtract/xtract_helper.h"
%include "xtract/xtract_macros.h"
%include "xtract/libxtract.h"
diff --git a/vc2012/LibXtract_static_dll/LibXtract.sln b/vc2012/LibXtract_static_dll/LibXtract.sln
new file mode 100644
index 0000000..e478212
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibXtract", "LibXtract\LibXtract.vcxproj", "{8C5AA960-7918-4D2D-B620-8B208E00A532}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Debug|Win32.Build.0 = Debug|Win32
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Release|Win32.ActiveCfg = Release|Win32
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.lastbuildstate b/vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.lastbuildstate
new file mode 100644
index 0000000..5d4a2ce
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.lastbuildstate
@@ -0,0 +1,2 @@
+#v4.0:v110:false
+Debug|Win32|C:\Users\Q\Code\LibXtract\vc2012\LibXtract_static_dll\|
diff --git a/vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.pch.ib_tag b/vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.pch.ib_tag
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/Debug/LibXtract.pch.ib_tag
diff --git a/vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.ib_pdb_index b/vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.ib_pdb_index
new file mode 100644
index 0000000..a306a4d
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.ib_pdb_index
Binary files differ
diff --git a/vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.idb b/vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.idb
new file mode 100644
index 0000000..86e10ef
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/Debug/vc110.idb
Binary files differ
diff --git a/vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj b/vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj
new file mode 100644
index 0000000..bc70090
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{8C5AA960-7918-4D2D-B620-8B208E00A532}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>LibXtract</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)\lib\</OutDir>
+ <TargetName>$(ProjectName)_d</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)\lib\</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\src\dywapitchtrack\dywapitchtrack.h" />
+ <ClInclude Include="..\..\..\src\fft.h" />
+ <ClInclude Include="..\..\..\src\ooura\fftsg.h" />
+ <ClInclude Include="..\..\..\src\xtract_globals_private.h" />
+ <ClInclude Include="..\..\..\src\xtract_macros_private.h" />
+ <ClInclude Include="..\..\..\src\xtract_window_private.h" />
+ <ClInclude Include="..\..\..\xtract\libxtract.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_delta.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_helper.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_macros.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_scalar.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_types.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_vector.h" />
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\src\delta.c" />
+ <ClCompile Include="..\..\..\src\descriptors.c" />
+ <ClCompile Include="..\..\..\src\dywapitchtrack\dywapitchtrack.c" />
+ <ClCompile Include="..\..\..\src\fini.c" />
+ <ClCompile Include="..\..\..\src\helper.c" />
+ <ClCompile Include="..\..\..\src\init.c" />
+ <ClCompile Include="..\..\..\src\libxtract.c" />
+ <ClCompile Include="..\..\..\src\ooura\fftsg.c" />
+ <ClCompile Include="..\..\..\src\scalar.c" />
+ <ClCompile Include="..\..\..\src\vector.c" />
+ <ClCompile Include="..\..\..\src\window.c" />
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\..\src\Makefile.am" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj.filters b/vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj.filters
new file mode 100644
index 0000000..d2e2002
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/LibXtract.vcxproj.filters
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ <Filter Include="Source Files\ooura">
+ <UniqueIdentifier>{4b080b90-2736-4aa7-ac76-6426243a4b71}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\dywapitchtrack">
+ <UniqueIdentifier>{ce27305e-5718-466e-be83-b45600d88a56}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\xtract">
+ <UniqueIdentifier>{a53ce415-7563-4e4c-8491-3582dcf43a3a}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="stdafx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="targetver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\fft.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\xtract_globals_private.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\xtract_macros_private.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\xtract_window_private.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\dywapitchtrack\dywapitchtrack.h">
+ <Filter>Source Files\dywapitchtrack</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\ooura\fftsg.h">
+ <Filter>Source Files\ooura</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\libxtract.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_delta.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_helper.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_macros.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_scalar.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_types.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_vector.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\delta.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\descriptors.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\fini.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\helper.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\init.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libxtract.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\scalar.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\vector.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\window.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\dywapitchtrack\dywapitchtrack.c">
+ <Filter>Source Files\dywapitchtrack</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\ooura\fftsg.c">
+ <Filter>Source Files\ooura</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\..\src\Makefile.am">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/vc2012/LibXtract_static_dll/LibXtract/ReadMe.txt b/vc2012/LibXtract_static_dll/LibXtract/ReadMe.txt
new file mode 100644
index 0000000..7f54fcf
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/ReadMe.txt
@@ -0,0 +1,37 @@
+========================================================================
+ STATIC LIBRARY : LibXtract Project Overview
+========================================================================
+
+AppWizard has created this LibXtract library project for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your LibXtract application.
+
+
+LibXtract.vcxproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+LibXtract.vcxproj.filters
+ This is the filters file for VC++ projects generated using an Application Wizard.
+ It contains information about the association between the files in your project
+ and the filters. This association is used in the IDE to show grouping of files with
+ similar extensions under a specific node (for e.g. ".cpp" files are associated with the
+ "Source Files" filter).
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named LibXtract.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/vc2012/LibXtract_static_dll/LibXtract/Release/LibXtract.lastbuildstate b/vc2012/LibXtract_static_dll/LibXtract/Release/LibXtract.lastbuildstate
new file mode 100644
index 0000000..a4d4e20
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/Release/LibXtract.lastbuildstate
@@ -0,0 +1,2 @@
+#v4.0:v110:false
+Release|Win32|C:\Users\Q\Code\LibXtract\vc2012\LibXtract_static_dll\|
diff --git a/vc2012/LibXtract_static_dll/LibXtract/stdafx.cpp b/vc2012/LibXtract_static_dll/LibXtract/stdafx.cpp
new file mode 100644
index 0000000..8b47bed
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// LibXtract.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/vc2012/LibXtract_static_dll/LibXtract/stdafx.h b/vc2012/LibXtract_static_dll/LibXtract/stdafx.h
new file mode 100644
index 0000000..5459378
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/stdafx.h
@@ -0,0 +1,14 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+
+
+// TODO: reference additional headers your program requires here
diff --git a/vc2012/LibXtract_static_dll/LibXtract/targetver.h b/vc2012/LibXtract_static_dll/LibXtract/targetver.h
new file mode 100644
index 0000000..87c0086
--- /dev/null
+++ b/vc2012/LibXtract_static_dll/LibXtract/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
diff --git a/vc2012/LibXtract_static_llib/LibXtract.sln b/vc2012/LibXtract_static_llib/LibXtract.sln
new file mode 100644
index 0000000..e478212
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibXtract", "LibXtract\LibXtract.vcxproj", "{8C5AA960-7918-4D2D-B620-8B208E00A532}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Debug|Win32.Build.0 = Debug|Win32
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Release|Win32.ActiveCfg = Release|Win32
+ {8C5AA960-7918-4D2D-B620-8B208E00A532}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.lastbuildstate b/vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.lastbuildstate
new file mode 100644
index 0000000..8839d19
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.lastbuildstate
@@ -0,0 +1,2 @@
+#v4.0:v110:false
+Debug|Win32|C:\Users\Q\Code\LibXtract\vc2012\LibXtract_static_llib\|
diff --git a/vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.pch.ib_tag b/vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.pch.ib_tag
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/Debug/LibXtract.pch.ib_tag
diff --git a/vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.ib_pdb_index b/vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.ib_pdb_index
new file mode 100644
index 0000000..a306a4d
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.ib_pdb_index
Binary files differ
diff --git a/vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.idb b/vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.idb
new file mode 100644
index 0000000..85e6b87
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/Debug/vc110.idb
Binary files differ
diff --git a/vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj b/vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj
new file mode 100644
index 0000000..f57c37e
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{8C5AA960-7918-4D2D-B620-8B208E00A532}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>LibXtract</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)\lib\</OutDir>
+ <TargetName>$(ProjectName)_d</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)\lib\</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\src\dywapitchtrack\dywapitchtrack.h" />
+ <ClInclude Include="..\..\..\src\fft.h" />
+ <ClInclude Include="..\..\..\src\ooura\fftsg.h" />
+ <ClInclude Include="..\..\..\src\xtract_globals_private.h" />
+ <ClInclude Include="..\..\..\src\xtract_macros_private.h" />
+ <ClInclude Include="..\..\..\src\xtract_window_private.h" />
+ <ClInclude Include="..\..\..\xtract\libxtract.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_delta.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_helper.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_macros.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_scalar.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_types.h" />
+ <ClInclude Include="..\..\..\xtract\xtract_vector.h" />
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\src\delta.c" />
+ <ClCompile Include="..\..\..\src\descriptors.c" />
+ <ClCompile Include="..\..\..\src\dywapitchtrack\dywapitchtrack.c" />
+ <ClCompile Include="..\..\..\src\fini.c" />
+ <ClCompile Include="..\..\..\src\helper.c" />
+ <ClCompile Include="..\..\..\src\init.c" />
+ <ClCompile Include="..\..\..\src\libxtract.c" />
+ <ClCompile Include="..\..\..\src\ooura\fftsg.c" />
+ <ClCompile Include="..\..\..\src\scalar.c" />
+ <ClCompile Include="..\..\..\src\vector.c" />
+ <ClCompile Include="..\..\..\src\window.c" />
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\..\src\Makefile.am" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj.filters b/vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj.filters
new file mode 100644
index 0000000..d2e2002
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/LibXtract.vcxproj.filters
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ <Filter Include="Source Files\ooura">
+ <UniqueIdentifier>{4b080b90-2736-4aa7-ac76-6426243a4b71}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\dywapitchtrack">
+ <UniqueIdentifier>{ce27305e-5718-466e-be83-b45600d88a56}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\xtract">
+ <UniqueIdentifier>{a53ce415-7563-4e4c-8491-3582dcf43a3a}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="stdafx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="targetver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\fft.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\xtract_globals_private.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\xtract_macros_private.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\xtract_window_private.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\dywapitchtrack\dywapitchtrack.h">
+ <Filter>Source Files\dywapitchtrack</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\ooura\fftsg.h">
+ <Filter>Source Files\ooura</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\libxtract.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_delta.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_helper.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_macros.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_scalar.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_types.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\xtract\xtract_vector.h">
+ <Filter>Header Files\xtract</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\delta.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\descriptors.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\fini.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\helper.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\init.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libxtract.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\scalar.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\vector.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\window.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\dywapitchtrack\dywapitchtrack.c">
+ <Filter>Source Files\dywapitchtrack</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\ooura\fftsg.c">
+ <Filter>Source Files\ooura</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\..\src\Makefile.am">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/vc2012/LibXtract_static_llib/LibXtract/ReadMe.txt b/vc2012/LibXtract_static_llib/LibXtract/ReadMe.txt
new file mode 100644
index 0000000..7f54fcf
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/ReadMe.txt
@@ -0,0 +1,37 @@
+========================================================================
+ STATIC LIBRARY : LibXtract Project Overview
+========================================================================
+
+AppWizard has created this LibXtract library project for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your LibXtract application.
+
+
+LibXtract.vcxproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+LibXtract.vcxproj.filters
+ This is the filters file for VC++ projects generated using an Application Wizard.
+ It contains information about the association between the files in your project
+ and the filters. This association is used in the IDE to show grouping of files with
+ similar extensions under a specific node (for e.g. ".cpp" files are associated with the
+ "Source Files" filter).
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named LibXtract.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/vc2012/LibXtract_static_llib/LibXtract/Release/LibXtract.lastbuildstate b/vc2012/LibXtract_static_llib/LibXtract/Release/LibXtract.lastbuildstate
new file mode 100644
index 0000000..45f56de
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/Release/LibXtract.lastbuildstate
@@ -0,0 +1,2 @@
+#v4.0:v110:false
+Release|Win32|C:\Users\Q\Code\LibXtract\vc2012\LibXtract_static_llib\|
diff --git a/vc2012/LibXtract_static_llib/LibXtract/stdafx.cpp b/vc2012/LibXtract_static_llib/LibXtract/stdafx.cpp
new file mode 100644
index 0000000..8b47bed
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// LibXtract.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/vc2012/LibXtract_static_llib/LibXtract/stdafx.h b/vc2012/LibXtract_static_llib/LibXtract/stdafx.h
new file mode 100644
index 0000000..5459378
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/stdafx.h
@@ -0,0 +1,14 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+
+
+// TODO: reference additional headers your program requires here
diff --git a/vc2012/LibXtract_static_llib/LibXtract/targetver.h b/vc2012/LibXtract_static_llib/LibXtract/targetver.h
new file mode 100644
index 0000000..87c0086
--- /dev/null
+++ b/vc2012/LibXtract_static_llib/LibXtract/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
diff --git a/xtract/libxtract.h b/xtract/libxtract.h
index c5140d4..8c20980 100644
--- a/xtract/libxtract.h
+++ b/xtract/libxtract.h
@@ -71,7 +71,7 @@ extern "C" {
* @{
*/
-#define XTRACT_FEATURES 60
+#define XTRACT_FEATURES 61
/** \brief Enumeration of features, elements are used as indixes to an array of pointers to feature extracton functions */
enum xtract_features_ {
@@ -117,6 +117,7 @@ enum xtract_features_ {
XTRACT_F0,
XTRACT_FAILSAFE_F0,
XTRACT_WAVELET_F0,
+ XTRACT_MIDICENT,
XTRACT_LNORM,
XTRACT_FLUX,
XTRACT_ATTACK_TIME,
@@ -171,9 +172,11 @@ enum xtract_return_codes_ {
XTRACT_MALLOC_FAILED,
XTRACT_BAD_ARGV,
XTRACT_BAD_VECTOR_SIZE,
+ XTRACT_BAD_STATE,
XTRACT_DENORMAL_FOUND,
XTRACT_NO_RESULT, /* This usually occurs when the correct calculation cannot take place because required data is missing or would result in a NaN or infinity/-infinity. Under these curcumstances 0.f is usually given by *result */
- XTRACT_FEATURE_NOT_IMPLEMENTED
+ XTRACT_FEATURE_NOT_IMPLEMENTED,
+ XTRACT_ARGUMENT_ERROR
};
/** \brief Enumeration of spectrum types */
@@ -207,7 +210,8 @@ typedef enum unit_ {
XTRACT_DBFS_HERTZ,
XTRACT_PERCENT,
XTRACT_BINS,
- XTRACT_SONE
+ XTRACT_SONE,
+ XTRACT_MIDI_CENT
} xtract_unit_t;
/** \brief Boolean */
diff --git a/xtract/xtract_helper.h b/xtract/xtract_helper.h
index bc5b892..9dabfbc 100644
--- a/xtract/xtract_helper.h
+++ b/xtract/xtract_helper.h
@@ -30,7 +30,16 @@
extern "C" {
#endif
-#include <stdbool.h>
+#ifdef _MSC_VER
+ #ifndef __cplusplus
+ typedef int bool;
+ #define false 0
+ #define true 1
+ #endif
+#else
+ #include <stdbool.h>
+#endif
+
/**
* \defgroup helper helper functions
diff --git a/xtract/xtract_scalar.h b/xtract/xtract_scalar.h
index 4461623..8e24284 100644
--- a/xtract/xtract_scalar.h
+++ b/xtract/xtract_scalar.h
@@ -434,6 +434,19 @@ int xtract_failsafe_f0(const double *data, const int N, const void *argv, double
*/
int xtract_wavelet_f0(const double *data, const int N, const void *argv, double *result);
+
+/** \brief Convenience function to convert a frequency in Hertz to a "pitch" value in MIDI cents
+ *
+ * \param *data: not used
+ * \param N: not used
+ * \param *argv: a pointer to a double-precision floating point value representing a frequency in Hertz
+ * \param *result: a pointer to a double-precision floating point value representing a "pitch" in MIDI cents
+ * \return if *argv value causes a *result within the range 0..127, XTRACT_SUCCESS will be returned, otherwise XTRACT_ARGUMENT_ERROR
+ *
+ */
+int xtract_midicent(const double *data, const int N, const void *argv, double *result);
+
+
/** \brief Extract the number of non-zero elements in an input vector
*
* \param *data: a pointer to the first element in an array of doubles
@@ -444,6 +457,20 @@ int xtract_wavelet_f0(const double *data, const int N, const void *argv, double
*/
int xtract_nonzero_count(const double *data, const int N, const void *argv, double *result);
+/**
+ * \brief Return XTRACT_SUCCESS if the 'current' value is considered a peak
+ *
+ * @param data a pointer to an array containing time series as provided by *result from xtract_last_n() where the Nth value is considered the 'current' value
+ * @param N an integer representing the number of elements in the time series
+ * @param argv a pointer to a double representing the threshold, whereby the current value will be considered a peak if it is above the average of the last N values (*data) by the threshold
+ * @param result a pointer to a copy of the current value if the current value is considered a peak
+ *
+ *
+ * @return XTRACT_SUCCESS if a peak was found or XTRACT_NO_RESULT if not
+ */
+int xtract_peak(const double *data, const int N, const void *argv, double *result);
+
+
/** @} */
#ifdef __cplusplus
diff --git a/xtract/xtract_stateful.h b/xtract/xtract_stateful.h
new file mode 100644
index 0000000..e26926d
--- /dev/null
+++ b/xtract/xtract_stateful.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Jamie Bullock
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+/** \file xtract_stateful.h: declares functions that extract features that require stateful data to be retained between frames */
+#ifndef XTRACT_STATEFUL_H
+#define XTRACT_STATEFUL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup stateful feature extraction functions and data structures
+ *
+ * Functions that extract a feature over multiple frames
+ *
+ * @{
+ */
+
+
+#include <stdint.h>
+#include <string.h>
+
+struct ringbuf_t;
+typedef struct ringbuf_t *ringbuf_t;
+typedef struct xtract_last_n_state_ xtract_last_n_state;
+
+xtract_last_n_state *xtract_last_n_state_new(size_t capacity);
+void xtract_last_n_state_delete(xtract_last_n_state *last_n_state);
+
+
+/**
+ * Write a vector of the last N input values to `result`
+ *
+ * @param state a pointer to an xtract_peak_picker_state struct as allocated by xtract_peak_picker_state_new()
+ * @param data a pointer to a double representing the current input value
+ * @param N an integer representing 'N' the number of values to be written to *result
+ * @param argv a pointer to NULL
+ * @param result a pointer to an array of doubles representing the last N values, where the nth value is the current one. The array must have been allocated to size N elements and initialised by the caller
+ *
+ */
+int xtract_last_n(const xtract_last_n_state *state, const double *data, const int N, const void *argv, double *result);
+
+
+
+
+#endif