summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/portmidi/pm_python/pyportmidi/_pyportmidi.c
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/portmidi/pm_python/pyportmidi/_pyportmidi.c')
-rw-r--r--3rdparty/portmidi/pm_python/pyportmidi/_pyportmidi.c5663
1 files changed, 5663 insertions, 0 deletions
diff --git a/3rdparty/portmidi/pm_python/pyportmidi/_pyportmidi.c b/3rdparty/portmidi/pm_python/pyportmidi/_pyportmidi.c
new file mode 100644
index 00000000000..7d700349e18
--- /dev/null
+++ b/3rdparty/portmidi/pm_python/pyportmidi/_pyportmidi.c
@@ -0,0 +1,5663 @@
+/* Generated by Cython 0.12.1 on Sun Sep 26 13:30:09 2010 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#include "structmember.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#else
+
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#if PY_VERSION_HEX < 0x02040000
+ #define METH_COEXIST 0
+ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
+ #define PyDict_Contains(d,o) PySequence_Contains(d,o)
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+ typedef int Py_ssize_t;
+ #define PY_SSIZE_T_MAX INT_MAX
+ #define PY_SSIZE_T_MIN INT_MIN
+ #define PY_FORMAT_SIZE_T ""
+ #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+ #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
+ #define PyNumber_Index(o) PyNumber_Int(o)
+ #define PyIndex_Check(o) PyNumber_Check(o)
+ #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+ #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
+ #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+ #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
+ #define PyVarObject_HEAD_INIT(type, size) \
+ PyObject_HEAD_INIT(type) size,
+ #define PyType_Modified(t)
+
+ typedef struct {
+ void *buf;
+ PyObject *obj;
+ Py_ssize_t len;
+ Py_ssize_t itemsize;
+ int readonly;
+ int ndim;
+ char *format;
+ Py_ssize_t *shape;
+ Py_ssize_t *strides;
+ Py_ssize_t *suboffsets;
+ void *internal;
+ } Py_buffer;
+
+ #define PyBUF_SIMPLE 0
+ #define PyBUF_WRITABLE 0x0001
+ #define PyBUF_FORMAT 0x0004
+ #define PyBUF_ND 0x0008
+ #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
+ #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
+ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
+ #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
+ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
+
+#endif
+
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+
+#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyString_Type PyUnicode_Type
+ #define PyString_CheckExact PyUnicode_CheckExact
+#else
+ #define PyBytes_Type PyString_Type
+ #define PyBytes_CheckExact PyString_CheckExact
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
+#endif
+
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#else
+ #define _USE_MATH_DEFINES
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+ #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
+ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
+ #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
+#else
+ #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
+ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
+ #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+ #define __Pyx_NAMESTR(n) ((char *)(n))
+ #define __Pyx_DOCSTR(n) ((char *)(n))
+#else
+ #define __Pyx_NAMESTR(n) (n)
+ #define __Pyx_DOCSTR(n) (n)
+#endif
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+#include <math.h>
+#define __PYX_HAVE_API___pyportmidi
+#include "portmidi.h"
+#include "porttime.h"
+
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+
+typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+
+/* Type Conversion Predeclarations */
+
+#if PY_MAJOR_VERSION < 3
+#define __Pyx_PyBytes_FromString PyString_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize
+#define __Pyx_PyBytes_AsString PyString_AsString
+#else
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+#define __Pyx_PyBytes_AsString PyBytes_AsString
+#endif
+
+#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s))
+
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+
+#if !defined(T_PYSSIZET)
+#if PY_VERSION_HEX < 0x02050000
+#define T_PYSSIZET T_INT
+#elif !defined(T_LONGLONG)
+#define T_PYSSIZET \
+ ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
+ ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
+#else
+#define T_PYSSIZET \
+ ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
+ ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \
+ ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
+#endif
+#endif
+
+
+#if !defined(T_ULONGLONG)
+#define __Pyx_T_UNSIGNED_INT(x) \
+ ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \
+ ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
+ ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \
+ ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1))))
+#else
+#define __Pyx_T_UNSIGNED_INT(x) \
+ ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \
+ ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
+ ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \
+ ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \
+ ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
+#endif
+#if !defined(T_LONGLONG)
+#define __Pyx_T_SIGNED_INT(x) \
+ ((sizeof(x) == sizeof(char)) ? T_BYTE : \
+ ((sizeof(x) == sizeof(short)) ? T_SHORT : \
+ ((sizeof(x) == sizeof(int)) ? T_INT : \
+ ((sizeof(x) == sizeof(long)) ? T_LONG : -1))))
+#else
+#define __Pyx_T_SIGNED_INT(x) \
+ ((sizeof(x) == sizeof(char)) ? T_BYTE : \
+ ((sizeof(x) == sizeof(short)) ? T_SHORT : \
+ ((sizeof(x) == sizeof(int)) ? T_INT : \
+ ((sizeof(x) == sizeof(long)) ? T_LONG : \
+ ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))))
+#endif
+
+#define __Pyx_T_FLOATING(x) \
+ ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
+ ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))
+
+#if !defined(T_SIZET)
+#if !defined(T_ULONGLONG)
+#define T_SIZET \
+ ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
+ ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
+#else
+#define T_SIZET \
+ ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
+ ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \
+ ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
+#endif
+#endif
+
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
+
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+
+
+#ifdef __GNUC__
+/* Test for GCC > 2.95 */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* __GNUC__ > 2 ... */
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ > 2 ... */
+#else /* __GNUC__ */
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+static const char **__pyx_f;
+
+
+/* Type declarations */
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":394
+ *
+ *
+ * cdef class Input: # <<<<<<<<<<<<<<
+ * """
+ * class Input:
+ */
+
+struct __pyx_obj_11_pyportmidi_Input {
+ PyObject_HEAD
+ PmStream *midi;
+ int debug;
+ int i;
+};
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":201
+ * return Pm_Channel(chan-1)
+ *
+ * cdef class Output: # <<<<<<<<<<<<<<
+ * """
+ * class Output:
+ */
+
+struct __pyx_obj_11_pyportmidi_Output {
+ PyObject_HEAD
+ int i;
+ PmStream *midi;
+ int debug;
+ int _aborted;
+};
+
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+ end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+ }
+ #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+ #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
+#else
+ #define __Pyx_RefNannySetupContext(name)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+#endif /* CYTHON_REFNANNY */
+#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
+#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name, PyObject* kw_name); /*proto*/
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
+
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+ PyObject *r;
+ if (!j) return NULL;
+ r = PyObject_GetItem(o, j);
+ Py_DECREF(j);
+ return r;
+}
+
+
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+ if (likely(o != Py_None)) {
+ if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+ PyObject *r = PyList_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+ PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+ Py_INCREF(r);
+ return r;
+ }
+ }
+ return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+}
+
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+ if (likely(o != Py_None)) {
+ if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+ PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+ Py_INCREF(r);
+ return r;
+ }
+ }
+ return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+}
+
+
+#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+ PyObject *r;
+ if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+ r = PyList_GET_ITEM(o, i);
+ Py_INCREF(r);
+ }
+ else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+ r = PyTuple_GET_ITEM(o, i);
+ Py_INCREF(r);
+ }
+ else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
+ r = PySequence_GetItem(o, i);
+ }
+ else {
+ r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+ }
+ return r;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
+ if (likely(PyList_CheckExact(L))) {
+ if (PyList_Append(L, x) < 0) return NULL;
+ Py_INCREF(Py_None);
+ return Py_None; /* this is just to have an accurate signature */
+ }
+ else {
+ PyObject *r, *m;
+ m = __Pyx_GetAttrString(L, "append");
+ if (!m) return NULL;
+ r = PyObject_CallFunctionObjArgs(m, x, NULL);
+ Py_DECREF(m);
+ return r;
+ }
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmDeviceID(PmDeviceID);
+
+static CYTHON_INLINE PmDeviceID __Pyx_PyInt_from_py_PmDeviceID(PyObject *);
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PtTimestamp(PtTimestamp);
+
+static int __Pyx_Print(PyObject *, int); /*proto*/
+#if PY_MAJOR_VERSION >= 3
+static PyObject* __pyx_print = 0;
+static PyObject* __pyx_print_kwargs = 0;
+#endif
+
+static int __Pyx_PrintOne(PyObject *o); /*proto*/
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmMessage(PmMessage);
+
+static CYTHON_INLINE PmMessage __Pyx_PyInt_from_py_PmMessage(PyObject *);
+
+static CYTHON_INLINE PmTimestamp __Pyx_PyInt_from_py_PmTimestamp(PyObject *);
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmTimestamp(PmTimestamp);
+
+static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
+
+static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
+
+static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
+
+static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
+
+static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
+
+static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
+
+static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
+
+static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
+
+static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
+
+static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
+
+static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
+
+static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
+
+static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
+
+static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
+
+static void __Pyx_AddTraceback(const char *funcname); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+/* Module declarations from _pyportmidi */
+
+static PyTypeObject *__pyx_ptype_11_pyportmidi_Output = 0;
+static PyTypeObject *__pyx_ptype_11_pyportmidi_Input = 0;
+#define __Pyx_MODULE_NAME "_pyportmidi"
+int __pyx_module_is_main__pyportmidi = 0;
+
+/* Implementation of _pyportmidi */
+static PyObject *__pyx_builtin_Exception;
+static PyObject *__pyx_builtin_IndexError;
+static PyObject *__pyx_builtin_range;
+static char __pyx_k_1[] = "Opening Midi Output";
+static char __pyx_k_2[] = "Unable to open Midi OutputDevice=";
+static char __pyx_k_3[] = " err=";
+static char __pyx_k_4[] = "Closing MIDI output stream and destroying instance";
+static char __pyx_k_5[] = "midi Output not open.";
+static char __pyx_k_6[] = "midi Output aborted. Need to call Close after Abort.";
+static char __pyx_k_7[] = "maximum list length is 1024";
+static char __pyx_k_8[] = " arguments in event list";
+static char __pyx_k_9[] = " : ";
+static char __pyx_k_10[] = "writing to midi buffer";
+static char __pyx_k_11[] = "Writing to MIDI buffer";
+static char __pyx_k_12[] = "MIDI input opened.";
+static char __pyx_k_13[] = "Closing MIDI input stream and destroying instance";
+static char __pyx_k_14[] = "midi Input not open.";
+static char __pyx_k_15[] = "maximum buffer length is 1024";
+static char __pyx_k_16[] = "minimum buffer length is 1";
+static char __pyx_k_17[] = "0.07";
+static char __pyx_k_18[] = "FILT_CHANNEL_AFTERTOUCH";
+static char __pyx_k_19[] = "FILT_POLY_AFTERTOUCH";
+static char __pyx_k_20[] = "Initialize (line 132)";
+static char __pyx_k_21[] = "Terminate (line 139)";
+static char __pyx_k_22[] = "GetDeviceInfo (line 156)";
+static char __pyx_k_23[] = "Time (line 173)";
+static char __pyx_k_24[] = "GetErrorText (line 180)";
+static char __pyx_k_25[] = "Channel (line 187)";
+static char __pyx_k_26[] = "Output._check_open (line 248)";
+static char __pyx_k_27[] = "Output.Close (line 258)";
+static char __pyx_k_28[] = "Output.Abort (line 274)";
+static char __pyx_k_29[] = "Output.Write (line 293)";
+static char __pyx_k_30[] = "Output.WriteShort (line 333)";
+static char __pyx_k_31[] = "Output.WriteSysEx (line 356)";
+static char __pyx_k_32[] = "Input._check_open (line 422)";
+static char __pyx_k_33[] = "Input.Close (line 430)";
+static char __pyx_k_34[] = "Input.SetFilter (line 447)";
+static char __pyx_k_35[] = "Input.SetChannelMask (line 481)";
+static char __pyx_k_36[] = "Input.Poll (line 502)";
+static char __pyx_k_37[] = "Input.Read (line 514)";
+static char __pyx_k__B[] = "B";
+static char __pyx_k__i[] = "i";
+static char __pyx_k__msg[] = "msg";
+static char __pyx_k__Poll[] = "Poll";
+static char __pyx_k__Read[] = "Read";
+static char __pyx_k__TRUE[] = "TRUE";
+static char __pyx_k__Time[] = "Time";
+static char __pyx_k__midi[] = "midi";
+static char __pyx_k__name[] = "name";
+static char __pyx_k__when[] = "when";
+static char __pyx_k__Abort[] = "Abort";
+static char __pyx_k__Close[] = "Close";
+static char __pyx_k__FALSE[] = "FALSE";
+static char __pyx_k__Input[] = "Input";
+static char __pyx_k__Write[] = "Write";
+static char __pyx_k__array[] = "array";
+static char __pyx_k__data1[] = "data1";
+static char __pyx_k__data2[] = "data2";
+static char __pyx_k__debug[] = "debug";
+static char __pyx_k__input[] = "input";
+static char __pyx_k__range[] = "range";
+static char __pyx_k__Output[] = "Output";
+static char __pyx_k__interf[] = "interf";
+static char __pyx_k__opened[] = "opened";
+static char __pyx_k__output[] = "output";
+static char __pyx_k__status[] = "status";
+static char __pyx_k__Channel[] = "Channel";
+static char __pyx_k__FILT_F9[] = "FILT_F9";
+static char __pyx_k__FILT_FD[] = "FILT_FD";
+static char __pyx_k__latency[] = "latency";
+static char __pyx_k__message[] = "message";
+static char __pyx_k__FILT_MTC[] = "FILT_MTC";
+static char __pyx_k____main__[] = "__main__";
+static char __pyx_k____test__[] = "__test__";
+static char __pyx_k___aborted[] = "_aborted";
+static char __pyx_k__tostring[] = "tostring";
+static char __pyx_k__Exception[] = "Exception";
+static char __pyx_k__FILT_NOTE[] = "FILT_NOTE";
+static char __pyx_k__FILT_PLAY[] = "FILT_PLAY";
+static char __pyx_k__FILT_TICK[] = "FILT_TICK";
+static char __pyx_k__FILT_TUNE[] = "FILT_TUNE";
+static char __pyx_k__SetFilter[] = "SetFilter";
+static char __pyx_k__Terminate[] = "Terminate";
+static char __pyx_k__timestamp[] = "timestamp";
+static char __pyx_k__FILT_CLOCK[] = "FILT_CLOCK";
+static char __pyx_k__FILT_RESET[] = "FILT_RESET";
+static char __pyx_k__FILT_SYSEX[] = "FILT_SYSEX";
+static char __pyx_k__IndexError[] = "IndexError";
+static char __pyx_k__Initialize[] = "Initialize";
+static char __pyx_k__WriteShort[] = "WriteShort";
+static char __pyx_k__WriteSysEx[] = "WriteSysEx";
+static char __pyx_k__buffersize[] = "buffersize";
+static char __pyx_k__FILT_ACTIVE[] = "FILT_ACTIVE";
+static char __pyx_k__InputDevice[] = "InputDevice";
+static char __pyx_k____version__[] = "__version__";
+static char __pyx_k___check_open[] = "_check_open";
+static char __pyx_k__FILT_CONTROL[] = "FILT_CONTROL";
+static char __pyx_k__FILT_PROGRAM[] = "FILT_PROGRAM";
+static char __pyx_k__GetErrorText[] = "GetErrorText";
+static char __pyx_k__OutputDevice[] = "OutputDevice";
+static char __pyx_k__FILT_REALTIME[] = "FILT_REALTIME";
+static char __pyx_k__GetDeviceInfo[] = "GetDeviceInfo";
+static char __pyx_k__FILT_PITCHBEND[] = "FILT_PITCHBEND";
+static char __pyx_k__FILT_UNDEFINED[] = "FILT_UNDEFINED";
+static char __pyx_k__SetChannelMask[] = "SetChannelMask";
+static char __pyx_k__FILT_AFTERTOUCH[] = "FILT_AFTERTOUCH";
+static char __pyx_k__FILT_SONG_SELECT[] = "FILT_SONG_SELECT";
+static char __pyx_k__FILT_SONG_POSITION[] = "FILT_SONG_POSITION";
+static PyObject *__pyx_kp_s_1;
+static PyObject *__pyx_kp_s_10;
+static PyObject *__pyx_kp_s_11;
+static PyObject *__pyx_kp_s_12;
+static PyObject *__pyx_kp_s_13;
+static PyObject *__pyx_kp_s_14;
+static PyObject *__pyx_kp_s_15;
+static PyObject *__pyx_kp_s_16;
+static PyObject *__pyx_kp_s_17;
+static PyObject *__pyx_n_s_18;
+static PyObject *__pyx_n_s_19;
+static PyObject *__pyx_kp_s_2;
+static PyObject *__pyx_kp_u_20;
+static PyObject *__pyx_kp_u_21;
+static PyObject *__pyx_kp_u_22;
+static PyObject *__pyx_kp_u_23;
+static PyObject *__pyx_kp_u_24;
+static PyObject *__pyx_kp_u_25;
+static PyObject *__pyx_kp_u_26;
+static PyObject *__pyx_kp_u_27;
+static PyObject *__pyx_kp_u_28;
+static PyObject *__pyx_kp_u_29;
+static PyObject *__pyx_kp_s_3;
+static PyObject *__pyx_kp_u_30;
+static PyObject *__pyx_kp_u_31;
+static PyObject *__pyx_kp_u_32;
+static PyObject *__pyx_kp_u_33;
+static PyObject *__pyx_kp_u_34;
+static PyObject *__pyx_kp_u_35;
+static PyObject *__pyx_kp_u_36;
+static PyObject *__pyx_kp_u_37;
+static PyObject *__pyx_kp_s_4;
+static PyObject *__pyx_kp_s_5;
+static PyObject *__pyx_kp_s_6;
+static PyObject *__pyx_kp_s_7;
+static PyObject *__pyx_kp_s_8;
+static PyObject *__pyx_kp_s_9;
+static PyObject *__pyx_n_s__Abort;
+static PyObject *__pyx_n_s__B;
+static PyObject *__pyx_n_s__Channel;
+static PyObject *__pyx_n_s__Close;
+static PyObject *__pyx_n_s__Exception;
+static PyObject *__pyx_n_s__FALSE;
+static PyObject *__pyx_n_s__FILT_ACTIVE;
+static PyObject *__pyx_n_s__FILT_AFTERTOUCH;
+static PyObject *__pyx_n_s__FILT_CLOCK;
+static PyObject *__pyx_n_s__FILT_CONTROL;
+static PyObject *__pyx_n_s__FILT_F9;
+static PyObject *__pyx_n_s__FILT_FD;
+static PyObject *__pyx_n_s__FILT_MTC;
+static PyObject *__pyx_n_s__FILT_NOTE;
+static PyObject *__pyx_n_s__FILT_PITCHBEND;
+static PyObject *__pyx_n_s__FILT_PLAY;
+static PyObject *__pyx_n_s__FILT_PROGRAM;
+static PyObject *__pyx_n_s__FILT_REALTIME;
+static PyObject *__pyx_n_s__FILT_RESET;
+static PyObject *__pyx_n_s__FILT_SONG_POSITION;
+static PyObject *__pyx_n_s__FILT_SONG_SELECT;
+static PyObject *__pyx_n_s__FILT_SYSEX;
+static PyObject *__pyx_n_s__FILT_TICK;
+static PyObject *__pyx_n_s__FILT_TUNE;
+static PyObject *__pyx_n_s__FILT_UNDEFINED;
+static PyObject *__pyx_n_s__GetDeviceInfo;
+static PyObject *__pyx_n_s__GetErrorText;
+static PyObject *__pyx_n_s__IndexError;
+static PyObject *__pyx_n_s__Initialize;
+static PyObject *__pyx_n_s__Input;
+static PyObject *__pyx_n_s__InputDevice;
+static PyObject *__pyx_n_s__Output;
+static PyObject *__pyx_n_s__OutputDevice;
+static PyObject *__pyx_n_s__Poll;
+static PyObject *__pyx_n_s__Read;
+static PyObject *__pyx_n_s__SetChannelMask;
+static PyObject *__pyx_n_s__SetFilter;
+static PyObject *__pyx_n_s__TRUE;
+static PyObject *__pyx_n_s__Terminate;
+static PyObject *__pyx_n_s__Time;
+static PyObject *__pyx_n_s__Write;
+static PyObject *__pyx_n_s__WriteShort;
+static PyObject *__pyx_n_s__WriteSysEx;
+static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s____version__;
+static PyObject *__pyx_n_s___aborted;
+static PyObject *__pyx_n_s___check_open;
+static PyObject *__pyx_n_s__array;
+static PyObject *__pyx_n_s__buffersize;
+static PyObject *__pyx_n_s__data1;
+static PyObject *__pyx_n_s__data2;
+static PyObject *__pyx_n_s__debug;
+static PyObject *__pyx_n_s__i;
+static PyObject *__pyx_n_s__input;
+static PyObject *__pyx_n_s__interf;
+static PyObject *__pyx_n_s__latency;
+static PyObject *__pyx_n_s__message;
+static PyObject *__pyx_n_s__midi;
+static PyObject *__pyx_n_s__msg;
+static PyObject *__pyx_n_s__name;
+static PyObject *__pyx_n_s__opened;
+static PyObject *__pyx_n_s__output;
+static PyObject *__pyx_n_s__range;
+static PyObject *__pyx_n_s__status;
+static PyObject *__pyx_n_s__timestamp;
+static PyObject *__pyx_n_s__tostring;
+static PyObject *__pyx_n_s__when;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_8;
+static PyObject *__pyx_int_16;
+static PyObject *__pyx_int_0x1;
+static PyObject *__pyx_int_0x2;
+static PyObject *__pyx_int_0x4;
+static PyObject *__pyx_int_0x8;
+static PyObject *__pyx_int_0x10;
+static PyObject *__pyx_int_0x20;
+static PyObject *__pyx_int_0x30;
+static PyObject *__pyx_int_0x40;
+static PyObject *__pyx_int_0x7F;
+static PyObject *__pyx_int_0x80;
+static PyObject *__pyx_int_0xFF;
+static PyObject *__pyx_int_1024;
+static PyObject *__pyx_int_4096;
+static PyObject *__pyx_int_0x100;
+static PyObject *__pyx_int_0x200;
+static PyObject *__pyx_int_0x300;
+static PyObject *__pyx_int_0x400;
+static PyObject *__pyx_int_0x800;
+static PyObject *__pyx_int_0x1000;
+static PyObject *__pyx_int_0x2000;
+static PyObject *__pyx_int_0x4000;
+static PyObject *__pyx_int_0x8000;
+static PyObject *__pyx_int_0xFF00;
+static PyObject *__pyx_int_0x10000;
+static PyObject *__pyx_int_0xFF0000;
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":132
+ * TRUE=1
+ *
+ * def Initialize(): # <<<<<<<<<<<<<<
+ * """
+ * Initialize: call this first
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_Initialize(PyObject *__pyx_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_Initialize[] = "\nInitialize: call this first\n ";
+static PyObject *__pyx_pf_11_pyportmidi_Initialize(PyObject *__pyx_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannySetupContext("Initialize");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":136
+ * Initialize: call this first
+ * """
+ * Pm_Initialize() # <<<<<<<<<<<<<<
+ * Pt_Start(1, NULL, NULL) # /[inserted by cython to avoid comment start]* equiv to TIME_START: start timer w/ ms accuracy *[inserted by cython to avoid comment closer]/
+ *
+ */
+ Pm_Initialize();
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":137
+ * """
+ * Pm_Initialize()
+ * Pt_Start(1, NULL, NULL) # /[inserted by cython to avoid comment start]* equiv to TIME_START: start timer w/ ms accuracy *[inserted by cython to avoid comment closer]/ # <<<<<<<<<<<<<<
+ *
+ * def Terminate():
+ */
+ Pt_Start(1, NULL, NULL);
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":139
+ * Pt_Start(1, NULL, NULL) # /[inserted by cython to avoid comment start]* equiv to TIME_START: start timer w/ ms accuracy *[inserted by cython to avoid comment closer]/
+ *
+ * def Terminate(): # <<<<<<<<<<<<<<
+ * """
+ * Terminate: call this to clean up Midi streams when done.
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_Terminate(PyObject *__pyx_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_Terminate[] = "\nTerminate: call this to clean up Midi streams when done.\nIf you do not call this on Windows machines when you are\ndone with MIDI, your system may crash.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_Terminate(PyObject *__pyx_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannySetupContext("Terminate");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":145
+ * done with MIDI, your system may crash.
+ * """
+ * Pm_Terminate() # <<<<<<<<<<<<<<
+ *
+ * def GetDefaultInputDeviceID():
+ */
+ Pm_Terminate();
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":147
+ * Pm_Terminate()
+ *
+ * def GetDefaultInputDeviceID(): # <<<<<<<<<<<<<<
+ * return Pm_GetDefaultInputDeviceID()
+ *
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_GetDefaultInputDeviceID(PyObject *__pyx_self, PyObject *unused); /*proto*/
+static PyObject *__pyx_pf_11_pyportmidi_GetDefaultInputDeviceID(PyObject *__pyx_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("GetDefaultInputDeviceID");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":148
+ *
+ * def GetDefaultInputDeviceID():
+ * return Pm_GetDefaultInputDeviceID() # <<<<<<<<<<<<<<
+ *
+ * def GetDefaultOutputDeviceID():
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_to_py_PmDeviceID(Pm_GetDefaultInputDeviceID()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.GetDefaultInputDeviceID");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":150
+ * return Pm_GetDefaultInputDeviceID()
+ *
+ * def GetDefaultOutputDeviceID(): # <<<<<<<<<<<<<<
+ * return Pm_GetDefaultOutputDeviceID()
+ *
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_GetDefaultOutputDeviceID(PyObject *__pyx_self, PyObject *unused); /*proto*/
+static PyObject *__pyx_pf_11_pyportmidi_GetDefaultOutputDeviceID(PyObject *__pyx_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("GetDefaultOutputDeviceID");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":151
+ *
+ * def GetDefaultOutputDeviceID():
+ * return Pm_GetDefaultOutputDeviceID() # <<<<<<<<<<<<<<
+ *
+ * def CountDevices():
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_to_py_PmDeviceID(Pm_GetDefaultOutputDeviceID()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.GetDefaultOutputDeviceID");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":153
+ * return Pm_GetDefaultOutputDeviceID()
+ *
+ * def CountDevices(): # <<<<<<<<<<<<<<
+ * return Pm_CountDevices()
+ *
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_CountDevices(PyObject *__pyx_self, PyObject *unused); /*proto*/
+static PyObject *__pyx_pf_11_pyportmidi_CountDevices(PyObject *__pyx_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("CountDevices");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":154
+ *
+ * def CountDevices():
+ * return Pm_CountDevices() # <<<<<<<<<<<<<<
+ *
+ * def GetDeviceInfo(i):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyInt_FromLong(Pm_CountDevices()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.CountDevices");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":156
+ * return Pm_CountDevices()
+ *
+ * def GetDeviceInfo(i): # <<<<<<<<<<<<<<
+ * """
+ * GetDeviceInfo(<device number>): returns 5 parameters
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_GetDeviceInfo(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/
+static char __pyx_doc_11_pyportmidi_GetDeviceInfo[] = "\nGetDeviceInfo(<device number>): returns 5 parameters\n - underlying MIDI API\n - device name\n - TRUE iff input is available\n - TRUE iff output is available\n - TRUE iff device stream is already open\n ";
+static PyObject *__pyx_pf_11_pyportmidi_GetDeviceInfo(PyObject *__pyx_self, PyObject *__pyx_v_i) {
+ PmDeviceInfo *__pyx_v_info;
+ PyObject *__pyx_r = NULL;
+ PmDeviceID __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ __Pyx_RefNannySetupContext("GetDeviceInfo");
+ __pyx_self = __pyx_self;
+ __Pyx_INCREF(__pyx_v_i);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":168
+ *
+ * # disregarding the constness from Pm_GetDeviceInfo, since pyrex doesn't do const.
+ * info = <PmDeviceInfo *>Pm_GetDeviceInfo(i) # <<<<<<<<<<<<<<
+ *
+ * if info <> NULL: return info.interf, info.name, info.input, info.output, info.opened
+ */
+ __pyx_t_1 = __Pyx_PyInt_from_py_PmDeviceID(__pyx_v_i); if (unlikely((__pyx_t_1 == (PmDeviceID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_info = ((PmDeviceInfo *)Pm_GetDeviceInfo(__pyx_t_1));
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":170
+ * info = <PmDeviceInfo *>Pm_GetDeviceInfo(i)
+ *
+ * if info <> NULL: return info.interf, info.name, info.input, info.output, info.opened # <<<<<<<<<<<<<<
+ * else: return
+ *
+ */
+ __pyx_t_2 = (__pyx_v_info != NULL);
+ if (__pyx_t_2) {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_info->interf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_info->name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __pyx_t_5 = PyInt_FromLong(__pyx_v_info->input); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyInt_FromLong(__pyx_v_info->output); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyInt_FromLong(__pyx_v_info->opened); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_4));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_6 = 0;
+ __pyx_t_7 = 0;
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L0;
+ goto __pyx_L5;
+ }
+ /*else*/ {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":171
+ *
+ * if info <> NULL: return info.interf, info.name, info.input, info.output, info.opened
+ * else: return # <<<<<<<<<<<<<<
+ *
+ * def Time():
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ }
+ __pyx_L5:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("_pyportmidi.GetDeviceInfo");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_i);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":173
+ * else: return
+ *
+ * def Time(): # <<<<<<<<<<<<<<
+ * """
+ * Time() returns the current time in ms
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_Time(PyObject *__pyx_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_Time[] = "\nTime() returns the current time in ms\nof the PortMidi timer\n ";
+static PyObject *__pyx_pf_11_pyportmidi_Time(PyObject *__pyx_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("Time");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":178
+ * of the PortMidi timer
+ * """
+ * return Pt_Time() # <<<<<<<<<<<<<<
+ *
+ * def GetErrorText(err):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_to_py_PtTimestamp(Pt_Time()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.Time");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":180
+ * return Pt_Time()
+ *
+ * def GetErrorText(err): # <<<<<<<<<<<<<<
+ * """
+ * GetErrorText(<err num>) returns human-readable error
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_GetErrorText(PyObject *__pyx_self, PyObject *__pyx_v_err); /*proto*/
+static char __pyx_doc_11_pyportmidi_GetErrorText[] = "\nGetErrorText(<err num>) returns human-readable error\nmessages translated from error numbers\n ";
+static PyObject *__pyx_pf_11_pyportmidi_GetErrorText(PyObject *__pyx_self, PyObject *__pyx_v_err) {
+ PyObject *__pyx_r = NULL;
+ PmError __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ __Pyx_RefNannySetupContext("GetErrorText");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":185
+ * messages translated from error numbers
+ * """
+ * return Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ * def Channel(chan):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = ((PmError)PyInt_AsLong(__pyx_v_err)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pyportmidi.GetErrorText");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":187
+ * return Pm_GetErrorText(err)
+ *
+ * def Channel(chan): # <<<<<<<<<<<<<<
+ * """
+ * Channel(<chan>) is used with ChannelMask on input MIDI streams.
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_Channel(PyObject *__pyx_self, PyObject *__pyx_v_chan); /*proto*/
+static char __pyx_doc_11_pyportmidi_Channel[] = "\nChannel(<chan>) is used with ChannelMask on input MIDI streams.\nExample: to receive input on channels 1 and 10 on a MIDI\n stream called MidiIn:\nMidiIn.SetChannelMask(pypm.Channel(1) | pypm.Channel(10))\n\nnote: PyPortMidi Channel function has been altered from\n the original PortMidi c call to correct for what\n seems to be a bug --- i.e. channel filters were\n all numbered from 0 to 15 instead of 1 to 16.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_Channel(PyObject *__pyx_self, PyObject *__pyx_v_chan) {
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ __Pyx_RefNannySetupContext("Channel");
+ __pyx_self = __pyx_self;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":199
+ * all numbered from 0 to 15 instead of 1 to 16.
+ * """
+ * return Pm_Channel(chan-1) # <<<<<<<<<<<<<<
+ *
+ * cdef class Output:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyNumber_Subtract(__pyx_v_chan, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyInt_FromLong(Pm_Channel(__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.Channel");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":214
+ * cdef int _aborted
+ *
+ * def __init__(self, OutputDevice, latency=0): # <<<<<<<<<<<<<<
+ *
+ * cdef PmError err
+ */
+
+static int __pyx_pf_11_pyportmidi_6Output___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_11_pyportmidi_6Output___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_OutputDevice = 0;
+ PyObject *__pyx_v_latency = 0;
+ PmError __pyx_v_err;
+ PmTimeProcPtr __pyx_v_PmPtr;
+ PyObject *__pyx_v_s;
+ int __pyx_r;
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ long __pyx_t_4;
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__OutputDevice,&__pyx_n_s__latency,0};
+ __Pyx_RefNannySetupContext("__init__");
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+ PyObject* values[2] = {0,0};
+ values[1] = ((PyObject *)__pyx_int_0);
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 0:
+ values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__OutputDevice);
+ if (likely(values[0])) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 1) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__latency);
+ if (unlikely(value)) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __pyx_v_OutputDevice = values[0];
+ __pyx_v_latency = values[1];
+ } else {
+ __pyx_v_latency = ((PyObject *)__pyx_int_0);
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: __pyx_v_latency = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: __pyx_v_OutputDevice = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pyportmidi.Output.__init__");
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_OutputDevice);
+ __Pyx_INCREF(__pyx_v_latency);
+ __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":220
+ * cdef PmTimeProcPtr PmPtr
+ *
+ * self.i = OutputDevice # <<<<<<<<<<<<<<
+ * self.debug = 0
+ * self._aborted = 0
+ */
+ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_OutputDevice); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->i = __pyx_t_1;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":221
+ *
+ * self.i = OutputDevice
+ * self.debug = 0 # <<<<<<<<<<<<<<
+ * self._aborted = 0
+ *
+ */
+ ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":222
+ * self.i = OutputDevice
+ * self.debug = 0
+ * self._aborted = 0 # <<<<<<<<<<<<<<
+ *
+ * if latency == 0:
+ */
+ ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->_aborted = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":224
+ * self._aborted = 0
+ *
+ * if latency == 0: # <<<<<<<<<<<<<<
+ * PmPtr = NULL
+ * else:
+ */
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_latency, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":225
+ *
+ * if latency == 0:
+ * PmPtr = NULL # <<<<<<<<<<<<<<
+ * else:
+ * PmPtr = <PmTimeProcPtr>&Pt_Time
+ */
+ __pyx_v_PmPtr = NULL;
+ goto __pyx_L6;
+ }
+ /*else*/ {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":227
+ * PmPtr = NULL
+ * else:
+ * PmPtr = <PmTimeProcPtr>&Pt_Time # <<<<<<<<<<<<<<
+ * if self.debug: print "Opening Midi Output"
+ * # Why is bufferSize 0 here?
+ */
+ __pyx_v_PmPtr = ((PmTimestamp (*)(void *))(&Pt_Time));
+ }
+ __pyx_L6:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":228
+ * else:
+ * PmPtr = <PmTimeProcPtr>&Pt_Time
+ * if self.debug: print "Opening Midi Output" # <<<<<<<<<<<<<<
+ * # Why is bufferSize 0 here?
+ * err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency)
+ */
+ __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
+ if (__pyx_t_1) {
+ if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":230
+ * if self.debug: print "Opening Midi Output"
+ * # Why is bufferSize 0 here?
+ * err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency) # <<<<<<<<<<<<<<
+ * if err < 0:
+ * s = Pm_GetErrorText(err)
+ */
+ __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_v_latency); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_err = Pm_OpenOutput((&((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi), ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->i, NULL, 0, __pyx_v_PmPtr, NULL, __pyx_t_4);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":231
+ * # Why is bufferSize 0 here?
+ * err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency)
+ * if err < 0: # <<<<<<<<<<<<<<
+ * s = Pm_GetErrorText(err)
+ * # Something's amiss here - if we try to throw an Exception
+ */
+ __pyx_t_3 = (__pyx_v_err < 0);
+ if (__pyx_t_3) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":232
+ * err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency)
+ * if err < 0:
+ * s = Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ * # Something's amiss here - if we try to throw an Exception
+ * # here, we crash.
+ */
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_DECREF(__pyx_v_s);
+ __pyx_v_s = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":235
+ * # Something's amiss here - if we try to throw an Exception
+ * # here, we crash.
+ * if not err == -10000: # <<<<<<<<<<<<<<
+ * raise Exception,s
+ * else:
+ */
+ __pyx_t_3 = (!(__pyx_v_err == -10000));
+ if (__pyx_t_3) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":236
+ * # here, we crash.
+ * if not err == -10000:
+ * raise Exception,s # <<<<<<<<<<<<<<
+ * else:
+ * print "Unable to open Midi OutputDevice=",OutputDevice," err=",s
+ */
+ __Pyx_Raise(__pyx_builtin_Exception, __pyx_v_s, 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L9;
+ }
+ /*else*/ {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":238
+ * raise Exception,s
+ * else:
+ * print "Unable to open Midi OutputDevice=",OutputDevice," err=",s # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_2));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+ __Pyx_INCREF(__pyx_v_OutputDevice);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_OutputDevice);
+ __Pyx_GIVEREF(__pyx_v_OutputDevice);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
+ PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_kp_s_3));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
+ __Pyx_INCREF(__pyx_v_s);
+ PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_s);
+ __Pyx_GIVEREF(__pyx_v_s);
+ if (__Pyx_Print(__pyx_t_2, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
+ __pyx_L9:;
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pyportmidi.Output.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_s);
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_OutputDevice);
+ __Pyx_DECREF(__pyx_v_latency);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":240
+ * print "Unable to open Midi OutputDevice=",OutputDevice," err=",s
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * if self.debug: print "Closing MIDI output stream and destroying instance"
+ * #err = Pm_Abort(self.midi)
+ */
+
+static void __pyx_pf_11_pyportmidi_6Output___dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_11_pyportmidi_6Output___dealloc__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_v_err;
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ PmError __pyx_t_4;
+ __Pyx_RefNannySetupContext("__dealloc__");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":241
+ *
+ * def __dealloc__(self):
+ * if self.debug: print "Closing MIDI output stream and destroying instance" # <<<<<<<<<<<<<<
+ * #err = Pm_Abort(self.midi)
+ * #if err < 0: raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
+ if (__pyx_t_1) {
+ if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":244
+ * #err = Pm_Abort(self.midi)
+ * #if err < 0: raise Exception, Pm_GetErrorText(err)
+ * err = Pm_Close(self.midi) # <<<<<<<<<<<<<<
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ */
+ __pyx_t_2 = PyInt_FromLong(Pm_Close(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_v_err);
+ __pyx_v_err = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":245
+ * #if err < 0: raise Exception, Pm_GetErrorText(err)
+ * err = Pm_Close(self.midi)
+ * if err < 0: raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_err, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+ __pyx_t_4 = ((PmError)PyInt_AsLong(__pyx_v_err)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pyportmidi.Output.__dealloc__");
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_err);
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":248
+ *
+ *
+ * def _check_open(self): # <<<<<<<<<<<<<<
+ * """ checks to see if the midi is open, and if not, raises an error.
+ * """
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_6Output__check_open(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_6Output__check_open[] = " checks to see if the midi is open, and if not, raises an error.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_6Output__check_open(PyObject *__pyx_v_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ int __pyx_t_1;
+ int __pyx_t_2;
+ __Pyx_RefNannySetupContext("_check_open");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":252
+ * """
+ *
+ * if self.midi == NULL: # <<<<<<<<<<<<<<
+ * raise Exception, "midi Output not open."
+ *
+ */
+ __pyx_t_1 = (((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi == NULL);
+ if (__pyx_t_1) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":253
+ *
+ * if self.midi == NULL:
+ * raise Exception, "midi Output not open." # <<<<<<<<<<<<<<
+ *
+ * if self._aborted:
+ */
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_kp_s_5), 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":255
+ * raise Exception, "midi Output not open."
+ *
+ * if self._aborted: # <<<<<<<<<<<<<<
+ * raise Exception, "midi Output aborted. Need to call Close after Abort."
+ *
+ */
+ __pyx_t_2 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->_aborted;
+ if (__pyx_t_2) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":256
+ *
+ * if self._aborted:
+ * raise Exception, "midi Output aborted. Need to call Close after Abort." # <<<<<<<<<<<<<<
+ *
+ * def Close(self):
+ */
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_kp_s_6), 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pyportmidi.Output._check_open");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":258
+ * raise Exception, "midi Output aborted. Need to call Close after Abort."
+ *
+ * def Close(self): # <<<<<<<<<<<<<<
+ * """
+ * Close()
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_6Output_Close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_6Output_Close[] = "\nClose()\n closes a midi stream, flushing any pending buffers.\n (PortMidi attempts to close open streams when the application\n exits -- this is particularly difficult under Windows.)\n ";
+static PyObject *__pyx_pf_11_pyportmidi_6Output_Close(PyObject *__pyx_v_self, PyObject *unused) {
+ PyObject *__pyx_v_err;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PmError __pyx_t_3;
+ __Pyx_RefNannySetupContext("Close");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":268
+ * # return
+ *
+ * err = Pm_Close(self.midi) # <<<<<<<<<<<<<<
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_t_1 = PyInt_FromLong(Pm_Close(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_v_err);
+ __pyx_v_err = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":269
+ *
+ * err = Pm_Close(self.midi)
+ * if err < 0: # <<<<<<<<<<<<<<
+ * raise Exception, Pm_GetErrorText(err)
+ * #self.midi = NULL
+ */
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_err, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":270
+ * err = Pm_Close(self.midi)
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ * #self.midi = NULL
+ *
+ */
+ __pyx_t_3 = ((PmError)PyInt_AsLong(__pyx_v_err)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.Output.Close");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_err);
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":274
+ *
+ *
+ * def Abort(self): # <<<<<<<<<<<<<<
+ * """
+ * Abort() terminates outgoing messages immediately
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_6Output_Abort(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_6Output_Abort[] = "\nAbort() terminates outgoing messages immediately\n The caller should immediately close the output port;\n this call may result in transmission of a partial midi message.\n There is no abort for Midi input because the user can simply\n ignore messages in the buffer and close an input device at\n any time.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_6Output_Abort(PyObject *__pyx_v_self, PyObject *unused) {
+ PyObject *__pyx_v_err;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PmError __pyx_t_3;
+ __Pyx_RefNannySetupContext("Abort");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":286
+ * # return
+ *
+ * err = Pm_Abort(self.midi) # <<<<<<<<<<<<<<
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_t_1 = PyInt_FromLong(Pm_Abort(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_v_err);
+ __pyx_v_err = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":287
+ *
+ * err = Pm_Abort(self.midi)
+ * if err < 0: # <<<<<<<<<<<<<<
+ * raise Exception, Pm_GetErrorText(err)
+ *
+ */
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_err, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":288
+ * err = Pm_Abort(self.midi)
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ * self._aborted = 1
+ */
+ __pyx_t_3 = ((PmError)PyInt_AsLong(__pyx_v_err)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":290
+ * raise Exception, Pm_GetErrorText(err)
+ *
+ * self._aborted = 1 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->_aborted = 1;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.Output.Abort");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_err);
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":293
+ *
+ *
+ * def Write(self, data): # <<<<<<<<<<<<<<
+ * """
+ * Write(data)
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_6Output_Write(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
+static char __pyx_doc_11_pyportmidi_6Output_Write[] = "\nWrite(data)\n output a series of MIDI information in the form of a list:\n Write([[[status <,data1><,data2><,data3>],timestamp],\n [[status <,data1><,data2><,data3>],timestamp],...])\n <data> fields are optional\n example: choose program change 1 at time 20000 and\n send note 65 with velocity 100 500 ms later.\n Write([[[0xc0,0,0],20000],[[0x90,60,100],20500]])\n notes:\n 1. timestamps will be ignored if latency = 0.\n 2. To get a note to play immediately, send MIDI info with\n timestamp read from function Time.\n 3. understanding optional data fields:\n Write([[[0xc0,0,0],20000]]) is equivalent to\n Write([[[0xc0],20000]])\n ";
+static PyObject *__pyx_pf_11_pyportmidi_6Output_Write(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
+ PmEvent __pyx_v_buffer[1024];
+ PmError __pyx_v_err;
+ int __pyx_v_i;
+ PyObject *__pyx_v_loop1;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t __pyx_t_3;
+ int __pyx_t_4;
+ Py_ssize_t __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ Py_ssize_t __pyx_t_7;
+ int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PmMessage __pyx_t_11;
+ PmTimestamp __pyx_t_12;
+ __Pyx_RefNannySetupContext("Write");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_data);
+ __pyx_v_loop1 = Py_None; __Pyx_INCREF(Py_None);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":315
+ * cdef int i
+ *
+ * self._check_open() # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":318
+ *
+ *
+ * if len(data) > 1024: raise IndexError, 'maximum list length is 1024' # <<<<<<<<<<<<<<
+ * else:
+ * for loop1 in range(len(data)):
+ */
+ __pyx_t_3 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = (__pyx_t_3 > 1024);
+ if (__pyx_t_4) {
+ __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_7), 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ /*else*/ {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":320
+ * if len(data) > 1024: raise IndexError, 'maximum list length is 1024'
+ * else:
+ * for loop1 in range(len(data)): # <<<<<<<<<<<<<<
+ * if ((len(data[loop1][0]) > 4) |
+ * (len(data[loop1][0]) < 1)):
+ */
+ __pyx_t_5 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
+ __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1);
+ } else {
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ for (;;) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ } else {
+ __pyx_t_2 = PyIter_Next(__pyx_t_1);
+ if (!__pyx_t_2) {
+ if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ }
+ __Pyx_DECREF(__pyx_v_loop1);
+ __pyx_v_loop1 = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":321
+ * else:
+ * for loop1 in range(len(data)):
+ * if ((len(data[loop1][0]) > 4) | # <<<<<<<<<<<<<<
+ * (len(data[loop1][0]) < 1)):
+ * raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
+ */
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_data, __pyx_v_loop1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":322
+ * for loop1 in range(len(data)):
+ * if ((len(data[loop1][0]) > 4) |
+ * (len(data[loop1][0]) < 1)): # <<<<<<<<<<<<<<
+ * raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
+ * buffer[loop1].message = 0
+ */
+ __pyx_t_6 = PyObject_GetItem(__pyx_v_data, __pyx_v_loop1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = ((__pyx_t_5 > 4) | (__pyx_t_7 < 1));
+ if (__pyx_t_4) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":323
+ * if ((len(data[loop1][0]) > 4) |
+ * (len(data[loop1][0]) < 1)):
+ * raise IndexError, str(len(data[loop1][0]))+' arguments in event list' # <<<<<<<<<<<<<<
+ * buffer[loop1].message = 0
+ * for i in range(len(data[loop1][0])):
+ */
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_data, __pyx_v_loop1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_2, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":324
+ * (len(data[loop1][0]) < 1)):
+ * raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
+ * buffer[loop1].message = 0 # <<<<<<<<<<<<<<
+ * for i in range(len(data[loop1][0])):
+ * buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
+ */
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop1); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ (__pyx_v_buffer[__pyx_t_7]).message = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":325
+ * raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
+ * buffer[loop1].message = 0
+ * for i in range(len(data[loop1][0])): # <<<<<<<<<<<<<<
+ * buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
+ * buffer[loop1].timestamp = data[loop1][1]
+ */
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_data, __pyx_v_loop1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+ __pyx_v_i = __pyx_t_8;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":326
+ * buffer[loop1].message = 0
+ * for i in range(len(data[loop1][0])):
+ * buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i)) # <<<<<<<<<<<<<<
+ * buffer[loop1].timestamp = data[loop1][1]
+ * if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
+ */
+ __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_to_py_PmMessage((__pyx_v_buffer[__pyx_t_5]).message); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_data, __pyx_v_loop1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = PyNumber_And(__pyx_t_2, __pyx_int_0xFF); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyInt_FromLong((8 * __pyx_v_i)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_10 = PyNumber_Lshift(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_11 = __Pyx_PyInt_from_py_PmMessage(__pyx_t_2); if (unlikely((__pyx_t_11 == (PmMessage)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ (__pyx_v_buffer[__pyx_t_5]).message = __pyx_t_11;
+ }
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":327
+ * for i in range(len(data[loop1][0])):
+ * buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
+ * buffer[loop1].timestamp = data[loop1][1] # <<<<<<<<<<<<<<
+ * if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
+ * if self.debug: print "writing to midi buffer"
+ */
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_data, __pyx_v_loop1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_12 = __Pyx_PyInt_from_py_PmTimestamp(__pyx_t_10); if (unlikely((__pyx_t_12 == (PmTimestamp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ (__pyx_v_buffer[__pyx_t_5]).timestamp = __pyx_t_12;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":328
+ * buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
+ * buffer[loop1].timestamp = data[loop1][1]
+ * if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp # <<<<<<<<<<<<<<
+ * if self.debug: print "writing to midi buffer"
+ * err= Pm_Write(self.midi, buffer, len(data))
+ */
+ __pyx_t_8 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
+ if (__pyx_t_8) {
+ __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_to_py_PmMessage((__pyx_v_buffer[__pyx_t_5]).message); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_to_py_PmTimestamp((__pyx_v_buffer[__pyx_t_5]).timestamp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_v_loop1);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_loop1);
+ __Pyx_GIVEREF(__pyx_v_loop1);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+ PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_kp_s_9));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+ PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+ PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_kp_s_9));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+ PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_10 = 0;
+ __pyx_t_2 = 0;
+ if (__Pyx_Print(__pyx_t_6, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L11;
+ }
+ __pyx_L11:;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":329
+ * buffer[loop1].timestamp = data[loop1][1]
+ * if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
+ * if self.debug: print "writing to midi buffer" # <<<<<<<<<<<<<<
+ * err= Pm_Write(self.midi, buffer, len(data))
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_t_8 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
+ if (__pyx_t_8) {
+ if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_10)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L12;
+ }
+ __pyx_L12:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":330
+ * if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
+ * if self.debug: print "writing to midi buffer"
+ * err= Pm_Write(self.midi, buffer, len(data)) # <<<<<<<<<<<<<<
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ */
+ __pyx_t_3 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_err = Pm_Write(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi, __pyx_v_buffer, __pyx_t_3);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":331
+ * if self.debug: print "writing to midi buffer"
+ * err= Pm_Write(self.midi, buffer, len(data))
+ * if err < 0: raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ * def WriteShort(self, status, data1 = 0, data2 = 0):
+ */
+ __pyx_t_4 = (__pyx_v_err < 0);
+ if (__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L13;
+ }
+ __pyx_L13:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_AddTraceback("_pyportmidi.Output.Write");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_loop1);
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_data);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":333
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ * def WriteShort(self, status, data1 = 0, data2 = 0): # <<<<<<<<<<<<<<
+ * """
+ * WriteShort(status <, data1><, data2>)
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteShort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_11_pyportmidi_6Output_WriteShort[] = "\nWriteShort(status <, data1><, data2>)\n output MIDI information of 3 bytes or less.\n data fields are optional\n status byte could be:\n 0xc0 = program change\n 0x90 = note on\n etc.\n data bytes are optional and assumed 0 if omitted\n example: note 65 on with velocity 100\n WriteShort(0x90,65,100)\n ";
+static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteShort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_status = 0;
+ PyObject *__pyx_v_data1 = 0;
+ PyObject *__pyx_v_data2 = 0;
+ PmEvent __pyx_v_buffer[1];
+ PmError __pyx_v_err;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PmMessage __pyx_t_4;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__status,&__pyx_n_s__data1,&__pyx_n_s__data2,0};
+ __Pyx_RefNannySetupContext("WriteShort");
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+ PyObject* values[3] = {0,0,0};
+ values[1] = ((PyObject *)__pyx_int_0);
+ values[2] = ((PyObject *)__pyx_int_0);
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 0:
+ values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__status);
+ if (likely(values[0])) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 1) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data1);
+ if (unlikely(value)) { values[1] = value; kw_args--; }
+ }
+ case 2:
+ if (kw_args > 1) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data2);
+ if (unlikely(value)) { values[2] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "WriteShort") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __pyx_v_status = values[0];
+ __pyx_v_data1 = values[1];
+ __pyx_v_data2 = values[2];
+ } else {
+ __pyx_v_data1 = ((PyObject *)__pyx_int_0);
+ __pyx_v_data2 = ((PyObject *)__pyx_int_0);
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 3: __pyx_v_data2 = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: __pyx_v_data1 = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: __pyx_v_status = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("WriteShort", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pyportmidi.Output.WriteShort");
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_status);
+ __Pyx_INCREF(__pyx_v_data1);
+ __Pyx_INCREF(__pyx_v_data2);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":348
+ * cdef PmEvent buffer[1]
+ * cdef PmError err
+ * self._check_open() # <<<<<<<<<<<<<<
+ *
+ * buffer[0].timestamp = Pt_Time()
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":350
+ * self._check_open()
+ *
+ * buffer[0].timestamp = Pt_Time() # <<<<<<<<<<<<<<
+ * buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF))
+ * if self.debug: print "Writing to MIDI buffer"
+ */
+ (__pyx_v_buffer[0]).timestamp = Pt_Time();
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":351
+ *
+ * buffer[0].timestamp = Pt_Time()
+ * buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF)) # <<<<<<<<<<<<<<
+ * if self.debug: print "Writing to MIDI buffer"
+ * err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
+ */
+ __pyx_t_2 = PyNumber_Lshift(__pyx_v_data2, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_int_0xFF0000); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Lshift(__pyx_v_data1, __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyNumber_And(__pyx_t_2, __pyx_int_0xFF00); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Or(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyNumber_And(__pyx_v_status, __pyx_int_0xFF); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyNumber_Or(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyInt_from_py_PmMessage(__pyx_t_1); if (unlikely((__pyx_t_4 == (PmMessage)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ (__pyx_v_buffer[0]).message = __pyx_t_4;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":352
+ * buffer[0].timestamp = Pt_Time()
+ * buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF))
+ * if self.debug: print "Writing to MIDI buffer" # <<<<<<<<<<<<<<
+ * err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
+ * if err < 0 : raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_t_5 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
+ if (__pyx_t_5) {
+ if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_11)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":353
+ * buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF))
+ * if self.debug: print "Writing to MIDI buffer"
+ * err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length # <<<<<<<<<<<<<<
+ * if err < 0 : raise Exception, Pm_GetErrorText(err)
+ *
+ */
+ __pyx_v_err = Pm_Write(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi, __pyx_v_buffer, 1);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":354
+ * if self.debug: print "Writing to MIDI buffer"
+ * err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
+ * if err < 0 : raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ * def WriteSysEx(self, when, msg):
+ */
+ __pyx_t_6 = (__pyx_v_err < 0);
+ if (__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("_pyportmidi.Output.WriteShort");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_status);
+ __Pyx_DECREF(__pyx_v_data1);
+ __Pyx_DECREF(__pyx_v_data2);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":356
+ * if err < 0 : raise Exception, Pm_GetErrorText(err)
+ *
+ * def WriteSysEx(self, when, msg): # <<<<<<<<<<<<<<
+ * """
+ * WriteSysEx(<timestamp>,<msg>)
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteSysEx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_11_pyportmidi_6Output_WriteSysEx[] = "\n WriteSysEx(<timestamp>,<msg>)\n writes a timestamped system-exclusive midi message.\n <msg> can be a *list* or a *string*\n example:\n (assuming y is an input MIDI stream)\n y.WriteSysEx(0,'\\xF0\\x7D\\x10\\x11\\x12\\x13\\xF7')\n is equivalent to\n y.WriteSysEx(pypm.Time,\n [0xF0, 0x7D, 0x10, 0x11, 0x12, 0x13, 0xF7])\n ";
+static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteSysEx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_when = 0;
+ PyObject *__pyx_v_msg = 0;
+ PmError __pyx_v_err;
+ char *__pyx_v_cmsg;
+ PtTimestamp __pyx_v_CurTime;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ char *__pyx_t_5;
+ PmTimestamp __pyx_t_6;
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__when,&__pyx_n_s__msg,0};
+ __Pyx_RefNannySetupContext("WriteSysEx");
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+ PyObject* values[2] = {0,0};
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 0:
+ values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__when);
+ if (likely(values[0])) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg);
+ if (likely(values[1])) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("WriteSysEx", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "WriteSysEx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __pyx_v_when = values[0];
+ __pyx_v_msg = values[1];
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ __pyx_v_when = PyTuple_GET_ITEM(__pyx_args, 0);
+ __pyx_v_msg = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("WriteSysEx", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pyportmidi.Output.WriteSysEx");
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_when);
+ __Pyx_INCREF(__pyx_v_msg);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":372
+ * cdef PtTimestamp CurTime
+ *
+ * self._check_open() # <<<<<<<<<<<<<<
+ *
+ * if type(msg) is list:
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":374
+ * self._check_open()
+ *
+ * if type(msg) is list: # <<<<<<<<<<<<<<
+ * msg = array.array('B',msg).tostring() # Markus Pfaff contribution
+ * cmsg = msg
+ */
+ __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_msg)) == ((PyObject *)((PyObject*)&PyList_Type)));
+ if (__pyx_t_3) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":375
+ *
+ * if type(msg) is list:
+ * msg = array.array('B',msg).tostring() # Markus Pfaff contribution # <<<<<<<<<<<<<<
+ * cmsg = msg
+ *
+ */
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__B));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__B));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B));
+ __Pyx_INCREF(__pyx_v_msg);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_msg);
+ __Pyx_GIVEREF(__pyx_v_msg);
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__tostring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_v_msg);
+ __pyx_v_msg = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":376
+ * if type(msg) is list:
+ * msg = array.array('B',msg).tostring() # Markus Pfaff contribution
+ * cmsg = msg # <<<<<<<<<<<<<<
+ *
+ * CurTime = Pt_Time()
+ */
+ __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_msg); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_cmsg = __pyx_t_5;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":378
+ * cmsg = msg
+ *
+ * CurTime = Pt_Time() # <<<<<<<<<<<<<<
+ * err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
+ * if err < 0 : raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_v_CurTime = Pt_Time();
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":379
+ *
+ * CurTime = Pt_Time()
+ * err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg) # <<<<<<<<<<<<<<
+ * if err < 0 : raise Exception, Pm_GetErrorText(err)
+ * while Pt_Time() == CurTime: # wait for SysEx to go thru or...my
+ */
+ __pyx_t_6 = __Pyx_PyInt_from_py_PmTimestamp(__pyx_v_when); if (unlikely((__pyx_t_6 == (PmTimestamp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_err = Pm_WriteSysEx(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi, __pyx_t_6, ((unsigned char *)__pyx_v_cmsg));
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":380
+ * CurTime = Pt_Time()
+ * err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
+ * if err < 0 : raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ * while Pt_Time() == CurTime: # wait for SysEx to go thru or...my
+ * pass # win32 machine crashes w/ multiple SysEx
+ */
+ __pyx_t_3 = (__pyx_v_err < 0);
+ if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_4), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":381
+ * err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
+ * if err < 0 : raise Exception, Pm_GetErrorText(err)
+ * while Pt_Time() == CurTime: # wait for SysEx to go thru or...my # <<<<<<<<<<<<<<
+ * pass # win32 machine crashes w/ multiple SysEx
+ *
+ */
+ while (1) {
+ __pyx_t_3 = (Pt_Time() == __pyx_v_CurTime);
+ if (!__pyx_t_3) break;
+ }
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("_pyportmidi.Output.WriteSysEx");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_when);
+ __Pyx_DECREF(__pyx_v_msg);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":404
+ * cdef int i
+ *
+ * def __init__(self, InputDevice, buffersize=4096): # <<<<<<<<<<<<<<
+ * cdef PmError err
+ * self.i = InputDevice
+ */
+
+static int __pyx_pf_11_pyportmidi_5Input___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_11_pyportmidi_5Input___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_InputDevice = 0;
+ PyObject *__pyx_v_buffersize = 0;
+ PmError __pyx_v_err;
+ int __pyx_r;
+ int __pyx_t_1;
+ long __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__InputDevice,&__pyx_n_s__buffersize,0};
+ __Pyx_RefNannySetupContext("__init__");
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+ PyObject* values[2] = {0,0};
+ values[1] = ((PyObject *)__pyx_int_4096);
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 0:
+ values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__InputDevice);
+ if (likely(values[0])) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 1) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffersize);
+ if (unlikely(value)) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __pyx_v_InputDevice = values[0];
+ __pyx_v_buffersize = values[1];
+ } else {
+ __pyx_v_buffersize = ((PyObject *)__pyx_int_4096);
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: __pyx_v_buffersize = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: __pyx_v_InputDevice = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pyportmidi.Input.__init__");
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_InputDevice);
+ __Pyx_INCREF(__pyx_v_buffersize);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":406
+ * def __init__(self, InputDevice, buffersize=4096):
+ * cdef PmError err
+ * self.i = InputDevice # <<<<<<<<<<<<<<
+ * self.debug = 0
+ * err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
+ */
+ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_InputDevice); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->i = __pyx_t_1;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":407
+ * cdef PmError err
+ * self.i = InputDevice
+ * self.debug = 0 # <<<<<<<<<<<<<<
+ * err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ */
+ ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->debug = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":408
+ * self.i = InputDevice
+ * self.debug = 0
+ * err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL) # <<<<<<<<<<<<<<
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ * if self.debug: print "MIDI input opened."
+ */
+ __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_v_buffersize); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_err = Pm_OpenInput((&((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi), ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->i, NULL, __pyx_t_2, (&Pt_Time), NULL);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":409
+ * self.debug = 0
+ * err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
+ * if err < 0: raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ * if self.debug: print "MIDI input opened."
+ *
+ */
+ __pyx_t_3 = (__pyx_v_err < 0);
+ if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_4), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":410
+ * err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ * if self.debug: print "MIDI input opened." # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->debug;
+ if (__pyx_t_1) {
+ if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_12)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("_pyportmidi.Input.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_InputDevice);
+ __Pyx_DECREF(__pyx_v_buffersize);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":412
+ * if self.debug: print "MIDI input opened."
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * cdef PmError err
+ * if self.debug: print "Closing MIDI input stream and destroying instance"
+ */
+
+static void __pyx_pf_11_pyportmidi_5Input___dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_11_pyportmidi_5Input___dealloc__(PyObject *__pyx_v_self) {
+ PmError __pyx_v_err;
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ __Pyx_RefNannySetupContext("__dealloc__");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":414
+ * def __dealloc__(self):
+ * cdef PmError err
+ * if self.debug: print "Closing MIDI input stream and destroying instance" # <<<<<<<<<<<<<<
+ *
+ * err = Pm_Close(self.midi)
+ */
+ __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->debug;
+ if (__pyx_t_1) {
+ if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_13)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":416
+ * if self.debug: print "Closing MIDI input stream and destroying instance"
+ *
+ * err = Pm_Close(self.midi) # <<<<<<<<<<<<<<
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_v_err = Pm_Close(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":417
+ *
+ * err = Pm_Close(self.midi)
+ * if err < 0: # <<<<<<<<<<<<<<
+ * raise Exception, Pm_GetErrorText(err)
+ *
+ */
+ __pyx_t_2 = (__pyx_v_err < 0);
+ if (__pyx_t_2) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":418
+ * err = Pm_Close(self.midi)
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_3 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_3), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("_pyportmidi.Input.__dealloc__");
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":422
+ *
+ *
+ * def _check_open(self): # <<<<<<<<<<<<<<
+ * """ checks to see if the midi is open, and if not, raises an error.
+ * """
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_5Input__check_open(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_5Input__check_open[] = " checks to see if the midi is open, and if not, raises an error.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_5Input__check_open(PyObject *__pyx_v_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("_check_open");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":426
+ * """
+ *
+ * if self.midi == NULL: # <<<<<<<<<<<<<<
+ * raise Exception, "midi Input not open."
+ *
+ */
+ __pyx_t_1 = (((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi == NULL);
+ if (__pyx_t_1) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":427
+ *
+ * if self.midi == NULL:
+ * raise Exception, "midi Input not open." # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_kp_s_14), 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pyportmidi.Input._check_open");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":430
+ *
+ *
+ * def Close(self): # <<<<<<<<<<<<<<
+ * """
+ * Close()
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_5Input_Close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_5Input_Close[] = "\nClose()\n closes a midi stream, flushing any pending buffers.\n (PortMidi attempts to close open streams when the application\n exits -- this is particularly difficult under Windows.)\n ";
+static PyObject *__pyx_pf_11_pyportmidi_5Input_Close(PyObject *__pyx_v_self, PyObject *unused) {
+ PyObject *__pyx_v_err;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PmError __pyx_t_3;
+ __Pyx_RefNannySetupContext("Close");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":440
+ * # return
+ *
+ * err = Pm_Close(self.midi) # <<<<<<<<<<<<<<
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_t_1 = PyInt_FromLong(Pm_Close(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_v_err);
+ __pyx_v_err = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":441
+ *
+ * err = Pm_Close(self.midi)
+ * if err < 0: # <<<<<<<<<<<<<<
+ * raise Exception, Pm_GetErrorText(err)
+ * #self.midi = NULL
+ */
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_err, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":442
+ * err = Pm_Close(self.midi)
+ * if err < 0:
+ * raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ * #self.midi = NULL
+ *
+ */
+ __pyx_t_3 = ((PmError)PyInt_AsLong(__pyx_v_err)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pyportmidi.Input.Close");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_err);
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":447
+ *
+ *
+ * def SetFilter(self, filters): # <<<<<<<<<<<<<<
+ * """
+ * SetFilter(<filters>) sets filters on an open input stream
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_5Input_SetFilter(PyObject *__pyx_v_self, PyObject *__pyx_v_filters); /*proto*/
+static char __pyx_doc_11_pyportmidi_5Input_SetFilter[] = "\n SetFilter(<filters>) sets filters on an open input stream\n to drop selected input types. By default, only active sensing\n messages are filtered. To prohibit, say, active sensing and\n sysex messages, call\n SetFilter(stream, FILT_ACTIVE | FILT_SYSEX);\n\n Filtering is useful when midi routing or midi thru functionality\n is being provided by the user application.\n For example, you may want to exclude timing messages\n (clock, MTC, start/stop/continue), while allowing note-related\n messages to pass. Or you may be using a sequencer or drum-machine\n for MIDI clock information but want to exclude any notes\n it may play.\n\n Note: SetFilter empties the buffer after setting the filter,\n just in case anything got through.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_5Input_SetFilter(PyObject *__pyx_v_self, PyObject *__pyx_v_filters) {
+ PmEvent __pyx_v_buffer[1];
+ PmError __pyx_v_err;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ long __pyx_t_3;
+ int __pyx_t_4;
+ __Pyx_RefNannySetupContext("SetFilter");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_filters);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":469
+ * cdef PmError err
+ *
+ * self._check_open() # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":472
+ *
+ *
+ * err = Pm_SetFilter(self.midi, filters) # <<<<<<<<<<<<<<
+ *
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ */
+ __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_v_filters); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_err = Pm_SetFilter(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi, __pyx_t_3);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":474
+ * err = Pm_SetFilter(self.midi, filters)
+ *
+ * if err < 0: raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ * while(Pm_Poll(self.midi) != pmNoError):
+ */
+ __pyx_t_4 = (__pyx_v_err < 0);
+ if (__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":476
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ * while(Pm_Poll(self.midi) != pmNoError): # <<<<<<<<<<<<<<
+ *
+ * err = Pm_Read(self.midi,buffer,1)
+ */
+ while (1) {
+ __pyx_t_4 = (Pm_Poll(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi) != pmNoError);
+ if (!__pyx_t_4) break;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":478
+ * while(Pm_Poll(self.midi) != pmNoError):
+ *
+ * err = Pm_Read(self.midi,buffer,1) # <<<<<<<<<<<<<<
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ */
+ __pyx_v_err = Pm_Read(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi, __pyx_v_buffer, 1);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":479
+ *
+ * err = Pm_Read(self.midi,buffer,1)
+ * if err < 0: raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ * def SetChannelMask(self, mask):
+ */
+ __pyx_t_4 = (__pyx_v_err < 0);
+ if (__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+ }
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pyportmidi.Input.SetFilter");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_filters);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":481
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ * def SetChannelMask(self, mask): # <<<<<<<<<<<<<<
+ * """
+ * SetChannelMask(<mask>) filters incoming messages based on channel.
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_5Input_SetChannelMask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask); /*proto*/
+static char __pyx_doc_11_pyportmidi_5Input_SetChannelMask[] = "\n SetChannelMask(<mask>) filters incoming messages based on channel.\n The mask is a 16-bit bitfield corresponding to appropriate channels\n Channel(<channel>) can assist in calling this function.\n i.e. to set receive only input on channel 1, call with\n SetChannelMask(Channel(1))\n Multiple channels should be OR'd together, like\n SetChannelMask(Channel(10) | Channel(11))\n note: PyPortMidi Channel function has been altered from\n the original PortMidi c call to correct for what\n seems to be a bug --- i.e. channel filters were\n all numbered from 0 to 15 instead of 1 to 16.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_5Input_SetChannelMask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask) {
+ PmError __pyx_v_err;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ __Pyx_RefNannySetupContext("SetChannelMask");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_mask);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":497
+ * cdef PmError err
+ *
+ * self._check_open() # <<<<<<<<<<<<<<
+ *
+ * err = Pm_SetChannelMask(self.midi,mask)
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":499
+ * self._check_open()
+ *
+ * err = Pm_SetChannelMask(self.midi,mask) # <<<<<<<<<<<<<<
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ */
+ __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_mask); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_err = Pm_SetChannelMask(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi, __pyx_t_3);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":500
+ *
+ * err = Pm_SetChannelMask(self.midi,mask)
+ * if err < 0: raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ *
+ * def Poll(self):
+ */
+ __pyx_t_4 = (__pyx_v_err < 0);
+ if (__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pyportmidi.Input.SetChannelMask");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_mask);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":502
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ *
+ * def Poll(self): # <<<<<<<<<<<<<<
+ * """
+ * Poll tests whether input is available,
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_5Input_Poll(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
+static char __pyx_doc_11_pyportmidi_5Input_Poll[] = "\n Poll tests whether input is available,\n returning TRUE, FALSE, or an error value.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_5Input_Poll(PyObject *__pyx_v_self, PyObject *unused) {
+ PmError __pyx_v_err;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ __Pyx_RefNannySetupContext("Poll");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":508
+ * """
+ * cdef PmError err
+ * self._check_open() # <<<<<<<<<<<<<<
+ *
+ * err = Pm_Poll(self.midi)
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":510
+ * self._check_open()
+ *
+ * err = Pm_Poll(self.midi) # <<<<<<<<<<<<<<
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ * return err
+ */
+ __pyx_v_err = Pm_Poll(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":511
+ *
+ * err = Pm_Poll(self.midi)
+ * if err < 0: raise Exception, Pm_GetErrorText(err) # <<<<<<<<<<<<<<
+ * return err
+ *
+ */
+ __pyx_t_3 = (__pyx_v_err < 0);
+ if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":512
+ * err = Pm_Poll(self.midi)
+ * if err < 0: raise Exception, Pm_GetErrorText(err)
+ * return err # <<<<<<<<<<<<<<
+ *
+ * def Read(self,length):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyInt_FromLong(__pyx_v_err); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pyportmidi.Input.Poll");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":514
+ * return err
+ *
+ * def Read(self,length): # <<<<<<<<<<<<<<
+ * """
+ * Read(length): returns up to <length> midi events stored in
+ */
+
+static PyObject *__pyx_pf_11_pyportmidi_5Input_Read(PyObject *__pyx_v_self, PyObject *__pyx_v_length); /*proto*/
+static char __pyx_doc_11_pyportmidi_5Input_Read[] = "\nRead(length): returns up to <length> midi events stored in\nthe buffer and returns them as a list:\n[[[status,data1,data2,data3],timestamp],\n [[status,data1,data2,data3],timestamp],...]\nexample: Read(50) returns all the events in the buffer,\n up to 50 events.\n ";
+static PyObject *__pyx_pf_11_pyportmidi_5Input_Read(PyObject *__pyx_v_self, PyObject *__pyx_v_length) {
+ PmEvent __pyx_v_buffer[1024];
+ PyObject *__pyx_v_x;
+ PyObject *__pyx_v_NumEvents;
+ PyObject *__pyx_v_loop;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ long __pyx_t_4;
+ PmError __pyx_t_5;
+ Py_ssize_t __pyx_t_6;
+ Py_ssize_t __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ __Pyx_RefNannySetupContext("Read");
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_INCREF(__pyx_v_length);
+ __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_v_NumEvents = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_v_loop = Py_None; __Pyx_INCREF(Py_None);
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":525
+ * cdef PmEvent buffer[1024]
+ *
+ * self._check_open() # <<<<<<<<<<<<<<
+ *
+ * x = []
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":527
+ * self._check_open()
+ *
+ * x = [] # <<<<<<<<<<<<<<
+ *
+ * if length > 1024: raise IndexError, 'maximum buffer length is 1024'
+ */
+ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_DECREF(__pyx_v_x);
+ __pyx_v_x = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":529
+ * x = []
+ *
+ * if length > 1024: raise IndexError, 'maximum buffer length is 1024' # <<<<<<<<<<<<<<
+ * if length < 1: raise IndexError, 'minimum buffer length is 1'
+ * NumEvents = Pm_Read(self.midi,buffer,length)
+ */
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_length, __pyx_int_1024, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+ __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_15), 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":530
+ *
+ * if length > 1024: raise IndexError, 'maximum buffer length is 1024'
+ * if length < 1: raise IndexError, 'minimum buffer length is 1' # <<<<<<<<<<<<<<
+ * NumEvents = Pm_Read(self.midi,buffer,length)
+ * if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
+ */
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_length, __pyx_int_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+ __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_16), 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":531
+ * if length > 1024: raise IndexError, 'maximum buffer length is 1024'
+ * if length < 1: raise IndexError, 'minimum buffer length is 1'
+ * NumEvents = Pm_Read(self.midi,buffer,length) # <<<<<<<<<<<<<<
+ * if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
+ * x=[]
+ */
+ __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_v_length); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(Pm_Read(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi, __pyx_v_buffer, __pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_v_NumEvents);
+ __pyx_v_NumEvents = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":532
+ * if length < 1: raise IndexError, 'minimum buffer length is 1'
+ * NumEvents = Pm_Read(self.midi,buffer,length)
+ * if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents) # <<<<<<<<<<<<<<
+ * x=[]
+ * if NumEvents >= 1:
+ */
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_NumEvents, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+ __pyx_t_5 = ((PmError)PyInt_AsLong(__pyx_v_NumEvents)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":533
+ * NumEvents = Pm_Read(self.midi,buffer,length)
+ * if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
+ * x=[] # <<<<<<<<<<<<<<
+ * if NumEvents >= 1:
+ * for loop in range(NumEvents):
+ */
+ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_DECREF(__pyx_v_x);
+ __pyx_v_x = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":534
+ * if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
+ * x=[]
+ * if NumEvents >= 1: # <<<<<<<<<<<<<<
+ * for loop in range(NumEvents):
+ * x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp])
+ */
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_NumEvents, __pyx_int_1, Py_GE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":535
+ * x=[]
+ * if NumEvents >= 1:
+ * for loop in range(NumEvents): # <<<<<<<<<<<<<<
+ * x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp])
+ * return x
+ */
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_NumEvents);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_NumEvents);
+ __Pyx_GIVEREF(__pyx_v_NumEvents);
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
+ } else {
+ __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ for (;;) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
+ } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
+ } else {
+ __pyx_t_1 = PyIter_Next(__pyx_t_2);
+ if (!__pyx_t_1) {
+ if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ }
+ __Pyx_DECREF(__pyx_v_loop);
+ __pyx_v_loop = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":536
+ * if NumEvents >= 1:
+ * for loop in range(NumEvents):
+ * x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp]) # <<<<<<<<<<<<<<
+ * return x
+ */
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_to_py_PmMessage(((__pyx_v_buffer[__pyx_t_7]).message & 0xff)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyInt_to_py_PmMessage((((__pyx_v_buffer[__pyx_t_7]).message >> 8) & 0xFF)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_to_py_PmMessage((((__pyx_v_buffer[__pyx_t_7]).message >> 16) & 0xFF)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_to_py_PmMessage((((__pyx_v_buffer[__pyx_t_7]).message >> 24) & 0xFF)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = PyList_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_11));
+ PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ PyList_SET_ITEM(__pyx_t_11, 2, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ PyList_SET_ITEM(__pyx_t_11, 3, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_1 = 0;
+ __pyx_t_8 = 0;
+ __pyx_t_9 = 0;
+ __pyx_t_10 = 0;
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loop); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_to_py_PmTimestamp((__pyx_v_buffer[__pyx_t_7]).timestamp); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+ PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_11));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
+ PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_11 = 0;
+ __pyx_t_10 = 0;
+ __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_x, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":537
+ * for loop in range(NumEvents):
+ * x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp])
+ * return x # <<<<<<<<<<<<<<
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_x);
+ __pyx_r = __pyx_v_x;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_AddTraceback("_pyportmidi.Input.Read");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(__pyx_v_x);
+ __Pyx_DECREF(__pyx_v_NumEvents);
+ __Pyx_DECREF(__pyx_v_loop);
+ __Pyx_DECREF((PyObject *)__pyx_v_self);
+ __Pyx_DECREF(__pyx_v_length);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_tp_new_11_pyportmidi_Output(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_11_pyportmidi_Output(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pf_11_pyportmidi_6Output___dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static struct PyMethodDef __pyx_methods_11_pyportmidi_Output[] = {
+ {__Pyx_NAMESTR("_check_open"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output__check_open, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output__check_open)},
+ {__Pyx_NAMESTR("Close"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_Close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_Close)},
+ {__Pyx_NAMESTR("Abort"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_Abort, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_Abort)},
+ {__Pyx_NAMESTR("Write"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_Write, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_Write)},
+ {__Pyx_NAMESTR("WriteShort"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_WriteShort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_WriteShort)},
+ {__Pyx_NAMESTR("WriteSysEx"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_WriteSysEx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_WriteSysEx)},
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_Output = {
+ 0, /*nb_add*/
+ 0, /*nb_subtract*/
+ 0, /*nb_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_divide*/
+ #endif
+ 0, /*nb_remainder*/
+ 0, /*nb_divmod*/
+ 0, /*nb_power*/
+ 0, /*nb_negative*/
+ 0, /*nb_positive*/
+ 0, /*nb_absolute*/
+ 0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_coerce*/
+ #endif
+ 0, /*nb_int*/
+ #if PY_MAJOR_VERSION >= 3
+ 0, /*reserved*/
+ #else
+ 0, /*nb_long*/
+ #endif
+ 0, /*nb_float*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_oct*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_hex*/
+ #endif
+ 0, /*nb_inplace_add*/
+ 0, /*nb_inplace_subtract*/
+ 0, /*nb_inplace_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_inplace_divide*/
+ #endif
+ 0, /*nb_inplace_remainder*/
+ 0, /*nb_inplace_power*/
+ 0, /*nb_inplace_lshift*/
+ 0, /*nb_inplace_rshift*/
+ 0, /*nb_inplace_and*/
+ 0, /*nb_inplace_xor*/
+ 0, /*nb_inplace_or*/
+ 0, /*nb_floor_divide*/
+ 0, /*nb_true_divide*/
+ 0, /*nb_inplace_floor_divide*/
+ 0, /*nb_inplace_true_divide*/
+ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
+ 0, /*nb_index*/
+ #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_Output = {
+ 0, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ 0, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_Output = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer_Output = {
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getreadbuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getwritebuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getsegcount*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getcharbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_getbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_releasebuffer*/
+ #endif
+};
+
+PyTypeObject __pyx_type_11_pyportmidi_Output = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_pyportmidi.Output"), /*tp_name*/
+ sizeof(struct __pyx_obj_11_pyportmidi_Output), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_11_pyportmidi_Output, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ &__pyx_tp_as_number_Output, /*tp_as_number*/
+ &__pyx_tp_as_sequence_Output, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_Output, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer_Output, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+ __Pyx_DOCSTR("\nclass Output:\n define an output MIDI stream. Takes the form:\n x = pypm.Output(MidiOutputDevice, latency)\n latency is in ms.\n If latency = 0 then timestamps for output are ignored.\n "), /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_11_pyportmidi_Output, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pf_11_pyportmidi_6Output___init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_11_pyportmidi_Output, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*tp_version_tag*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_11_pyportmidi_Input(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_11_pyportmidi_Input(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pf_11_pyportmidi_5Input___dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static struct PyMethodDef __pyx_methods_11_pyportmidi_Input[] = {
+ {__Pyx_NAMESTR("_check_open"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input__check_open, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input__check_open)},
+ {__Pyx_NAMESTR("Close"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_Close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_Close)},
+ {__Pyx_NAMESTR("SetFilter"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_SetFilter, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_SetFilter)},
+ {__Pyx_NAMESTR("SetChannelMask"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_SetChannelMask, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_SetChannelMask)},
+ {__Pyx_NAMESTR("Poll"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_Poll, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_Poll)},
+ {__Pyx_NAMESTR("Read"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_Read, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_Read)},
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_Input = {
+ 0, /*nb_add*/
+ 0, /*nb_subtract*/
+ 0, /*nb_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_divide*/
+ #endif
+ 0, /*nb_remainder*/
+ 0, /*nb_divmod*/
+ 0, /*nb_power*/
+ 0, /*nb_negative*/
+ 0, /*nb_positive*/
+ 0, /*nb_absolute*/
+ 0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_coerce*/
+ #endif
+ 0, /*nb_int*/
+ #if PY_MAJOR_VERSION >= 3
+ 0, /*reserved*/
+ #else
+ 0, /*nb_long*/
+ #endif
+ 0, /*nb_float*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_oct*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_hex*/
+ #endif
+ 0, /*nb_inplace_add*/
+ 0, /*nb_inplace_subtract*/
+ 0, /*nb_inplace_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_inplace_divide*/
+ #endif
+ 0, /*nb_inplace_remainder*/
+ 0, /*nb_inplace_power*/
+ 0, /*nb_inplace_lshift*/
+ 0, /*nb_inplace_rshift*/
+ 0, /*nb_inplace_and*/
+ 0, /*nb_inplace_xor*/
+ 0, /*nb_inplace_or*/
+ 0, /*nb_floor_divide*/
+ 0, /*nb_true_divide*/
+ 0, /*nb_inplace_floor_divide*/
+ 0, /*nb_inplace_true_divide*/
+ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
+ 0, /*nb_index*/
+ #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_Input = {
+ 0, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ 0, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_Input = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer_Input = {
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getreadbuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getwritebuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getsegcount*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getcharbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_getbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_releasebuffer*/
+ #endif
+};
+
+PyTypeObject __pyx_type_11_pyportmidi_Input = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_pyportmidi.Input"), /*tp_name*/
+ sizeof(struct __pyx_obj_11_pyportmidi_Input), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_11_pyportmidi_Input, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ &__pyx_tp_as_number_Input, /*tp_as_number*/
+ &__pyx_tp_as_sequence_Input, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_Input, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer_Input, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+ __Pyx_DOCSTR("\nclass Input:\n define an input MIDI stream. Takes the form:\n x = pypm.Input(MidiInputDevice)\n "), /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_11_pyportmidi_Input, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pf_11_pyportmidi_5Input___init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_11_pyportmidi_Input, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*tp_version_tag*/
+ #endif
+};
+
+static struct PyMethodDef __pyx_methods[] = {
+ {__Pyx_NAMESTR("Initialize"), (PyCFunction)__pyx_pf_11_pyportmidi_Initialize, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Initialize)},
+ {__Pyx_NAMESTR("Terminate"), (PyCFunction)__pyx_pf_11_pyportmidi_Terminate, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Terminate)},
+ {__Pyx_NAMESTR("GetDefaultInputDeviceID"), (PyCFunction)__pyx_pf_11_pyportmidi_GetDefaultInputDeviceID, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("GetDefaultOutputDeviceID"), (PyCFunction)__pyx_pf_11_pyportmidi_GetDefaultOutputDeviceID, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("CountDevices"), (PyCFunction)__pyx_pf_11_pyportmidi_CountDevices, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("GetDeviceInfo"), (PyCFunction)__pyx_pf_11_pyportmidi_GetDeviceInfo, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_GetDeviceInfo)},
+ {__Pyx_NAMESTR("Time"), (PyCFunction)__pyx_pf_11_pyportmidi_Time, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Time)},
+ {__Pyx_NAMESTR("GetErrorText"), (PyCFunction)__pyx_pf_11_pyportmidi_GetErrorText, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_GetErrorText)},
+ {__Pyx_NAMESTR("Channel"), (PyCFunction)__pyx_pf_11_pyportmidi_Channel, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Channel)},
+ {0, 0, 0, 0}
+};
+
+static void __pyx_init_filenames(void); /*proto*/
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ PyModuleDef_HEAD_INIT,
+ __Pyx_NAMESTR("_pyportmidi"),
+ 0, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
+ {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
+ {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
+ {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
+ {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
+ {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
+ {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+ {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
+ {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
+ {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1},
+ {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1},
+ {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
+ {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 1, 0, 0},
+ {&__pyx_kp_u_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 1, 0, 0},
+ {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0},
+ {&__pyx_kp_u_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 1, 0, 0},
+ {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0, 0},
+ {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0},
+ {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0},
+ {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0},
+ {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0},
+ {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0},
+ {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
+ {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0},
+ {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0},
+ {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0},
+ {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0},
+ {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0},
+ {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0},
+ {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0},
+ {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0},
+ {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
+ {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
+ {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
+ {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
+ {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
+ {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
+ {&__pyx_n_s__Abort, __pyx_k__Abort, sizeof(__pyx_k__Abort), 0, 0, 1, 1},
+ {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1},
+ {&__pyx_n_s__Channel, __pyx_k__Channel, sizeof(__pyx_k__Channel), 0, 0, 1, 1},
+ {&__pyx_n_s__Close, __pyx_k__Close, sizeof(__pyx_k__Close), 0, 0, 1, 1},
+ {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
+ {&__pyx_n_s__FALSE, __pyx_k__FALSE, sizeof(__pyx_k__FALSE), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_ACTIVE, __pyx_k__FILT_ACTIVE, sizeof(__pyx_k__FILT_ACTIVE), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_AFTERTOUCH, __pyx_k__FILT_AFTERTOUCH, sizeof(__pyx_k__FILT_AFTERTOUCH), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_CLOCK, __pyx_k__FILT_CLOCK, sizeof(__pyx_k__FILT_CLOCK), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_CONTROL, __pyx_k__FILT_CONTROL, sizeof(__pyx_k__FILT_CONTROL), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_F9, __pyx_k__FILT_F9, sizeof(__pyx_k__FILT_F9), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_FD, __pyx_k__FILT_FD, sizeof(__pyx_k__FILT_FD), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_MTC, __pyx_k__FILT_MTC, sizeof(__pyx_k__FILT_MTC), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_NOTE, __pyx_k__FILT_NOTE, sizeof(__pyx_k__FILT_NOTE), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_PITCHBEND, __pyx_k__FILT_PITCHBEND, sizeof(__pyx_k__FILT_PITCHBEND), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_PLAY, __pyx_k__FILT_PLAY, sizeof(__pyx_k__FILT_PLAY), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_PROGRAM, __pyx_k__FILT_PROGRAM, sizeof(__pyx_k__FILT_PROGRAM), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_REALTIME, __pyx_k__FILT_REALTIME, sizeof(__pyx_k__FILT_REALTIME), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_RESET, __pyx_k__FILT_RESET, sizeof(__pyx_k__FILT_RESET), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_SONG_POSITION, __pyx_k__FILT_SONG_POSITION, sizeof(__pyx_k__FILT_SONG_POSITION), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_SONG_SELECT, __pyx_k__FILT_SONG_SELECT, sizeof(__pyx_k__FILT_SONG_SELECT), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_SYSEX, __pyx_k__FILT_SYSEX, sizeof(__pyx_k__FILT_SYSEX), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_TICK, __pyx_k__FILT_TICK, sizeof(__pyx_k__FILT_TICK), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_TUNE, __pyx_k__FILT_TUNE, sizeof(__pyx_k__FILT_TUNE), 0, 0, 1, 1},
+ {&__pyx_n_s__FILT_UNDEFINED, __pyx_k__FILT_UNDEFINED, sizeof(__pyx_k__FILT_UNDEFINED), 0, 0, 1, 1},
+ {&__pyx_n_s__GetDeviceInfo, __pyx_k__GetDeviceInfo, sizeof(__pyx_k__GetDeviceInfo), 0, 0, 1, 1},
+ {&__pyx_n_s__GetErrorText, __pyx_k__GetErrorText, sizeof(__pyx_k__GetErrorText), 0, 0, 1, 1},
+ {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
+ {&__pyx_n_s__Initialize, __pyx_k__Initialize, sizeof(__pyx_k__Initialize), 0, 0, 1, 1},
+ {&__pyx_n_s__Input, __pyx_k__Input, sizeof(__pyx_k__Input), 0, 0, 1, 1},
+ {&__pyx_n_s__InputDevice, __pyx_k__InputDevice, sizeof(__pyx_k__InputDevice), 0, 0, 1, 1},
+ {&__pyx_n_s__Output, __pyx_k__Output, sizeof(__pyx_k__Output), 0, 0, 1, 1},
+ {&__pyx_n_s__OutputDevice, __pyx_k__OutputDevice, sizeof(__pyx_k__OutputDevice), 0, 0, 1, 1},
+ {&__pyx_n_s__Poll, __pyx_k__Poll, sizeof(__pyx_k__Poll), 0, 0, 1, 1},
+ {&__pyx_n_s__Read, __pyx_k__Read, sizeof(__pyx_k__Read), 0, 0, 1, 1},
+ {&__pyx_n_s__SetChannelMask, __pyx_k__SetChannelMask, sizeof(__pyx_k__SetChannelMask), 0, 0, 1, 1},
+ {&__pyx_n_s__SetFilter, __pyx_k__SetFilter, sizeof(__pyx_k__SetFilter), 0, 0, 1, 1},
+ {&__pyx_n_s__TRUE, __pyx_k__TRUE, sizeof(__pyx_k__TRUE), 0, 0, 1, 1},
+ {&__pyx_n_s__Terminate, __pyx_k__Terminate, sizeof(__pyx_k__Terminate), 0, 0, 1, 1},
+ {&__pyx_n_s__Time, __pyx_k__Time, sizeof(__pyx_k__Time), 0, 0, 1, 1},
+ {&__pyx_n_s__Write, __pyx_k__Write, sizeof(__pyx_k__Write), 0, 0, 1, 1},
+ {&__pyx_n_s__WriteShort, __pyx_k__WriteShort, sizeof(__pyx_k__WriteShort), 0, 0, 1, 1},
+ {&__pyx_n_s__WriteSysEx, __pyx_k__WriteSysEx, sizeof(__pyx_k__WriteSysEx), 0, 0, 1, 1},
+ {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
+ {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
+ {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1},
+ {&__pyx_n_s___aborted, __pyx_k___aborted, sizeof(__pyx_k___aborted), 0, 0, 1, 1},
+ {&__pyx_n_s___check_open, __pyx_k___check_open, sizeof(__pyx_k___check_open), 0, 0, 1, 1},
+ {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
+ {&__pyx_n_s__buffersize, __pyx_k__buffersize, sizeof(__pyx_k__buffersize), 0, 0, 1, 1},
+ {&__pyx_n_s__data1, __pyx_k__data1, sizeof(__pyx_k__data1), 0, 0, 1, 1},
+ {&__pyx_n_s__data2, __pyx_k__data2, sizeof(__pyx_k__data2), 0, 0, 1, 1},
+ {&__pyx_n_s__debug, __pyx_k__debug, sizeof(__pyx_k__debug), 0, 0, 1, 1},
+ {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
+ {&__pyx_n_s__input, __pyx_k__input, sizeof(__pyx_k__input), 0, 0, 1, 1},
+ {&__pyx_n_s__interf, __pyx_k__interf, sizeof(__pyx_k__interf), 0, 0, 1, 1},
+ {&__pyx_n_s__latency, __pyx_k__latency, sizeof(__pyx_k__latency), 0, 0, 1, 1},
+ {&__pyx_n_s__message, __pyx_k__message, sizeof(__pyx_k__message), 0, 0, 1, 1},
+ {&__pyx_n_s__midi, __pyx_k__midi, sizeof(__pyx_k__midi), 0, 0, 1, 1},
+ {&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1},
+ {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
+ {&__pyx_n_s__opened, __pyx_k__opened, sizeof(__pyx_k__opened), 0, 0, 1, 1},
+ {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1},
+ {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
+ {&__pyx_n_s__status, __pyx_k__status, sizeof(__pyx_k__status), 0, 0, 1, 1},
+ {&__pyx_n_s__timestamp, __pyx_k__timestamp, sizeof(__pyx_k__timestamp), 0, 0, 1, 1},
+ {&__pyx_n_s__tostring, __pyx_k__tostring, sizeof(__pyx_k__tostring), 0, 0, 1, 1},
+ {&__pyx_n_s__when, __pyx_k__when, sizeof(__pyx_k__when), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x1 = PyInt_FromLong(0x1); if (unlikely(!__pyx_int_0x1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x2 = PyInt_FromLong(0x2); if (unlikely(!__pyx_int_0x2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x4 = PyInt_FromLong(0x4); if (unlikely(!__pyx_int_0x4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x8 = PyInt_FromLong(0x8); if (unlikely(!__pyx_int_0x8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x10 = PyInt_FromLong(0x10); if (unlikely(!__pyx_int_0x10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x20 = PyInt_FromLong(0x20); if (unlikely(!__pyx_int_0x20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x30 = PyInt_FromLong(0x30); if (unlikely(!__pyx_int_0x30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x40 = PyInt_FromLong(0x40); if (unlikely(!__pyx_int_0x40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x7F = PyInt_FromLong(0x7F); if (unlikely(!__pyx_int_0x7F)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x80 = PyInt_FromLong(0x80); if (unlikely(!__pyx_int_0x80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0xFF = PyInt_FromLong(0xFF); if (unlikely(!__pyx_int_0xFF)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_4096 = PyInt_FromLong(4096); if (unlikely(!__pyx_int_4096)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x100 = PyInt_FromLong(0x100); if (unlikely(!__pyx_int_0x100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x200 = PyInt_FromLong(0x200); if (unlikely(!__pyx_int_0x200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x300 = PyInt_FromLong(0x300); if (unlikely(!__pyx_int_0x300)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x400 = PyInt_FromLong(0x400); if (unlikely(!__pyx_int_0x400)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x800 = PyInt_FromLong(0x800); if (unlikely(!__pyx_int_0x800)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x1000 = PyInt_FromLong(0x1000); if (unlikely(!__pyx_int_0x1000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x2000 = PyInt_FromLong(0x2000); if (unlikely(!__pyx_int_0x2000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x4000 = PyInt_FromLong(0x4000); if (unlikely(!__pyx_int_0x4000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x8000 = PyInt_FromLong(0x8000); if (unlikely(!__pyx_int_0x8000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0xFF00 = PyInt_FromLong(0xFF00); if (unlikely(!__pyx_int_0xFF00)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0x10000 = PyInt_FromLong(0x10000); if (unlikely(!__pyx_int_0x10000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0xFF0000 = PyInt_FromLong(0xFF0000); if (unlikely(!__pyx_int_0xFF0000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC init_pyportmidi(void); /*proto*/
+PyMODINIT_FUNC init_pyportmidi(void)
+#else
+PyMODINIT_FUNC PyInit__pyportmidi(void); /*proto*/
+PyMODINIT_FUNC PyInit__pyportmidi(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ #if CYTHON_REFNANNY
+ void* __pyx_refnanny = NULL;
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__pyportmidi(void)", __LINE__, __FILE__);
+ #endif
+ __pyx_init_filenames();
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3
+ __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_pyportmidi"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #if PY_MAJOR_VERSION < 3
+ Py_INCREF(__pyx_m);
+ #endif
+ __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+ if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_module_is_main__pyportmidi) {
+ if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ if (PyType_Ready(&__pyx_type_11_pyportmidi_Output) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Output", (PyObject *)&__pyx_type_11_pyportmidi_Output) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_11_pyportmidi_Output = &__pyx_type_11_pyportmidi_Output;
+ if (PyType_Ready(&__pyx_type_11_pyportmidi_Input) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Input", (PyObject *)&__pyx_type_11_pyportmidi_Input) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_11_pyportmidi_Input = &__pyx_type_11_pyportmidi_Input;
+ /*--- Type import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":7
+ * # harrison@media.mit.edu
+ * # written in Pyrex
+ * __version__="0.07" # <<<<<<<<<<<<<<
+ *
+ * import array
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":9
+ * __version__="0.07"
+ *
+ * import array # <<<<<<<<<<<<<<
+ *
+ * # CHANGES:
+ */
+ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__array), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":108
+ * PtTimestamp Pt_Time()
+ *
+ * FILT_ACTIVE=0x1 # <<<<<<<<<<<<<<
+ * FILT_SYSEX=0x2
+ * FILT_CLOCK=0x4
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_ACTIVE, __pyx_int_0x1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":109
+ *
+ * FILT_ACTIVE=0x1
+ * FILT_SYSEX=0x2 # <<<<<<<<<<<<<<
+ * FILT_CLOCK=0x4
+ * FILT_PLAY=0x8
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_SYSEX, __pyx_int_0x2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":110
+ * FILT_ACTIVE=0x1
+ * FILT_SYSEX=0x2
+ * FILT_CLOCK=0x4 # <<<<<<<<<<<<<<
+ * FILT_PLAY=0x8
+ * FILT_F9=0x10
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_CLOCK, __pyx_int_0x4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":111
+ * FILT_SYSEX=0x2
+ * FILT_CLOCK=0x4
+ * FILT_PLAY=0x8 # <<<<<<<<<<<<<<
+ * FILT_F9=0x10
+ * FILT_TICK=0x10
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_PLAY, __pyx_int_0x8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":112
+ * FILT_CLOCK=0x4
+ * FILT_PLAY=0x8
+ * FILT_F9=0x10 # <<<<<<<<<<<<<<
+ * FILT_TICK=0x10
+ * FILT_FD=0x20
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_F9, __pyx_int_0x10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":113
+ * FILT_PLAY=0x8
+ * FILT_F9=0x10
+ * FILT_TICK=0x10 # <<<<<<<<<<<<<<
+ * FILT_FD=0x20
+ * FILT_UNDEFINED=0x30
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_TICK, __pyx_int_0x10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":114
+ * FILT_F9=0x10
+ * FILT_TICK=0x10
+ * FILT_FD=0x20 # <<<<<<<<<<<<<<
+ * FILT_UNDEFINED=0x30
+ * FILT_RESET=0x40
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_FD, __pyx_int_0x20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":115
+ * FILT_TICK=0x10
+ * FILT_FD=0x20
+ * FILT_UNDEFINED=0x30 # <<<<<<<<<<<<<<
+ * FILT_RESET=0x40
+ * FILT_REALTIME=0x7F
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_UNDEFINED, __pyx_int_0x30) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":116
+ * FILT_FD=0x20
+ * FILT_UNDEFINED=0x30
+ * FILT_RESET=0x40 # <<<<<<<<<<<<<<
+ * FILT_REALTIME=0x7F
+ * FILT_NOTE=0x80
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_RESET, __pyx_int_0x40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":117
+ * FILT_UNDEFINED=0x30
+ * FILT_RESET=0x40
+ * FILT_REALTIME=0x7F # <<<<<<<<<<<<<<
+ * FILT_NOTE=0x80
+ * FILT_CHANNEL_AFTERTOUCH=0x100
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_REALTIME, __pyx_int_0x7F) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":118
+ * FILT_RESET=0x40
+ * FILT_REALTIME=0x7F
+ * FILT_NOTE=0x80 # <<<<<<<<<<<<<<
+ * FILT_CHANNEL_AFTERTOUCH=0x100
+ * FILT_POLY_AFTERTOUCH=0x200
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_NOTE, __pyx_int_0x80) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":119
+ * FILT_REALTIME=0x7F
+ * FILT_NOTE=0x80
+ * FILT_CHANNEL_AFTERTOUCH=0x100 # <<<<<<<<<<<<<<
+ * FILT_POLY_AFTERTOUCH=0x200
+ * FILT_AFTERTOUCH=0x300
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_18, __pyx_int_0x100) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":120
+ * FILT_NOTE=0x80
+ * FILT_CHANNEL_AFTERTOUCH=0x100
+ * FILT_POLY_AFTERTOUCH=0x200 # <<<<<<<<<<<<<<
+ * FILT_AFTERTOUCH=0x300
+ * FILT_PROGRAM=0x400
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_19, __pyx_int_0x200) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":121
+ * FILT_CHANNEL_AFTERTOUCH=0x100
+ * FILT_POLY_AFTERTOUCH=0x200
+ * FILT_AFTERTOUCH=0x300 # <<<<<<<<<<<<<<
+ * FILT_PROGRAM=0x400
+ * FILT_CONTROL=0x800
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_AFTERTOUCH, __pyx_int_0x300) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":122
+ * FILT_POLY_AFTERTOUCH=0x200
+ * FILT_AFTERTOUCH=0x300
+ * FILT_PROGRAM=0x400 # <<<<<<<<<<<<<<
+ * FILT_CONTROL=0x800
+ * FILT_PITCHBEND=0x1000
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_PROGRAM, __pyx_int_0x400) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":123
+ * FILT_AFTERTOUCH=0x300
+ * FILT_PROGRAM=0x400
+ * FILT_CONTROL=0x800 # <<<<<<<<<<<<<<
+ * FILT_PITCHBEND=0x1000
+ * FILT_MTC=0x2000
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_CONTROL, __pyx_int_0x800) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":124
+ * FILT_PROGRAM=0x400
+ * FILT_CONTROL=0x800
+ * FILT_PITCHBEND=0x1000 # <<<<<<<<<<<<<<
+ * FILT_MTC=0x2000
+ * FILT_SONG_POSITION=0x4000
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_PITCHBEND, __pyx_int_0x1000) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":125
+ * FILT_CONTROL=0x800
+ * FILT_PITCHBEND=0x1000
+ * FILT_MTC=0x2000 # <<<<<<<<<<<<<<
+ * FILT_SONG_POSITION=0x4000
+ * FILT_SONG_SELECT=0x8000
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_MTC, __pyx_int_0x2000) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":126
+ * FILT_PITCHBEND=0x1000
+ * FILT_MTC=0x2000
+ * FILT_SONG_POSITION=0x4000 # <<<<<<<<<<<<<<
+ * FILT_SONG_SELECT=0x8000
+ * FILT_TUNE=0x10000
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_SONG_POSITION, __pyx_int_0x4000) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":127
+ * FILT_MTC=0x2000
+ * FILT_SONG_POSITION=0x4000
+ * FILT_SONG_SELECT=0x8000 # <<<<<<<<<<<<<<
+ * FILT_TUNE=0x10000
+ * FALSE=0
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_SONG_SELECT, __pyx_int_0x8000) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":128
+ * FILT_SONG_POSITION=0x4000
+ * FILT_SONG_SELECT=0x8000
+ * FILT_TUNE=0x10000 # <<<<<<<<<<<<<<
+ * FALSE=0
+ * TRUE=1
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FILT_TUNE, __pyx_int_0x10000) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":129
+ * FILT_SONG_SELECT=0x8000
+ * FILT_TUNE=0x10000
+ * FALSE=0 # <<<<<<<<<<<<<<
+ * TRUE=1
+ *
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FALSE, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":130
+ * FILT_TUNE=0x10000
+ * FALSE=0
+ * TRUE=1 # <<<<<<<<<<<<<<
+ *
+ * def Initialize():
+ */
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TRUE, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":1
+ * # pyPortMidi # <<<<<<<<<<<<<<
+ * # Python bindings for PortMidi
+ * # John Harrison
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Initialize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__");
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_20), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Terminate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_21), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GetDeviceInfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__");
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_22), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_23), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GetErrorText); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__");
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_24), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Channel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_25), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Output); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___check_open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_26), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Output); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_27), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Output); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Abort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_28), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Output); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_29), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Output); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__WriteShort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_30), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Output); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__WriteSysEx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_31), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___check_open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_32), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_33), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__SetFilter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_34), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__SetChannelMask); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_35), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Poll); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_36), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Input); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_37), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ if (__pyx_m) {
+ __Pyx_AddTraceback("init _pyportmidi");
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init _pyportmidi");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+static const char *__pyx_filenames[] = {
+ "_pyportmidi.pyx",
+};
+
+/* Runtime support code */
+
+static void __pyx_init_filenames(void) {
+ __pyx_f = __pyx_filenames;
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AS_STRING(kw_name));
+ #endif
+}
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *number, *more_or_less;
+
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ number = (num_expected == 1) ? "" : "s";
+ PyErr_Format(PyExc_TypeError,
+ #if PY_VERSION_HEX < 0x02050000
+ "%s() takes %s %d positional argument%s (%d given)",
+ #else
+ "%s() takes %s %zd positional argument%s (%zd given)",
+ #endif
+ func_name, more_or_less, num_expected, number, num_found);
+}
+
+static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ } else {
+ #if PY_MAJOR_VERSION < 3
+ if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
+ #else
+ if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
+ #endif
+ goto invalid_keyword_type;
+ } else {
+ for (name = first_kw_arg; *name; name++) {
+ #if PY_MAJOR_VERSION >= 3
+ if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+ PyUnicode_Compare(**name, key) == 0) break;
+ #else
+ if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+ _PyString_Eq(**name, key)) break;
+ #endif
+ }
+ if (*name) {
+ values[name-argnames] = value;
+ } else {
+ /* unexpected keyword found */
+ for (name=argnames; name != first_kw_arg; name++) {
+ if (**name == key) goto arg_passed_twice;
+ #if PY_MAJOR_VERSION >= 3
+ if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+ PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
+ #else
+ if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+ _PyString_Eq(**name, key)) goto arg_passed_twice;
+ #endif
+ }
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ }
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, **name);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%s() got an unexpected keyword argument '%s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
+ PyObject *__import__ = 0;
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
+ if (!__import__)
+ goto bad;
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(__import__,
+ name, global_dict, empty_dict, list, NULL);
+bad:
+ Py_XDECREF(empty_list);
+ Py_XDECREF(__import__);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmDeviceID(PmDeviceID val) {
+ const PmDeviceID neg_one = (PmDeviceID)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(PmDeviceID) < sizeof(long)) {
+ return PyInt_FromLong((long)val);
+ } else if (sizeof(PmDeviceID) == sizeof(long)) {
+ if (is_unsigned)
+ return PyLong_FromUnsignedLong((unsigned long)val);
+ else
+ return PyInt_FromLong((long)val);
+ } else { /* (sizeof(PmDeviceID) > sizeof(long)) */
+ if (is_unsigned)
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
+ else
+ return PyLong_FromLongLong((PY_LONG_LONG)val);
+ }
+}
+
+static CYTHON_INLINE PmDeviceID __Pyx_PyInt_from_py_PmDeviceID(PyObject* x) {
+ const PmDeviceID neg_one = (PmDeviceID)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(PmDeviceID) == sizeof(char)) {
+ if (is_unsigned)
+ return (PmDeviceID)__Pyx_PyInt_AsUnsignedChar(x);
+ else
+ return (PmDeviceID)__Pyx_PyInt_AsSignedChar(x);
+ } else if (sizeof(PmDeviceID) == sizeof(short)) {
+ if (is_unsigned)
+ return (PmDeviceID)__Pyx_PyInt_AsUnsignedShort(x);
+ else
+ return (PmDeviceID)__Pyx_PyInt_AsSignedShort(x);
+ } else if (sizeof(PmDeviceID) == sizeof(int)) {
+ if (is_unsigned)
+ return (PmDeviceID)__Pyx_PyInt_AsUnsignedInt(x);
+ else
+ return (PmDeviceID)__Pyx_PyInt_AsSignedInt(x);
+ } else if (sizeof(PmDeviceID) == sizeof(long)) {
+ if (is_unsigned)
+ return (PmDeviceID)__Pyx_PyInt_AsUnsignedLong(x);
+ else
+ return (PmDeviceID)__Pyx_PyInt_AsSignedLong(x);
+ } else if (sizeof(PmDeviceID) == sizeof(PY_LONG_LONG)) {
+ if (is_unsigned)
+ return (PmDeviceID)__Pyx_PyInt_AsUnsignedLongLong(x);
+ else
+ return (PmDeviceID)__Pyx_PyInt_AsSignedLongLong(x);
+#if 0
+ } else if (sizeof(PmDeviceID) > sizeof(short) &&
+ sizeof(PmDeviceID) < sizeof(int)) { /* __int32 ILP64 ? */
+ if (is_unsigned)
+ return (PmDeviceID)__Pyx_PyInt_AsUnsignedInt(x);
+ else
+ return (PmDeviceID)__Pyx_PyInt_AsSignedInt(x);
+#endif
+ }
+ PyErr_SetString(PyExc_TypeError, "PmDeviceID");
+ return (PmDeviceID)-1;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PtTimestamp(PtTimestamp val) {
+ const PtTimestamp neg_one = (PtTimestamp)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(PtTimestamp) < sizeof(long)) {
+ return PyInt_FromLong((long)val);
+ } else if (sizeof(PtTimestamp) == sizeof(long)) {
+ if (is_unsigned)
+ return PyLong_FromUnsignedLong((unsigned long)val);
+ else
+ return PyInt_FromLong((long)val);
+ } else { /* (sizeof(PtTimestamp) > sizeof(long)) */
+ if (is_unsigned)
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
+ else
+ return PyLong_FromLongLong((PY_LONG_LONG)val);
+ }
+}
+
+#if PY_MAJOR_VERSION < 3
+static PyObject *__Pyx_GetStdout(void) {
+ PyObject *f = PySys_GetObject((char *)"stdout");
+ if (!f) {
+ PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
+ }
+ return f;
+}
+
+static int __Pyx_Print(PyObject *arg_tuple, int newline) {
+ PyObject *f;
+ PyObject* v;
+ int i;
+
+ if (!(f = __Pyx_GetStdout()))
+ return -1;
+ for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
+ if (PyFile_SoftSpace(f, 1)) {
+ if (PyFile_WriteString(" ", f) < 0)
+ return -1;
+ }
+ v = PyTuple_GET_ITEM(arg_tuple, i);
+ if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
+ return -1;
+ if (PyString_Check(v)) {
+ char *s = PyString_AsString(v);
+ Py_ssize_t len = PyString_Size(v);
+ if (len > 0 &&
+ isspace(Py_CHARMASK(s[len-1])) &&
+ s[len-1] != ' ')
+ PyFile_SoftSpace(f, 0);
+ }
+ }
+ if (newline) {
+ if (PyFile_WriteString("\n", f) < 0)
+ return -1;
+ PyFile_SoftSpace(f, 0);
+ }
+ return 0;
+}
+
+#else /* Python 3 has a print function */
+
+static int __Pyx_Print(PyObject *arg_tuple, int newline) {
+ PyObject* kwargs = 0;
+ PyObject* result = 0;
+ PyObject* end_string;
+ if (!__pyx_print) {
+ __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
+ if (!__pyx_print)
+ return -1;
+ }
+ if (!newline) {
+ if (!__pyx_print_kwargs) {
+ __pyx_print_kwargs = PyDict_New();
+ if (!__pyx_print_kwargs)
+ return -1;
+ end_string = PyUnicode_FromStringAndSize(" ", 1);
+ if (!end_string)
+ return -1;
+ if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
+ Py_DECREF(end_string);
+ return -1;
+ }
+ Py_DECREF(end_string);
+ }
+ kwargs = __pyx_print_kwargs;
+ }
+ result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
+ if (!result)
+ return -1;
+ Py_DECREF(result);
+ return 0;
+}
+
+#endif
+
+#if PY_MAJOR_VERSION < 3
+
+static int __Pyx_PrintOne(PyObject *o) {
+ PyObject *f;
+ if (!(f = __Pyx_GetStdout()))
+ return -1;
+ if (PyFile_SoftSpace(f, 0)) {
+ if (PyFile_WriteString(" ", f) < 0)
+ return -1;
+ }
+ if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
+ return -1;
+ if (PyFile_WriteString("\n", f) < 0)
+ return -1;
+ return 0;
+ /* the line below is just to avoid compiler
+ * compiler warnings about unused functions */
+ return __Pyx_Print(NULL, 0);
+}
+
+#else /* Python 3 has a print function */
+
+static int __Pyx_PrintOne(PyObject *o) {
+ int res;
+ PyObject* arg_tuple = PyTuple_New(1);
+ if (unlikely(!arg_tuple))
+ return -1;
+ Py_INCREF(o);
+ PyTuple_SET_ITEM(arg_tuple, 0, o);
+ res = __Pyx_Print(arg_tuple, 1);
+ Py_DECREF(arg_tuple);
+ return res;
+}
+
+#endif
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
+ PyObject *result;
+ result = PyObject_GetAttr(dict, name);
+ if (!result)
+ PyErr_SetObject(PyExc_NameError, name);
+ return result;
+}
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+}
+
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+}
+
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+ Py_XINCREF(type);
+ Py_XINCREF(value);
+ Py_XINCREF(tb);
+ /* First, check the traceback argument, replacing None with NULL. */
+ if (tb == Py_None) {
+ Py_DECREF(tb);
+ tb = 0;
+ }
+ else if (tb != NULL && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ /* Next, replace a missing value with None */
+ if (value == NULL) {
+ value = Py_None;
+ Py_INCREF(value);
+ }
+ #if PY_VERSION_HEX < 0x02050000
+ if (!PyClass_Check(type))
+ #else
+ if (!PyType_Check(type))
+ #endif
+ {
+ /* Raising an instance. The value should be a dummy. */
+ if (value != Py_None) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ /* Normalize to raise <class>, <instance> */
+ Py_DECREF(value);
+ value = type;
+ #if PY_VERSION_HEX < 0x02050000
+ if (PyInstance_Check(type)) {
+ type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+ Py_INCREF(type);
+ }
+ else {
+ type = 0;
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception must be an old-style class or instance");
+ goto raise_error;
+ }
+ #else
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ #endif
+ }
+
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+
+#else /* Python 3+ */
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (!PyExceptionClass_Check(type)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+
+ PyErr_SetObject(type, value);
+
+ if (tb) {
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+ }
+
+bad:
+ return;
+}
+#endif
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmMessage(PmMessage val) {
+ const PmMessage neg_one = (PmMessage)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(PmMessage) < sizeof(long)) {
+ return PyInt_FromLong((long)val);
+ } else if (sizeof(PmMessage) == sizeof(long)) {
+ if (is_unsigned)
+ return PyLong_FromUnsignedLong((unsigned long)val);
+ else
+ return PyInt_FromLong((long)val);
+ } else { /* (sizeof(PmMessage) > sizeof(long)) */
+ if (is_unsigned)
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
+ else
+ return PyLong_FromLongLong((PY_LONG_LONG)val);
+ }
+}
+
+static CYTHON_INLINE PmMessage __Pyx_PyInt_from_py_PmMessage(PyObject* x) {
+ const PmMessage neg_one = (PmMessage)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(PmMessage) == sizeof(char)) {
+ if (is_unsigned)
+ return (PmMessage)__Pyx_PyInt_AsUnsignedChar(x);
+ else
+ return (PmMessage)__Pyx_PyInt_AsSignedChar(x);
+ } else if (sizeof(PmMessage) == sizeof(short)) {
+ if (is_unsigned)
+ return (PmMessage)__Pyx_PyInt_AsUnsignedShort(x);
+ else
+ return (PmMessage)__Pyx_PyInt_AsSignedShort(x);
+ } else if (sizeof(PmMessage) == sizeof(int)) {
+ if (is_unsigned)
+ return (PmMessage)__Pyx_PyInt_AsUnsignedInt(x);
+ else
+ return (PmMessage)__Pyx_PyInt_AsSignedInt(x);
+ } else if (sizeof(PmMessage) == sizeof(long)) {
+ if (is_unsigned)
+ return (PmMessage)__Pyx_PyInt_AsUnsignedLong(x);
+ else
+ return (PmMessage)__Pyx_PyInt_AsSignedLong(x);
+ } else if (sizeof(PmMessage) == sizeof(PY_LONG_LONG)) {
+ if (is_unsigned)
+ return (PmMessage)__Pyx_PyInt_AsUnsignedLongLong(x);
+ else
+ return (PmMessage)__Pyx_PyInt_AsSignedLongLong(x);
+#if 0
+ } else if (sizeof(PmMessage) > sizeof(short) &&
+ sizeof(PmMessage) < sizeof(int)) { /* __int32 ILP64 ? */
+ if (is_unsigned)
+ return (PmMessage)__Pyx_PyInt_AsUnsignedInt(x);
+ else
+ return (PmMessage)__Pyx_PyInt_AsSignedInt(x);
+#endif
+ }
+ PyErr_SetString(PyExc_TypeError, "PmMessage");
+ return (PmMessage)-1;
+}
+
+static CYTHON_INLINE PmTimestamp __Pyx_PyInt_from_py_PmTimestamp(PyObject* x) {
+ const PmTimestamp neg_one = (PmTimestamp)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(PmTimestamp) == sizeof(char)) {
+ if (is_unsigned)
+ return (PmTimestamp)__Pyx_PyInt_AsUnsignedChar(x);
+ else
+ return (PmTimestamp)__Pyx_PyInt_AsSignedChar(x);
+ } else if (sizeof(PmTimestamp) == sizeof(short)) {
+ if (is_unsigned)
+ return (PmTimestamp)__Pyx_PyInt_AsUnsignedShort(x);
+ else
+ return (PmTimestamp)__Pyx_PyInt_AsSignedShort(x);
+ } else if (sizeof(PmTimestamp) == sizeof(int)) {
+ if (is_unsigned)
+ return (PmTimestamp)__Pyx_PyInt_AsUnsignedInt(x);
+ else
+ return (PmTimestamp)__Pyx_PyInt_AsSignedInt(x);
+ } else if (sizeof(PmTimestamp) == sizeof(long)) {
+ if (is_unsigned)
+ return (PmTimestamp)__Pyx_PyInt_AsUnsignedLong(x);
+ else
+ return (PmTimestamp)__Pyx_PyInt_AsSignedLong(x);
+ } else if (sizeof(PmTimestamp) == sizeof(PY_LONG_LONG)) {
+ if (is_unsigned)
+ return (PmTimestamp)__Pyx_PyInt_AsUnsignedLongLong(x);
+ else
+ return (PmTimestamp)__Pyx_PyInt_AsSignedLongLong(x);
+#if 0
+ } else if (sizeof(PmTimestamp) > sizeof(short) &&
+ sizeof(PmTimestamp) < sizeof(int)) { /* __int32 ILP64 ? */
+ if (is_unsigned)
+ return (PmTimestamp)__Pyx_PyInt_AsUnsignedInt(x);
+ else
+ return (PmTimestamp)__Pyx_PyInt_AsSignedInt(x);
+#endif
+ }
+ PyErr_SetString(PyExc_TypeError, "PmTimestamp");
+ return (PmTimestamp)-1;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmTimestamp(PmTimestamp val) {
+ const PmTimestamp neg_one = (PmTimestamp)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(PmTimestamp) < sizeof(long)) {
+ return PyInt_FromLong((long)val);
+ } else if (sizeof(PmTimestamp) == sizeof(long)) {
+ if (is_unsigned)
+ return PyLong_FromUnsignedLong((unsigned long)val);
+ else
+ return PyInt_FromLong((long)val);
+ } else { /* (sizeof(PmTimestamp) > sizeof(long)) */
+ if (is_unsigned)
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
+ else
+ return PyLong_FromLongLong((PY_LONG_LONG)val);
+ }
+}
+
+static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
+ const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(unsigned char) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(unsigned char)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to unsigned char" :
+ "value too large to convert to unsigned char");
+ }
+ return (unsigned char)-1;
+ }
+ return (unsigned char)val;
+ }
+ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
+}
+
+static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
+ const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(unsigned short) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(unsigned short)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to unsigned short" :
+ "value too large to convert to unsigned short");
+ }
+ return (unsigned short)-1;
+ }
+ return (unsigned short)val;
+ }
+ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
+}
+
+static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
+ const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(unsigned int) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(unsigned int)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to unsigned int" :
+ "value too large to convert to unsigned int");
+ }
+ return (unsigned int)-1;
+ }
+ return (unsigned int)val;
+ }
+ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
+}
+
+static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
+ const char neg_one = (char)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(char) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(char)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to char" :
+ "value too large to convert to char");
+ }
+ return (char)-1;
+ }
+ return (char)val;
+ }
+ return (char)__Pyx_PyInt_AsLong(x);
+}
+
+static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
+ const short neg_one = (short)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(short) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(short)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to short" :
+ "value too large to convert to short");
+ }
+ return (short)-1;
+ }
+ return (short)val;
+ }
+ return (short)__Pyx_PyInt_AsLong(x);
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
+ const int neg_one = (int)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(int) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(int)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to int" :
+ "value too large to convert to int");
+ }
+ return (int)-1;
+ }
+ return (int)val;
+ }
+ return (int)__Pyx_PyInt_AsLong(x);
+}
+
+static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
+ const signed char neg_one = (signed char)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(signed char) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(signed char)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to signed char" :
+ "value too large to convert to signed char");
+ }
+ return (signed char)-1;
+ }
+ return (signed char)val;
+ }
+ return (signed char)__Pyx_PyInt_AsSignedLong(x);
+}
+
+static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
+ const signed short neg_one = (signed short)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(signed short) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(signed short)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to signed short" :
+ "value too large to convert to signed short");
+ }
+ return (signed short)-1;
+ }
+ return (signed short)val;
+ }
+ return (signed short)__Pyx_PyInt_AsSignedLong(x);
+}
+
+static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
+ const signed int neg_one = (signed int)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(signed int) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(signed int)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to signed int" :
+ "value too large to convert to signed int");
+ }
+ return (signed int)-1;
+ }
+ return (signed int)val;
+ }
+ return (signed int)__Pyx_PyInt_AsSignedLong(x);
+}
+
+static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
+ const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+ if (likely(PyInt_Check(x))) {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to unsigned long");
+ return (unsigned long)-1;
+ }
+ return (unsigned long)val;
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+ if (unlikely(Py_SIZE(x) < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to unsigned long");
+ return (unsigned long)-1;
+ }
+ return PyLong_AsUnsignedLong(x);
+ } else {
+ return PyLong_AsLong(x);
+ }
+ } else {
+ unsigned long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (unsigned long)-1;
+ val = __Pyx_PyInt_AsUnsignedLong(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+}
+
+static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
+ const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+ if (likely(PyInt_Check(x))) {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to unsigned PY_LONG_LONG");
+ return (unsigned PY_LONG_LONG)-1;
+ }
+ return (unsigned PY_LONG_LONG)val;
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+ if (unlikely(Py_SIZE(x) < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to unsigned PY_LONG_LONG");
+ return (unsigned PY_LONG_LONG)-1;
+ }
+ return PyLong_AsUnsignedLongLong(x);
+ } else {
+ return PyLong_AsLongLong(x);
+ }
+ } else {
+ unsigned PY_LONG_LONG val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (unsigned PY_LONG_LONG)-1;
+ val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
+ const long neg_one = (long)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+ if (likely(PyInt_Check(x))) {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long)-1;
+ }
+ return (long)val;
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+ if (unlikely(Py_SIZE(x) < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long)-1;
+ }
+ return PyLong_AsUnsignedLong(x);
+ } else {
+ return PyLong_AsLong(x);
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long)-1;
+ val = __Pyx_PyInt_AsLong(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+}
+
+static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
+ const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+ if (likely(PyInt_Check(x))) {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to PY_LONG_LONG");
+ return (PY_LONG_LONG)-1;
+ }
+ return (PY_LONG_LONG)val;
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+ if (unlikely(Py_SIZE(x) < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to PY_LONG_LONG");
+ return (PY_LONG_LONG)-1;
+ }
+ return PyLong_AsUnsignedLongLong(x);
+ } else {
+ return PyLong_AsLongLong(x);
+ }
+ } else {
+ PY_LONG_LONG val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (PY_LONG_LONG)-1;
+ val = __Pyx_PyInt_AsLongLong(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+}
+
+static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
+ const signed long neg_one = (signed long)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+ if (likely(PyInt_Check(x))) {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to signed long");
+ return (signed long)-1;
+ }
+ return (signed long)val;
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+ if (unlikely(Py_SIZE(x) < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to signed long");
+ return (signed long)-1;
+ }
+ return PyLong_AsUnsignedLong(x);
+ } else {
+ return PyLong_AsLong(x);
+ }
+ } else {
+ signed long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (signed long)-1;
+ val = __Pyx_PyInt_AsSignedLong(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+}
+
+static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
+ const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+ if (likely(PyInt_Check(x))) {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to signed PY_LONG_LONG");
+ return (signed PY_LONG_LONG)-1;
+ }
+ return (signed PY_LONG_LONG)val;
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+ if (unlikely(Py_SIZE(x) < 0)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to signed PY_LONG_LONG");
+ return (signed PY_LONG_LONG)-1;
+ }
+ return PyLong_AsUnsignedLongLong(x);
+ } else {
+ return PyLong_AsLongLong(x);
+ }
+ } else {
+ signed PY_LONG_LONG val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (signed PY_LONG_LONG)-1;
+ val = __Pyx_PyInt_AsSignedLongLong(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+
+static void __Pyx_AddTraceback(const char *funcname) {
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ PyObject *py_globals = 0;
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(__pyx_filename);
+ #else
+ py_srcfile = PyUnicode_FromString(__pyx_filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (__pyx_clineno) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_globals = PyModule_GetDict(__pyx_m);
+ if (!py_globals) goto bad;
+ py_code = PyCode_New(
+ 0, /*int argcount,*/
+ #if PY_MAJOR_VERSION >= 3
+ 0, /*int kwonlyargcount,*/
+ #endif
+ 0, /*int nlocals,*/
+ 0, /*int stacksize,*/
+ 0, /*int flags,*/
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ __pyx_lineno, /*int firstlineno,*/
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ if (!py_code) goto bad;
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ py_globals, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = __pyx_lineno;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else /* Python 3+ has unicode identifiers */
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+/* Type Conversion Functions */
+
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ if (x == Py_True) return 1;
+ else if ((x == Py_False) | (x == Py_None)) return 0;
+ else return PyObject_IsTrue(x);
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_VERSION_HEX < 0x03000000
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_VERSION_HEX < 0x03000000
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_VERSION_HEX < 0x03000000
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%s__ returned non-%s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject* x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+#if PY_VERSION_HEX < 0x02050000
+ if (ival <= LONG_MAX)
+ return PyInt_FromLong((long)ival);
+ else {
+ unsigned char *bytes = (unsigned char *) &ival;
+ int one = 1; int little = (int)*(unsigned char*)&one;
+ return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
+ }
+#else
+ return PyInt_FromSize_t(ival);
+#endif
+}
+
+static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
+ unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
+ if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
+ return (size_t)-1;
+ } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to size_t");
+ return (size_t)-1;
+ }
+ return (size_t)val;
+}
+
+
+#endif /* Py_PYTHON_H */