diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-06-19 16:24:27 -0400 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-06-19 16:24:27 -0400 |
| commit | 8adfb3bd99b4dcff2459756af090a640fd7a4b4a (patch) | |
| tree | c1e6adddda335f4d36a98039ccc5ac867ae7296d /pysoundtouch/src/pybpmdetect.h | |
clone
Diffstat (limited to 'pysoundtouch/src/pybpmdetect.h')
| -rw-r--r-- | pysoundtouch/src/pybpmdetect.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/pysoundtouch/src/pybpmdetect.h b/pysoundtouch/src/pybpmdetect.h new file mode 100644 index 0000000..54438d0 --- /dev/null +++ b/pysoundtouch/src/pybpmdetect.h @@ -0,0 +1,41 @@ +/* + * python interface to soundtouch (the open-source audio processing library) + * BPM Detection + */ + +#ifndef __PY_BMPDETECT_H__ +#define __PY_BMPDETECT_H__ + +#include <Python.h> +#include <BPMDetect.h> + +#define BUFFER_SIZE 44100 + +// Definition of the bpmdetect object +typedef struct { + PyObject_HEAD + soundtouch::BPMDetect* bpmdetect; + int channels; // 1 or 2 + union { + char chars[BUFFER_SIZE]; + short shorts[BUFFER_SIZE/2]; + } buffer; +} py_bpmdetect; /* Soundtouch */ + +#define PY_BPMDETECT(x) ((py_bpmdetect *) x) + +extern PyTypeObject py_bpmdetect_t; + +// Deallocate the BPMDetect object +static void py_bpmdetect_dealloc(PyObject* self, PyObject* args); + +// Read in a number of samples for beat detection +static PyObject* py_bpmdetect_put_samples(PyObject* self, PyObject* args); + +// Perform the beat detection algorithm +static PyObject* py_bpmdetect_get_bpm(PyObject* self, PyObject* args); + +// Extract information from the bpmdetect object +static PyObject* py_bpmdetect_getattr(PyObject* self, char* name); + +#endif |
