gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

_pyportmidi.c (254875B)


      1 /* Generated by Cython 0.12.1 on Sun Sep 26 13:30:09 2010 */
      2 
      3 #define PY_SSIZE_T_CLEAN
      4 #include "Python.h"
      5 #include "structmember.h"
      6 #ifndef Py_PYTHON_H
      7     #error Python headers needed to compile C extensions, please install development version of Python.
      8 #else
      9 
     10 #ifndef PY_LONG_LONG
     11   #define PY_LONG_LONG LONG_LONG
     12 #endif
     13 #ifndef DL_EXPORT
     14   #define DL_EXPORT(t) t
     15 #endif
     16 #if PY_VERSION_HEX < 0x02040000
     17   #define METH_COEXIST 0
     18   #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
     19   #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
     20 #endif
     21 
     22 #if PY_VERSION_HEX < 0x02050000
     23   typedef int Py_ssize_t;
     24   #define PY_SSIZE_T_MAX INT_MAX
     25   #define PY_SSIZE_T_MIN INT_MIN
     26   #define PY_FORMAT_SIZE_T ""
     27   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
     28   #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
     29   #define PyNumber_Index(o)    PyNumber_Int(o)
     30   #define PyIndex_Check(o)     PyNumber_Check(o)
     31   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
     32 #endif
     33 
     34 #if PY_VERSION_HEX < 0x02060000
     35   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
     36   #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
     37   #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
     38   #define PyVarObject_HEAD_INIT(type, size) \
     39           PyObject_HEAD_INIT(type) size,
     40   #define PyType_Modified(t)
     41 
     42   typedef struct {
     43      void *buf;
     44      PyObject *obj;
     45      Py_ssize_t len;
     46      Py_ssize_t itemsize;
     47      int readonly;
     48      int ndim;
     49      char *format;
     50      Py_ssize_t *shape;
     51      Py_ssize_t *strides;
     52      Py_ssize_t *suboffsets;
     53      void *internal;
     54   } Py_buffer;
     55 
     56   #define PyBUF_SIMPLE 0
     57   #define PyBUF_WRITABLE 0x0001
     58   #define PyBUF_FORMAT 0x0004
     59   #define PyBUF_ND 0x0008
     60   #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
     61   #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
     62   #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
     63   #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
     64   #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
     65 
     66 #endif
     67 
     68 #if PY_MAJOR_VERSION < 3
     69   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
     70 #else
     71   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
     72 #endif
     73 
     74 #if PY_MAJOR_VERSION >= 3
     75   #define Py_TPFLAGS_CHECKTYPES 0
     76   #define Py_TPFLAGS_HAVE_INDEX 0
     77 #endif
     78 
     79 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
     80   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
     81 #endif
     82 
     83 #if PY_MAJOR_VERSION >= 3
     84   #define PyBaseString_Type            PyUnicode_Type
     85   #define PyString_Type                PyUnicode_Type
     86   #define PyString_CheckExact          PyUnicode_CheckExact
     87 #else
     88   #define PyBytes_Type                 PyString_Type
     89   #define PyBytes_CheckExact           PyString_CheckExact
     90 #endif
     91 
     92 #if PY_MAJOR_VERSION >= 3
     93   #define PyInt_Type                   PyLong_Type
     94   #define PyInt_Check(op)              PyLong_Check(op)
     95   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
     96   #define PyInt_FromString             PyLong_FromString
     97   #define PyInt_FromUnicode            PyLong_FromUnicode
     98   #define PyInt_FromLong               PyLong_FromLong
     99   #define PyInt_FromSize_t             PyLong_FromSize_t
    100   #define PyInt_FromSsize_t            PyLong_FromSsize_t
    101   #define PyInt_AsLong                 PyLong_AsLong
    102   #define PyInt_AS_LONG                PyLong_AS_LONG
    103   #define PyInt_AsSsize_t              PyLong_AsSsize_t
    104   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
    105   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
    106   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
    107   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
    108 #else
    109   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
    110   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
    111 
    112 #endif
    113 
    114 #if PY_MAJOR_VERSION >= 3
    115   #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
    116 #endif
    117 
    118 #if !defined(WIN32) && !defined(MS_WINDOWS)
    119   #ifndef __stdcall
    120     #define __stdcall
    121   #endif
    122   #ifndef __cdecl
    123     #define __cdecl
    124   #endif
    125   #ifndef __fastcall
    126     #define __fastcall
    127   #endif
    128 #else
    129   #define _USE_MATH_DEFINES
    130 #endif
    131 
    132 #if PY_VERSION_HEX < 0x02050000
    133   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
    134   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
    135   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
    136 #else
    137   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
    138   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
    139   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
    140 #endif
    141 
    142 #if PY_VERSION_HEX < 0x02050000
    143   #define __Pyx_NAMESTR(n) ((char *)(n))
    144   #define __Pyx_DOCSTR(n)  ((char *)(n))
    145 #else
    146   #define __Pyx_NAMESTR(n) (n)
    147   #define __Pyx_DOCSTR(n)  (n)
    148 #endif
    149 #ifdef __cplusplus
    150 #define __PYX_EXTERN_C extern "C"
    151 #else
    152 #define __PYX_EXTERN_C extern
    153 #endif
    154 #include <math.h>
    155 #define __PYX_HAVE_API___pyportmidi
    156 #include "portmidi.h"
    157 #include "porttime.h"
    158 
    159 #ifndef CYTHON_INLINE
    160   #if defined(__GNUC__)
    161     #define CYTHON_INLINE __inline__
    162   #elif defined(_MSC_VER)
    163     #define CYTHON_INLINE __inline
    164   #else
    165     #define CYTHON_INLINE 
    166   #endif
    167 #endif
    168 
    169 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*/
    170 
    171 
    172 /* Type Conversion Predeclarations */
    173 
    174 #if PY_MAJOR_VERSION < 3
    175 #define __Pyx_PyBytes_FromString          PyString_FromString
    176 #define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
    177 #define __Pyx_PyBytes_AsString            PyString_AsString
    178 #else
    179 #define __Pyx_PyBytes_FromString          PyBytes_FromString
    180 #define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
    181 #define __Pyx_PyBytes_AsString            PyBytes_AsString
    182 #endif
    183 
    184 #define __Pyx_PyBytes_FromUString(s)      __Pyx_PyBytes_FromString((char*)s)
    185 #define __Pyx_PyBytes_AsUString(s)        ((unsigned char*) __Pyx_PyBytes_AsString(s))
    186 
    187 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
    188 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
    189 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
    190 
    191 #if !defined(T_PYSSIZET)
    192 #if PY_VERSION_HEX < 0x02050000
    193 #define T_PYSSIZET T_INT
    194 #elif !defined(T_LONGLONG)
    195 #define T_PYSSIZET \
    196         ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
    197         ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
    198 #else
    199 #define T_PYSSIZET \
    200         ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
    201         ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
    202         ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
    203 #endif
    204 #endif
    205 
    206 
    207 #if !defined(T_ULONGLONG)
    208 #define __Pyx_T_UNSIGNED_INT(x) \
    209         ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
    210         ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
    211         ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
    212         ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : -1))))
    213 #else
    214 #define __Pyx_T_UNSIGNED_INT(x) \
    215         ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
    216         ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
    217         ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
    218         ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : \
    219         ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
    220 #endif
    221 #if !defined(T_LONGLONG)
    222 #define __Pyx_T_SIGNED_INT(x) \
    223         ((sizeof(x) == sizeof(char))  ? T_BYTE : \
    224         ((sizeof(x) == sizeof(short)) ? T_SHORT : \
    225         ((sizeof(x) == sizeof(int))   ? T_INT : \
    226         ((sizeof(x) == sizeof(long))  ? T_LONG : -1))))
    227 #else
    228 #define __Pyx_T_SIGNED_INT(x) \
    229         ((sizeof(x) == sizeof(char))  ? T_BYTE : \
    230         ((sizeof(x) == sizeof(short)) ? T_SHORT : \
    231         ((sizeof(x) == sizeof(int))   ? T_INT : \
    232         ((sizeof(x) == sizeof(long))  ? T_LONG : \
    233         ((sizeof(x) == sizeof(PY_LONG_LONG))   ? T_LONGLONG : -1)))))
    234 #endif
    235 
    236 #define __Pyx_T_FLOATING(x) \
    237         ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
    238         ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))
    239 
    240 #if !defined(T_SIZET)
    241 #if !defined(T_ULONGLONG)
    242 #define T_SIZET \
    243         ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
    244         ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
    245 #else
    246 #define T_SIZET \
    247         ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
    248         ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
    249         ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
    250 #endif
    251 #endif
    252 
    253 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
    254 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
    255 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
    256 
    257 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
    258 
    259 
    260 #ifdef __GNUC__
    261 /* Test for GCC > 2.95 */
    262 #if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
    263 #define likely(x)   __builtin_expect(!!(x), 1)
    264 #define unlikely(x) __builtin_expect(!!(x), 0)
    265 #else /* __GNUC__ > 2 ... */
    266 #define likely(x)   (x)
    267 #define unlikely(x) (x)
    268 #endif /* __GNUC__ > 2 ... */
    269 #else /* __GNUC__ */
    270 #define likely(x)   (x)
    271 #define unlikely(x) (x)
    272 #endif /* __GNUC__ */
    273     
    274 static PyObject *__pyx_m;
    275 static PyObject *__pyx_b;
    276 static PyObject *__pyx_empty_tuple;
    277 static PyObject *__pyx_empty_bytes;
    278 static int __pyx_lineno;
    279 static int __pyx_clineno = 0;
    280 static const char * __pyx_cfilenm= __FILE__;
    281 static const char *__pyx_filename;
    282 static const char **__pyx_f;
    283 
    284 
    285 /* Type declarations */
    286 
    287 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":394
    288  * 
    289  * 
    290  * cdef class Input:             # <<<<<<<<<<<<<<
    291  *     """
    292  * class Input:
    293  */
    294 
    295 struct __pyx_obj_11_pyportmidi_Input {
    296   PyObject_HEAD
    297   PmStream *midi;
    298   int debug;
    299   int i;
    300 };
    301 
    302 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":201
    303  *     return Pm_Channel(chan-1)
    304  * 
    305  * cdef class Output:             # <<<<<<<<<<<<<<
    306  *     """
    307  * class Output:
    308  */
    309 
    310 struct __pyx_obj_11_pyportmidi_Output {
    311   PyObject_HEAD
    312   int i;
    313   PmStream *midi;
    314   int debug;
    315   int _aborted;
    316 };
    317 
    318 #ifndef CYTHON_REFNANNY
    319   #define CYTHON_REFNANNY 0
    320 #endif
    321 
    322 #if CYTHON_REFNANNY
    323   typedef struct {
    324     void (*INCREF)(void*, PyObject*, int);
    325     void (*DECREF)(void*, PyObject*, int);
    326     void (*GOTREF)(void*, PyObject*, int);
    327     void (*GIVEREF)(void*, PyObject*, int);
    328     void* (*SetupContext)(const char*, int, const char*);
    329     void (*FinishContext)(void**);
    330   } __Pyx_RefNannyAPIStruct;
    331   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
    332   static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
    333     PyObject *m = NULL, *p = NULL;
    334     void *r = NULL;
    335     m = PyImport_ImportModule((char *)modname);
    336     if (!m) goto end;
    337     p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    338     if (!p) goto end;
    339     r = PyLong_AsVoidPtr(p);
    340   end:
    341     Py_XDECREF(p);
    342     Py_XDECREF(m);
    343     return (__Pyx_RefNannyAPIStruct *)r;
    344   }
    345   #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
    346   #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
    347   #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    348   #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    349   #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    350   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
    351   #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
    352 #else
    353   #define __Pyx_RefNannySetupContext(name)
    354   #define __Pyx_RefNannyFinishContext()
    355   #define __Pyx_INCREF(r) Py_INCREF(r)
    356   #define __Pyx_DECREF(r) Py_DECREF(r)
    357   #define __Pyx_GOTREF(r)
    358   #define __Pyx_GIVEREF(r)
    359   #define __Pyx_XDECREF(r) Py_XDECREF(r)
    360 #endif /* CYTHON_REFNANNY */
    361 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
    362 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
    363 
    364 static void __Pyx_RaiseDoubleKeywordsError(
    365     const char* func_name, PyObject* kw_name); /*proto*/
    366 
    367 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    368     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
    369 
    370 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
    371 
    372 
    373 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    374     PyObject *r;
    375     if (!j) return NULL;
    376     r = PyObject_GetItem(o, j);
    377     Py_DECREF(j);
    378     return r;
    379 }
    380 
    381 
    382 #define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
    383                                                     __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
    384                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
    385 
    386 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    387     if (likely(o != Py_None)) {
    388         if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
    389             PyObject *r = PyList_GET_ITEM(o, i);
    390             Py_INCREF(r);
    391             return r;
    392         }
    393         else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
    394             PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
    395             Py_INCREF(r);
    396             return r;
    397         }
    398     }
    399     return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    400 }
    401 
    402 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
    403                                                     __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
    404                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
    405 
    406 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    407     if (likely(o != Py_None)) {
    408         if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
    409             PyObject *r = PyTuple_GET_ITEM(o, i);
    410             Py_INCREF(r);
    411             return r;
    412         }
    413         else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
    414             PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
    415             Py_INCREF(r);
    416             return r;
    417         }
    418     }
    419     return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    420 }
    421 
    422 
    423 #define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
    424                                                     __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
    425                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
    426 
    427 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    428     PyObject *r;
    429     if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
    430         r = PyList_GET_ITEM(o, i);
    431         Py_INCREF(r);
    432     }
    433     else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
    434         r = PyTuple_GET_ITEM(o, i);
    435         Py_INCREF(r);
    436     }
    437     else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
    438         r = PySequence_GetItem(o, i);
    439     }
    440     else {
    441         r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    442     }
    443     return r;
    444 }
    445 
    446 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    447     if (likely(PyList_CheckExact(L))) {
    448         if (PyList_Append(L, x) < 0) return NULL;
    449         Py_INCREF(Py_None);
    450         return Py_None; /* this is just to have an accurate signature */
    451     }
    452     else {
    453         PyObject *r, *m;
    454         m = __Pyx_GetAttrString(L, "append");
    455         if (!m) return NULL;
    456         r = PyObject_CallFunctionObjArgs(m, x, NULL);
    457         Py_DECREF(m);
    458         return r;
    459     }
    460 }
    461 
    462 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
    463 
    464 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmDeviceID(PmDeviceID);
    465 
    466 static CYTHON_INLINE PmDeviceID __Pyx_PyInt_from_py_PmDeviceID(PyObject *);
    467 
    468 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PtTimestamp(PtTimestamp);
    469 
    470 static int __Pyx_Print(PyObject *, int); /*proto*/
    471 #if PY_MAJOR_VERSION >= 3
    472 static PyObject* __pyx_print = 0;
    473 static PyObject* __pyx_print_kwargs = 0;
    474 #endif
    475 
    476 static int __Pyx_PrintOne(PyObject *o); /*proto*/
    477 
    478 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
    479 
    480 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    481 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
    482 
    483 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    484 
    485 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmMessage(PmMessage);
    486 
    487 static CYTHON_INLINE PmMessage __Pyx_PyInt_from_py_PmMessage(PyObject *);
    488 
    489 static CYTHON_INLINE PmTimestamp __Pyx_PyInt_from_py_PmTimestamp(PyObject *);
    490 
    491 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmTimestamp(PmTimestamp);
    492 
    493 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
    494 
    495 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
    496 
    497 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
    498 
    499 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
    500 
    501 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
    502 
    503 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
    504 
    505 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
    506 
    507 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
    508 
    509 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
    510 
    511 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
    512 
    513 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
    514 
    515 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
    516 
    517 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
    518 
    519 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
    520 
    521 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
    522 
    523 static void __Pyx_AddTraceback(const char *funcname); /*proto*/
    524 
    525 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
    526 /* Module declarations from _pyportmidi */
    527 
    528 static PyTypeObject *__pyx_ptype_11_pyportmidi_Output = 0;
    529 static PyTypeObject *__pyx_ptype_11_pyportmidi_Input = 0;
    530 #define __Pyx_MODULE_NAME "_pyportmidi"
    531 int __pyx_module_is_main__pyportmidi = 0;
    532 
    533 /* Implementation of _pyportmidi */
    534 static PyObject *__pyx_builtin_Exception;
    535 static PyObject *__pyx_builtin_IndexError;
    536 static PyObject *__pyx_builtin_range;
    537 static char __pyx_k_1[] = "Opening Midi Output";
    538 static char __pyx_k_2[] = "Unable to open Midi OutputDevice=";
    539 static char __pyx_k_3[] = " err=";
    540 static char __pyx_k_4[] = "Closing MIDI output stream and destroying instance";
    541 static char __pyx_k_5[] = "midi Output not open.";
    542 static char __pyx_k_6[] = "midi Output aborted.  Need to call Close after Abort.";
    543 static char __pyx_k_7[] = "maximum list length is 1024";
    544 static char __pyx_k_8[] = " arguments in event list";
    545 static char __pyx_k_9[] = " : ";
    546 static char __pyx_k_10[] = "writing to midi buffer";
    547 static char __pyx_k_11[] = "Writing to MIDI buffer";
    548 static char __pyx_k_12[] = "MIDI input opened.";
    549 static char __pyx_k_13[] = "Closing MIDI input stream and destroying instance";
    550 static char __pyx_k_14[] = "midi Input not open.";
    551 static char __pyx_k_15[] = "maximum buffer length is 1024";
    552 static char __pyx_k_16[] = "minimum buffer length is 1";
    553 static char __pyx_k_17[] = "0.07";
    554 static char __pyx_k_18[] = "FILT_CHANNEL_AFTERTOUCH";
    555 static char __pyx_k_19[] = "FILT_POLY_AFTERTOUCH";
    556 static char __pyx_k_20[] = "Initialize (line 132)";
    557 static char __pyx_k_21[] = "Terminate (line 139)";
    558 static char __pyx_k_22[] = "GetDeviceInfo (line 156)";
    559 static char __pyx_k_23[] = "Time (line 173)";
    560 static char __pyx_k_24[] = "GetErrorText (line 180)";
    561 static char __pyx_k_25[] = "Channel (line 187)";
    562 static char __pyx_k_26[] = "Output._check_open (line 248)";
    563 static char __pyx_k_27[] = "Output.Close (line 258)";
    564 static char __pyx_k_28[] = "Output.Abort (line 274)";
    565 static char __pyx_k_29[] = "Output.Write (line 293)";
    566 static char __pyx_k_30[] = "Output.WriteShort (line 333)";
    567 static char __pyx_k_31[] = "Output.WriteSysEx (line 356)";
    568 static char __pyx_k_32[] = "Input._check_open (line 422)";
    569 static char __pyx_k_33[] = "Input.Close (line 430)";
    570 static char __pyx_k_34[] = "Input.SetFilter (line 447)";
    571 static char __pyx_k_35[] = "Input.SetChannelMask (line 481)";
    572 static char __pyx_k_36[] = "Input.Poll (line 502)";
    573 static char __pyx_k_37[] = "Input.Read (line 514)";
    574 static char __pyx_k__B[] = "B";
    575 static char __pyx_k__i[] = "i";
    576 static char __pyx_k__msg[] = "msg";
    577 static char __pyx_k__Poll[] = "Poll";
    578 static char __pyx_k__Read[] = "Read";
    579 static char __pyx_k__TRUE[] = "TRUE";
    580 static char __pyx_k__Time[] = "Time";
    581 static char __pyx_k__midi[] = "midi";
    582 static char __pyx_k__name[] = "name";
    583 static char __pyx_k__when[] = "when";
    584 static char __pyx_k__Abort[] = "Abort";
    585 static char __pyx_k__Close[] = "Close";
    586 static char __pyx_k__FALSE[] = "FALSE";
    587 static char __pyx_k__Input[] = "Input";
    588 static char __pyx_k__Write[] = "Write";
    589 static char __pyx_k__array[] = "array";
    590 static char __pyx_k__data1[] = "data1";
    591 static char __pyx_k__data2[] = "data2";
    592 static char __pyx_k__debug[] = "debug";
    593 static char __pyx_k__input[] = "input";
    594 static char __pyx_k__range[] = "range";
    595 static char __pyx_k__Output[] = "Output";
    596 static char __pyx_k__interf[] = "interf";
    597 static char __pyx_k__opened[] = "opened";
    598 static char __pyx_k__output[] = "output";
    599 static char __pyx_k__status[] = "status";
    600 static char __pyx_k__Channel[] = "Channel";
    601 static char __pyx_k__FILT_F9[] = "FILT_F9";
    602 static char __pyx_k__FILT_FD[] = "FILT_FD";
    603 static char __pyx_k__latency[] = "latency";
    604 static char __pyx_k__message[] = "message";
    605 static char __pyx_k__FILT_MTC[] = "FILT_MTC";
    606 static char __pyx_k____main__[] = "__main__";
    607 static char __pyx_k____test__[] = "__test__";
    608 static char __pyx_k___aborted[] = "_aborted";
    609 static char __pyx_k__tostring[] = "tostring";
    610 static char __pyx_k__Exception[] = "Exception";
    611 static char __pyx_k__FILT_NOTE[] = "FILT_NOTE";
    612 static char __pyx_k__FILT_PLAY[] = "FILT_PLAY";
    613 static char __pyx_k__FILT_TICK[] = "FILT_TICK";
    614 static char __pyx_k__FILT_TUNE[] = "FILT_TUNE";
    615 static char __pyx_k__SetFilter[] = "SetFilter";
    616 static char __pyx_k__Terminate[] = "Terminate";
    617 static char __pyx_k__timestamp[] = "timestamp";
    618 static char __pyx_k__FILT_CLOCK[] = "FILT_CLOCK";
    619 static char __pyx_k__FILT_RESET[] = "FILT_RESET";
    620 static char __pyx_k__FILT_SYSEX[] = "FILT_SYSEX";
    621 static char __pyx_k__IndexError[] = "IndexError";
    622 static char __pyx_k__Initialize[] = "Initialize";
    623 static char __pyx_k__WriteShort[] = "WriteShort";
    624 static char __pyx_k__WriteSysEx[] = "WriteSysEx";
    625 static char __pyx_k__buffersize[] = "buffersize";
    626 static char __pyx_k__FILT_ACTIVE[] = "FILT_ACTIVE";
    627 static char __pyx_k__InputDevice[] = "InputDevice";
    628 static char __pyx_k____version__[] = "__version__";
    629 static char __pyx_k___check_open[] = "_check_open";
    630 static char __pyx_k__FILT_CONTROL[] = "FILT_CONTROL";
    631 static char __pyx_k__FILT_PROGRAM[] = "FILT_PROGRAM";
    632 static char __pyx_k__GetErrorText[] = "GetErrorText";
    633 static char __pyx_k__OutputDevice[] = "OutputDevice";
    634 static char __pyx_k__FILT_REALTIME[] = "FILT_REALTIME";
    635 static char __pyx_k__GetDeviceInfo[] = "GetDeviceInfo";
    636 static char __pyx_k__FILT_PITCHBEND[] = "FILT_PITCHBEND";
    637 static char __pyx_k__FILT_UNDEFINED[] = "FILT_UNDEFINED";
    638 static char __pyx_k__SetChannelMask[] = "SetChannelMask";
    639 static char __pyx_k__FILT_AFTERTOUCH[] = "FILT_AFTERTOUCH";
    640 static char __pyx_k__FILT_SONG_SELECT[] = "FILT_SONG_SELECT";
    641 static char __pyx_k__FILT_SONG_POSITION[] = "FILT_SONG_POSITION";
    642 static PyObject *__pyx_kp_s_1;
    643 static PyObject *__pyx_kp_s_10;
    644 static PyObject *__pyx_kp_s_11;
    645 static PyObject *__pyx_kp_s_12;
    646 static PyObject *__pyx_kp_s_13;
    647 static PyObject *__pyx_kp_s_14;
    648 static PyObject *__pyx_kp_s_15;
    649 static PyObject *__pyx_kp_s_16;
    650 static PyObject *__pyx_kp_s_17;
    651 static PyObject *__pyx_n_s_18;
    652 static PyObject *__pyx_n_s_19;
    653 static PyObject *__pyx_kp_s_2;
    654 static PyObject *__pyx_kp_u_20;
    655 static PyObject *__pyx_kp_u_21;
    656 static PyObject *__pyx_kp_u_22;
    657 static PyObject *__pyx_kp_u_23;
    658 static PyObject *__pyx_kp_u_24;
    659 static PyObject *__pyx_kp_u_25;
    660 static PyObject *__pyx_kp_u_26;
    661 static PyObject *__pyx_kp_u_27;
    662 static PyObject *__pyx_kp_u_28;
    663 static PyObject *__pyx_kp_u_29;
    664 static PyObject *__pyx_kp_s_3;
    665 static PyObject *__pyx_kp_u_30;
    666 static PyObject *__pyx_kp_u_31;
    667 static PyObject *__pyx_kp_u_32;
    668 static PyObject *__pyx_kp_u_33;
    669 static PyObject *__pyx_kp_u_34;
    670 static PyObject *__pyx_kp_u_35;
    671 static PyObject *__pyx_kp_u_36;
    672 static PyObject *__pyx_kp_u_37;
    673 static PyObject *__pyx_kp_s_4;
    674 static PyObject *__pyx_kp_s_5;
    675 static PyObject *__pyx_kp_s_6;
    676 static PyObject *__pyx_kp_s_7;
    677 static PyObject *__pyx_kp_s_8;
    678 static PyObject *__pyx_kp_s_9;
    679 static PyObject *__pyx_n_s__Abort;
    680 static PyObject *__pyx_n_s__B;
    681 static PyObject *__pyx_n_s__Channel;
    682 static PyObject *__pyx_n_s__Close;
    683 static PyObject *__pyx_n_s__Exception;
    684 static PyObject *__pyx_n_s__FALSE;
    685 static PyObject *__pyx_n_s__FILT_ACTIVE;
    686 static PyObject *__pyx_n_s__FILT_AFTERTOUCH;
    687 static PyObject *__pyx_n_s__FILT_CLOCK;
    688 static PyObject *__pyx_n_s__FILT_CONTROL;
    689 static PyObject *__pyx_n_s__FILT_F9;
    690 static PyObject *__pyx_n_s__FILT_FD;
    691 static PyObject *__pyx_n_s__FILT_MTC;
    692 static PyObject *__pyx_n_s__FILT_NOTE;
    693 static PyObject *__pyx_n_s__FILT_PITCHBEND;
    694 static PyObject *__pyx_n_s__FILT_PLAY;
    695 static PyObject *__pyx_n_s__FILT_PROGRAM;
    696 static PyObject *__pyx_n_s__FILT_REALTIME;
    697 static PyObject *__pyx_n_s__FILT_RESET;
    698 static PyObject *__pyx_n_s__FILT_SONG_POSITION;
    699 static PyObject *__pyx_n_s__FILT_SONG_SELECT;
    700 static PyObject *__pyx_n_s__FILT_SYSEX;
    701 static PyObject *__pyx_n_s__FILT_TICK;
    702 static PyObject *__pyx_n_s__FILT_TUNE;
    703 static PyObject *__pyx_n_s__FILT_UNDEFINED;
    704 static PyObject *__pyx_n_s__GetDeviceInfo;
    705 static PyObject *__pyx_n_s__GetErrorText;
    706 static PyObject *__pyx_n_s__IndexError;
    707 static PyObject *__pyx_n_s__Initialize;
    708 static PyObject *__pyx_n_s__Input;
    709 static PyObject *__pyx_n_s__InputDevice;
    710 static PyObject *__pyx_n_s__Output;
    711 static PyObject *__pyx_n_s__OutputDevice;
    712 static PyObject *__pyx_n_s__Poll;
    713 static PyObject *__pyx_n_s__Read;
    714 static PyObject *__pyx_n_s__SetChannelMask;
    715 static PyObject *__pyx_n_s__SetFilter;
    716 static PyObject *__pyx_n_s__TRUE;
    717 static PyObject *__pyx_n_s__Terminate;
    718 static PyObject *__pyx_n_s__Time;
    719 static PyObject *__pyx_n_s__Write;
    720 static PyObject *__pyx_n_s__WriteShort;
    721 static PyObject *__pyx_n_s__WriteSysEx;
    722 static PyObject *__pyx_n_s____main__;
    723 static PyObject *__pyx_n_s____test__;
    724 static PyObject *__pyx_n_s____version__;
    725 static PyObject *__pyx_n_s___aborted;
    726 static PyObject *__pyx_n_s___check_open;
    727 static PyObject *__pyx_n_s__array;
    728 static PyObject *__pyx_n_s__buffersize;
    729 static PyObject *__pyx_n_s__data1;
    730 static PyObject *__pyx_n_s__data2;
    731 static PyObject *__pyx_n_s__debug;
    732 static PyObject *__pyx_n_s__i;
    733 static PyObject *__pyx_n_s__input;
    734 static PyObject *__pyx_n_s__interf;
    735 static PyObject *__pyx_n_s__latency;
    736 static PyObject *__pyx_n_s__message;
    737 static PyObject *__pyx_n_s__midi;
    738 static PyObject *__pyx_n_s__msg;
    739 static PyObject *__pyx_n_s__name;
    740 static PyObject *__pyx_n_s__opened;
    741 static PyObject *__pyx_n_s__output;
    742 static PyObject *__pyx_n_s__range;
    743 static PyObject *__pyx_n_s__status;
    744 static PyObject *__pyx_n_s__timestamp;
    745 static PyObject *__pyx_n_s__tostring;
    746 static PyObject *__pyx_n_s__when;
    747 static PyObject *__pyx_int_0;
    748 static PyObject *__pyx_int_1;
    749 static PyObject *__pyx_int_8;
    750 static PyObject *__pyx_int_16;
    751 static PyObject *__pyx_int_0x1;
    752 static PyObject *__pyx_int_0x2;
    753 static PyObject *__pyx_int_0x4;
    754 static PyObject *__pyx_int_0x8;
    755 static PyObject *__pyx_int_0x10;
    756 static PyObject *__pyx_int_0x20;
    757 static PyObject *__pyx_int_0x30;
    758 static PyObject *__pyx_int_0x40;
    759 static PyObject *__pyx_int_0x7F;
    760 static PyObject *__pyx_int_0x80;
    761 static PyObject *__pyx_int_0xFF;
    762 static PyObject *__pyx_int_1024;
    763 static PyObject *__pyx_int_4096;
    764 static PyObject *__pyx_int_0x100;
    765 static PyObject *__pyx_int_0x200;
    766 static PyObject *__pyx_int_0x300;
    767 static PyObject *__pyx_int_0x400;
    768 static PyObject *__pyx_int_0x800;
    769 static PyObject *__pyx_int_0x1000;
    770 static PyObject *__pyx_int_0x2000;
    771 static PyObject *__pyx_int_0x4000;
    772 static PyObject *__pyx_int_0x8000;
    773 static PyObject *__pyx_int_0xFF00;
    774 static PyObject *__pyx_int_0x10000;
    775 static PyObject *__pyx_int_0xFF0000;
    776 
    777 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":132
    778  * TRUE=1
    779  * 
    780  * def Initialize():             # <<<<<<<<<<<<<<
    781  *     """
    782  * Initialize: call this first
    783  */
    784 
    785 static PyObject *__pyx_pf_11_pyportmidi_Initialize(PyObject *__pyx_self, PyObject *unused); /*proto*/
    786 static char __pyx_doc_11_pyportmidi_Initialize[] = "\nInitialize: call this first\n    ";
    787 static PyObject *__pyx_pf_11_pyportmidi_Initialize(PyObject *__pyx_self, PyObject *unused) {
    788   PyObject *__pyx_r = NULL;
    789   __Pyx_RefNannySetupContext("Initialize");
    790   __pyx_self = __pyx_self;
    791 
    792   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":136
    793  * Initialize: call this first
    794  *     """
    795  *     Pm_Initialize()             # <<<<<<<<<<<<<<
    796  *     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]/
    797  * 
    798  */
    799   Pm_Initialize();
    800 
    801   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":137
    802  *     """
    803  *     Pm_Initialize()
    804  *     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]/             # <<<<<<<<<<<<<<
    805  * 
    806  * def Terminate():
    807  */
    808   Pt_Start(1, NULL, NULL);
    809 
    810   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    811   __Pyx_XGIVEREF(__pyx_r);
    812   __Pyx_RefNannyFinishContext();
    813   return __pyx_r;
    814 }
    815 
    816 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":139
    817  *     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]/
    818  * 
    819  * def Terminate():             # <<<<<<<<<<<<<<
    820  *     """
    821  * Terminate: call this to clean up Midi streams when done.
    822  */
    823 
    824 static PyObject *__pyx_pf_11_pyportmidi_Terminate(PyObject *__pyx_self, PyObject *unused); /*proto*/
    825 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    ";
    826 static PyObject *__pyx_pf_11_pyportmidi_Terminate(PyObject *__pyx_self, PyObject *unused) {
    827   PyObject *__pyx_r = NULL;
    828   __Pyx_RefNannySetupContext("Terminate");
    829   __pyx_self = __pyx_self;
    830 
    831   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":145
    832  * done with MIDI, your system may crash.
    833  *     """
    834  *     Pm_Terminate()             # <<<<<<<<<<<<<<
    835  * 
    836  * def GetDefaultInputDeviceID():
    837  */
    838   Pm_Terminate();
    839 
    840   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    841   __Pyx_XGIVEREF(__pyx_r);
    842   __Pyx_RefNannyFinishContext();
    843   return __pyx_r;
    844 }
    845 
    846 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":147
    847  *     Pm_Terminate()
    848  * 
    849  * def GetDefaultInputDeviceID():             # <<<<<<<<<<<<<<
    850  *     return Pm_GetDefaultInputDeviceID()
    851  * 
    852  */
    853 
    854 static PyObject *__pyx_pf_11_pyportmidi_GetDefaultInputDeviceID(PyObject *__pyx_self, PyObject *unused); /*proto*/
    855 static PyObject *__pyx_pf_11_pyportmidi_GetDefaultInputDeviceID(PyObject *__pyx_self, PyObject *unused) {
    856   PyObject *__pyx_r = NULL;
    857   PyObject *__pyx_t_1 = NULL;
    858   __Pyx_RefNannySetupContext("GetDefaultInputDeviceID");
    859   __pyx_self = __pyx_self;
    860 
    861   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":148
    862  * 
    863  * def GetDefaultInputDeviceID():
    864  *     return Pm_GetDefaultInputDeviceID()             # <<<<<<<<<<<<<<
    865  * 
    866  * def GetDefaultOutputDeviceID():
    867  */
    868   __Pyx_XDECREF(__pyx_r);
    869   __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;}
    870   __Pyx_GOTREF(__pyx_t_1);
    871   __pyx_r = __pyx_t_1;
    872   __pyx_t_1 = 0;
    873   goto __pyx_L0;
    874 
    875   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    876   goto __pyx_L0;
    877   __pyx_L1_error:;
    878   __Pyx_XDECREF(__pyx_t_1);
    879   __Pyx_AddTraceback("_pyportmidi.GetDefaultInputDeviceID");
    880   __pyx_r = NULL;
    881   __pyx_L0:;
    882   __Pyx_XGIVEREF(__pyx_r);
    883   __Pyx_RefNannyFinishContext();
    884   return __pyx_r;
    885 }
    886 
    887 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":150
    888  *     return Pm_GetDefaultInputDeviceID()
    889  * 
    890  * def GetDefaultOutputDeviceID():             # <<<<<<<<<<<<<<
    891  *     return Pm_GetDefaultOutputDeviceID()
    892  * 
    893  */
    894 
    895 static PyObject *__pyx_pf_11_pyportmidi_GetDefaultOutputDeviceID(PyObject *__pyx_self, PyObject *unused); /*proto*/
    896 static PyObject *__pyx_pf_11_pyportmidi_GetDefaultOutputDeviceID(PyObject *__pyx_self, PyObject *unused) {
    897   PyObject *__pyx_r = NULL;
    898   PyObject *__pyx_t_1 = NULL;
    899   __Pyx_RefNannySetupContext("GetDefaultOutputDeviceID");
    900   __pyx_self = __pyx_self;
    901 
    902   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":151
    903  * 
    904  * def GetDefaultOutputDeviceID():
    905  *     return Pm_GetDefaultOutputDeviceID()             # <<<<<<<<<<<<<<
    906  * 
    907  * def CountDevices():
    908  */
    909   __Pyx_XDECREF(__pyx_r);
    910   __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;}
    911   __Pyx_GOTREF(__pyx_t_1);
    912   __pyx_r = __pyx_t_1;
    913   __pyx_t_1 = 0;
    914   goto __pyx_L0;
    915 
    916   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    917   goto __pyx_L0;
    918   __pyx_L1_error:;
    919   __Pyx_XDECREF(__pyx_t_1);
    920   __Pyx_AddTraceback("_pyportmidi.GetDefaultOutputDeviceID");
    921   __pyx_r = NULL;
    922   __pyx_L0:;
    923   __Pyx_XGIVEREF(__pyx_r);
    924   __Pyx_RefNannyFinishContext();
    925   return __pyx_r;
    926 }
    927 
    928 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":153
    929  *     return Pm_GetDefaultOutputDeviceID()
    930  * 
    931  * def CountDevices():             # <<<<<<<<<<<<<<
    932  *     return Pm_CountDevices()
    933  * 
    934  */
    935 
    936 static PyObject *__pyx_pf_11_pyportmidi_CountDevices(PyObject *__pyx_self, PyObject *unused); /*proto*/
    937 static PyObject *__pyx_pf_11_pyportmidi_CountDevices(PyObject *__pyx_self, PyObject *unused) {
    938   PyObject *__pyx_r = NULL;
    939   PyObject *__pyx_t_1 = NULL;
    940   __Pyx_RefNannySetupContext("CountDevices");
    941   __pyx_self = __pyx_self;
    942 
    943   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":154
    944  * 
    945  * def CountDevices():
    946  *     return Pm_CountDevices()             # <<<<<<<<<<<<<<
    947  * 
    948  * def GetDeviceInfo(i):
    949  */
    950   __Pyx_XDECREF(__pyx_r);
    951   __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;}
    952   __Pyx_GOTREF(__pyx_t_1);
    953   __pyx_r = __pyx_t_1;
    954   __pyx_t_1 = 0;
    955   goto __pyx_L0;
    956 
    957   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    958   goto __pyx_L0;
    959   __pyx_L1_error:;
    960   __Pyx_XDECREF(__pyx_t_1);
    961   __Pyx_AddTraceback("_pyportmidi.CountDevices");
    962   __pyx_r = NULL;
    963   __pyx_L0:;
    964   __Pyx_XGIVEREF(__pyx_r);
    965   __Pyx_RefNannyFinishContext();
    966   return __pyx_r;
    967 }
    968 
    969 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":156
    970  *     return Pm_CountDevices()
    971  * 
    972  * def GetDeviceInfo(i):             # <<<<<<<<<<<<<<
    973  *     """
    974  * GetDeviceInfo(<device number>): returns 5 parameters
    975  */
    976 
    977 static PyObject *__pyx_pf_11_pyportmidi_GetDeviceInfo(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/
    978 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    ";
    979 static PyObject *__pyx_pf_11_pyportmidi_GetDeviceInfo(PyObject *__pyx_self, PyObject *__pyx_v_i) {
    980   PmDeviceInfo *__pyx_v_info;
    981   PyObject *__pyx_r = NULL;
    982   PmDeviceID __pyx_t_1;
    983   int __pyx_t_2;
    984   PyObject *__pyx_t_3 = NULL;
    985   PyObject *__pyx_t_4 = NULL;
    986   PyObject *__pyx_t_5 = NULL;
    987   PyObject *__pyx_t_6 = NULL;
    988   PyObject *__pyx_t_7 = NULL;
    989   PyObject *__pyx_t_8 = NULL;
    990   __Pyx_RefNannySetupContext("GetDeviceInfo");
    991   __pyx_self = __pyx_self;
    992   __Pyx_INCREF(__pyx_v_i);
    993 
    994   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":168
    995  * 
    996  *     # disregarding the constness from Pm_GetDeviceInfo, since pyrex doesn't do const.
    997  *     info = <PmDeviceInfo *>Pm_GetDeviceInfo(i)             # <<<<<<<<<<<<<<
    998  * 
    999  *     if info <> NULL: return info.interf, info.name, info.input, info.output, info.opened
   1000  */
   1001   __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;}
   1002   __pyx_v_info = ((PmDeviceInfo *)Pm_GetDeviceInfo(__pyx_t_1));
   1003 
   1004   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":170
   1005  *     info = <PmDeviceInfo *>Pm_GetDeviceInfo(i)
   1006  * 
   1007  *     if info <> NULL: return info.interf, info.name, info.input, info.output, info.opened             # <<<<<<<<<<<<<<
   1008  *     else: return
   1009  * 
   1010  */
   1011   __pyx_t_2 = (__pyx_v_info != NULL);
   1012   if (__pyx_t_2) {
   1013     __Pyx_XDECREF(__pyx_r);
   1014     __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;}
   1015     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   1016     __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;}
   1017     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   1018     __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;}
   1019     __Pyx_GOTREF(__pyx_t_5);
   1020     __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;}
   1021     __Pyx_GOTREF(__pyx_t_6);
   1022     __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;}
   1023     __Pyx_GOTREF(__pyx_t_7);
   1024     __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;}
   1025     __Pyx_GOTREF(__pyx_t_8);
   1026     PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
   1027     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
   1028     PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_4));
   1029     __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   1030     PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5);
   1031     __Pyx_GIVEREF(__pyx_t_5);
   1032     PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_6);
   1033     __Pyx_GIVEREF(__pyx_t_6);
   1034     PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_7);
   1035     __Pyx_GIVEREF(__pyx_t_7);
   1036     __pyx_t_3 = 0;
   1037     __pyx_t_4 = 0;
   1038     __pyx_t_5 = 0;
   1039     __pyx_t_6 = 0;
   1040     __pyx_t_7 = 0;
   1041     __pyx_r = __pyx_t_8;
   1042     __pyx_t_8 = 0;
   1043     goto __pyx_L0;
   1044     goto __pyx_L5;
   1045   }
   1046   /*else*/ {
   1047 
   1048     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":171
   1049  * 
   1050  *     if info <> NULL: return info.interf, info.name, info.input, info.output, info.opened
   1051  *     else: return             # <<<<<<<<<<<<<<
   1052  * 
   1053  * def Time():
   1054  */
   1055     __Pyx_XDECREF(__pyx_r);
   1056     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1057     goto __pyx_L0;
   1058   }
   1059   __pyx_L5:;
   1060 
   1061   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1062   goto __pyx_L0;
   1063   __pyx_L1_error:;
   1064   __Pyx_XDECREF(__pyx_t_3);
   1065   __Pyx_XDECREF(__pyx_t_4);
   1066   __Pyx_XDECREF(__pyx_t_5);
   1067   __Pyx_XDECREF(__pyx_t_6);
   1068   __Pyx_XDECREF(__pyx_t_7);
   1069   __Pyx_XDECREF(__pyx_t_8);
   1070   __Pyx_AddTraceback("_pyportmidi.GetDeviceInfo");
   1071   __pyx_r = NULL;
   1072   __pyx_L0:;
   1073   __Pyx_DECREF(__pyx_v_i);
   1074   __Pyx_XGIVEREF(__pyx_r);
   1075   __Pyx_RefNannyFinishContext();
   1076   return __pyx_r;
   1077 }
   1078 
   1079 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":173
   1080  *     else: return
   1081  * 
   1082  * def Time():             # <<<<<<<<<<<<<<
   1083  *     """
   1084  * Time() returns the current time in ms
   1085  */
   1086 
   1087 static PyObject *__pyx_pf_11_pyportmidi_Time(PyObject *__pyx_self, PyObject *unused); /*proto*/
   1088 static char __pyx_doc_11_pyportmidi_Time[] = "\nTime() returns the current time in ms\nof the PortMidi timer\n    ";
   1089 static PyObject *__pyx_pf_11_pyportmidi_Time(PyObject *__pyx_self, PyObject *unused) {
   1090   PyObject *__pyx_r = NULL;
   1091   PyObject *__pyx_t_1 = NULL;
   1092   __Pyx_RefNannySetupContext("Time");
   1093   __pyx_self = __pyx_self;
   1094 
   1095   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":178
   1096  * of the PortMidi timer
   1097  *     """
   1098  *     return Pt_Time()             # <<<<<<<<<<<<<<
   1099  * 
   1100  * def GetErrorText(err):
   1101  */
   1102   __Pyx_XDECREF(__pyx_r);
   1103   __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;}
   1104   __Pyx_GOTREF(__pyx_t_1);
   1105   __pyx_r = __pyx_t_1;
   1106   __pyx_t_1 = 0;
   1107   goto __pyx_L0;
   1108 
   1109   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1110   goto __pyx_L0;
   1111   __pyx_L1_error:;
   1112   __Pyx_XDECREF(__pyx_t_1);
   1113   __Pyx_AddTraceback("_pyportmidi.Time");
   1114   __pyx_r = NULL;
   1115   __pyx_L0:;
   1116   __Pyx_XGIVEREF(__pyx_r);
   1117   __Pyx_RefNannyFinishContext();
   1118   return __pyx_r;
   1119 }
   1120 
   1121 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":180
   1122  *     return Pt_Time()
   1123  * 
   1124  * def GetErrorText(err):             # <<<<<<<<<<<<<<
   1125  *     """
   1126  * GetErrorText(<err num>) returns human-readable error
   1127  */
   1128 
   1129 static PyObject *__pyx_pf_11_pyportmidi_GetErrorText(PyObject *__pyx_self, PyObject *__pyx_v_err); /*proto*/
   1130 static char __pyx_doc_11_pyportmidi_GetErrorText[] = "\nGetErrorText(<err num>) returns human-readable error\nmessages translated from error numbers\n    ";
   1131 static PyObject *__pyx_pf_11_pyportmidi_GetErrorText(PyObject *__pyx_self, PyObject *__pyx_v_err) {
   1132   PyObject *__pyx_r = NULL;
   1133   PmError __pyx_t_1;
   1134   PyObject *__pyx_t_2 = NULL;
   1135   __Pyx_RefNannySetupContext("GetErrorText");
   1136   __pyx_self = __pyx_self;
   1137 
   1138   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":185
   1139  * messages translated from error numbers
   1140  *     """
   1141  *     return Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   1142  * 
   1143  * def Channel(chan):
   1144  */
   1145   __Pyx_XDECREF(__pyx_r);
   1146   __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;}
   1147   __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;}
   1148   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   1149   __pyx_r = ((PyObject *)__pyx_t_2);
   1150   __pyx_t_2 = 0;
   1151   goto __pyx_L0;
   1152 
   1153   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1154   goto __pyx_L0;
   1155   __pyx_L1_error:;
   1156   __Pyx_XDECREF(__pyx_t_2);
   1157   __Pyx_AddTraceback("_pyportmidi.GetErrorText");
   1158   __pyx_r = NULL;
   1159   __pyx_L0:;
   1160   __Pyx_XGIVEREF(__pyx_r);
   1161   __Pyx_RefNannyFinishContext();
   1162   return __pyx_r;
   1163 }
   1164 
   1165 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":187
   1166  *     return Pm_GetErrorText(err)
   1167  * 
   1168  * def Channel(chan):             # <<<<<<<<<<<<<<
   1169  *     """
   1170  * Channel(<chan>) is used with ChannelMask on input MIDI streams.
   1171  */
   1172 
   1173 static PyObject *__pyx_pf_11_pyportmidi_Channel(PyObject *__pyx_self, PyObject *__pyx_v_chan); /*proto*/
   1174 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    ";
   1175 static PyObject *__pyx_pf_11_pyportmidi_Channel(PyObject *__pyx_self, PyObject *__pyx_v_chan) {
   1176   PyObject *__pyx_r = NULL;
   1177   PyObject *__pyx_t_1 = NULL;
   1178   int __pyx_t_2;
   1179   __Pyx_RefNannySetupContext("Channel");
   1180   __pyx_self = __pyx_self;
   1181 
   1182   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":199
   1183  *       all numbered from 0 to 15 instead of 1 to 16.
   1184  *     """
   1185  *     return Pm_Channel(chan-1)             # <<<<<<<<<<<<<<
   1186  * 
   1187  * cdef class Output:
   1188  */
   1189   __Pyx_XDECREF(__pyx_r);
   1190   __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;}
   1191   __Pyx_GOTREF(__pyx_t_1);
   1192   __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;}
   1193   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   1194   __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;}
   1195   __Pyx_GOTREF(__pyx_t_1);
   1196   __pyx_r = __pyx_t_1;
   1197   __pyx_t_1 = 0;
   1198   goto __pyx_L0;
   1199 
   1200   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1201   goto __pyx_L0;
   1202   __pyx_L1_error:;
   1203   __Pyx_XDECREF(__pyx_t_1);
   1204   __Pyx_AddTraceback("_pyportmidi.Channel");
   1205   __pyx_r = NULL;
   1206   __pyx_L0:;
   1207   __Pyx_XGIVEREF(__pyx_r);
   1208   __Pyx_RefNannyFinishContext();
   1209   return __pyx_r;
   1210 }
   1211 
   1212 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":214
   1213  *     cdef int _aborted
   1214  * 
   1215  *     def __init__(self, OutputDevice, latency=0):             # <<<<<<<<<<<<<<
   1216  * 
   1217  *         cdef PmError err
   1218  */
   1219 
   1220 static int __pyx_pf_11_pyportmidi_6Output___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
   1221 static int __pyx_pf_11_pyportmidi_6Output___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   1222   PyObject *__pyx_v_OutputDevice = 0;
   1223   PyObject *__pyx_v_latency = 0;
   1224   PmError __pyx_v_err;
   1225   PmTimeProcPtr __pyx_v_PmPtr;
   1226   PyObject *__pyx_v_s;
   1227   int __pyx_r;
   1228   int __pyx_t_1;
   1229   PyObject *__pyx_t_2 = NULL;
   1230   int __pyx_t_3;
   1231   long __pyx_t_4;
   1232   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__OutputDevice,&__pyx_n_s__latency,0};
   1233   __Pyx_RefNannySetupContext("__init__");
   1234   if (unlikely(__pyx_kwds)) {
   1235     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
   1236     PyObject* values[2] = {0,0};
   1237     values[1] = ((PyObject *)__pyx_int_0);
   1238     switch (PyTuple_GET_SIZE(__pyx_args)) {
   1239       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
   1240       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
   1241       case  0: break;
   1242       default: goto __pyx_L5_argtuple_error;
   1243     }
   1244     switch (PyTuple_GET_SIZE(__pyx_args)) {
   1245       case  0:
   1246       values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__OutputDevice);
   1247       if (likely(values[0])) kw_args--;
   1248       else goto __pyx_L5_argtuple_error;
   1249       case  1:
   1250       if (kw_args > 1) {
   1251         PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__latency);
   1252         if (unlikely(value)) { values[1] = value; kw_args--; }
   1253       }
   1254     }
   1255     if (unlikely(kw_args > 0)) {
   1256       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;}
   1257     }
   1258     __pyx_v_OutputDevice = values[0];
   1259     __pyx_v_latency = values[1];
   1260   } else {
   1261     __pyx_v_latency = ((PyObject *)__pyx_int_0);
   1262     switch (PyTuple_GET_SIZE(__pyx_args)) {
   1263       case  2: __pyx_v_latency = PyTuple_GET_ITEM(__pyx_args, 1);
   1264       case  1: __pyx_v_OutputDevice = PyTuple_GET_ITEM(__pyx_args, 0);
   1265       break;
   1266       default: goto __pyx_L5_argtuple_error;
   1267     }
   1268   }
   1269   goto __pyx_L4_argument_unpacking_done;
   1270   __pyx_L5_argtuple_error:;
   1271   __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;}
   1272   __pyx_L3_error:;
   1273   __Pyx_AddTraceback("_pyportmidi.Output.__init__");
   1274   return -1;
   1275   __pyx_L4_argument_unpacking_done:;
   1276   __Pyx_INCREF((PyObject *)__pyx_v_self);
   1277   __Pyx_INCREF(__pyx_v_OutputDevice);
   1278   __Pyx_INCREF(__pyx_v_latency);
   1279   __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
   1280 
   1281   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":220
   1282  *         cdef PmTimeProcPtr PmPtr
   1283  * 
   1284  *         self.i = OutputDevice             # <<<<<<<<<<<<<<
   1285  *         self.debug = 0
   1286  *         self._aborted = 0
   1287  */
   1288   __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;}
   1289   ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->i = __pyx_t_1;
   1290 
   1291   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":221
   1292  * 
   1293  *         self.i = OutputDevice
   1294  *         self.debug = 0             # <<<<<<<<<<<<<<
   1295  *         self._aborted = 0
   1296  * 
   1297  */
   1298   ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug = 0;
   1299 
   1300   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":222
   1301  *         self.i = OutputDevice
   1302  *         self.debug = 0
   1303  *         self._aborted = 0             # <<<<<<<<<<<<<<
   1304  * 
   1305  *         if latency == 0:
   1306  */
   1307   ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->_aborted = 0;
   1308 
   1309   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":224
   1310  *         self._aborted = 0
   1311  * 
   1312  *         if latency == 0:             # <<<<<<<<<<<<<<
   1313  *             PmPtr = NULL
   1314  *         else:
   1315  */
   1316   __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;}
   1317   __Pyx_GOTREF(__pyx_t_2);
   1318   __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;}
   1319   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1320   if (__pyx_t_3) {
   1321 
   1322     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":225
   1323  * 
   1324  *         if latency == 0:
   1325  *             PmPtr = NULL             # <<<<<<<<<<<<<<
   1326  *         else:
   1327  *             PmPtr = <PmTimeProcPtr>&Pt_Time
   1328  */
   1329     __pyx_v_PmPtr = NULL;
   1330     goto __pyx_L6;
   1331   }
   1332   /*else*/ {
   1333 
   1334     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":227
   1335  *             PmPtr = NULL
   1336  *         else:
   1337  *             PmPtr = <PmTimeProcPtr>&Pt_Time             # <<<<<<<<<<<<<<
   1338  *         if self.debug: print "Opening Midi Output"
   1339  * 	# Why is bufferSize 0 here?
   1340  */
   1341     __pyx_v_PmPtr = ((PmTimestamp (*)(void *))(&Pt_Time));
   1342   }
   1343   __pyx_L6:;
   1344 
   1345   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":228
   1346  *         else:
   1347  *             PmPtr = <PmTimeProcPtr>&Pt_Time
   1348  *         if self.debug: print "Opening Midi Output"             # <<<<<<<<<<<<<<
   1349  * 	# Why is bufferSize 0 here?
   1350  *         err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency)
   1351  */
   1352   __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
   1353   if (__pyx_t_1) {
   1354     if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1355     goto __pyx_L7;
   1356   }
   1357   __pyx_L7:;
   1358 
   1359   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":230
   1360  *         if self.debug: print "Opening Midi Output"
   1361  * 	# Why is bufferSize 0 here?
   1362  *         err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency)             # <<<<<<<<<<<<<<
   1363  *         if err < 0:
   1364  *                 s = Pm_GetErrorText(err)
   1365  */
   1366   __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;}
   1367   __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);
   1368 
   1369   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":231
   1370  * 	# Why is bufferSize 0 here?
   1371  *         err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency)
   1372  *         if err < 0:             # <<<<<<<<<<<<<<
   1373  *                 s = Pm_GetErrorText(err)
   1374  *                 # Something's amiss here - if we try to throw an Exception
   1375  */
   1376   __pyx_t_3 = (__pyx_v_err < 0);
   1377   if (__pyx_t_3) {
   1378 
   1379     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":232
   1380  *         err = Pm_OpenOutput(&(self.midi), self.i, NULL, 0, PmPtr, NULL, latency)
   1381  *         if err < 0:
   1382  *                 s = Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   1383  *                 # Something's amiss here - if we try to throw an Exception
   1384  *                	# here, we crash.
   1385  */
   1386     __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;}
   1387     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   1388     __Pyx_DECREF(__pyx_v_s);
   1389     __pyx_v_s = ((PyObject *)__pyx_t_2);
   1390     __pyx_t_2 = 0;
   1391 
   1392     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":235
   1393  *                 # Something's amiss here - if we try to throw an Exception
   1394  *                	# here, we crash.
   1395  *                 if not err == -10000:             # <<<<<<<<<<<<<<
   1396  *                         raise Exception,s
   1397  *                 else:
   1398  */
   1399     __pyx_t_3 = (!(__pyx_v_err == -10000));
   1400     if (__pyx_t_3) {
   1401 
   1402       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":236
   1403  *                	# here, we crash.
   1404  *                 if not err == -10000:
   1405  *                         raise Exception,s             # <<<<<<<<<<<<<<
   1406  *                 else:
   1407  *                         print "Unable to open Midi OutputDevice=",OutputDevice," err=",s
   1408  */
   1409       __Pyx_Raise(__pyx_builtin_Exception, __pyx_v_s, 0);
   1410       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1411       goto __pyx_L9;
   1412     }
   1413     /*else*/ {
   1414 
   1415       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":238
   1416  *                         raise Exception,s
   1417  *                 else:
   1418  *                         print "Unable to open Midi OutputDevice=",OutputDevice," err=",s             # <<<<<<<<<<<<<<
   1419  * 
   1420  *     def __dealloc__(self):
   1421  */
   1422       __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;}
   1423       __Pyx_GOTREF(__pyx_t_2);
   1424       __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
   1425       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_2));
   1426       __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   1427       __Pyx_INCREF(__pyx_v_OutputDevice);
   1428       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_OutputDevice);
   1429       __Pyx_GIVEREF(__pyx_v_OutputDevice);
   1430       __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
   1431       PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_kp_s_3));
   1432       __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
   1433       __Pyx_INCREF(__pyx_v_s);
   1434       PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_s);
   1435       __Pyx_GIVEREF(__pyx_v_s);
   1436       if (__Pyx_Print(__pyx_t_2, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1437       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1438     }
   1439     __pyx_L9:;
   1440     goto __pyx_L8;
   1441   }
   1442   __pyx_L8:;
   1443 
   1444   __pyx_r = 0;
   1445   goto __pyx_L0;
   1446   __pyx_L1_error:;
   1447   __Pyx_XDECREF(__pyx_t_2);
   1448   __Pyx_AddTraceback("_pyportmidi.Output.__init__");
   1449   __pyx_r = -1;
   1450   __pyx_L0:;
   1451   __Pyx_DECREF(__pyx_v_s);
   1452   __Pyx_DECREF((PyObject *)__pyx_v_self);
   1453   __Pyx_DECREF(__pyx_v_OutputDevice);
   1454   __Pyx_DECREF(__pyx_v_latency);
   1455   __Pyx_RefNannyFinishContext();
   1456   return __pyx_r;
   1457 }
   1458 
   1459 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":240
   1460  *                         print "Unable to open Midi OutputDevice=",OutputDevice," err=",s
   1461  * 
   1462  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
   1463  *         if self.debug: print "Closing MIDI output stream and destroying instance"
   1464  *         #err = Pm_Abort(self.midi)
   1465  */
   1466 
   1467 static void __pyx_pf_11_pyportmidi_6Output___dealloc__(PyObject *__pyx_v_self); /*proto*/
   1468 static void __pyx_pf_11_pyportmidi_6Output___dealloc__(PyObject *__pyx_v_self) {
   1469   PyObject *__pyx_v_err;
   1470   int __pyx_t_1;
   1471   PyObject *__pyx_t_2 = NULL;
   1472   int __pyx_t_3;
   1473   PmError __pyx_t_4;
   1474   __Pyx_RefNannySetupContext("__dealloc__");
   1475   __Pyx_INCREF((PyObject *)__pyx_v_self);
   1476   __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
   1477 
   1478   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":241
   1479  * 
   1480  *     def __dealloc__(self):
   1481  *         if self.debug: print "Closing MIDI output stream and destroying instance"             # <<<<<<<<<<<<<<
   1482  *         #err = Pm_Abort(self.midi)
   1483  *         #if err < 0: raise Exception, Pm_GetErrorText(err)
   1484  */
   1485   __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
   1486   if (__pyx_t_1) {
   1487     if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1488     goto __pyx_L5;
   1489   }
   1490   __pyx_L5:;
   1491 
   1492   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":244
   1493  *         #err = Pm_Abort(self.midi)
   1494  *         #if err < 0: raise Exception, Pm_GetErrorText(err)
   1495  *         err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
   1496  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   1497  * 
   1498  */
   1499   __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;}
   1500   __Pyx_GOTREF(__pyx_t_2);
   1501   __Pyx_DECREF(__pyx_v_err);
   1502   __pyx_v_err = __pyx_t_2;
   1503   __pyx_t_2 = 0;
   1504 
   1505   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":245
   1506  *         #if err < 0: raise Exception, Pm_GetErrorText(err)
   1507  *         err = Pm_Close(self.midi)
   1508  *         if err < 0: raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   1509  * 
   1510  * 
   1511  */
   1512   __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;}
   1513   __Pyx_GOTREF(__pyx_t_2);
   1514   __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;}
   1515   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1516   if (__pyx_t_3) {
   1517     __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;}
   1518     __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;}
   1519     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   1520     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
   1521     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   1522     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1523     goto __pyx_L6;
   1524   }
   1525   __pyx_L6:;
   1526 
   1527   goto __pyx_L0;
   1528   __pyx_L1_error:;
   1529   __Pyx_XDECREF(__pyx_t_2);
   1530   __Pyx_AddTraceback("_pyportmidi.Output.__dealloc__");
   1531   __pyx_L0:;
   1532   __Pyx_DECREF(__pyx_v_err);
   1533   __Pyx_DECREF((PyObject *)__pyx_v_self);
   1534   __Pyx_RefNannyFinishContext();
   1535 }
   1536 
   1537 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":248
   1538  * 
   1539  * 
   1540  *     def _check_open(self):             # <<<<<<<<<<<<<<
   1541  *         """ checks to see if the midi is open, and if not, raises an error.
   1542  *         """
   1543  */
   1544 
   1545 static PyObject *__pyx_pf_11_pyportmidi_6Output__check_open(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
   1546 static char __pyx_doc_11_pyportmidi_6Output__check_open[] = " checks to see if the midi is open, and if not, raises an error.\n        ";
   1547 static PyObject *__pyx_pf_11_pyportmidi_6Output__check_open(PyObject *__pyx_v_self, PyObject *unused) {
   1548   PyObject *__pyx_r = NULL;
   1549   int __pyx_t_1;
   1550   int __pyx_t_2;
   1551   __Pyx_RefNannySetupContext("_check_open");
   1552   __Pyx_INCREF((PyObject *)__pyx_v_self);
   1553 
   1554   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":252
   1555  *         """
   1556  * 
   1557  *         if self.midi == NULL:             # <<<<<<<<<<<<<<
   1558  *             raise Exception, "midi Output not open."
   1559  * 
   1560  */
   1561   __pyx_t_1 = (((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi == NULL);
   1562   if (__pyx_t_1) {
   1563 
   1564     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":253
   1565  * 
   1566  *         if self.midi == NULL:
   1567  *             raise Exception, "midi Output not open."             # <<<<<<<<<<<<<<
   1568  * 
   1569  *         if self._aborted:
   1570  */
   1571     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_kp_s_5), 0);
   1572     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1573     goto __pyx_L5;
   1574   }
   1575   __pyx_L5:;
   1576 
   1577   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":255
   1578  *             raise Exception, "midi Output not open."
   1579  * 
   1580  *         if self._aborted:             # <<<<<<<<<<<<<<
   1581  *             raise Exception, "midi Output aborted.  Need to call Close after Abort."
   1582  * 
   1583  */
   1584   __pyx_t_2 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->_aborted;
   1585   if (__pyx_t_2) {
   1586 
   1587     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":256
   1588  * 
   1589  *         if self._aborted:
   1590  *             raise Exception, "midi Output aborted.  Need to call Close after Abort."             # <<<<<<<<<<<<<<
   1591  * 
   1592  *     def Close(self):
   1593  */
   1594     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_kp_s_6), 0);
   1595     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1596     goto __pyx_L6;
   1597   }
   1598   __pyx_L6:;
   1599 
   1600   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1601   goto __pyx_L0;
   1602   __pyx_L1_error:;
   1603   __Pyx_AddTraceback("_pyportmidi.Output._check_open");
   1604   __pyx_r = NULL;
   1605   __pyx_L0:;
   1606   __Pyx_DECREF((PyObject *)__pyx_v_self);
   1607   __Pyx_XGIVEREF(__pyx_r);
   1608   __Pyx_RefNannyFinishContext();
   1609   return __pyx_r;
   1610 }
   1611 
   1612 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":258
   1613  *             raise Exception, "midi Output aborted.  Need to call Close after Abort."
   1614  * 
   1615  *     def Close(self):             # <<<<<<<<<<<<<<
   1616  *         """
   1617  * Close()
   1618  */
   1619 
   1620 static PyObject *__pyx_pf_11_pyportmidi_6Output_Close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
   1621 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        ";
   1622 static PyObject *__pyx_pf_11_pyportmidi_6Output_Close(PyObject *__pyx_v_self, PyObject *unused) {
   1623   PyObject *__pyx_v_err;
   1624   PyObject *__pyx_r = NULL;
   1625   PyObject *__pyx_t_1 = NULL;
   1626   int __pyx_t_2;
   1627   PmError __pyx_t_3;
   1628   __Pyx_RefNannySetupContext("Close");
   1629   __Pyx_INCREF((PyObject *)__pyx_v_self);
   1630   __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
   1631 
   1632   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":268
   1633  *         #    return
   1634  * 
   1635  *         err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
   1636  *         if err < 0:
   1637  *             raise Exception, Pm_GetErrorText(err)
   1638  */
   1639   __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;}
   1640   __Pyx_GOTREF(__pyx_t_1);
   1641   __Pyx_DECREF(__pyx_v_err);
   1642   __pyx_v_err = __pyx_t_1;
   1643   __pyx_t_1 = 0;
   1644 
   1645   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":269
   1646  * 
   1647  *         err = Pm_Close(self.midi)
   1648  *         if err < 0:             # <<<<<<<<<<<<<<
   1649  *             raise Exception, Pm_GetErrorText(err)
   1650  *         #self.midi = NULL
   1651  */
   1652   __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;}
   1653   __Pyx_GOTREF(__pyx_t_1);
   1654   __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;}
   1655   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   1656   if (__pyx_t_2) {
   1657 
   1658     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":270
   1659  *         err = Pm_Close(self.midi)
   1660  *         if err < 0:
   1661  *             raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   1662  *         #self.midi = NULL
   1663  * 
   1664  */
   1665     __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;}
   1666     __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;}
   1667     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   1668     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
   1669     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   1670     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1671     goto __pyx_L5;
   1672   }
   1673   __pyx_L5:;
   1674 
   1675   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1676   goto __pyx_L0;
   1677   __pyx_L1_error:;
   1678   __Pyx_XDECREF(__pyx_t_1);
   1679   __Pyx_AddTraceback("_pyportmidi.Output.Close");
   1680   __pyx_r = NULL;
   1681   __pyx_L0:;
   1682   __Pyx_DECREF(__pyx_v_err);
   1683   __Pyx_DECREF((PyObject *)__pyx_v_self);
   1684   __Pyx_XGIVEREF(__pyx_r);
   1685   __Pyx_RefNannyFinishContext();
   1686   return __pyx_r;
   1687 }
   1688 
   1689 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":274
   1690  * 
   1691  * 
   1692  *     def Abort(self):             # <<<<<<<<<<<<<<
   1693  *         """
   1694  * Abort() terminates outgoing messages immediately
   1695  */
   1696 
   1697 static PyObject *__pyx_pf_11_pyportmidi_6Output_Abort(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
   1698 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        ";
   1699 static PyObject *__pyx_pf_11_pyportmidi_6Output_Abort(PyObject *__pyx_v_self, PyObject *unused) {
   1700   PyObject *__pyx_v_err;
   1701   PyObject *__pyx_r = NULL;
   1702   PyObject *__pyx_t_1 = NULL;
   1703   int __pyx_t_2;
   1704   PmError __pyx_t_3;
   1705   __Pyx_RefNannySetupContext("Abort");
   1706   __Pyx_INCREF((PyObject *)__pyx_v_self);
   1707   __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
   1708 
   1709   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":286
   1710  *         #    return
   1711  * 
   1712  *         err = Pm_Abort(self.midi)             # <<<<<<<<<<<<<<
   1713  *         if err < 0:
   1714  *             raise Exception, Pm_GetErrorText(err)
   1715  */
   1716   __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;}
   1717   __Pyx_GOTREF(__pyx_t_1);
   1718   __Pyx_DECREF(__pyx_v_err);
   1719   __pyx_v_err = __pyx_t_1;
   1720   __pyx_t_1 = 0;
   1721 
   1722   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":287
   1723  * 
   1724  *         err = Pm_Abort(self.midi)
   1725  *         if err < 0:             # <<<<<<<<<<<<<<
   1726  *             raise Exception, Pm_GetErrorText(err)
   1727  * 
   1728  */
   1729   __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;}
   1730   __Pyx_GOTREF(__pyx_t_1);
   1731   __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;}
   1732   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   1733   if (__pyx_t_2) {
   1734 
   1735     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":288
   1736  *         err = Pm_Abort(self.midi)
   1737  *         if err < 0:
   1738  *             raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   1739  * 
   1740  *         self._aborted = 1
   1741  */
   1742     __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;}
   1743     __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;}
   1744     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   1745     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
   1746     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   1747     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1748     goto __pyx_L5;
   1749   }
   1750   __pyx_L5:;
   1751 
   1752   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":290
   1753  *             raise Exception, Pm_GetErrorText(err)
   1754  * 
   1755  *         self._aborted = 1             # <<<<<<<<<<<<<<
   1756  * 
   1757  * 
   1758  */
   1759   ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->_aborted = 1;
   1760 
   1761   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   1762   goto __pyx_L0;
   1763   __pyx_L1_error:;
   1764   __Pyx_XDECREF(__pyx_t_1);
   1765   __Pyx_AddTraceback("_pyportmidi.Output.Abort");
   1766   __pyx_r = NULL;
   1767   __pyx_L0:;
   1768   __Pyx_DECREF(__pyx_v_err);
   1769   __Pyx_DECREF((PyObject *)__pyx_v_self);
   1770   __Pyx_XGIVEREF(__pyx_r);
   1771   __Pyx_RefNannyFinishContext();
   1772   return __pyx_r;
   1773 }
   1774 
   1775 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":293
   1776  * 
   1777  * 
   1778  *     def Write(self, data):             # <<<<<<<<<<<<<<
   1779  *         """
   1780  * Write(data)
   1781  */
   1782 
   1783 static PyObject *__pyx_pf_11_pyportmidi_6Output_Write(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
   1784 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        ";
   1785 static PyObject *__pyx_pf_11_pyportmidi_6Output_Write(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
   1786   PmEvent __pyx_v_buffer[1024];
   1787   PmError __pyx_v_err;
   1788   int __pyx_v_i;
   1789   PyObject *__pyx_v_loop1;
   1790   PyObject *__pyx_r = NULL;
   1791   PyObject *__pyx_t_1 = NULL;
   1792   PyObject *__pyx_t_2 = NULL;
   1793   Py_ssize_t __pyx_t_3;
   1794   int __pyx_t_4;
   1795   Py_ssize_t __pyx_t_5;
   1796   PyObject *__pyx_t_6 = NULL;
   1797   Py_ssize_t __pyx_t_7;
   1798   int __pyx_t_8;
   1799   PyObject *__pyx_t_9 = NULL;
   1800   PyObject *__pyx_t_10 = NULL;
   1801   PmMessage __pyx_t_11;
   1802   PmTimestamp __pyx_t_12;
   1803   __Pyx_RefNannySetupContext("Write");
   1804   __Pyx_INCREF((PyObject *)__pyx_v_self);
   1805   __Pyx_INCREF(__pyx_v_data);
   1806   __pyx_v_loop1 = Py_None; __Pyx_INCREF(Py_None);
   1807 
   1808   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":315
   1809  *         cdef int i
   1810  * 
   1811  *         self._check_open()             # <<<<<<<<<<<<<<
   1812  * 
   1813  * 
   1814  */
   1815   __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;}
   1816   __Pyx_GOTREF(__pyx_t_1);
   1817   __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;}
   1818   __Pyx_GOTREF(__pyx_t_2);
   1819   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   1820   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1821 
   1822   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":318
   1823  * 
   1824  * 
   1825  *         if len(data) > 1024: raise IndexError, 'maximum list length is 1024'             # <<<<<<<<<<<<<<
   1826  *         else:
   1827  *             for loop1 in range(len(data)):
   1828  */
   1829   __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;}
   1830   __pyx_t_4 = (__pyx_t_3 > 1024);
   1831   if (__pyx_t_4) {
   1832     __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_7), 0);
   1833     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1834     goto __pyx_L5;
   1835   }
   1836   /*else*/ {
   1837 
   1838     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":320
   1839  *         if len(data) > 1024: raise IndexError, 'maximum list length is 1024'
   1840  *         else:
   1841  *             for loop1 in range(len(data)):             # <<<<<<<<<<<<<<
   1842  *                 if ((len(data[loop1][0]) > 4) |
   1843  *                     (len(data[loop1][0]) < 1)):
   1844  */
   1845     __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;}
   1846     __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;}
   1847     __Pyx_GOTREF(__pyx_t_2);
   1848     __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;}
   1849     __Pyx_GOTREF(__pyx_t_1);
   1850     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
   1851     __Pyx_GIVEREF(__pyx_t_2);
   1852     __pyx_t_2 = 0;
   1853     __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;}
   1854     __Pyx_GOTREF(__pyx_t_2);
   1855     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   1856     if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
   1857       __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1);
   1858     } else {
   1859       __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;}
   1860       __Pyx_GOTREF(__pyx_t_1);
   1861     }
   1862     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1863     for (;;) {
   1864       if (likely(PyList_CheckExact(__pyx_t_1))) {
   1865         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
   1866         __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
   1867       } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
   1868         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
   1869         __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
   1870       } else {
   1871         __pyx_t_2 = PyIter_Next(__pyx_t_1);
   1872         if (!__pyx_t_2) {
   1873           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1874           break;
   1875         }
   1876         __Pyx_GOTREF(__pyx_t_2);
   1877       }
   1878       __Pyx_DECREF(__pyx_v_loop1);
   1879       __pyx_v_loop1 = __pyx_t_2;
   1880       __pyx_t_2 = 0;
   1881 
   1882       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":321
   1883  *         else:
   1884  *             for loop1 in range(len(data)):
   1885  *                 if ((len(data[loop1][0]) > 4) |             # <<<<<<<<<<<<<<
   1886  *                     (len(data[loop1][0]) < 1)):
   1887  *                     raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
   1888  */
   1889       __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;}
   1890       __Pyx_GOTREF(__pyx_t_2);
   1891       __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;}
   1892       __Pyx_GOTREF(__pyx_t_6);
   1893       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1894       __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;}
   1895       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   1896 
   1897       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":322
   1898  *             for loop1 in range(len(data)):
   1899  *                 if ((len(data[loop1][0]) > 4) |
   1900  *                     (len(data[loop1][0]) < 1)):             # <<<<<<<<<<<<<<
   1901  *                     raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
   1902  *                 buffer[loop1].message = 0
   1903  */
   1904       __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;}
   1905       __Pyx_GOTREF(__pyx_t_6);
   1906       __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;}
   1907       __Pyx_GOTREF(__pyx_t_2);
   1908       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   1909       __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;}
   1910       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1911       __pyx_t_4 = ((__pyx_t_5 > 4) | (__pyx_t_7 < 1));
   1912       if (__pyx_t_4) {
   1913 
   1914         /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":323
   1915  *                 if ((len(data[loop1][0]) > 4) |
   1916  *                     (len(data[loop1][0]) < 1)):
   1917  *                     raise IndexError, str(len(data[loop1][0]))+' arguments in event list'             # <<<<<<<<<<<<<<
   1918  *                 buffer[loop1].message = 0
   1919  *                 for i in range(len(data[loop1][0])):
   1920  */
   1921         __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;}
   1922         __Pyx_GOTREF(__pyx_t_2);
   1923         __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;}
   1924         __Pyx_GOTREF(__pyx_t_6);
   1925         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1926         __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;}
   1927         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   1928         __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;}
   1929         __Pyx_GOTREF(__pyx_t_6);
   1930         __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;}
   1931         __Pyx_GOTREF(__pyx_t_2);
   1932         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
   1933         __Pyx_GIVEREF(__pyx_t_6);
   1934         __pyx_t_6 = 0;
   1935         __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;}
   1936         __Pyx_GOTREF(__pyx_t_6);
   1937         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1938         __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;}
   1939         __Pyx_GOTREF(__pyx_t_2);
   1940         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   1941         __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_2, 0);
   1942         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1943         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   1944         goto __pyx_L8;
   1945       }
   1946       __pyx_L8:;
   1947 
   1948       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":324
   1949  *                     (len(data[loop1][0]) < 1)):
   1950  *                     raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
   1951  *                 buffer[loop1].message = 0             # <<<<<<<<<<<<<<
   1952  *                 for i in range(len(data[loop1][0])):
   1953  *                     buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
   1954  */
   1955       __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;}
   1956       (__pyx_v_buffer[__pyx_t_7]).message = 0;
   1957 
   1958       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":325
   1959  *                     raise IndexError, str(len(data[loop1][0]))+' arguments in event list'
   1960  *                 buffer[loop1].message = 0
   1961  *                 for i in range(len(data[loop1][0])):             # <<<<<<<<<<<<<<
   1962  *                     buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
   1963  *                 buffer[loop1].timestamp = data[loop1][1]
   1964  */
   1965       __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;}
   1966       __Pyx_GOTREF(__pyx_t_2);
   1967       __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;}
   1968       __Pyx_GOTREF(__pyx_t_6);
   1969       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1970       __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;}
   1971       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   1972       for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
   1973         __pyx_v_i = __pyx_t_8;
   1974 
   1975         /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":326
   1976  *                 buffer[loop1].message = 0
   1977  *                 for i in range(len(data[loop1][0])):
   1978  *                     buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))             # <<<<<<<<<<<<<<
   1979  *                 buffer[loop1].timestamp = data[loop1][1]
   1980  *                 if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
   1981  */
   1982         __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;}
   1983         __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;}
   1984         __Pyx_GOTREF(__pyx_t_6);
   1985         __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;}
   1986         __Pyx_GOTREF(__pyx_t_2);
   1987         __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;}
   1988         __Pyx_GOTREF(__pyx_t_9);
   1989         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1990         __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;}
   1991         __Pyx_GOTREF(__pyx_t_2);
   1992         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   1993         __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;}
   1994         __Pyx_GOTREF(__pyx_t_9);
   1995         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   1996         __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;}
   1997         __Pyx_GOTREF(__pyx_t_2);
   1998         __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;}
   1999         __Pyx_GOTREF(__pyx_t_10);
   2000         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   2001         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2002         __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;}
   2003         __Pyx_GOTREF(__pyx_t_2);
   2004         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   2005         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   2006         __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;}
   2007         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2008         __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;}
   2009         (__pyx_v_buffer[__pyx_t_5]).message = __pyx_t_11;
   2010       }
   2011 
   2012       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":327
   2013  *                 for i in range(len(data[loop1][0])):
   2014  *                     buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
   2015  *                 buffer[loop1].timestamp = data[loop1][1]             # <<<<<<<<<<<<<<
   2016  *                 if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
   2017  *         if self.debug: print "writing to midi buffer"
   2018  */
   2019       __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;}
   2020       __Pyx_GOTREF(__pyx_t_2);
   2021       __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;}
   2022       __Pyx_GOTREF(__pyx_t_10);
   2023       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2024       __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;}
   2025       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   2026       __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;}
   2027       (__pyx_v_buffer[__pyx_t_5]).timestamp = __pyx_t_12;
   2028 
   2029       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":328
   2030  *                     buffer[loop1].message = buffer[loop1].message + ((data[loop1][0][i]&0xFF) << (8*i))
   2031  *                 buffer[loop1].timestamp = data[loop1][1]
   2032  *                 if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp             # <<<<<<<<<<<<<<
   2033  *         if self.debug: print "writing to midi buffer"
   2034  *         err= Pm_Write(self.midi, buffer, len(data))
   2035  */
   2036       __pyx_t_8 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
   2037       if (__pyx_t_8) {
   2038         __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;}
   2039         __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;}
   2040         __Pyx_GOTREF(__pyx_t_10);
   2041         __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;}
   2042         __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;}
   2043         __Pyx_GOTREF(__pyx_t_2);
   2044         __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;}
   2045         __Pyx_GOTREF(__pyx_t_6);
   2046         __Pyx_INCREF(__pyx_v_loop1);
   2047         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_loop1);
   2048         __Pyx_GIVEREF(__pyx_v_loop1);
   2049         __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
   2050         PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_kp_s_9));
   2051         __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
   2052         PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_10);
   2053         __Pyx_GIVEREF(__pyx_t_10);
   2054         __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
   2055         PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_kp_s_9));
   2056         __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
   2057         PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_2);
   2058         __Pyx_GIVEREF(__pyx_t_2);
   2059         __pyx_t_10 = 0;
   2060         __pyx_t_2 = 0;
   2061         if (__Pyx_Print(__pyx_t_6, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2062         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   2063         goto __pyx_L11;
   2064       }
   2065       __pyx_L11:;
   2066     }
   2067     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2068   }
   2069   __pyx_L5:;
   2070 
   2071   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":329
   2072  *                 buffer[loop1].timestamp = data[loop1][1]
   2073  *                 if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
   2074  *         if self.debug: print "writing to midi buffer"             # <<<<<<<<<<<<<<
   2075  *         err= Pm_Write(self.midi, buffer, len(data))
   2076  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2077  */
   2078   __pyx_t_8 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
   2079   if (__pyx_t_8) {
   2080     if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_10)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2081     goto __pyx_L12;
   2082   }
   2083   __pyx_L12:;
   2084 
   2085   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":330
   2086  *                 if self.debug: print loop1," : ",buffer[loop1].message," : ",buffer[loop1].timestamp
   2087  *         if self.debug: print "writing to midi buffer"
   2088  *         err= Pm_Write(self.midi, buffer, len(data))             # <<<<<<<<<<<<<<
   2089  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2090  * 
   2091  */
   2092   __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;}
   2093   __pyx_v_err = Pm_Write(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi, __pyx_v_buffer, __pyx_t_3);
   2094 
   2095   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":331
   2096  *         if self.debug: print "writing to midi buffer"
   2097  *         err= Pm_Write(self.midi, buffer, len(data))
   2098  *         if err < 0: raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2099  * 
   2100  *     def WriteShort(self, status, data1 = 0, data2 = 0):
   2101  */
   2102   __pyx_t_4 = (__pyx_v_err < 0);
   2103   if (__pyx_t_4) {
   2104     __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;}
   2105     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   2106     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
   2107     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   2108     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2109     goto __pyx_L13;
   2110   }
   2111   __pyx_L13:;
   2112 
   2113   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   2114   goto __pyx_L0;
   2115   __pyx_L1_error:;
   2116   __Pyx_XDECREF(__pyx_t_1);
   2117   __Pyx_XDECREF(__pyx_t_2);
   2118   __Pyx_XDECREF(__pyx_t_6);
   2119   __Pyx_XDECREF(__pyx_t_9);
   2120   __Pyx_XDECREF(__pyx_t_10);
   2121   __Pyx_AddTraceback("_pyportmidi.Output.Write");
   2122   __pyx_r = NULL;
   2123   __pyx_L0:;
   2124   __Pyx_DECREF(__pyx_v_loop1);
   2125   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2126   __Pyx_DECREF(__pyx_v_data);
   2127   __Pyx_XGIVEREF(__pyx_r);
   2128   __Pyx_RefNannyFinishContext();
   2129   return __pyx_r;
   2130 }
   2131 
   2132 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":333
   2133  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2134  * 
   2135  *     def WriteShort(self, status, data1 = 0, data2 = 0):             # <<<<<<<<<<<<<<
   2136  *         """
   2137  * WriteShort(status <, data1><, data2>)
   2138  */
   2139 
   2140 static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteShort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
   2141 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        ";
   2142 static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteShort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   2143   PyObject *__pyx_v_status = 0;
   2144   PyObject *__pyx_v_data1 = 0;
   2145   PyObject *__pyx_v_data2 = 0;
   2146   PmEvent __pyx_v_buffer[1];
   2147   PmError __pyx_v_err;
   2148   PyObject *__pyx_r = NULL;
   2149   PyObject *__pyx_t_1 = NULL;
   2150   PyObject *__pyx_t_2 = NULL;
   2151   PyObject *__pyx_t_3 = NULL;
   2152   PmMessage __pyx_t_4;
   2153   int __pyx_t_5;
   2154   int __pyx_t_6;
   2155   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__status,&__pyx_n_s__data1,&__pyx_n_s__data2,0};
   2156   __Pyx_RefNannySetupContext("WriteShort");
   2157   if (unlikely(__pyx_kwds)) {
   2158     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
   2159     PyObject* values[3] = {0,0,0};
   2160     values[1] = ((PyObject *)__pyx_int_0);
   2161     values[2] = ((PyObject *)__pyx_int_0);
   2162     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2163       case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
   2164       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
   2165       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
   2166       case  0: break;
   2167       default: goto __pyx_L5_argtuple_error;
   2168     }
   2169     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2170       case  0:
   2171       values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__status);
   2172       if (likely(values[0])) kw_args--;
   2173       else goto __pyx_L5_argtuple_error;
   2174       case  1:
   2175       if (kw_args > 1) {
   2176         PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data1);
   2177         if (unlikely(value)) { values[1] = value; kw_args--; }
   2178       }
   2179       case  2:
   2180       if (kw_args > 1) {
   2181         PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data2);
   2182         if (unlikely(value)) { values[2] = value; kw_args--; }
   2183       }
   2184     }
   2185     if (unlikely(kw_args > 0)) {
   2186       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;}
   2187     }
   2188     __pyx_v_status = values[0];
   2189     __pyx_v_data1 = values[1];
   2190     __pyx_v_data2 = values[2];
   2191   } else {
   2192     __pyx_v_data1 = ((PyObject *)__pyx_int_0);
   2193     __pyx_v_data2 = ((PyObject *)__pyx_int_0);
   2194     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2195       case  3: __pyx_v_data2 = PyTuple_GET_ITEM(__pyx_args, 2);
   2196       case  2: __pyx_v_data1 = PyTuple_GET_ITEM(__pyx_args, 1);
   2197       case  1: __pyx_v_status = PyTuple_GET_ITEM(__pyx_args, 0);
   2198       break;
   2199       default: goto __pyx_L5_argtuple_error;
   2200     }
   2201   }
   2202   goto __pyx_L4_argument_unpacking_done;
   2203   __pyx_L5_argtuple_error:;
   2204   __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;}
   2205   __pyx_L3_error:;
   2206   __Pyx_AddTraceback("_pyportmidi.Output.WriteShort");
   2207   return NULL;
   2208   __pyx_L4_argument_unpacking_done:;
   2209   __Pyx_INCREF((PyObject *)__pyx_v_self);
   2210   __Pyx_INCREF(__pyx_v_status);
   2211   __Pyx_INCREF(__pyx_v_data1);
   2212   __Pyx_INCREF(__pyx_v_data2);
   2213 
   2214   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":348
   2215  *         cdef PmEvent buffer[1]
   2216  *         cdef PmError err
   2217  *         self._check_open()             # <<<<<<<<<<<<<<
   2218  * 
   2219  *         buffer[0].timestamp = Pt_Time()
   2220  */
   2221   __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;}
   2222   __Pyx_GOTREF(__pyx_t_1);
   2223   __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;}
   2224   __Pyx_GOTREF(__pyx_t_2);
   2225   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2226   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2227 
   2228   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":350
   2229  *         self._check_open()
   2230  * 
   2231  *         buffer[0].timestamp = Pt_Time()             # <<<<<<<<<<<<<<
   2232  *         buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF))
   2233  *         if self.debug: print "Writing to MIDI buffer"
   2234  */
   2235   (__pyx_v_buffer[0]).timestamp = Pt_Time();
   2236 
   2237   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":351
   2238  * 
   2239  *         buffer[0].timestamp = Pt_Time()
   2240  *         buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF))             # <<<<<<<<<<<<<<
   2241  *         if self.debug: print "Writing to MIDI buffer"
   2242  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
   2243  */
   2244   __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;}
   2245   __Pyx_GOTREF(__pyx_t_2);
   2246   __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;}
   2247   __Pyx_GOTREF(__pyx_t_1);
   2248   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2249   __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;}
   2250   __Pyx_GOTREF(__pyx_t_2);
   2251   __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;}
   2252   __Pyx_GOTREF(__pyx_t_3);
   2253   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2254   __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;}
   2255   __Pyx_GOTREF(__pyx_t_2);
   2256   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2257   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   2258   __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;}
   2259   __Pyx_GOTREF(__pyx_t_3);
   2260   __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;}
   2261   __Pyx_GOTREF(__pyx_t_1);
   2262   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2263   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   2264   __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;}
   2265   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2266   (__pyx_v_buffer[0]).message = __pyx_t_4;
   2267 
   2268   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":352
   2269  *         buffer[0].timestamp = Pt_Time()
   2270  *         buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF))
   2271  *         if self.debug: print "Writing to MIDI buffer"             # <<<<<<<<<<<<<<
   2272  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
   2273  *         if err < 0 : raise Exception, Pm_GetErrorText(err)
   2274  */
   2275   __pyx_t_5 = ((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->debug;
   2276   if (__pyx_t_5) {
   2277     if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_11)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2278     goto __pyx_L6;
   2279   }
   2280   __pyx_L6:;
   2281 
   2282   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":353
   2283  *         buffer[0].message = ((((data2) << 16) & 0xFF0000) | (((data1) << 8) & 0xFF00) | ((status) & 0xFF))
   2284  *         if self.debug: print "Writing to MIDI buffer"
   2285  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length             # <<<<<<<<<<<<<<
   2286  *         if err < 0 : raise Exception, Pm_GetErrorText(err)
   2287  * 
   2288  */
   2289   __pyx_v_err = Pm_Write(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi, __pyx_v_buffer, 1);
   2290 
   2291   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":354
   2292  *         if self.debug: print "Writing to MIDI buffer"
   2293  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
   2294  *         if err < 0 : raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2295  * 
   2296  *     def WriteSysEx(self, when, msg):
   2297  */
   2298   __pyx_t_6 = (__pyx_v_err < 0);
   2299   if (__pyx_t_6) {
   2300     __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;}
   2301     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   2302     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
   2303     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   2304     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2305     goto __pyx_L7;
   2306   }
   2307   __pyx_L7:;
   2308 
   2309   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   2310   goto __pyx_L0;
   2311   __pyx_L1_error:;
   2312   __Pyx_XDECREF(__pyx_t_1);
   2313   __Pyx_XDECREF(__pyx_t_2);
   2314   __Pyx_XDECREF(__pyx_t_3);
   2315   __Pyx_AddTraceback("_pyportmidi.Output.WriteShort");
   2316   __pyx_r = NULL;
   2317   __pyx_L0:;
   2318   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2319   __Pyx_DECREF(__pyx_v_status);
   2320   __Pyx_DECREF(__pyx_v_data1);
   2321   __Pyx_DECREF(__pyx_v_data2);
   2322   __Pyx_XGIVEREF(__pyx_r);
   2323   __Pyx_RefNannyFinishContext();
   2324   return __pyx_r;
   2325 }
   2326 
   2327 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":356
   2328  *         if err < 0 : raise Exception, Pm_GetErrorText(err)
   2329  * 
   2330  *     def WriteSysEx(self, when, msg):             # <<<<<<<<<<<<<<
   2331  *         """
   2332  *         WriteSysEx(<timestamp>,<msg>)
   2333  */
   2334 
   2335 static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteSysEx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
   2336 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        ";
   2337 static PyObject *__pyx_pf_11_pyportmidi_6Output_WriteSysEx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   2338   PyObject *__pyx_v_when = 0;
   2339   PyObject *__pyx_v_msg = 0;
   2340   PmError __pyx_v_err;
   2341   char *__pyx_v_cmsg;
   2342   PtTimestamp __pyx_v_CurTime;
   2343   PyObject *__pyx_r = NULL;
   2344   PyObject *__pyx_t_1 = NULL;
   2345   PyObject *__pyx_t_2 = NULL;
   2346   int __pyx_t_3;
   2347   PyObject *__pyx_t_4 = NULL;
   2348   char *__pyx_t_5;
   2349   PmTimestamp __pyx_t_6;
   2350   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__when,&__pyx_n_s__msg,0};
   2351   __Pyx_RefNannySetupContext("WriteSysEx");
   2352   if (unlikely(__pyx_kwds)) {
   2353     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
   2354     PyObject* values[2] = {0,0};
   2355     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2356       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
   2357       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
   2358       case  0: break;
   2359       default: goto __pyx_L5_argtuple_error;
   2360     }
   2361     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2362       case  0:
   2363       values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__when);
   2364       if (likely(values[0])) kw_args--;
   2365       else goto __pyx_L5_argtuple_error;
   2366       case  1:
   2367       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg);
   2368       if (likely(values[1])) kw_args--;
   2369       else {
   2370         __Pyx_RaiseArgtupleInvalid("WriteSysEx", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   2371       }
   2372     }
   2373     if (unlikely(kw_args > 0)) {
   2374       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;}
   2375     }
   2376     __pyx_v_when = values[0];
   2377     __pyx_v_msg = values[1];
   2378   } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
   2379     goto __pyx_L5_argtuple_error;
   2380   } else {
   2381     __pyx_v_when = PyTuple_GET_ITEM(__pyx_args, 0);
   2382     __pyx_v_msg = PyTuple_GET_ITEM(__pyx_args, 1);
   2383   }
   2384   goto __pyx_L4_argument_unpacking_done;
   2385   __pyx_L5_argtuple_error:;
   2386   __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;}
   2387   __pyx_L3_error:;
   2388   __Pyx_AddTraceback("_pyportmidi.Output.WriteSysEx");
   2389   return NULL;
   2390   __pyx_L4_argument_unpacking_done:;
   2391   __Pyx_INCREF((PyObject *)__pyx_v_self);
   2392   __Pyx_INCREF(__pyx_v_when);
   2393   __Pyx_INCREF(__pyx_v_msg);
   2394 
   2395   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":372
   2396  *         cdef PtTimestamp CurTime
   2397  * 
   2398  *         self._check_open()             # <<<<<<<<<<<<<<
   2399  * 
   2400  *         if type(msg) is list:
   2401  */
   2402   __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;}
   2403   __Pyx_GOTREF(__pyx_t_1);
   2404   __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;}
   2405   __Pyx_GOTREF(__pyx_t_2);
   2406   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2407   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2408 
   2409   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":374
   2410  *         self._check_open()
   2411  * 
   2412  *         if type(msg) is list:             # <<<<<<<<<<<<<<
   2413  *             msg = array.array('B',msg).tostring() # Markus Pfaff contribution
   2414  *         cmsg = msg
   2415  */
   2416   __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_msg)) == ((PyObject *)((PyObject*)&PyList_Type)));
   2417   if (__pyx_t_3) {
   2418 
   2419     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":375
   2420  * 
   2421  *         if type(msg) is list:
   2422  *             msg = array.array('B',msg).tostring() # Markus Pfaff contribution             # <<<<<<<<<<<<<<
   2423  *         cmsg = msg
   2424  * 
   2425  */
   2426     __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;}
   2427     __Pyx_GOTREF(__pyx_t_2);
   2428     __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;}
   2429     __Pyx_GOTREF(__pyx_t_1);
   2430     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2431     __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;}
   2432     __Pyx_GOTREF(__pyx_t_2);
   2433     __Pyx_INCREF(((PyObject *)__pyx_n_s__B));
   2434     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__B));
   2435     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B));
   2436     __Pyx_INCREF(__pyx_v_msg);
   2437     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_msg);
   2438     __Pyx_GIVEREF(__pyx_v_msg);
   2439     __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;}
   2440     __Pyx_GOTREF(__pyx_t_4);
   2441     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2442     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2443     __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;}
   2444     __Pyx_GOTREF(__pyx_t_2);
   2445     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   2446     __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;}
   2447     __Pyx_GOTREF(__pyx_t_4);
   2448     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2449     __Pyx_DECREF(__pyx_v_msg);
   2450     __pyx_v_msg = __pyx_t_4;
   2451     __pyx_t_4 = 0;
   2452     goto __pyx_L6;
   2453   }
   2454   __pyx_L6:;
   2455 
   2456   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":376
   2457  *         if type(msg) is list:
   2458  *             msg = array.array('B',msg).tostring() # Markus Pfaff contribution
   2459  *         cmsg = msg             # <<<<<<<<<<<<<<
   2460  * 
   2461  *         CurTime = Pt_Time()
   2462  */
   2463   __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;}
   2464   __pyx_v_cmsg = __pyx_t_5;
   2465 
   2466   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":378
   2467  *         cmsg = msg
   2468  * 
   2469  *         CurTime = Pt_Time()             # <<<<<<<<<<<<<<
   2470  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
   2471  *         if err < 0 : raise Exception, Pm_GetErrorText(err)
   2472  */
   2473   __pyx_v_CurTime = Pt_Time();
   2474 
   2475   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":379
   2476  * 
   2477  *         CurTime = Pt_Time()
   2478  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)             # <<<<<<<<<<<<<<
   2479  *         if err < 0 : raise Exception, Pm_GetErrorText(err)
   2480  *         while Pt_Time() == CurTime: # wait for SysEx to go thru or...my
   2481  */
   2482   __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;}
   2483   __pyx_v_err = Pm_WriteSysEx(((struct __pyx_obj_11_pyportmidi_Output *)__pyx_v_self)->midi, __pyx_t_6, ((unsigned char *)__pyx_v_cmsg));
   2484 
   2485   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":380
   2486  *         CurTime = Pt_Time()
   2487  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
   2488  *         if err < 0 : raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2489  *         while Pt_Time() == CurTime: # wait for SysEx to go thru or...my
   2490  *             pass                    # win32 machine crashes w/ multiple SysEx
   2491  */
   2492   __pyx_t_3 = (__pyx_v_err < 0);
   2493   if (__pyx_t_3) {
   2494     __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;}
   2495     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   2496     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_4), 0);
   2497     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   2498     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2499     goto __pyx_L7;
   2500   }
   2501   __pyx_L7:;
   2502 
   2503   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":381
   2504  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
   2505  *         if err < 0 : raise Exception, Pm_GetErrorText(err)
   2506  *         while Pt_Time() == CurTime: # wait for SysEx to go thru or...my             # <<<<<<<<<<<<<<
   2507  *             pass                    # win32 machine crashes w/ multiple SysEx
   2508  * 
   2509  */
   2510   while (1) {
   2511     __pyx_t_3 = (Pt_Time() == __pyx_v_CurTime);
   2512     if (!__pyx_t_3) break;
   2513   }
   2514 
   2515   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   2516   goto __pyx_L0;
   2517   __pyx_L1_error:;
   2518   __Pyx_XDECREF(__pyx_t_1);
   2519   __Pyx_XDECREF(__pyx_t_2);
   2520   __Pyx_XDECREF(__pyx_t_4);
   2521   __Pyx_AddTraceback("_pyportmidi.Output.WriteSysEx");
   2522   __pyx_r = NULL;
   2523   __pyx_L0:;
   2524   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2525   __Pyx_DECREF(__pyx_v_when);
   2526   __Pyx_DECREF(__pyx_v_msg);
   2527   __Pyx_XGIVEREF(__pyx_r);
   2528   __Pyx_RefNannyFinishContext();
   2529   return __pyx_r;
   2530 }
   2531 
   2532 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":404
   2533  *     cdef int i
   2534  * 
   2535  *     def __init__(self, InputDevice, buffersize=4096):             # <<<<<<<<<<<<<<
   2536  *         cdef PmError err
   2537  *         self.i = InputDevice
   2538  */
   2539 
   2540 static int __pyx_pf_11_pyportmidi_5Input___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
   2541 static int __pyx_pf_11_pyportmidi_5Input___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   2542   PyObject *__pyx_v_InputDevice = 0;
   2543   PyObject *__pyx_v_buffersize = 0;
   2544   PmError __pyx_v_err;
   2545   int __pyx_r;
   2546   int __pyx_t_1;
   2547   long __pyx_t_2;
   2548   int __pyx_t_3;
   2549   PyObject *__pyx_t_4 = NULL;
   2550   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__InputDevice,&__pyx_n_s__buffersize,0};
   2551   __Pyx_RefNannySetupContext("__init__");
   2552   if (unlikely(__pyx_kwds)) {
   2553     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
   2554     PyObject* values[2] = {0,0};
   2555     values[1] = ((PyObject *)__pyx_int_4096);
   2556     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2557       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
   2558       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
   2559       case  0: break;
   2560       default: goto __pyx_L5_argtuple_error;
   2561     }
   2562     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2563       case  0:
   2564       values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__InputDevice);
   2565       if (likely(values[0])) kw_args--;
   2566       else goto __pyx_L5_argtuple_error;
   2567       case  1:
   2568       if (kw_args > 1) {
   2569         PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffersize);
   2570         if (unlikely(value)) { values[1] = value; kw_args--; }
   2571       }
   2572     }
   2573     if (unlikely(kw_args > 0)) {
   2574       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;}
   2575     }
   2576     __pyx_v_InputDevice = values[0];
   2577     __pyx_v_buffersize = values[1];
   2578   } else {
   2579     __pyx_v_buffersize = ((PyObject *)__pyx_int_4096);
   2580     switch (PyTuple_GET_SIZE(__pyx_args)) {
   2581       case  2: __pyx_v_buffersize = PyTuple_GET_ITEM(__pyx_args, 1);
   2582       case  1: __pyx_v_InputDevice = PyTuple_GET_ITEM(__pyx_args, 0);
   2583       break;
   2584       default: goto __pyx_L5_argtuple_error;
   2585     }
   2586   }
   2587   goto __pyx_L4_argument_unpacking_done;
   2588   __pyx_L5_argtuple_error:;
   2589   __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;}
   2590   __pyx_L3_error:;
   2591   __Pyx_AddTraceback("_pyportmidi.Input.__init__");
   2592   return -1;
   2593   __pyx_L4_argument_unpacking_done:;
   2594   __Pyx_INCREF((PyObject *)__pyx_v_self);
   2595   __Pyx_INCREF(__pyx_v_InputDevice);
   2596   __Pyx_INCREF(__pyx_v_buffersize);
   2597 
   2598   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":406
   2599  *     def __init__(self, InputDevice, buffersize=4096):
   2600  *         cdef PmError err
   2601  *         self.i = InputDevice             # <<<<<<<<<<<<<<
   2602  *         self.debug = 0
   2603  *         err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
   2604  */
   2605   __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;}
   2606   ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->i = __pyx_t_1;
   2607 
   2608   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":407
   2609  *         cdef PmError err
   2610  *         self.i = InputDevice
   2611  *         self.debug = 0             # <<<<<<<<<<<<<<
   2612  *         err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
   2613  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2614  */
   2615   ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->debug = 0;
   2616 
   2617   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":408
   2618  *         self.i = InputDevice
   2619  *         self.debug = 0
   2620  *         err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)             # <<<<<<<<<<<<<<
   2621  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2622  *         if self.debug: print "MIDI input opened."
   2623  */
   2624   __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;}
   2625   __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);
   2626 
   2627   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":409
   2628  *         self.debug = 0
   2629  *         err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
   2630  *         if err < 0: raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2631  *         if self.debug: print "MIDI input opened."
   2632  * 
   2633  */
   2634   __pyx_t_3 = (__pyx_v_err < 0);
   2635   if (__pyx_t_3) {
   2636     __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;}
   2637     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   2638     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_4), 0);
   2639     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   2640     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2641     goto __pyx_L6;
   2642   }
   2643   __pyx_L6:;
   2644 
   2645   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":410
   2646  *         err= Pm_OpenInput(&(self.midi),self.i,NULL,buffersize,&Pt_Time,NULL)
   2647  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2648  *         if self.debug: print "MIDI input opened."             # <<<<<<<<<<<<<<
   2649  * 
   2650  *     def __dealloc__(self):
   2651  */
   2652   __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->debug;
   2653   if (__pyx_t_1) {
   2654     if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_12)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2655     goto __pyx_L7;
   2656   }
   2657   __pyx_L7:;
   2658 
   2659   __pyx_r = 0;
   2660   goto __pyx_L0;
   2661   __pyx_L1_error:;
   2662   __Pyx_XDECREF(__pyx_t_4);
   2663   __Pyx_AddTraceback("_pyportmidi.Input.__init__");
   2664   __pyx_r = -1;
   2665   __pyx_L0:;
   2666   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2667   __Pyx_DECREF(__pyx_v_InputDevice);
   2668   __Pyx_DECREF(__pyx_v_buffersize);
   2669   __Pyx_RefNannyFinishContext();
   2670   return __pyx_r;
   2671 }
   2672 
   2673 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":412
   2674  *         if self.debug: print "MIDI input opened."
   2675  * 
   2676  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
   2677  *         cdef PmError err
   2678  *         if self.debug: print "Closing MIDI input stream and destroying instance"
   2679  */
   2680 
   2681 static void __pyx_pf_11_pyportmidi_5Input___dealloc__(PyObject *__pyx_v_self); /*proto*/
   2682 static void __pyx_pf_11_pyportmidi_5Input___dealloc__(PyObject *__pyx_v_self) {
   2683   PmError __pyx_v_err;
   2684   int __pyx_t_1;
   2685   int __pyx_t_2;
   2686   PyObject *__pyx_t_3 = NULL;
   2687   __Pyx_RefNannySetupContext("__dealloc__");
   2688   __Pyx_INCREF((PyObject *)__pyx_v_self);
   2689 
   2690   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":414
   2691  *     def __dealloc__(self):
   2692  *         cdef PmError err
   2693  *         if self.debug: print "Closing MIDI input stream and destroying instance"             # <<<<<<<<<<<<<<
   2694  * 
   2695  *         err = Pm_Close(self.midi)
   2696  */
   2697   __pyx_t_1 = ((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->debug;
   2698   if (__pyx_t_1) {
   2699     if (__Pyx_PrintOne(((PyObject *)__pyx_kp_s_13)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2700     goto __pyx_L5;
   2701   }
   2702   __pyx_L5:;
   2703 
   2704   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":416
   2705  *         if self.debug: print "Closing MIDI input stream and destroying instance"
   2706  * 
   2707  *         err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
   2708  *         if err < 0:
   2709  *             raise Exception, Pm_GetErrorText(err)
   2710  */
   2711   __pyx_v_err = Pm_Close(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi);
   2712 
   2713   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":417
   2714  * 
   2715  *         err = Pm_Close(self.midi)
   2716  *         if err < 0:             # <<<<<<<<<<<<<<
   2717  *             raise Exception, Pm_GetErrorText(err)
   2718  * 
   2719  */
   2720   __pyx_t_2 = (__pyx_v_err < 0);
   2721   if (__pyx_t_2) {
   2722 
   2723     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":418
   2724  *         err = Pm_Close(self.midi)
   2725  *         if err < 0:
   2726  *             raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2727  * 
   2728  * 
   2729  */
   2730     __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;}
   2731     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   2732     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_3), 0);
   2733     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   2734     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2735     goto __pyx_L6;
   2736   }
   2737   __pyx_L6:;
   2738 
   2739   goto __pyx_L0;
   2740   __pyx_L1_error:;
   2741   __Pyx_XDECREF(__pyx_t_3);
   2742   __Pyx_AddTraceback("_pyportmidi.Input.__dealloc__");
   2743   __pyx_L0:;
   2744   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2745   __Pyx_RefNannyFinishContext();
   2746 }
   2747 
   2748 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":422
   2749  * 
   2750  * 
   2751  *     def _check_open(self):             # <<<<<<<<<<<<<<
   2752  *         """ checks to see if the midi is open, and if not, raises an error.
   2753  *         """
   2754  */
   2755 
   2756 static PyObject *__pyx_pf_11_pyportmidi_5Input__check_open(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
   2757 static char __pyx_doc_11_pyportmidi_5Input__check_open[] = " checks to see if the midi is open, and if not, raises an error.\n        ";
   2758 static PyObject *__pyx_pf_11_pyportmidi_5Input__check_open(PyObject *__pyx_v_self, PyObject *unused) {
   2759   PyObject *__pyx_r = NULL;
   2760   int __pyx_t_1;
   2761   __Pyx_RefNannySetupContext("_check_open");
   2762   __Pyx_INCREF((PyObject *)__pyx_v_self);
   2763 
   2764   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":426
   2765  *         """
   2766  * 
   2767  *         if self.midi == NULL:             # <<<<<<<<<<<<<<
   2768  *             raise Exception, "midi Input not open."
   2769  * 
   2770  */
   2771   __pyx_t_1 = (((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi == NULL);
   2772   if (__pyx_t_1) {
   2773 
   2774     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":427
   2775  * 
   2776  *         if self.midi == NULL:
   2777  *             raise Exception, "midi Input not open."             # <<<<<<<<<<<<<<
   2778  * 
   2779  * 
   2780  */
   2781     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_kp_s_14), 0);
   2782     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2783     goto __pyx_L5;
   2784   }
   2785   __pyx_L5:;
   2786 
   2787   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   2788   goto __pyx_L0;
   2789   __pyx_L1_error:;
   2790   __Pyx_AddTraceback("_pyportmidi.Input._check_open");
   2791   __pyx_r = NULL;
   2792   __pyx_L0:;
   2793   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2794   __Pyx_XGIVEREF(__pyx_r);
   2795   __Pyx_RefNannyFinishContext();
   2796   return __pyx_r;
   2797 }
   2798 
   2799 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":430
   2800  * 
   2801  * 
   2802  *     def Close(self):             # <<<<<<<<<<<<<<
   2803  *         """
   2804  * Close()
   2805  */
   2806 
   2807 static PyObject *__pyx_pf_11_pyportmidi_5Input_Close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
   2808 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        ";
   2809 static PyObject *__pyx_pf_11_pyportmidi_5Input_Close(PyObject *__pyx_v_self, PyObject *unused) {
   2810   PyObject *__pyx_v_err;
   2811   PyObject *__pyx_r = NULL;
   2812   PyObject *__pyx_t_1 = NULL;
   2813   int __pyx_t_2;
   2814   PmError __pyx_t_3;
   2815   __Pyx_RefNannySetupContext("Close");
   2816   __Pyx_INCREF((PyObject *)__pyx_v_self);
   2817   __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
   2818 
   2819   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":440
   2820  *         #    return
   2821  * 
   2822  *         err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
   2823  *         if err < 0:
   2824  *             raise Exception, Pm_GetErrorText(err)
   2825  */
   2826   __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;}
   2827   __Pyx_GOTREF(__pyx_t_1);
   2828   __Pyx_DECREF(__pyx_v_err);
   2829   __pyx_v_err = __pyx_t_1;
   2830   __pyx_t_1 = 0;
   2831 
   2832   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":441
   2833  * 
   2834  *         err = Pm_Close(self.midi)
   2835  *         if err < 0:             # <<<<<<<<<<<<<<
   2836  *             raise Exception, Pm_GetErrorText(err)
   2837  *         #self.midi = NULL
   2838  */
   2839   __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;}
   2840   __Pyx_GOTREF(__pyx_t_1);
   2841   __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;}
   2842   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2843   if (__pyx_t_2) {
   2844 
   2845     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":442
   2846  *         err = Pm_Close(self.midi)
   2847  *         if err < 0:
   2848  *             raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2849  *         #self.midi = NULL
   2850  * 
   2851  */
   2852     __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;}
   2853     __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;}
   2854     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   2855     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), 0);
   2856     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   2857     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2858     goto __pyx_L5;
   2859   }
   2860   __pyx_L5:;
   2861 
   2862   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   2863   goto __pyx_L0;
   2864   __pyx_L1_error:;
   2865   __Pyx_XDECREF(__pyx_t_1);
   2866   __Pyx_AddTraceback("_pyportmidi.Input.Close");
   2867   __pyx_r = NULL;
   2868   __pyx_L0:;
   2869   __Pyx_DECREF(__pyx_v_err);
   2870   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2871   __Pyx_XGIVEREF(__pyx_r);
   2872   __Pyx_RefNannyFinishContext();
   2873   return __pyx_r;
   2874 }
   2875 
   2876 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":447
   2877  * 
   2878  * 
   2879  *     def SetFilter(self, filters):             # <<<<<<<<<<<<<<
   2880  *         """
   2881  *     SetFilter(<filters>) sets filters on an open input stream
   2882  */
   2883 
   2884 static PyObject *__pyx_pf_11_pyportmidi_5Input_SetFilter(PyObject *__pyx_v_self, PyObject *__pyx_v_filters); /*proto*/
   2885 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        ";
   2886 static PyObject *__pyx_pf_11_pyportmidi_5Input_SetFilter(PyObject *__pyx_v_self, PyObject *__pyx_v_filters) {
   2887   PmEvent __pyx_v_buffer[1];
   2888   PmError __pyx_v_err;
   2889   PyObject *__pyx_r = NULL;
   2890   PyObject *__pyx_t_1 = NULL;
   2891   PyObject *__pyx_t_2 = NULL;
   2892   long __pyx_t_3;
   2893   int __pyx_t_4;
   2894   __Pyx_RefNannySetupContext("SetFilter");
   2895   __Pyx_INCREF((PyObject *)__pyx_v_self);
   2896   __Pyx_INCREF(__pyx_v_filters);
   2897 
   2898   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":469
   2899  *         cdef PmError err
   2900  * 
   2901  *         self._check_open()             # <<<<<<<<<<<<<<
   2902  * 
   2903  * 
   2904  */
   2905   __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;}
   2906   __Pyx_GOTREF(__pyx_t_1);
   2907   __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;}
   2908   __Pyx_GOTREF(__pyx_t_2);
   2909   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   2910   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   2911 
   2912   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":472
   2913  * 
   2914  * 
   2915  *         err = Pm_SetFilter(self.midi, filters)             # <<<<<<<<<<<<<<
   2916  * 
   2917  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2918  */
   2919   __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;}
   2920   __pyx_v_err = Pm_SetFilter(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi, __pyx_t_3);
   2921 
   2922   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":474
   2923  *         err = Pm_SetFilter(self.midi, filters)
   2924  * 
   2925  *         if err < 0: raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2926  * 
   2927  *         while(Pm_Poll(self.midi) != pmNoError):
   2928  */
   2929   __pyx_t_4 = (__pyx_v_err < 0);
   2930   if (__pyx_t_4) {
   2931     __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;}
   2932     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   2933     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
   2934     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   2935     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2936     goto __pyx_L5;
   2937   }
   2938   __pyx_L5:;
   2939 
   2940   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":476
   2941  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   2942  * 
   2943  *         while(Pm_Poll(self.midi) != pmNoError):             # <<<<<<<<<<<<<<
   2944  * 
   2945  *             err = Pm_Read(self.midi,buffer,1)
   2946  */
   2947   while (1) {
   2948     __pyx_t_4 = (Pm_Poll(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi) != pmNoError);
   2949     if (!__pyx_t_4) break;
   2950 
   2951     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":478
   2952  *         while(Pm_Poll(self.midi) != pmNoError):
   2953  * 
   2954  *             err = Pm_Read(self.midi,buffer,1)             # <<<<<<<<<<<<<<
   2955  *             if err < 0: raise Exception, Pm_GetErrorText(err)
   2956  * 
   2957  */
   2958     __pyx_v_err = Pm_Read(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi, __pyx_v_buffer, 1);
   2959 
   2960     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":479
   2961  * 
   2962  *             err = Pm_Read(self.midi,buffer,1)
   2963  *             if err < 0: raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   2964  * 
   2965  *     def SetChannelMask(self, mask):
   2966  */
   2967     __pyx_t_4 = (__pyx_v_err < 0);
   2968     if (__pyx_t_4) {
   2969       __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;}
   2970       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   2971       __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
   2972       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   2973       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   2974       goto __pyx_L8;
   2975     }
   2976     __pyx_L8:;
   2977   }
   2978 
   2979   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   2980   goto __pyx_L0;
   2981   __pyx_L1_error:;
   2982   __Pyx_XDECREF(__pyx_t_1);
   2983   __Pyx_XDECREF(__pyx_t_2);
   2984   __Pyx_AddTraceback("_pyportmidi.Input.SetFilter");
   2985   __pyx_r = NULL;
   2986   __pyx_L0:;
   2987   __Pyx_DECREF((PyObject *)__pyx_v_self);
   2988   __Pyx_DECREF(__pyx_v_filters);
   2989   __Pyx_XGIVEREF(__pyx_r);
   2990   __Pyx_RefNannyFinishContext();
   2991   return __pyx_r;
   2992 }
   2993 
   2994 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":481
   2995  *             if err < 0: raise Exception, Pm_GetErrorText(err)
   2996  * 
   2997  *     def SetChannelMask(self, mask):             # <<<<<<<<<<<<<<
   2998  *         """
   2999  *     SetChannelMask(<mask>) filters incoming messages based on channel.
   3000  */
   3001 
   3002 static PyObject *__pyx_pf_11_pyportmidi_5Input_SetChannelMask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask); /*proto*/
   3003 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        ";
   3004 static PyObject *__pyx_pf_11_pyportmidi_5Input_SetChannelMask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask) {
   3005   PmError __pyx_v_err;
   3006   PyObject *__pyx_r = NULL;
   3007   PyObject *__pyx_t_1 = NULL;
   3008   PyObject *__pyx_t_2 = NULL;
   3009   int __pyx_t_3;
   3010   int __pyx_t_4;
   3011   __Pyx_RefNannySetupContext("SetChannelMask");
   3012   __Pyx_INCREF((PyObject *)__pyx_v_self);
   3013   __Pyx_INCREF(__pyx_v_mask);
   3014 
   3015   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":497
   3016  *         cdef PmError err
   3017  * 
   3018  *         self._check_open()             # <<<<<<<<<<<<<<
   3019  * 
   3020  *         err = Pm_SetChannelMask(self.midi,mask)
   3021  */
   3022   __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;}
   3023   __Pyx_GOTREF(__pyx_t_1);
   3024   __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;}
   3025   __Pyx_GOTREF(__pyx_t_2);
   3026   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   3027   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3028 
   3029   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":499
   3030  *         self._check_open()
   3031  * 
   3032  *         err = Pm_SetChannelMask(self.midi,mask)             # <<<<<<<<<<<<<<
   3033  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   3034  * 
   3035  */
   3036   __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;}
   3037   __pyx_v_err = Pm_SetChannelMask(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi, __pyx_t_3);
   3038 
   3039   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":500
   3040  * 
   3041  *         err = Pm_SetChannelMask(self.midi,mask)
   3042  *         if err < 0: raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   3043  * 
   3044  *     def Poll(self):
   3045  */
   3046   __pyx_t_4 = (__pyx_v_err < 0);
   3047   if (__pyx_t_4) {
   3048     __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;}
   3049     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   3050     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
   3051     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   3052     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   3053     goto __pyx_L5;
   3054   }
   3055   __pyx_L5:;
   3056 
   3057   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   3058   goto __pyx_L0;
   3059   __pyx_L1_error:;
   3060   __Pyx_XDECREF(__pyx_t_1);
   3061   __Pyx_XDECREF(__pyx_t_2);
   3062   __Pyx_AddTraceback("_pyportmidi.Input.SetChannelMask");
   3063   __pyx_r = NULL;
   3064   __pyx_L0:;
   3065   __Pyx_DECREF((PyObject *)__pyx_v_self);
   3066   __Pyx_DECREF(__pyx_v_mask);
   3067   __Pyx_XGIVEREF(__pyx_r);
   3068   __Pyx_RefNannyFinishContext();
   3069   return __pyx_r;
   3070 }
   3071 
   3072 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":502
   3073  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   3074  * 
   3075  *     def Poll(self):             # <<<<<<<<<<<<<<
   3076  *         """
   3077  *     Poll tests whether input is available,
   3078  */
   3079 
   3080 static PyObject *__pyx_pf_11_pyportmidi_5Input_Poll(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
   3081 static char __pyx_doc_11_pyportmidi_5Input_Poll[] = "\n    Poll tests whether input is available,\n    returning TRUE, FALSE, or an error value.\n        ";
   3082 static PyObject *__pyx_pf_11_pyportmidi_5Input_Poll(PyObject *__pyx_v_self, PyObject *unused) {
   3083   PmError __pyx_v_err;
   3084   PyObject *__pyx_r = NULL;
   3085   PyObject *__pyx_t_1 = NULL;
   3086   PyObject *__pyx_t_2 = NULL;
   3087   int __pyx_t_3;
   3088   __Pyx_RefNannySetupContext("Poll");
   3089   __Pyx_INCREF((PyObject *)__pyx_v_self);
   3090 
   3091   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":508
   3092  *         """
   3093  *         cdef PmError err
   3094  *         self._check_open()             # <<<<<<<<<<<<<<
   3095  * 
   3096  *         err = Pm_Poll(self.midi)
   3097  */
   3098   __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;}
   3099   __Pyx_GOTREF(__pyx_t_1);
   3100   __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;}
   3101   __Pyx_GOTREF(__pyx_t_2);
   3102   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   3103   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3104 
   3105   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":510
   3106  *         self._check_open()
   3107  * 
   3108  *         err = Pm_Poll(self.midi)             # <<<<<<<<<<<<<<
   3109  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   3110  *         return err
   3111  */
   3112   __pyx_v_err = Pm_Poll(((struct __pyx_obj_11_pyportmidi_Input *)__pyx_v_self)->midi);
   3113 
   3114   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":511
   3115  * 
   3116  *         err = Pm_Poll(self.midi)
   3117  *         if err < 0: raise Exception, Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
   3118  *         return err
   3119  * 
   3120  */
   3121   __pyx_t_3 = (__pyx_v_err < 0);
   3122   if (__pyx_t_3) {
   3123     __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;}
   3124     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   3125     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
   3126     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   3127     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   3128     goto __pyx_L5;
   3129   }
   3130   __pyx_L5:;
   3131 
   3132   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":512
   3133  *         err = Pm_Poll(self.midi)
   3134  *         if err < 0: raise Exception, Pm_GetErrorText(err)
   3135  *         return err             # <<<<<<<<<<<<<<
   3136  * 
   3137  *     def Read(self,length):
   3138  */
   3139   __Pyx_XDECREF(__pyx_r);
   3140   __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;}
   3141   __Pyx_GOTREF(__pyx_t_2);
   3142   __pyx_r = __pyx_t_2;
   3143   __pyx_t_2 = 0;
   3144   goto __pyx_L0;
   3145 
   3146   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   3147   goto __pyx_L0;
   3148   __pyx_L1_error:;
   3149   __Pyx_XDECREF(__pyx_t_1);
   3150   __Pyx_XDECREF(__pyx_t_2);
   3151   __Pyx_AddTraceback("_pyportmidi.Input.Poll");
   3152   __pyx_r = NULL;
   3153   __pyx_L0:;
   3154   __Pyx_DECREF((PyObject *)__pyx_v_self);
   3155   __Pyx_XGIVEREF(__pyx_r);
   3156   __Pyx_RefNannyFinishContext();
   3157   return __pyx_r;
   3158 }
   3159 
   3160 /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":514
   3161  *         return err
   3162  * 
   3163  *     def Read(self,length):             # <<<<<<<<<<<<<<
   3164  *         """
   3165  * Read(length): returns up to <length> midi events stored in
   3166  */
   3167 
   3168 static PyObject *__pyx_pf_11_pyportmidi_5Input_Read(PyObject *__pyx_v_self, PyObject *__pyx_v_length); /*proto*/
   3169 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        ";
   3170 static PyObject *__pyx_pf_11_pyportmidi_5Input_Read(PyObject *__pyx_v_self, PyObject *__pyx_v_length) {
   3171   PmEvent __pyx_v_buffer[1024];
   3172   PyObject *__pyx_v_x;
   3173   PyObject *__pyx_v_NumEvents;
   3174   PyObject *__pyx_v_loop;
   3175   PyObject *__pyx_r = NULL;
   3176   PyObject *__pyx_t_1 = NULL;
   3177   PyObject *__pyx_t_2 = NULL;
   3178   int __pyx_t_3;
   3179   long __pyx_t_4;
   3180   PmError __pyx_t_5;
   3181   Py_ssize_t __pyx_t_6;
   3182   Py_ssize_t __pyx_t_7;
   3183   PyObject *__pyx_t_8 = NULL;
   3184   PyObject *__pyx_t_9 = NULL;
   3185   PyObject *__pyx_t_10 = NULL;
   3186   PyObject *__pyx_t_11 = NULL;
   3187   __Pyx_RefNannySetupContext("Read");
   3188   __Pyx_INCREF((PyObject *)__pyx_v_self);
   3189   __Pyx_INCREF(__pyx_v_length);
   3190   __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
   3191   __pyx_v_NumEvents = Py_None; __Pyx_INCREF(Py_None);
   3192   __pyx_v_loop = Py_None; __Pyx_INCREF(Py_None);
   3193 
   3194   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":525
   3195  *         cdef PmEvent buffer[1024]
   3196  * 
   3197  *         self._check_open()             # <<<<<<<<<<<<<<
   3198  * 
   3199  *         x = []
   3200  */
   3201   __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;}
   3202   __Pyx_GOTREF(__pyx_t_1);
   3203   __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;}
   3204   __Pyx_GOTREF(__pyx_t_2);
   3205   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   3206   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3207 
   3208   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":527
   3209  *         self._check_open()
   3210  * 
   3211  *         x = []             # <<<<<<<<<<<<<<
   3212  * 
   3213  *         if length > 1024: raise IndexError, 'maximum buffer length is 1024'
   3214  */
   3215   __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;}
   3216   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   3217   __Pyx_DECREF(__pyx_v_x);
   3218   __pyx_v_x = ((PyObject *)__pyx_t_2);
   3219   __pyx_t_2 = 0;
   3220 
   3221   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":529
   3222  *         x = []
   3223  * 
   3224  *         if length > 1024: raise IndexError, 'maximum buffer length is 1024'             # <<<<<<<<<<<<<<
   3225  *         if length < 1: raise IndexError, 'minimum buffer length is 1'
   3226  *         NumEvents = Pm_Read(self.midi,buffer,length)
   3227  */
   3228   __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;}
   3229   __Pyx_GOTREF(__pyx_t_2);
   3230   __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;}
   3231   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3232   if (__pyx_t_3) {
   3233     __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_15), 0);
   3234     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   3235     goto __pyx_L5;
   3236   }
   3237   __pyx_L5:;
   3238 
   3239   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":530
   3240  * 
   3241  *         if length > 1024: raise IndexError, 'maximum buffer length is 1024'
   3242  *         if length < 1: raise IndexError, 'minimum buffer length is 1'             # <<<<<<<<<<<<<<
   3243  *         NumEvents = Pm_Read(self.midi,buffer,length)
   3244  *         if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
   3245  */
   3246   __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;}
   3247   __Pyx_GOTREF(__pyx_t_2);
   3248   __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;}
   3249   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3250   if (__pyx_t_3) {
   3251     __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_16), 0);
   3252     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   3253     goto __pyx_L6;
   3254   }
   3255   __pyx_L6:;
   3256 
   3257   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":531
   3258  *         if length > 1024: raise IndexError, 'maximum buffer length is 1024'
   3259  *         if length < 1: raise IndexError, 'minimum buffer length is 1'
   3260  *         NumEvents = Pm_Read(self.midi,buffer,length)             # <<<<<<<<<<<<<<
   3261  *         if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
   3262  *         x=[]
   3263  */
   3264   __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;}
   3265   __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;}
   3266   __Pyx_GOTREF(__pyx_t_2);
   3267   __Pyx_DECREF(__pyx_v_NumEvents);
   3268   __pyx_v_NumEvents = __pyx_t_2;
   3269   __pyx_t_2 = 0;
   3270 
   3271   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":532
   3272  *         if length < 1: raise IndexError, 'minimum buffer length is 1'
   3273  *         NumEvents = Pm_Read(self.midi,buffer,length)
   3274  *         if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)             # <<<<<<<<<<<<<<
   3275  *         x=[]
   3276  *         if NumEvents >= 1:
   3277  */
   3278   __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;}
   3279   __Pyx_GOTREF(__pyx_t_2);
   3280   __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;}
   3281   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3282   if (__pyx_t_3) {
   3283     __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;}
   3284     __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;}
   3285     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   3286     __Pyx_Raise(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), 0);
   3287     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   3288     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   3289     goto __pyx_L7;
   3290   }
   3291   __pyx_L7:;
   3292 
   3293   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":533
   3294  *         NumEvents = Pm_Read(self.midi,buffer,length)
   3295  *         if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
   3296  *         x=[]             # <<<<<<<<<<<<<<
   3297  *         if NumEvents >= 1:
   3298  *             for loop in range(NumEvents):
   3299  */
   3300   __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;}
   3301   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   3302   __Pyx_DECREF(__pyx_v_x);
   3303   __pyx_v_x = ((PyObject *)__pyx_t_2);
   3304   __pyx_t_2 = 0;
   3305 
   3306   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":534
   3307  *         if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents)
   3308  *         x=[]
   3309  *         if NumEvents >= 1:             # <<<<<<<<<<<<<<
   3310  *             for loop in range(NumEvents):
   3311  *                  x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp])
   3312  */
   3313   __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;}
   3314   __Pyx_GOTREF(__pyx_t_2);
   3315   __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;}
   3316   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3317   if (__pyx_t_3) {
   3318 
   3319     /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":535
   3320  *         x=[]
   3321  *         if NumEvents >= 1:
   3322  *             for loop in range(NumEvents):             # <<<<<<<<<<<<<<
   3323  *                  x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp])
   3324  *         return x
   3325  */
   3326     __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;}
   3327     __Pyx_GOTREF(__pyx_t_2);
   3328     __Pyx_INCREF(__pyx_v_NumEvents);
   3329     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_NumEvents);
   3330     __Pyx_GIVEREF(__pyx_v_NumEvents);
   3331     __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;}
   3332     __Pyx_GOTREF(__pyx_t_1);
   3333     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3334     if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
   3335       __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
   3336     } else {
   3337       __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;}
   3338       __Pyx_GOTREF(__pyx_t_2);
   3339     }
   3340     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   3341     for (;;) {
   3342       if (likely(PyList_CheckExact(__pyx_t_2))) {
   3343         if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
   3344         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
   3345       } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
   3346         if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
   3347         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
   3348       } else {
   3349         __pyx_t_1 = PyIter_Next(__pyx_t_2);
   3350         if (!__pyx_t_1) {
   3351           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   3352           break;
   3353         }
   3354         __Pyx_GOTREF(__pyx_t_1);
   3355       }
   3356       __Pyx_DECREF(__pyx_v_loop);
   3357       __pyx_v_loop = __pyx_t_1;
   3358       __pyx_t_1 = 0;
   3359 
   3360       /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":536
   3361  *         if NumEvents >= 1:
   3362  *             for loop in range(NumEvents):
   3363  *                  x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp])             # <<<<<<<<<<<<<<
   3364  *         return x
   3365  */
   3366       __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;}
   3367       __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;}
   3368       __Pyx_GOTREF(__pyx_t_1);
   3369       __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;}
   3370       __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;}
   3371       __Pyx_GOTREF(__pyx_t_8);
   3372       __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;}
   3373       __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;}
   3374       __Pyx_GOTREF(__pyx_t_9);
   3375       __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;}
   3376       __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;}
   3377       __Pyx_GOTREF(__pyx_t_10);
   3378       __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;}
   3379       __Pyx_GOTREF(((PyObject *)__pyx_t_11));
   3380       PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
   3381       __Pyx_GIVEREF(__pyx_t_1);
   3382       PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_8);
   3383       __Pyx_GIVEREF(__pyx_t_8);
   3384       PyList_SET_ITEM(__pyx_t_11, 2, __pyx_t_9);
   3385       __Pyx_GIVEREF(__pyx_t_9);
   3386       PyList_SET_ITEM(__pyx_t_11, 3, __pyx_t_10);
   3387       __Pyx_GIVEREF(__pyx_t_10);
   3388       __pyx_t_1 = 0;
   3389       __pyx_t_8 = 0;
   3390       __pyx_t_9 = 0;
   3391       __pyx_t_10 = 0;
   3392       __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;}
   3393       __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;}
   3394       __Pyx_GOTREF(__pyx_t_10);
   3395       __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;}
   3396       __Pyx_GOTREF(((PyObject *)__pyx_t_9));
   3397       PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_11));
   3398       __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
   3399       PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
   3400       __Pyx_GIVEREF(__pyx_t_10);
   3401       __pyx_t_11 = 0;
   3402       __pyx_t_10 = 0;
   3403       __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;}
   3404       __Pyx_GOTREF(__pyx_t_10);
   3405       __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
   3406       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   3407     }
   3408     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   3409     goto __pyx_L8;
   3410   }
   3411   __pyx_L8:;
   3412 
   3413   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":537
   3414  *             for loop in range(NumEvents):
   3415  *                  x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp])
   3416  *         return x             # <<<<<<<<<<<<<<
   3417  */
   3418   __Pyx_XDECREF(__pyx_r);
   3419   __Pyx_INCREF(__pyx_v_x);
   3420   __pyx_r = __pyx_v_x;
   3421   goto __pyx_L0;
   3422 
   3423   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   3424   goto __pyx_L0;
   3425   __pyx_L1_error:;
   3426   __Pyx_XDECREF(__pyx_t_1);
   3427   __Pyx_XDECREF(__pyx_t_2);
   3428   __Pyx_XDECREF(__pyx_t_8);
   3429   __Pyx_XDECREF(__pyx_t_9);
   3430   __Pyx_XDECREF(__pyx_t_10);
   3431   __Pyx_XDECREF(__pyx_t_11);
   3432   __Pyx_AddTraceback("_pyportmidi.Input.Read");
   3433   __pyx_r = NULL;
   3434   __pyx_L0:;
   3435   __Pyx_DECREF(__pyx_v_x);
   3436   __Pyx_DECREF(__pyx_v_NumEvents);
   3437   __Pyx_DECREF(__pyx_v_loop);
   3438   __Pyx_DECREF((PyObject *)__pyx_v_self);
   3439   __Pyx_DECREF(__pyx_v_length);
   3440   __Pyx_XGIVEREF(__pyx_r);
   3441   __Pyx_RefNannyFinishContext();
   3442   return __pyx_r;
   3443 }
   3444 
   3445 static PyObject *__pyx_tp_new_11_pyportmidi_Output(PyTypeObject *t, PyObject *a, PyObject *k) {
   3446   PyObject *o = (*t->tp_alloc)(t, 0);
   3447   if (!o) return 0;
   3448   return o;
   3449 }
   3450 
   3451 static void __pyx_tp_dealloc_11_pyportmidi_Output(PyObject *o) {
   3452   {
   3453     PyObject *etype, *eval, *etb;
   3454     PyErr_Fetch(&etype, &eval, &etb);
   3455     ++Py_REFCNT(o);
   3456     __pyx_pf_11_pyportmidi_6Output___dealloc__(o);
   3457     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
   3458     --Py_REFCNT(o);
   3459     PyErr_Restore(etype, eval, etb);
   3460   }
   3461   (*Py_TYPE(o)->tp_free)(o);
   3462 }
   3463 
   3464 static struct PyMethodDef __pyx_methods_11_pyportmidi_Output[] = {
   3465   {__Pyx_NAMESTR("_check_open"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output__check_open, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output__check_open)},
   3466   {__Pyx_NAMESTR("Close"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_Close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_Close)},
   3467   {__Pyx_NAMESTR("Abort"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_Abort, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_Abort)},
   3468   {__Pyx_NAMESTR("Write"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_Write, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_Write)},
   3469   {__Pyx_NAMESTR("WriteShort"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_WriteShort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_WriteShort)},
   3470   {__Pyx_NAMESTR("WriteSysEx"), (PyCFunction)__pyx_pf_11_pyportmidi_6Output_WriteSysEx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_6Output_WriteSysEx)},
   3471   {0, 0, 0, 0}
   3472 };
   3473 
   3474 static PyNumberMethods __pyx_tp_as_number_Output = {
   3475   0, /*nb_add*/
   3476   0, /*nb_subtract*/
   3477   0, /*nb_multiply*/
   3478   #if PY_MAJOR_VERSION < 3
   3479   0, /*nb_divide*/
   3480   #endif
   3481   0, /*nb_remainder*/
   3482   0, /*nb_divmod*/
   3483   0, /*nb_power*/
   3484   0, /*nb_negative*/
   3485   0, /*nb_positive*/
   3486   0, /*nb_absolute*/
   3487   0, /*nb_nonzero*/
   3488   0, /*nb_invert*/
   3489   0, /*nb_lshift*/
   3490   0, /*nb_rshift*/
   3491   0, /*nb_and*/
   3492   0, /*nb_xor*/
   3493   0, /*nb_or*/
   3494   #if PY_MAJOR_VERSION < 3
   3495   0, /*nb_coerce*/
   3496   #endif
   3497   0, /*nb_int*/
   3498   #if PY_MAJOR_VERSION >= 3
   3499   0, /*reserved*/
   3500   #else
   3501   0, /*nb_long*/
   3502   #endif
   3503   0, /*nb_float*/
   3504   #if PY_MAJOR_VERSION < 3
   3505   0, /*nb_oct*/
   3506   #endif
   3507   #if PY_MAJOR_VERSION < 3
   3508   0, /*nb_hex*/
   3509   #endif
   3510   0, /*nb_inplace_add*/
   3511   0, /*nb_inplace_subtract*/
   3512   0, /*nb_inplace_multiply*/
   3513   #if PY_MAJOR_VERSION < 3
   3514   0, /*nb_inplace_divide*/
   3515   #endif
   3516   0, /*nb_inplace_remainder*/
   3517   0, /*nb_inplace_power*/
   3518   0, /*nb_inplace_lshift*/
   3519   0, /*nb_inplace_rshift*/
   3520   0, /*nb_inplace_and*/
   3521   0, /*nb_inplace_xor*/
   3522   0, /*nb_inplace_or*/
   3523   0, /*nb_floor_divide*/
   3524   0, /*nb_true_divide*/
   3525   0, /*nb_inplace_floor_divide*/
   3526   0, /*nb_inplace_true_divide*/
   3527   #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
   3528   0, /*nb_index*/
   3529   #endif
   3530 };
   3531 
   3532 static PySequenceMethods __pyx_tp_as_sequence_Output = {
   3533   0, /*sq_length*/
   3534   0, /*sq_concat*/
   3535   0, /*sq_repeat*/
   3536   0, /*sq_item*/
   3537   0, /*sq_slice*/
   3538   0, /*sq_ass_item*/
   3539   0, /*sq_ass_slice*/
   3540   0, /*sq_contains*/
   3541   0, /*sq_inplace_concat*/
   3542   0, /*sq_inplace_repeat*/
   3543 };
   3544 
   3545 static PyMappingMethods __pyx_tp_as_mapping_Output = {
   3546   0, /*mp_length*/
   3547   0, /*mp_subscript*/
   3548   0, /*mp_ass_subscript*/
   3549 };
   3550 
   3551 static PyBufferProcs __pyx_tp_as_buffer_Output = {
   3552   #if PY_MAJOR_VERSION < 3
   3553   0, /*bf_getreadbuffer*/
   3554   #endif
   3555   #if PY_MAJOR_VERSION < 3
   3556   0, /*bf_getwritebuffer*/
   3557   #endif
   3558   #if PY_MAJOR_VERSION < 3
   3559   0, /*bf_getsegcount*/
   3560   #endif
   3561   #if PY_MAJOR_VERSION < 3
   3562   0, /*bf_getcharbuffer*/
   3563   #endif
   3564   #if PY_VERSION_HEX >= 0x02060000
   3565   0, /*bf_getbuffer*/
   3566   #endif
   3567   #if PY_VERSION_HEX >= 0x02060000
   3568   0, /*bf_releasebuffer*/
   3569   #endif
   3570 };
   3571 
   3572 PyTypeObject __pyx_type_11_pyportmidi_Output = {
   3573   PyVarObject_HEAD_INIT(0, 0)
   3574   __Pyx_NAMESTR("_pyportmidi.Output"), /*tp_name*/
   3575   sizeof(struct __pyx_obj_11_pyportmidi_Output), /*tp_basicsize*/
   3576   0, /*tp_itemsize*/
   3577   __pyx_tp_dealloc_11_pyportmidi_Output, /*tp_dealloc*/
   3578   0, /*tp_print*/
   3579   0, /*tp_getattr*/
   3580   0, /*tp_setattr*/
   3581   0, /*tp_compare*/
   3582   0, /*tp_repr*/
   3583   &__pyx_tp_as_number_Output, /*tp_as_number*/
   3584   &__pyx_tp_as_sequence_Output, /*tp_as_sequence*/
   3585   &__pyx_tp_as_mapping_Output, /*tp_as_mapping*/
   3586   0, /*tp_hash*/
   3587   0, /*tp_call*/
   3588   0, /*tp_str*/
   3589   0, /*tp_getattro*/
   3590   0, /*tp_setattro*/
   3591   &__pyx_tp_as_buffer_Output, /*tp_as_buffer*/
   3592   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
   3593   __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*/
   3594   0, /*tp_traverse*/
   3595   0, /*tp_clear*/
   3596   0, /*tp_richcompare*/
   3597   0, /*tp_weaklistoffset*/
   3598   0, /*tp_iter*/
   3599   0, /*tp_iternext*/
   3600   __pyx_methods_11_pyportmidi_Output, /*tp_methods*/
   3601   0, /*tp_members*/
   3602   0, /*tp_getset*/
   3603   0, /*tp_base*/
   3604   0, /*tp_dict*/
   3605   0, /*tp_descr_get*/
   3606   0, /*tp_descr_set*/
   3607   0, /*tp_dictoffset*/
   3608   __pyx_pf_11_pyportmidi_6Output___init__, /*tp_init*/
   3609   0, /*tp_alloc*/
   3610   __pyx_tp_new_11_pyportmidi_Output, /*tp_new*/
   3611   0, /*tp_free*/
   3612   0, /*tp_is_gc*/
   3613   0, /*tp_bases*/
   3614   0, /*tp_mro*/
   3615   0, /*tp_cache*/
   3616   0, /*tp_subclasses*/
   3617   0, /*tp_weaklist*/
   3618   0, /*tp_del*/
   3619   #if PY_VERSION_HEX >= 0x02060000
   3620   0, /*tp_version_tag*/
   3621   #endif
   3622 };
   3623 
   3624 static PyObject *__pyx_tp_new_11_pyportmidi_Input(PyTypeObject *t, PyObject *a, PyObject *k) {
   3625   PyObject *o = (*t->tp_alloc)(t, 0);
   3626   if (!o) return 0;
   3627   return o;
   3628 }
   3629 
   3630 static void __pyx_tp_dealloc_11_pyportmidi_Input(PyObject *o) {
   3631   {
   3632     PyObject *etype, *eval, *etb;
   3633     PyErr_Fetch(&etype, &eval, &etb);
   3634     ++Py_REFCNT(o);
   3635     __pyx_pf_11_pyportmidi_5Input___dealloc__(o);
   3636     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
   3637     --Py_REFCNT(o);
   3638     PyErr_Restore(etype, eval, etb);
   3639   }
   3640   (*Py_TYPE(o)->tp_free)(o);
   3641 }
   3642 
   3643 static struct PyMethodDef __pyx_methods_11_pyportmidi_Input[] = {
   3644   {__Pyx_NAMESTR("_check_open"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input__check_open, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input__check_open)},
   3645   {__Pyx_NAMESTR("Close"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_Close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_Close)},
   3646   {__Pyx_NAMESTR("SetFilter"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_SetFilter, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_SetFilter)},
   3647   {__Pyx_NAMESTR("SetChannelMask"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_SetChannelMask, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_SetChannelMask)},
   3648   {__Pyx_NAMESTR("Poll"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_Poll, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_Poll)},
   3649   {__Pyx_NAMESTR("Read"), (PyCFunction)__pyx_pf_11_pyportmidi_5Input_Read, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_5Input_Read)},
   3650   {0, 0, 0, 0}
   3651 };
   3652 
   3653 static PyNumberMethods __pyx_tp_as_number_Input = {
   3654   0, /*nb_add*/
   3655   0, /*nb_subtract*/
   3656   0, /*nb_multiply*/
   3657   #if PY_MAJOR_VERSION < 3
   3658   0, /*nb_divide*/
   3659   #endif
   3660   0, /*nb_remainder*/
   3661   0, /*nb_divmod*/
   3662   0, /*nb_power*/
   3663   0, /*nb_negative*/
   3664   0, /*nb_positive*/
   3665   0, /*nb_absolute*/
   3666   0, /*nb_nonzero*/
   3667   0, /*nb_invert*/
   3668   0, /*nb_lshift*/
   3669   0, /*nb_rshift*/
   3670   0, /*nb_and*/
   3671   0, /*nb_xor*/
   3672   0, /*nb_or*/
   3673   #if PY_MAJOR_VERSION < 3
   3674   0, /*nb_coerce*/
   3675   #endif
   3676   0, /*nb_int*/
   3677   #if PY_MAJOR_VERSION >= 3
   3678   0, /*reserved*/
   3679   #else
   3680   0, /*nb_long*/
   3681   #endif
   3682   0, /*nb_float*/
   3683   #if PY_MAJOR_VERSION < 3
   3684   0, /*nb_oct*/
   3685   #endif
   3686   #if PY_MAJOR_VERSION < 3
   3687   0, /*nb_hex*/
   3688   #endif
   3689   0, /*nb_inplace_add*/
   3690   0, /*nb_inplace_subtract*/
   3691   0, /*nb_inplace_multiply*/
   3692   #if PY_MAJOR_VERSION < 3
   3693   0, /*nb_inplace_divide*/
   3694   #endif
   3695   0, /*nb_inplace_remainder*/
   3696   0, /*nb_inplace_power*/
   3697   0, /*nb_inplace_lshift*/
   3698   0, /*nb_inplace_rshift*/
   3699   0, /*nb_inplace_and*/
   3700   0, /*nb_inplace_xor*/
   3701   0, /*nb_inplace_or*/
   3702   0, /*nb_floor_divide*/
   3703   0, /*nb_true_divide*/
   3704   0, /*nb_inplace_floor_divide*/
   3705   0, /*nb_inplace_true_divide*/
   3706   #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
   3707   0, /*nb_index*/
   3708   #endif
   3709 };
   3710 
   3711 static PySequenceMethods __pyx_tp_as_sequence_Input = {
   3712   0, /*sq_length*/
   3713   0, /*sq_concat*/
   3714   0, /*sq_repeat*/
   3715   0, /*sq_item*/
   3716   0, /*sq_slice*/
   3717   0, /*sq_ass_item*/
   3718   0, /*sq_ass_slice*/
   3719   0, /*sq_contains*/
   3720   0, /*sq_inplace_concat*/
   3721   0, /*sq_inplace_repeat*/
   3722 };
   3723 
   3724 static PyMappingMethods __pyx_tp_as_mapping_Input = {
   3725   0, /*mp_length*/
   3726   0, /*mp_subscript*/
   3727   0, /*mp_ass_subscript*/
   3728 };
   3729 
   3730 static PyBufferProcs __pyx_tp_as_buffer_Input = {
   3731   #if PY_MAJOR_VERSION < 3
   3732   0, /*bf_getreadbuffer*/
   3733   #endif
   3734   #if PY_MAJOR_VERSION < 3
   3735   0, /*bf_getwritebuffer*/
   3736   #endif
   3737   #if PY_MAJOR_VERSION < 3
   3738   0, /*bf_getsegcount*/
   3739   #endif
   3740   #if PY_MAJOR_VERSION < 3
   3741   0, /*bf_getcharbuffer*/
   3742   #endif
   3743   #if PY_VERSION_HEX >= 0x02060000
   3744   0, /*bf_getbuffer*/
   3745   #endif
   3746   #if PY_VERSION_HEX >= 0x02060000
   3747   0, /*bf_releasebuffer*/
   3748   #endif
   3749 };
   3750 
   3751 PyTypeObject __pyx_type_11_pyportmidi_Input = {
   3752   PyVarObject_HEAD_INIT(0, 0)
   3753   __Pyx_NAMESTR("_pyportmidi.Input"), /*tp_name*/
   3754   sizeof(struct __pyx_obj_11_pyportmidi_Input), /*tp_basicsize*/
   3755   0, /*tp_itemsize*/
   3756   __pyx_tp_dealloc_11_pyportmidi_Input, /*tp_dealloc*/
   3757   0, /*tp_print*/
   3758   0, /*tp_getattr*/
   3759   0, /*tp_setattr*/
   3760   0, /*tp_compare*/
   3761   0, /*tp_repr*/
   3762   &__pyx_tp_as_number_Input, /*tp_as_number*/
   3763   &__pyx_tp_as_sequence_Input, /*tp_as_sequence*/
   3764   &__pyx_tp_as_mapping_Input, /*tp_as_mapping*/
   3765   0, /*tp_hash*/
   3766   0, /*tp_call*/
   3767   0, /*tp_str*/
   3768   0, /*tp_getattro*/
   3769   0, /*tp_setattro*/
   3770   &__pyx_tp_as_buffer_Input, /*tp_as_buffer*/
   3771   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
   3772   __Pyx_DOCSTR("\nclass Input:\n    define an input MIDI stream. Takes the form:\n        x = pypm.Input(MidiInputDevice)\n    "), /*tp_doc*/
   3773   0, /*tp_traverse*/
   3774   0, /*tp_clear*/
   3775   0, /*tp_richcompare*/
   3776   0, /*tp_weaklistoffset*/
   3777   0, /*tp_iter*/
   3778   0, /*tp_iternext*/
   3779   __pyx_methods_11_pyportmidi_Input, /*tp_methods*/
   3780   0, /*tp_members*/
   3781   0, /*tp_getset*/
   3782   0, /*tp_base*/
   3783   0, /*tp_dict*/
   3784   0, /*tp_descr_get*/
   3785   0, /*tp_descr_set*/
   3786   0, /*tp_dictoffset*/
   3787   __pyx_pf_11_pyportmidi_5Input___init__, /*tp_init*/
   3788   0, /*tp_alloc*/
   3789   __pyx_tp_new_11_pyportmidi_Input, /*tp_new*/
   3790   0, /*tp_free*/
   3791   0, /*tp_is_gc*/
   3792   0, /*tp_bases*/
   3793   0, /*tp_mro*/
   3794   0, /*tp_cache*/
   3795   0, /*tp_subclasses*/
   3796   0, /*tp_weaklist*/
   3797   0, /*tp_del*/
   3798   #if PY_VERSION_HEX >= 0x02060000
   3799   0, /*tp_version_tag*/
   3800   #endif
   3801 };
   3802 
   3803 static struct PyMethodDef __pyx_methods[] = {
   3804   {__Pyx_NAMESTR("Initialize"), (PyCFunction)__pyx_pf_11_pyportmidi_Initialize, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Initialize)},
   3805   {__Pyx_NAMESTR("Terminate"), (PyCFunction)__pyx_pf_11_pyportmidi_Terminate, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Terminate)},
   3806   {__Pyx_NAMESTR("GetDefaultInputDeviceID"), (PyCFunction)__pyx_pf_11_pyportmidi_GetDefaultInputDeviceID, METH_NOARGS, __Pyx_DOCSTR(0)},
   3807   {__Pyx_NAMESTR("GetDefaultOutputDeviceID"), (PyCFunction)__pyx_pf_11_pyportmidi_GetDefaultOutputDeviceID, METH_NOARGS, __Pyx_DOCSTR(0)},
   3808   {__Pyx_NAMESTR("CountDevices"), (PyCFunction)__pyx_pf_11_pyportmidi_CountDevices, METH_NOARGS, __Pyx_DOCSTR(0)},
   3809   {__Pyx_NAMESTR("GetDeviceInfo"), (PyCFunction)__pyx_pf_11_pyportmidi_GetDeviceInfo, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_GetDeviceInfo)},
   3810   {__Pyx_NAMESTR("Time"), (PyCFunction)__pyx_pf_11_pyportmidi_Time, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Time)},
   3811   {__Pyx_NAMESTR("GetErrorText"), (PyCFunction)__pyx_pf_11_pyportmidi_GetErrorText, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_GetErrorText)},
   3812   {__Pyx_NAMESTR("Channel"), (PyCFunction)__pyx_pf_11_pyportmidi_Channel, METH_O, __Pyx_DOCSTR(__pyx_doc_11_pyportmidi_Channel)},
   3813   {0, 0, 0, 0}
   3814 };
   3815 
   3816 static void __pyx_init_filenames(void); /*proto*/
   3817 
   3818 #if PY_MAJOR_VERSION >= 3
   3819 static struct PyModuleDef __pyx_moduledef = {
   3820     PyModuleDef_HEAD_INIT,
   3821     __Pyx_NAMESTR("_pyportmidi"),
   3822     0, /* m_doc */
   3823     -1, /* m_size */
   3824     __pyx_methods /* m_methods */,
   3825     NULL, /* m_reload */
   3826     NULL, /* m_traverse */
   3827     NULL, /* m_clear */
   3828     NULL /* m_free */
   3829 };
   3830 #endif
   3831 
   3832 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   3833   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
   3834   {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
   3835   {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
   3836   {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
   3837   {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
   3838   {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
   3839   {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
   3840   {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
   3841   {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
   3842   {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1},
   3843   {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1},
   3844   {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
   3845   {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 1, 0, 0},
   3846   {&__pyx_kp_u_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 1, 0, 0},
   3847   {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0},
   3848   {&__pyx_kp_u_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 1, 0, 0},
   3849   {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0, 0},
   3850   {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0},
   3851   {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0},
   3852   {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0},
   3853   {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0},
   3854   {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0},
   3855   {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
   3856   {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0},
   3857   {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0},
   3858   {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0},
   3859   {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0},
   3860   {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0},
   3861   {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0},
   3862   {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0},
   3863   {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0},
   3864   {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
   3865   {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
   3866   {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
   3867   {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
   3868   {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
   3869   {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
   3870   {&__pyx_n_s__Abort, __pyx_k__Abort, sizeof(__pyx_k__Abort), 0, 0, 1, 1},
   3871   {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1},
   3872   {&__pyx_n_s__Channel, __pyx_k__Channel, sizeof(__pyx_k__Channel), 0, 0, 1, 1},
   3873   {&__pyx_n_s__Close, __pyx_k__Close, sizeof(__pyx_k__Close), 0, 0, 1, 1},
   3874   {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
   3875   {&__pyx_n_s__FALSE, __pyx_k__FALSE, sizeof(__pyx_k__FALSE), 0, 0, 1, 1},
   3876   {&__pyx_n_s__FILT_ACTIVE, __pyx_k__FILT_ACTIVE, sizeof(__pyx_k__FILT_ACTIVE), 0, 0, 1, 1},
   3877   {&__pyx_n_s__FILT_AFTERTOUCH, __pyx_k__FILT_AFTERTOUCH, sizeof(__pyx_k__FILT_AFTERTOUCH), 0, 0, 1, 1},
   3878   {&__pyx_n_s__FILT_CLOCK, __pyx_k__FILT_CLOCK, sizeof(__pyx_k__FILT_CLOCK), 0, 0, 1, 1},
   3879   {&__pyx_n_s__FILT_CONTROL, __pyx_k__FILT_CONTROL, sizeof(__pyx_k__FILT_CONTROL), 0, 0, 1, 1},
   3880   {&__pyx_n_s__FILT_F9, __pyx_k__FILT_F9, sizeof(__pyx_k__FILT_F9), 0, 0, 1, 1},
   3881   {&__pyx_n_s__FILT_FD, __pyx_k__FILT_FD, sizeof(__pyx_k__FILT_FD), 0, 0, 1, 1},
   3882   {&__pyx_n_s__FILT_MTC, __pyx_k__FILT_MTC, sizeof(__pyx_k__FILT_MTC), 0, 0, 1, 1},
   3883   {&__pyx_n_s__FILT_NOTE, __pyx_k__FILT_NOTE, sizeof(__pyx_k__FILT_NOTE), 0, 0, 1, 1},
   3884   {&__pyx_n_s__FILT_PITCHBEND, __pyx_k__FILT_PITCHBEND, sizeof(__pyx_k__FILT_PITCHBEND), 0, 0, 1, 1},
   3885   {&__pyx_n_s__FILT_PLAY, __pyx_k__FILT_PLAY, sizeof(__pyx_k__FILT_PLAY), 0, 0, 1, 1},
   3886   {&__pyx_n_s__FILT_PROGRAM, __pyx_k__FILT_PROGRAM, sizeof(__pyx_k__FILT_PROGRAM), 0, 0, 1, 1},
   3887   {&__pyx_n_s__FILT_REALTIME, __pyx_k__FILT_REALTIME, sizeof(__pyx_k__FILT_REALTIME), 0, 0, 1, 1},
   3888   {&__pyx_n_s__FILT_RESET, __pyx_k__FILT_RESET, sizeof(__pyx_k__FILT_RESET), 0, 0, 1, 1},
   3889   {&__pyx_n_s__FILT_SONG_POSITION, __pyx_k__FILT_SONG_POSITION, sizeof(__pyx_k__FILT_SONG_POSITION), 0, 0, 1, 1},
   3890   {&__pyx_n_s__FILT_SONG_SELECT, __pyx_k__FILT_SONG_SELECT, sizeof(__pyx_k__FILT_SONG_SELECT), 0, 0, 1, 1},
   3891   {&__pyx_n_s__FILT_SYSEX, __pyx_k__FILT_SYSEX, sizeof(__pyx_k__FILT_SYSEX), 0, 0, 1, 1},
   3892   {&__pyx_n_s__FILT_TICK, __pyx_k__FILT_TICK, sizeof(__pyx_k__FILT_TICK), 0, 0, 1, 1},
   3893   {&__pyx_n_s__FILT_TUNE, __pyx_k__FILT_TUNE, sizeof(__pyx_k__FILT_TUNE), 0, 0, 1, 1},
   3894   {&__pyx_n_s__FILT_UNDEFINED, __pyx_k__FILT_UNDEFINED, sizeof(__pyx_k__FILT_UNDEFINED), 0, 0, 1, 1},
   3895   {&__pyx_n_s__GetDeviceInfo, __pyx_k__GetDeviceInfo, sizeof(__pyx_k__GetDeviceInfo), 0, 0, 1, 1},
   3896   {&__pyx_n_s__GetErrorText, __pyx_k__GetErrorText, sizeof(__pyx_k__GetErrorText), 0, 0, 1, 1},
   3897   {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
   3898   {&__pyx_n_s__Initialize, __pyx_k__Initialize, sizeof(__pyx_k__Initialize), 0, 0, 1, 1},
   3899   {&__pyx_n_s__Input, __pyx_k__Input, sizeof(__pyx_k__Input), 0, 0, 1, 1},
   3900   {&__pyx_n_s__InputDevice, __pyx_k__InputDevice, sizeof(__pyx_k__InputDevice), 0, 0, 1, 1},
   3901   {&__pyx_n_s__Output, __pyx_k__Output, sizeof(__pyx_k__Output), 0, 0, 1, 1},
   3902   {&__pyx_n_s__OutputDevice, __pyx_k__OutputDevice, sizeof(__pyx_k__OutputDevice), 0, 0, 1, 1},
   3903   {&__pyx_n_s__Poll, __pyx_k__Poll, sizeof(__pyx_k__Poll), 0, 0, 1, 1},
   3904   {&__pyx_n_s__Read, __pyx_k__Read, sizeof(__pyx_k__Read), 0, 0, 1, 1},
   3905   {&__pyx_n_s__SetChannelMask, __pyx_k__SetChannelMask, sizeof(__pyx_k__SetChannelMask), 0, 0, 1, 1},
   3906   {&__pyx_n_s__SetFilter, __pyx_k__SetFilter, sizeof(__pyx_k__SetFilter), 0, 0, 1, 1},
   3907   {&__pyx_n_s__TRUE, __pyx_k__TRUE, sizeof(__pyx_k__TRUE), 0, 0, 1, 1},
   3908   {&__pyx_n_s__Terminate, __pyx_k__Terminate, sizeof(__pyx_k__Terminate), 0, 0, 1, 1},
   3909   {&__pyx_n_s__Time, __pyx_k__Time, sizeof(__pyx_k__Time), 0, 0, 1, 1},
   3910   {&__pyx_n_s__Write, __pyx_k__Write, sizeof(__pyx_k__Write), 0, 0, 1, 1},
   3911   {&__pyx_n_s__WriteShort, __pyx_k__WriteShort, sizeof(__pyx_k__WriteShort), 0, 0, 1, 1},
   3912   {&__pyx_n_s__WriteSysEx, __pyx_k__WriteSysEx, sizeof(__pyx_k__WriteSysEx), 0, 0, 1, 1},
   3913   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   3914   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   3915   {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1},
   3916   {&__pyx_n_s___aborted, __pyx_k___aborted, sizeof(__pyx_k___aborted), 0, 0, 1, 1},
   3917   {&__pyx_n_s___check_open, __pyx_k___check_open, sizeof(__pyx_k___check_open), 0, 0, 1, 1},
   3918   {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
   3919   {&__pyx_n_s__buffersize, __pyx_k__buffersize, sizeof(__pyx_k__buffersize), 0, 0, 1, 1},
   3920   {&__pyx_n_s__data1, __pyx_k__data1, sizeof(__pyx_k__data1), 0, 0, 1, 1},
   3921   {&__pyx_n_s__data2, __pyx_k__data2, sizeof(__pyx_k__data2), 0, 0, 1, 1},
   3922   {&__pyx_n_s__debug, __pyx_k__debug, sizeof(__pyx_k__debug), 0, 0, 1, 1},
   3923   {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
   3924   {&__pyx_n_s__input, __pyx_k__input, sizeof(__pyx_k__input), 0, 0, 1, 1},
   3925   {&__pyx_n_s__interf, __pyx_k__interf, sizeof(__pyx_k__interf), 0, 0, 1, 1},
   3926   {&__pyx_n_s__latency, __pyx_k__latency, sizeof(__pyx_k__latency), 0, 0, 1, 1},
   3927   {&__pyx_n_s__message, __pyx_k__message, sizeof(__pyx_k__message), 0, 0, 1, 1},
   3928   {&__pyx_n_s__midi, __pyx_k__midi, sizeof(__pyx_k__midi), 0, 0, 1, 1},
   3929   {&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1},
   3930   {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
   3931   {&__pyx_n_s__opened, __pyx_k__opened, sizeof(__pyx_k__opened), 0, 0, 1, 1},
   3932   {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1},
   3933   {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
   3934   {&__pyx_n_s__status, __pyx_k__status, sizeof(__pyx_k__status), 0, 0, 1, 1},
   3935   {&__pyx_n_s__timestamp, __pyx_k__timestamp, sizeof(__pyx_k__timestamp), 0, 0, 1, 1},
   3936   {&__pyx_n_s__tostring, __pyx_k__tostring, sizeof(__pyx_k__tostring), 0, 0, 1, 1},
   3937   {&__pyx_n_s__when, __pyx_k__when, sizeof(__pyx_k__when), 0, 0, 1, 1},
   3938   {0, 0, 0, 0, 0, 0, 0}
   3939 };
   3940 static int __Pyx_InitCachedBuiltins(void) {
   3941   __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;}
   3942   __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;}
   3943   __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;}
   3944   return 0;
   3945   __pyx_L1_error:;
   3946   return -1;
   3947 }
   3948 
   3949 static int __Pyx_InitGlobals(void) {
   3950   if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   3951   __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;};
   3952   __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;};
   3953   __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;};
   3954   __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;};
   3955   __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;};
   3956   __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;};
   3957   __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;};
   3958   __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;};
   3959   __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;};
   3960   __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;};
   3961   __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;};
   3962   __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;};
   3963   __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;};
   3964   __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;};
   3965   __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;};
   3966   __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;};
   3967   __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;};
   3968   __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;};
   3969   __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;};
   3970   __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;};
   3971   __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;};
   3972   __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;};
   3973   __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;};
   3974   __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;};
   3975   __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;};
   3976   __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;};
   3977   __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;};
   3978   __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;};
   3979   __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;};
   3980   return 0;
   3981   __pyx_L1_error:;
   3982   return -1;
   3983 }
   3984 
   3985 #if PY_MAJOR_VERSION < 3
   3986 PyMODINIT_FUNC init_pyportmidi(void); /*proto*/
   3987 PyMODINIT_FUNC init_pyportmidi(void)
   3988 #else
   3989 PyMODINIT_FUNC PyInit__pyportmidi(void); /*proto*/
   3990 PyMODINIT_FUNC PyInit__pyportmidi(void)
   3991 #endif
   3992 {
   3993   PyObject *__pyx_t_1 = NULL;
   3994   PyObject *__pyx_t_2 = NULL;
   3995   PyObject *__pyx_t_3 = NULL;
   3996   #if CYTHON_REFNANNY
   3997   void* __pyx_refnanny = NULL;
   3998   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
   3999   if (!__Pyx_RefNanny) {
   4000       PyErr_Clear();
   4001       __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
   4002       if (!__Pyx_RefNanny)
   4003           Py_FatalError("failed to import 'refnanny' module");
   4004   }
   4005   __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__pyportmidi(void)", __LINE__, __FILE__);
   4006   #endif
   4007   __pyx_init_filenames();
   4008   __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;}
   4009   #if PY_MAJOR_VERSION < 3
   4010   __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;}
   4011   #else
   4012   __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;}
   4013   #endif
   4014   /*--- Library function declarations ---*/
   4015   /*--- Threads initialization code ---*/
   4016   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
   4017   #ifdef WITH_THREAD /* Python build with threading support? */
   4018   PyEval_InitThreads();
   4019   #endif
   4020   #endif
   4021   /*--- Module creation code ---*/
   4022   #if PY_MAJOR_VERSION < 3
   4023   __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_pyportmidi"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
   4024   #else
   4025   __pyx_m = PyModule_Create(&__pyx_moduledef);
   4026   #endif
   4027   if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   4028   #if PY_MAJOR_VERSION < 3
   4029   Py_INCREF(__pyx_m);
   4030   #endif
   4031   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
   4032   if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   4033   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   4034   /*--- Initialize various global constants etc. ---*/
   4035   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   4036   if (__pyx_module_is_main__pyportmidi) {
   4037     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;};
   4038   }
   4039   /*--- Builtin init code ---*/
   4040   if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   4041   /*--- Global init code ---*/
   4042   /*--- Function export code ---*/
   4043   /*--- Type init code ---*/
   4044   if (PyType_Ready(&__pyx_type_11_pyportmidi_Output) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   4045   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;}
   4046   __pyx_ptype_11_pyportmidi_Output = &__pyx_type_11_pyportmidi_Output;
   4047   if (PyType_Ready(&__pyx_type_11_pyportmidi_Input) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   4048   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;}
   4049   __pyx_ptype_11_pyportmidi_Input = &__pyx_type_11_pyportmidi_Input;
   4050   /*--- Type import code ---*/
   4051   /*--- Function import code ---*/
   4052   /*--- Execution code ---*/
   4053 
   4054   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":7
   4055  * # harrison@media.mit.edu
   4056  * # written in Pyrex
   4057  * __version__="0.07"             # <<<<<<<<<<<<<<
   4058  * 
   4059  * import array
   4060  */
   4061   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;}
   4062 
   4063   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":9
   4064  * __version__="0.07"
   4065  * 
   4066  * import array             # <<<<<<<<<<<<<<
   4067  * 
   4068  * # CHANGES:
   4069  */
   4070   __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;}
   4071   __Pyx_GOTREF(__pyx_t_1);
   4072   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;}
   4073   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   4074 
   4075   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":108
   4076  *     PtTimestamp Pt_Time()
   4077  * 
   4078  * FILT_ACTIVE=0x1             # <<<<<<<<<<<<<<
   4079  * FILT_SYSEX=0x2
   4080  * FILT_CLOCK=0x4
   4081  */
   4082   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;}
   4083 
   4084   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":109
   4085  * 
   4086  * FILT_ACTIVE=0x1
   4087  * FILT_SYSEX=0x2             # <<<<<<<<<<<<<<
   4088  * FILT_CLOCK=0x4
   4089  * FILT_PLAY=0x8
   4090  */
   4091   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;}
   4092 
   4093   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":110
   4094  * FILT_ACTIVE=0x1
   4095  * FILT_SYSEX=0x2
   4096  * FILT_CLOCK=0x4             # <<<<<<<<<<<<<<
   4097  * FILT_PLAY=0x8
   4098  * FILT_F9=0x10
   4099  */
   4100   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;}
   4101 
   4102   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":111
   4103  * FILT_SYSEX=0x2
   4104  * FILT_CLOCK=0x4
   4105  * FILT_PLAY=0x8             # <<<<<<<<<<<<<<
   4106  * FILT_F9=0x10
   4107  * FILT_TICK=0x10
   4108  */
   4109   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;}
   4110 
   4111   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":112
   4112  * FILT_CLOCK=0x4
   4113  * FILT_PLAY=0x8
   4114  * FILT_F9=0x10             # <<<<<<<<<<<<<<
   4115  * FILT_TICK=0x10
   4116  * FILT_FD=0x20
   4117  */
   4118   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;}
   4119 
   4120   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":113
   4121  * FILT_PLAY=0x8
   4122  * FILT_F9=0x10
   4123  * FILT_TICK=0x10             # <<<<<<<<<<<<<<
   4124  * FILT_FD=0x20
   4125  * FILT_UNDEFINED=0x30
   4126  */
   4127   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;}
   4128 
   4129   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":114
   4130  * FILT_F9=0x10
   4131  * FILT_TICK=0x10
   4132  * FILT_FD=0x20             # <<<<<<<<<<<<<<
   4133  * FILT_UNDEFINED=0x30
   4134  * FILT_RESET=0x40
   4135  */
   4136   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;}
   4137 
   4138   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":115
   4139  * FILT_TICK=0x10
   4140  * FILT_FD=0x20
   4141  * FILT_UNDEFINED=0x30             # <<<<<<<<<<<<<<
   4142  * FILT_RESET=0x40
   4143  * FILT_REALTIME=0x7F
   4144  */
   4145   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;}
   4146 
   4147   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":116
   4148  * FILT_FD=0x20
   4149  * FILT_UNDEFINED=0x30
   4150  * FILT_RESET=0x40             # <<<<<<<<<<<<<<
   4151  * FILT_REALTIME=0x7F
   4152  * FILT_NOTE=0x80
   4153  */
   4154   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;}
   4155 
   4156   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":117
   4157  * FILT_UNDEFINED=0x30
   4158  * FILT_RESET=0x40
   4159  * FILT_REALTIME=0x7F             # <<<<<<<<<<<<<<
   4160  * FILT_NOTE=0x80
   4161  * FILT_CHANNEL_AFTERTOUCH=0x100
   4162  */
   4163   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;}
   4164 
   4165   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":118
   4166  * FILT_RESET=0x40
   4167  * FILT_REALTIME=0x7F
   4168  * FILT_NOTE=0x80             # <<<<<<<<<<<<<<
   4169  * FILT_CHANNEL_AFTERTOUCH=0x100
   4170  * FILT_POLY_AFTERTOUCH=0x200
   4171  */
   4172   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;}
   4173 
   4174   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":119
   4175  * FILT_REALTIME=0x7F
   4176  * FILT_NOTE=0x80
   4177  * FILT_CHANNEL_AFTERTOUCH=0x100             # <<<<<<<<<<<<<<
   4178  * FILT_POLY_AFTERTOUCH=0x200
   4179  * FILT_AFTERTOUCH=0x300
   4180  */
   4181   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;}
   4182 
   4183   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":120
   4184  * FILT_NOTE=0x80
   4185  * FILT_CHANNEL_AFTERTOUCH=0x100
   4186  * FILT_POLY_AFTERTOUCH=0x200             # <<<<<<<<<<<<<<
   4187  * FILT_AFTERTOUCH=0x300
   4188  * FILT_PROGRAM=0x400
   4189  */
   4190   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;}
   4191 
   4192   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":121
   4193  * FILT_CHANNEL_AFTERTOUCH=0x100
   4194  * FILT_POLY_AFTERTOUCH=0x200
   4195  * FILT_AFTERTOUCH=0x300             # <<<<<<<<<<<<<<
   4196  * FILT_PROGRAM=0x400
   4197  * FILT_CONTROL=0x800
   4198  */
   4199   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;}
   4200 
   4201   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":122
   4202  * FILT_POLY_AFTERTOUCH=0x200
   4203  * FILT_AFTERTOUCH=0x300
   4204  * FILT_PROGRAM=0x400             # <<<<<<<<<<<<<<
   4205  * FILT_CONTROL=0x800
   4206  * FILT_PITCHBEND=0x1000
   4207  */
   4208   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;}
   4209 
   4210   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":123
   4211  * FILT_AFTERTOUCH=0x300
   4212  * FILT_PROGRAM=0x400
   4213  * FILT_CONTROL=0x800             # <<<<<<<<<<<<<<
   4214  * FILT_PITCHBEND=0x1000
   4215  * FILT_MTC=0x2000
   4216  */
   4217   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;}
   4218 
   4219   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":124
   4220  * FILT_PROGRAM=0x400
   4221  * FILT_CONTROL=0x800
   4222  * FILT_PITCHBEND=0x1000             # <<<<<<<<<<<<<<
   4223  * FILT_MTC=0x2000
   4224  * FILT_SONG_POSITION=0x4000
   4225  */
   4226   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;}
   4227 
   4228   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":125
   4229  * FILT_CONTROL=0x800
   4230  * FILT_PITCHBEND=0x1000
   4231  * FILT_MTC=0x2000             # <<<<<<<<<<<<<<
   4232  * FILT_SONG_POSITION=0x4000
   4233  * FILT_SONG_SELECT=0x8000
   4234  */
   4235   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;}
   4236 
   4237   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":126
   4238  * FILT_PITCHBEND=0x1000
   4239  * FILT_MTC=0x2000
   4240  * FILT_SONG_POSITION=0x4000             # <<<<<<<<<<<<<<
   4241  * FILT_SONG_SELECT=0x8000
   4242  * FILT_TUNE=0x10000
   4243  */
   4244   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;}
   4245 
   4246   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":127
   4247  * FILT_MTC=0x2000
   4248  * FILT_SONG_POSITION=0x4000
   4249  * FILT_SONG_SELECT=0x8000             # <<<<<<<<<<<<<<
   4250  * FILT_TUNE=0x10000
   4251  * FALSE=0
   4252  */
   4253   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;}
   4254 
   4255   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":128
   4256  * FILT_SONG_POSITION=0x4000
   4257  * FILT_SONG_SELECT=0x8000
   4258  * FILT_TUNE=0x10000             # <<<<<<<<<<<<<<
   4259  * FALSE=0
   4260  * TRUE=1
   4261  */
   4262   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;}
   4263 
   4264   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":129
   4265  * FILT_SONG_SELECT=0x8000
   4266  * FILT_TUNE=0x10000
   4267  * FALSE=0             # <<<<<<<<<<<<<<
   4268  * TRUE=1
   4269  * 
   4270  */
   4271   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;}
   4272 
   4273   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":130
   4274  * FILT_TUNE=0x10000
   4275  * FALSE=0
   4276  * TRUE=1             # <<<<<<<<<<<<<<
   4277  * 
   4278  * def Initialize():
   4279  */
   4280   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;}
   4281 
   4282   /* "/Users/rene/dev/portmedia/portmedia/portmidi/trunk/pm_python/pyportmidi/_pyportmidi.pyx":1
   4283  * # pyPortMidi             # <<<<<<<<<<<<<<
   4284  * # Python bindings for PortMidi
   4285  * # John Harrison
   4286  */
   4287   __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;}
   4288   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   4289   __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;}
   4290   __Pyx_GOTREF(__pyx_t_2);
   4291   __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__");
   4292   __Pyx_GOTREF(__pyx_t_3);
   4293   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4294   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;}
   4295   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4296   __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;}
   4297   __Pyx_GOTREF(__pyx_t_3);
   4298   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4299   __Pyx_GOTREF(__pyx_t_2);
   4300   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4301   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;}
   4302   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4303   __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;}
   4304   __Pyx_GOTREF(__pyx_t_2);
   4305   __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__");
   4306   __Pyx_GOTREF(__pyx_t_3);
   4307   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4308   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;}
   4309   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4310   __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;}
   4311   __Pyx_GOTREF(__pyx_t_3);
   4312   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4313   __Pyx_GOTREF(__pyx_t_2);
   4314   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4315   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;}
   4316   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4317   __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;}
   4318   __Pyx_GOTREF(__pyx_t_2);
   4319   __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__");
   4320   __Pyx_GOTREF(__pyx_t_3);
   4321   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4322   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;}
   4323   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4324   __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;}
   4325   __Pyx_GOTREF(__pyx_t_3);
   4326   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4327   __Pyx_GOTREF(__pyx_t_2);
   4328   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4329   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;}
   4330   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4331   __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;}
   4332   __Pyx_GOTREF(__pyx_t_2);
   4333   __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;}
   4334   __Pyx_GOTREF(__pyx_t_3);
   4335   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4336   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4337   __Pyx_GOTREF(__pyx_t_2);
   4338   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4339   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;}
   4340   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4341   __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;}
   4342   __Pyx_GOTREF(__pyx_t_2);
   4343   __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;}
   4344   __Pyx_GOTREF(__pyx_t_3);
   4345   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4346   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4347   __Pyx_GOTREF(__pyx_t_2);
   4348   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4349   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;}
   4350   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4351   __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;}
   4352   __Pyx_GOTREF(__pyx_t_2);
   4353   __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;}
   4354   __Pyx_GOTREF(__pyx_t_3);
   4355   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4356   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4357   __Pyx_GOTREF(__pyx_t_2);
   4358   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4359   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;}
   4360   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4361   __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;}
   4362   __Pyx_GOTREF(__pyx_t_2);
   4363   __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;}
   4364   __Pyx_GOTREF(__pyx_t_3);
   4365   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4366   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4367   __Pyx_GOTREF(__pyx_t_2);
   4368   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4369   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;}
   4370   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4371   __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;}
   4372   __Pyx_GOTREF(__pyx_t_2);
   4373   __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;}
   4374   __Pyx_GOTREF(__pyx_t_3);
   4375   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4376   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4377   __Pyx_GOTREF(__pyx_t_2);
   4378   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4379   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;}
   4380   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4381   __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;}
   4382   __Pyx_GOTREF(__pyx_t_2);
   4383   __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;}
   4384   __Pyx_GOTREF(__pyx_t_3);
   4385   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4386   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4387   __Pyx_GOTREF(__pyx_t_2);
   4388   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4389   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;}
   4390   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4391   __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;}
   4392   __Pyx_GOTREF(__pyx_t_2);
   4393   __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;}
   4394   __Pyx_GOTREF(__pyx_t_3);
   4395   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4396   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4397   __Pyx_GOTREF(__pyx_t_2);
   4398   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4399   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;}
   4400   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4401   __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;}
   4402   __Pyx_GOTREF(__pyx_t_2);
   4403   __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;}
   4404   __Pyx_GOTREF(__pyx_t_3);
   4405   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4406   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4407   __Pyx_GOTREF(__pyx_t_2);
   4408   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4409   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;}
   4410   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4411   __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;}
   4412   __Pyx_GOTREF(__pyx_t_2);
   4413   __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;}
   4414   __Pyx_GOTREF(__pyx_t_3);
   4415   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4416   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4417   __Pyx_GOTREF(__pyx_t_2);
   4418   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4419   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;}
   4420   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4421   __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;}
   4422   __Pyx_GOTREF(__pyx_t_2);
   4423   __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;}
   4424   __Pyx_GOTREF(__pyx_t_3);
   4425   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4426   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4427   __Pyx_GOTREF(__pyx_t_2);
   4428   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4429   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;}
   4430   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4431   __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;}
   4432   __Pyx_GOTREF(__pyx_t_2);
   4433   __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;}
   4434   __Pyx_GOTREF(__pyx_t_3);
   4435   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4436   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4437   __Pyx_GOTREF(__pyx_t_2);
   4438   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4439   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;}
   4440   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4441   __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;}
   4442   __Pyx_GOTREF(__pyx_t_2);
   4443   __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;}
   4444   __Pyx_GOTREF(__pyx_t_3);
   4445   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4446   __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
   4447   __Pyx_GOTREF(__pyx_t_2);
   4448   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   4449   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;}
   4450   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   4451   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;}
   4452   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   4453   goto __pyx_L0;
   4454   __pyx_L1_error:;
   4455   __Pyx_XDECREF(__pyx_t_1);
   4456   __Pyx_XDECREF(__pyx_t_2);
   4457   __Pyx_XDECREF(__pyx_t_3);
   4458   if (__pyx_m) {
   4459     __Pyx_AddTraceback("init _pyportmidi");
   4460     Py_DECREF(__pyx_m); __pyx_m = 0;
   4461   } else if (!PyErr_Occurred()) {
   4462     PyErr_SetString(PyExc_ImportError, "init _pyportmidi");
   4463   }
   4464   __pyx_L0:;
   4465   __Pyx_RefNannyFinishContext();
   4466   #if PY_MAJOR_VERSION < 3
   4467   return;
   4468   #else
   4469   return __pyx_m;
   4470   #endif
   4471 }
   4472 
   4473 static const char *__pyx_filenames[] = {
   4474   "_pyportmidi.pyx",
   4475 };
   4476 
   4477 /* Runtime support code */
   4478 
   4479 static void __pyx_init_filenames(void) {
   4480   __pyx_f = __pyx_filenames;
   4481 }
   4482 
   4483 static void __Pyx_RaiseDoubleKeywordsError(
   4484     const char* func_name,
   4485     PyObject* kw_name)
   4486 {
   4487     PyErr_Format(PyExc_TypeError,
   4488         #if PY_MAJOR_VERSION >= 3
   4489         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
   4490         #else
   4491         "%s() got multiple values for keyword argument '%s'", func_name,
   4492         PyString_AS_STRING(kw_name));
   4493         #endif
   4494 }
   4495 
   4496 static void __Pyx_RaiseArgtupleInvalid(
   4497     const char* func_name,
   4498     int exact,
   4499     Py_ssize_t num_min,
   4500     Py_ssize_t num_max,
   4501     Py_ssize_t num_found)
   4502 {
   4503     Py_ssize_t num_expected;
   4504     const char *number, *more_or_less;
   4505 
   4506     if (num_found < num_min) {
   4507         num_expected = num_min;
   4508         more_or_less = "at least";
   4509     } else {
   4510         num_expected = num_max;
   4511         more_or_less = "at most";
   4512     }
   4513     if (exact) {
   4514         more_or_less = "exactly";
   4515     }
   4516     number = (num_expected == 1) ? "" : "s";
   4517     PyErr_Format(PyExc_TypeError,
   4518         #if PY_VERSION_HEX < 0x02050000
   4519             "%s() takes %s %d positional argument%s (%d given)",
   4520         #else
   4521             "%s() takes %s %zd positional argument%s (%zd given)",
   4522         #endif
   4523         func_name, more_or_less, num_expected, number, num_found);
   4524 }
   4525 
   4526 static int __Pyx_ParseOptionalKeywords(
   4527     PyObject *kwds,
   4528     PyObject **argnames[],
   4529     PyObject *kwds2,
   4530     PyObject *values[],
   4531     Py_ssize_t num_pos_args,
   4532     const char* function_name)
   4533 {
   4534     PyObject *key = 0, *value = 0;
   4535     Py_ssize_t pos = 0;
   4536     PyObject*** name;
   4537     PyObject*** first_kw_arg = argnames + num_pos_args;
   4538 
   4539     while (PyDict_Next(kwds, &pos, &key, &value)) {
   4540         name = first_kw_arg;
   4541         while (*name && (**name != key)) name++;
   4542         if (*name) {
   4543             values[name-argnames] = value;
   4544         } else {
   4545             #if PY_MAJOR_VERSION < 3
   4546             if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
   4547             #else
   4548             if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
   4549             #endif
   4550                 goto invalid_keyword_type;
   4551             } else {
   4552                 for (name = first_kw_arg; *name; name++) {
   4553                     #if PY_MAJOR_VERSION >= 3
   4554                     if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
   4555                         PyUnicode_Compare(**name, key) == 0) break;
   4556                     #else
   4557                     if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
   4558                         _PyString_Eq(**name, key)) break;
   4559                     #endif
   4560                 }
   4561                 if (*name) {
   4562                     values[name-argnames] = value;
   4563                 } else {
   4564                     /* unexpected keyword found */
   4565                     for (name=argnames; name != first_kw_arg; name++) {
   4566                         if (**name == key) goto arg_passed_twice;
   4567                         #if PY_MAJOR_VERSION >= 3
   4568                         if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
   4569                             PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
   4570                         #else
   4571                         if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
   4572                             _PyString_Eq(**name, key)) goto arg_passed_twice;
   4573                         #endif
   4574                     }
   4575                     if (kwds2) {
   4576                         if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
   4577                     } else {
   4578                         goto invalid_keyword;
   4579                     }
   4580                 }
   4581             }
   4582         }
   4583     }
   4584     return 0;
   4585 arg_passed_twice:
   4586     __Pyx_RaiseDoubleKeywordsError(function_name, **name);
   4587     goto bad;
   4588 invalid_keyword_type:
   4589     PyErr_Format(PyExc_TypeError,
   4590         "%s() keywords must be strings", function_name);
   4591     goto bad;
   4592 invalid_keyword:
   4593     PyErr_Format(PyExc_TypeError,
   4594     #if PY_MAJOR_VERSION < 3
   4595         "%s() got an unexpected keyword argument '%s'",
   4596         function_name, PyString_AsString(key));
   4597     #else
   4598         "%s() got an unexpected keyword argument '%U'",
   4599         function_name, key);
   4600     #endif
   4601 bad:
   4602     return -1;
   4603 }
   4604 
   4605 
   4606 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
   4607     PyObject *__import__ = 0;
   4608     PyObject *empty_list = 0;
   4609     PyObject *module = 0;
   4610     PyObject *global_dict = 0;
   4611     PyObject *empty_dict = 0;
   4612     PyObject *list;
   4613     __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
   4614     if (!__import__)
   4615         goto bad;
   4616     if (from_list)
   4617         list = from_list;
   4618     else {
   4619         empty_list = PyList_New(0);
   4620         if (!empty_list)
   4621             goto bad;
   4622         list = empty_list;
   4623     }
   4624     global_dict = PyModule_GetDict(__pyx_m);
   4625     if (!global_dict)
   4626         goto bad;
   4627     empty_dict = PyDict_New();
   4628     if (!empty_dict)
   4629         goto bad;
   4630     module = PyObject_CallFunctionObjArgs(__import__,
   4631         name, global_dict, empty_dict, list, NULL);
   4632 bad:
   4633     Py_XDECREF(empty_list);
   4634     Py_XDECREF(__import__);
   4635     Py_XDECREF(empty_dict);
   4636     return module;
   4637 }
   4638 
   4639 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmDeviceID(PmDeviceID val) {
   4640     const PmDeviceID neg_one = (PmDeviceID)-1, const_zero = 0;
   4641     const int is_unsigned = neg_one > const_zero;
   4642     if (sizeof(PmDeviceID) <  sizeof(long)) {
   4643         return PyInt_FromLong((long)val);
   4644     } else if (sizeof(PmDeviceID) == sizeof(long)) {
   4645         if (is_unsigned)
   4646             return PyLong_FromUnsignedLong((unsigned long)val);
   4647         else
   4648             return PyInt_FromLong((long)val);
   4649     } else { /* (sizeof(PmDeviceID) > sizeof(long)) */
   4650         if (is_unsigned)
   4651             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
   4652         else
   4653             return PyLong_FromLongLong((PY_LONG_LONG)val);
   4654     }
   4655 }
   4656 
   4657 static CYTHON_INLINE PmDeviceID __Pyx_PyInt_from_py_PmDeviceID(PyObject* x) {
   4658     const PmDeviceID neg_one = (PmDeviceID)-1, const_zero = 0;
   4659     const int is_unsigned = neg_one > const_zero;
   4660     if (sizeof(PmDeviceID) == sizeof(char)) {
   4661         if (is_unsigned)
   4662             return (PmDeviceID)__Pyx_PyInt_AsUnsignedChar(x);
   4663         else
   4664             return (PmDeviceID)__Pyx_PyInt_AsSignedChar(x);
   4665     } else if (sizeof(PmDeviceID) == sizeof(short)) {
   4666         if (is_unsigned)
   4667             return (PmDeviceID)__Pyx_PyInt_AsUnsignedShort(x);
   4668         else
   4669             return (PmDeviceID)__Pyx_PyInt_AsSignedShort(x);
   4670     } else if (sizeof(PmDeviceID) == sizeof(int)) {
   4671         if (is_unsigned)
   4672             return (PmDeviceID)__Pyx_PyInt_AsUnsignedInt(x);
   4673         else
   4674             return (PmDeviceID)__Pyx_PyInt_AsSignedInt(x);
   4675     } else if (sizeof(PmDeviceID) == sizeof(long)) {
   4676         if (is_unsigned)
   4677             return (PmDeviceID)__Pyx_PyInt_AsUnsignedLong(x);
   4678         else
   4679             return (PmDeviceID)__Pyx_PyInt_AsSignedLong(x);
   4680     } else if (sizeof(PmDeviceID) == sizeof(PY_LONG_LONG)) {
   4681         if (is_unsigned)
   4682             return (PmDeviceID)__Pyx_PyInt_AsUnsignedLongLong(x);
   4683         else
   4684             return (PmDeviceID)__Pyx_PyInt_AsSignedLongLong(x);
   4685 #if 0
   4686     } else if (sizeof(PmDeviceID) > sizeof(short) &&
   4687                sizeof(PmDeviceID) < sizeof(int)) { /*  __int32 ILP64 ? */
   4688         if (is_unsigned)
   4689             return (PmDeviceID)__Pyx_PyInt_AsUnsignedInt(x);
   4690         else
   4691             return (PmDeviceID)__Pyx_PyInt_AsSignedInt(x);
   4692 #endif
   4693     }
   4694     PyErr_SetString(PyExc_TypeError, "PmDeviceID");
   4695     return (PmDeviceID)-1;
   4696 }
   4697 
   4698 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PtTimestamp(PtTimestamp val) {
   4699     const PtTimestamp neg_one = (PtTimestamp)-1, const_zero = 0;
   4700     const int is_unsigned = neg_one > const_zero;
   4701     if (sizeof(PtTimestamp) <  sizeof(long)) {
   4702         return PyInt_FromLong((long)val);
   4703     } else if (sizeof(PtTimestamp) == sizeof(long)) {
   4704         if (is_unsigned)
   4705             return PyLong_FromUnsignedLong((unsigned long)val);
   4706         else
   4707             return PyInt_FromLong((long)val);
   4708     } else { /* (sizeof(PtTimestamp) > sizeof(long)) */
   4709         if (is_unsigned)
   4710             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
   4711         else
   4712             return PyLong_FromLongLong((PY_LONG_LONG)val);
   4713     }
   4714 }
   4715 
   4716 #if PY_MAJOR_VERSION < 3
   4717 static PyObject *__Pyx_GetStdout(void) {
   4718     PyObject *f = PySys_GetObject((char *)"stdout");
   4719     if (!f) {
   4720         PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
   4721     }
   4722     return f;
   4723 }
   4724 
   4725 static int __Pyx_Print(PyObject *arg_tuple, int newline) {
   4726     PyObject *f;
   4727     PyObject* v;
   4728     int i;
   4729 
   4730     if (!(f = __Pyx_GetStdout()))
   4731         return -1;
   4732     for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
   4733         if (PyFile_SoftSpace(f, 1)) {
   4734             if (PyFile_WriteString(" ", f) < 0)
   4735                 return -1;
   4736         }
   4737         v = PyTuple_GET_ITEM(arg_tuple, i);
   4738         if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
   4739             return -1;
   4740         if (PyString_Check(v)) {
   4741             char *s = PyString_AsString(v);
   4742             Py_ssize_t len = PyString_Size(v);
   4743             if (len > 0 &&
   4744                 isspace(Py_CHARMASK(s[len-1])) &&
   4745                 s[len-1] != ' ')
   4746                     PyFile_SoftSpace(f, 0);
   4747         }
   4748     }
   4749     if (newline) {
   4750         if (PyFile_WriteString("\n", f) < 0)
   4751             return -1;
   4752         PyFile_SoftSpace(f, 0);
   4753     }
   4754     return 0;
   4755 }
   4756 
   4757 #else /* Python 3 has a print function */
   4758 
   4759 static int __Pyx_Print(PyObject *arg_tuple, int newline) {
   4760     PyObject* kwargs = 0;
   4761     PyObject* result = 0;
   4762     PyObject* end_string;
   4763     if (!__pyx_print) {
   4764         __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
   4765         if (!__pyx_print)
   4766             return -1;
   4767     }
   4768     if (!newline) {
   4769         if (!__pyx_print_kwargs) {
   4770             __pyx_print_kwargs = PyDict_New();
   4771             if (!__pyx_print_kwargs)
   4772                 return -1;
   4773             end_string = PyUnicode_FromStringAndSize(" ", 1);
   4774             if (!end_string)
   4775                 return -1;
   4776             if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
   4777                 Py_DECREF(end_string);
   4778                 return -1;
   4779             }
   4780             Py_DECREF(end_string);
   4781         }
   4782         kwargs = __pyx_print_kwargs;
   4783     }
   4784     result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
   4785     if (!result)
   4786         return -1;
   4787     Py_DECREF(result);
   4788     return 0;
   4789 }
   4790 
   4791 #endif
   4792 
   4793 #if PY_MAJOR_VERSION < 3
   4794 
   4795 static int __Pyx_PrintOne(PyObject *o) {
   4796     PyObject *f;
   4797     if (!(f = __Pyx_GetStdout()))
   4798         return -1;
   4799     if (PyFile_SoftSpace(f, 0)) {
   4800         if (PyFile_WriteString(" ", f) < 0)
   4801             return -1;
   4802     }
   4803     if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
   4804         return -1;
   4805     if (PyFile_WriteString("\n", f) < 0)
   4806         return -1;
   4807     return 0;
   4808     /* the line below is just to avoid compiler
   4809      * compiler warnings about unused functions */
   4810     return __Pyx_Print(NULL, 0);
   4811 }
   4812 
   4813 #else /* Python 3 has a print function */
   4814 
   4815 static int __Pyx_PrintOne(PyObject *o) {
   4816     int res;
   4817     PyObject* arg_tuple = PyTuple_New(1);
   4818     if (unlikely(!arg_tuple))
   4819         return -1;
   4820     Py_INCREF(o);
   4821     PyTuple_SET_ITEM(arg_tuple, 0, o);
   4822     res = __Pyx_Print(arg_tuple, 1);
   4823     Py_DECREF(arg_tuple);
   4824     return res;
   4825 }
   4826 
   4827 #endif
   4828 
   4829 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
   4830     PyObject *result;
   4831     result = PyObject_GetAttr(dict, name);
   4832     if (!result)
   4833         PyErr_SetObject(PyExc_NameError, name);
   4834     return result;
   4835 }
   4836 
   4837 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
   4838     PyObject *tmp_type, *tmp_value, *tmp_tb;
   4839     PyThreadState *tstate = PyThreadState_GET();
   4840 
   4841     tmp_type = tstate->curexc_type;
   4842     tmp_value = tstate->curexc_value;
   4843     tmp_tb = tstate->curexc_traceback;
   4844     tstate->curexc_type = type;
   4845     tstate->curexc_value = value;
   4846     tstate->curexc_traceback = tb;
   4847     Py_XDECREF(tmp_type);
   4848     Py_XDECREF(tmp_value);
   4849     Py_XDECREF(tmp_tb);
   4850 }
   4851 
   4852 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
   4853     PyThreadState *tstate = PyThreadState_GET();
   4854     *type = tstate->curexc_type;
   4855     *value = tstate->curexc_value;
   4856     *tb = tstate->curexc_traceback;
   4857 
   4858     tstate->curexc_type = 0;
   4859     tstate->curexc_value = 0;
   4860     tstate->curexc_traceback = 0;
   4861 }
   4862 
   4863 
   4864 #if PY_MAJOR_VERSION < 3
   4865 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
   4866     Py_XINCREF(type);
   4867     Py_XINCREF(value);
   4868     Py_XINCREF(tb);
   4869     /* First, check the traceback argument, replacing None with NULL. */
   4870     if (tb == Py_None) {
   4871         Py_DECREF(tb);
   4872         tb = 0;
   4873     }
   4874     else if (tb != NULL && !PyTraceBack_Check(tb)) {
   4875         PyErr_SetString(PyExc_TypeError,
   4876             "raise: arg 3 must be a traceback or None");
   4877         goto raise_error;
   4878     }
   4879     /* Next, replace a missing value with None */
   4880     if (value == NULL) {
   4881         value = Py_None;
   4882         Py_INCREF(value);
   4883     }
   4884     #if PY_VERSION_HEX < 0x02050000
   4885     if (!PyClass_Check(type))
   4886     #else
   4887     if (!PyType_Check(type))
   4888     #endif
   4889     {
   4890         /* Raising an instance.  The value should be a dummy. */
   4891         if (value != Py_None) {
   4892             PyErr_SetString(PyExc_TypeError,
   4893                 "instance exception may not have a separate value");
   4894             goto raise_error;
   4895         }
   4896         /* Normalize to raise <class>, <instance> */
   4897         Py_DECREF(value);
   4898         value = type;
   4899         #if PY_VERSION_HEX < 0x02050000
   4900             if (PyInstance_Check(type)) {
   4901                 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
   4902                 Py_INCREF(type);
   4903             }
   4904             else {
   4905                 type = 0;
   4906                 PyErr_SetString(PyExc_TypeError,
   4907                     "raise: exception must be an old-style class or instance");
   4908                 goto raise_error;
   4909             }
   4910         #else
   4911             type = (PyObject*) Py_TYPE(type);
   4912             Py_INCREF(type);
   4913             if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
   4914                 PyErr_SetString(PyExc_TypeError,
   4915                     "raise: exception class must be a subclass of BaseException");
   4916                 goto raise_error;
   4917             }
   4918         #endif
   4919     }
   4920 
   4921     __Pyx_ErrRestore(type, value, tb);
   4922     return;
   4923 raise_error:
   4924     Py_XDECREF(value);
   4925     Py_XDECREF(type);
   4926     Py_XDECREF(tb);
   4927     return;
   4928 }
   4929 
   4930 #else /* Python 3+ */
   4931 
   4932 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
   4933     if (tb == Py_None) {
   4934         tb = 0;
   4935     } else if (tb && !PyTraceBack_Check(tb)) {
   4936         PyErr_SetString(PyExc_TypeError,
   4937             "raise: arg 3 must be a traceback or None");
   4938         goto bad;
   4939     }
   4940     if (value == Py_None)
   4941         value = 0;
   4942 
   4943     if (PyExceptionInstance_Check(type)) {
   4944         if (value) {
   4945             PyErr_SetString(PyExc_TypeError,
   4946                 "instance exception may not have a separate value");
   4947             goto bad;
   4948         }
   4949         value = type;
   4950         type = (PyObject*) Py_TYPE(value);
   4951     } else if (!PyExceptionClass_Check(type)) {
   4952         PyErr_SetString(PyExc_TypeError,
   4953             "raise: exception class must be a subclass of BaseException");
   4954         goto bad;
   4955     }
   4956 
   4957     PyErr_SetObject(type, value);
   4958 
   4959     if (tb) {
   4960         PyThreadState *tstate = PyThreadState_GET();
   4961         PyObject* tmp_tb = tstate->curexc_traceback;
   4962         if (tb != tmp_tb) {
   4963             Py_INCREF(tb);
   4964             tstate->curexc_traceback = tb;
   4965             Py_XDECREF(tmp_tb);
   4966         }
   4967     }
   4968 
   4969 bad:
   4970     return;
   4971 }
   4972 #endif
   4973 
   4974 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmMessage(PmMessage val) {
   4975     const PmMessage neg_one = (PmMessage)-1, const_zero = 0;
   4976     const int is_unsigned = neg_one > const_zero;
   4977     if (sizeof(PmMessage) <  sizeof(long)) {
   4978         return PyInt_FromLong((long)val);
   4979     } else if (sizeof(PmMessage) == sizeof(long)) {
   4980         if (is_unsigned)
   4981             return PyLong_FromUnsignedLong((unsigned long)val);
   4982         else
   4983             return PyInt_FromLong((long)val);
   4984     } else { /* (sizeof(PmMessage) > sizeof(long)) */
   4985         if (is_unsigned)
   4986             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
   4987         else
   4988             return PyLong_FromLongLong((PY_LONG_LONG)val);
   4989     }
   4990 }
   4991 
   4992 static CYTHON_INLINE PmMessage __Pyx_PyInt_from_py_PmMessage(PyObject* x) {
   4993     const PmMessage neg_one = (PmMessage)-1, const_zero = 0;
   4994     const int is_unsigned = neg_one > const_zero;
   4995     if (sizeof(PmMessage) == sizeof(char)) {
   4996         if (is_unsigned)
   4997             return (PmMessage)__Pyx_PyInt_AsUnsignedChar(x);
   4998         else
   4999             return (PmMessage)__Pyx_PyInt_AsSignedChar(x);
   5000     } else if (sizeof(PmMessage) == sizeof(short)) {
   5001         if (is_unsigned)
   5002             return (PmMessage)__Pyx_PyInt_AsUnsignedShort(x);
   5003         else
   5004             return (PmMessage)__Pyx_PyInt_AsSignedShort(x);
   5005     } else if (sizeof(PmMessage) == sizeof(int)) {
   5006         if (is_unsigned)
   5007             return (PmMessage)__Pyx_PyInt_AsUnsignedInt(x);
   5008         else
   5009             return (PmMessage)__Pyx_PyInt_AsSignedInt(x);
   5010     } else if (sizeof(PmMessage) == sizeof(long)) {
   5011         if (is_unsigned)
   5012             return (PmMessage)__Pyx_PyInt_AsUnsignedLong(x);
   5013         else
   5014             return (PmMessage)__Pyx_PyInt_AsSignedLong(x);
   5015     } else if (sizeof(PmMessage) == sizeof(PY_LONG_LONG)) {
   5016         if (is_unsigned)
   5017             return (PmMessage)__Pyx_PyInt_AsUnsignedLongLong(x);
   5018         else
   5019             return (PmMessage)__Pyx_PyInt_AsSignedLongLong(x);
   5020 #if 0
   5021     } else if (sizeof(PmMessage) > sizeof(short) &&
   5022                sizeof(PmMessage) < sizeof(int)) { /*  __int32 ILP64 ? */
   5023         if (is_unsigned)
   5024             return (PmMessage)__Pyx_PyInt_AsUnsignedInt(x);
   5025         else
   5026             return (PmMessage)__Pyx_PyInt_AsSignedInt(x);
   5027 #endif
   5028     }
   5029     PyErr_SetString(PyExc_TypeError, "PmMessage");
   5030     return (PmMessage)-1;
   5031 }
   5032 
   5033 static CYTHON_INLINE PmTimestamp __Pyx_PyInt_from_py_PmTimestamp(PyObject* x) {
   5034     const PmTimestamp neg_one = (PmTimestamp)-1, const_zero = 0;
   5035     const int is_unsigned = neg_one > const_zero;
   5036     if (sizeof(PmTimestamp) == sizeof(char)) {
   5037         if (is_unsigned)
   5038             return (PmTimestamp)__Pyx_PyInt_AsUnsignedChar(x);
   5039         else
   5040             return (PmTimestamp)__Pyx_PyInt_AsSignedChar(x);
   5041     } else if (sizeof(PmTimestamp) == sizeof(short)) {
   5042         if (is_unsigned)
   5043             return (PmTimestamp)__Pyx_PyInt_AsUnsignedShort(x);
   5044         else
   5045             return (PmTimestamp)__Pyx_PyInt_AsSignedShort(x);
   5046     } else if (sizeof(PmTimestamp) == sizeof(int)) {
   5047         if (is_unsigned)
   5048             return (PmTimestamp)__Pyx_PyInt_AsUnsignedInt(x);
   5049         else
   5050             return (PmTimestamp)__Pyx_PyInt_AsSignedInt(x);
   5051     } else if (sizeof(PmTimestamp) == sizeof(long)) {
   5052         if (is_unsigned)
   5053             return (PmTimestamp)__Pyx_PyInt_AsUnsignedLong(x);
   5054         else
   5055             return (PmTimestamp)__Pyx_PyInt_AsSignedLong(x);
   5056     } else if (sizeof(PmTimestamp) == sizeof(PY_LONG_LONG)) {
   5057         if (is_unsigned)
   5058             return (PmTimestamp)__Pyx_PyInt_AsUnsignedLongLong(x);
   5059         else
   5060             return (PmTimestamp)__Pyx_PyInt_AsSignedLongLong(x);
   5061 #if 0
   5062     } else if (sizeof(PmTimestamp) > sizeof(short) &&
   5063                sizeof(PmTimestamp) < sizeof(int)) { /*  __int32 ILP64 ? */
   5064         if (is_unsigned)
   5065             return (PmTimestamp)__Pyx_PyInt_AsUnsignedInt(x);
   5066         else
   5067             return (PmTimestamp)__Pyx_PyInt_AsSignedInt(x);
   5068 #endif
   5069     }
   5070     PyErr_SetString(PyExc_TypeError, "PmTimestamp");
   5071     return (PmTimestamp)-1;
   5072 }
   5073 
   5074 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_PmTimestamp(PmTimestamp val) {
   5075     const PmTimestamp neg_one = (PmTimestamp)-1, const_zero = 0;
   5076     const int is_unsigned = neg_one > const_zero;
   5077     if (sizeof(PmTimestamp) <  sizeof(long)) {
   5078         return PyInt_FromLong((long)val);
   5079     } else if (sizeof(PmTimestamp) == sizeof(long)) {
   5080         if (is_unsigned)
   5081             return PyLong_FromUnsignedLong((unsigned long)val);
   5082         else
   5083             return PyInt_FromLong((long)val);
   5084     } else { /* (sizeof(PmTimestamp) > sizeof(long)) */
   5085         if (is_unsigned)
   5086             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
   5087         else
   5088             return PyLong_FromLongLong((PY_LONG_LONG)val);
   5089     }
   5090 }
   5091 
   5092 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
   5093     const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
   5094     const int is_unsigned = neg_one > const_zero;
   5095     if (sizeof(unsigned char) < sizeof(long)) {
   5096         long val = __Pyx_PyInt_AsLong(x);
   5097         if (unlikely(val != (long)(unsigned char)val)) {
   5098             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5099                 PyErr_SetString(PyExc_OverflowError,
   5100                     (is_unsigned && unlikely(val < 0)) ?
   5101                     "can't convert negative value to unsigned char" :
   5102                     "value too large to convert to unsigned char");
   5103             }
   5104             return (unsigned char)-1;
   5105         }
   5106         return (unsigned char)val;
   5107     }
   5108     return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
   5109 }
   5110 
   5111 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
   5112     const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
   5113     const int is_unsigned = neg_one > const_zero;
   5114     if (sizeof(unsigned short) < sizeof(long)) {
   5115         long val = __Pyx_PyInt_AsLong(x);
   5116         if (unlikely(val != (long)(unsigned short)val)) {
   5117             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5118                 PyErr_SetString(PyExc_OverflowError,
   5119                     (is_unsigned && unlikely(val < 0)) ?
   5120                     "can't convert negative value to unsigned short" :
   5121                     "value too large to convert to unsigned short");
   5122             }
   5123             return (unsigned short)-1;
   5124         }
   5125         return (unsigned short)val;
   5126     }
   5127     return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
   5128 }
   5129 
   5130 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
   5131     const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
   5132     const int is_unsigned = neg_one > const_zero;
   5133     if (sizeof(unsigned int) < sizeof(long)) {
   5134         long val = __Pyx_PyInt_AsLong(x);
   5135         if (unlikely(val != (long)(unsigned int)val)) {
   5136             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5137                 PyErr_SetString(PyExc_OverflowError,
   5138                     (is_unsigned && unlikely(val < 0)) ?
   5139                     "can't convert negative value to unsigned int" :
   5140                     "value too large to convert to unsigned int");
   5141             }
   5142             return (unsigned int)-1;
   5143         }
   5144         return (unsigned int)val;
   5145     }
   5146     return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
   5147 }
   5148 
   5149 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
   5150     const char neg_one = (char)-1, const_zero = 0;
   5151     const int is_unsigned = neg_one > const_zero;
   5152     if (sizeof(char) < sizeof(long)) {
   5153         long val = __Pyx_PyInt_AsLong(x);
   5154         if (unlikely(val != (long)(char)val)) {
   5155             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5156                 PyErr_SetString(PyExc_OverflowError,
   5157                     (is_unsigned && unlikely(val < 0)) ?
   5158                     "can't convert negative value to char" :
   5159                     "value too large to convert to char");
   5160             }
   5161             return (char)-1;
   5162         }
   5163         return (char)val;
   5164     }
   5165     return (char)__Pyx_PyInt_AsLong(x);
   5166 }
   5167 
   5168 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
   5169     const short neg_one = (short)-1, const_zero = 0;
   5170     const int is_unsigned = neg_one > const_zero;
   5171     if (sizeof(short) < sizeof(long)) {
   5172         long val = __Pyx_PyInt_AsLong(x);
   5173         if (unlikely(val != (long)(short)val)) {
   5174             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5175                 PyErr_SetString(PyExc_OverflowError,
   5176                     (is_unsigned && unlikely(val < 0)) ?
   5177                     "can't convert negative value to short" :
   5178                     "value too large to convert to short");
   5179             }
   5180             return (short)-1;
   5181         }
   5182         return (short)val;
   5183     }
   5184     return (short)__Pyx_PyInt_AsLong(x);
   5185 }
   5186 
   5187 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
   5188     const int neg_one = (int)-1, const_zero = 0;
   5189     const int is_unsigned = neg_one > const_zero;
   5190     if (sizeof(int) < sizeof(long)) {
   5191         long val = __Pyx_PyInt_AsLong(x);
   5192         if (unlikely(val != (long)(int)val)) {
   5193             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5194                 PyErr_SetString(PyExc_OverflowError,
   5195                     (is_unsigned && unlikely(val < 0)) ?
   5196                     "can't convert negative value to int" :
   5197                     "value too large to convert to int");
   5198             }
   5199             return (int)-1;
   5200         }
   5201         return (int)val;
   5202     }
   5203     return (int)__Pyx_PyInt_AsLong(x);
   5204 }
   5205 
   5206 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
   5207     const signed char neg_one = (signed char)-1, const_zero = 0;
   5208     const int is_unsigned = neg_one > const_zero;
   5209     if (sizeof(signed char) < sizeof(long)) {
   5210         long val = __Pyx_PyInt_AsLong(x);
   5211         if (unlikely(val != (long)(signed char)val)) {
   5212             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5213                 PyErr_SetString(PyExc_OverflowError,
   5214                     (is_unsigned && unlikely(val < 0)) ?
   5215                     "can't convert negative value to signed char" :
   5216                     "value too large to convert to signed char");
   5217             }
   5218             return (signed char)-1;
   5219         }
   5220         return (signed char)val;
   5221     }
   5222     return (signed char)__Pyx_PyInt_AsSignedLong(x);
   5223 }
   5224 
   5225 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
   5226     const signed short neg_one = (signed short)-1, const_zero = 0;
   5227     const int is_unsigned = neg_one > const_zero;
   5228     if (sizeof(signed short) < sizeof(long)) {
   5229         long val = __Pyx_PyInt_AsLong(x);
   5230         if (unlikely(val != (long)(signed short)val)) {
   5231             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5232                 PyErr_SetString(PyExc_OverflowError,
   5233                     (is_unsigned && unlikely(val < 0)) ?
   5234                     "can't convert negative value to signed short" :
   5235                     "value too large to convert to signed short");
   5236             }
   5237             return (signed short)-1;
   5238         }
   5239         return (signed short)val;
   5240     }
   5241     return (signed short)__Pyx_PyInt_AsSignedLong(x);
   5242 }
   5243 
   5244 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
   5245     const signed int neg_one = (signed int)-1, const_zero = 0;
   5246     const int is_unsigned = neg_one > const_zero;
   5247     if (sizeof(signed int) < sizeof(long)) {
   5248         long val = __Pyx_PyInt_AsLong(x);
   5249         if (unlikely(val != (long)(signed int)val)) {
   5250             if (!unlikely(val == -1 && PyErr_Occurred())) {
   5251                 PyErr_SetString(PyExc_OverflowError,
   5252                     (is_unsigned && unlikely(val < 0)) ?
   5253                     "can't convert negative value to signed int" :
   5254                     "value too large to convert to signed int");
   5255             }
   5256             return (signed int)-1;
   5257         }
   5258         return (signed int)val;
   5259     }
   5260     return (signed int)__Pyx_PyInt_AsSignedLong(x);
   5261 }
   5262 
   5263 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
   5264     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
   5265     const int is_unsigned = neg_one > const_zero;
   5266 #if PY_VERSION_HEX < 0x03000000
   5267     if (likely(PyInt_Check(x))) {
   5268         long val = PyInt_AS_LONG(x);
   5269         if (is_unsigned && unlikely(val < 0)) {
   5270             PyErr_SetString(PyExc_OverflowError,
   5271                             "can't convert negative value to unsigned long");
   5272             return (unsigned long)-1;
   5273         }
   5274         return (unsigned long)val;
   5275     } else
   5276 #endif
   5277     if (likely(PyLong_Check(x))) {
   5278         if (is_unsigned) {
   5279             if (unlikely(Py_SIZE(x) < 0)) {
   5280                 PyErr_SetString(PyExc_OverflowError,
   5281                                 "can't convert negative value to unsigned long");
   5282                 return (unsigned long)-1;
   5283             }
   5284             return PyLong_AsUnsignedLong(x);
   5285         } else {
   5286             return PyLong_AsLong(x);
   5287         }
   5288     } else {
   5289         unsigned long val;
   5290         PyObject *tmp = __Pyx_PyNumber_Int(x);
   5291         if (!tmp) return (unsigned long)-1;
   5292         val = __Pyx_PyInt_AsUnsignedLong(tmp);
   5293         Py_DECREF(tmp);
   5294         return val;
   5295     }
   5296 }
   5297 
   5298 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
   5299     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
   5300     const int is_unsigned = neg_one > const_zero;
   5301 #if PY_VERSION_HEX < 0x03000000
   5302     if (likely(PyInt_Check(x))) {
   5303         long val = PyInt_AS_LONG(x);
   5304         if (is_unsigned && unlikely(val < 0)) {
   5305             PyErr_SetString(PyExc_OverflowError,
   5306                             "can't convert negative value to unsigned PY_LONG_LONG");
   5307             return (unsigned PY_LONG_LONG)-1;
   5308         }
   5309         return (unsigned PY_LONG_LONG)val;
   5310     } else
   5311 #endif
   5312     if (likely(PyLong_Check(x))) {
   5313         if (is_unsigned) {
   5314             if (unlikely(Py_SIZE(x) < 0)) {
   5315                 PyErr_SetString(PyExc_OverflowError,
   5316                                 "can't convert negative value to unsigned PY_LONG_LONG");
   5317                 return (unsigned PY_LONG_LONG)-1;
   5318             }
   5319             return PyLong_AsUnsignedLongLong(x);
   5320         } else {
   5321             return PyLong_AsLongLong(x);
   5322         }
   5323     } else {
   5324         unsigned PY_LONG_LONG val;
   5325         PyObject *tmp = __Pyx_PyNumber_Int(x);
   5326         if (!tmp) return (unsigned PY_LONG_LONG)-1;
   5327         val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
   5328         Py_DECREF(tmp);
   5329         return val;
   5330     }
   5331 }
   5332 
   5333 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
   5334     const long neg_one = (long)-1, const_zero = 0;
   5335     const int is_unsigned = neg_one > const_zero;
   5336 #if PY_VERSION_HEX < 0x03000000
   5337     if (likely(PyInt_Check(x))) {
   5338         long val = PyInt_AS_LONG(x);
   5339         if (is_unsigned && unlikely(val < 0)) {
   5340             PyErr_SetString(PyExc_OverflowError,
   5341                             "can't convert negative value to long");
   5342             return (long)-1;
   5343         }
   5344         return (long)val;
   5345     } else
   5346 #endif
   5347     if (likely(PyLong_Check(x))) {
   5348         if (is_unsigned) {
   5349             if (unlikely(Py_SIZE(x) < 0)) {
   5350                 PyErr_SetString(PyExc_OverflowError,
   5351                                 "can't convert negative value to long");
   5352                 return (long)-1;
   5353             }
   5354             return PyLong_AsUnsignedLong(x);
   5355         } else {
   5356             return PyLong_AsLong(x);
   5357         }
   5358     } else {
   5359         long val;
   5360         PyObject *tmp = __Pyx_PyNumber_Int(x);
   5361         if (!tmp) return (long)-1;
   5362         val = __Pyx_PyInt_AsLong(tmp);
   5363         Py_DECREF(tmp);
   5364         return val;
   5365     }
   5366 }
   5367 
   5368 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
   5369     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
   5370     const int is_unsigned = neg_one > const_zero;
   5371 #if PY_VERSION_HEX < 0x03000000
   5372     if (likely(PyInt_Check(x))) {
   5373         long val = PyInt_AS_LONG(x);
   5374         if (is_unsigned && unlikely(val < 0)) {
   5375             PyErr_SetString(PyExc_OverflowError,
   5376                             "can't convert negative value to PY_LONG_LONG");
   5377             return (PY_LONG_LONG)-1;
   5378         }
   5379         return (PY_LONG_LONG)val;
   5380     } else
   5381 #endif
   5382     if (likely(PyLong_Check(x))) {
   5383         if (is_unsigned) {
   5384             if (unlikely(Py_SIZE(x) < 0)) {
   5385                 PyErr_SetString(PyExc_OverflowError,
   5386                                 "can't convert negative value to PY_LONG_LONG");
   5387                 return (PY_LONG_LONG)-1;
   5388             }
   5389             return PyLong_AsUnsignedLongLong(x);
   5390         } else {
   5391             return PyLong_AsLongLong(x);
   5392         }
   5393     } else {
   5394         PY_LONG_LONG val;
   5395         PyObject *tmp = __Pyx_PyNumber_Int(x);
   5396         if (!tmp) return (PY_LONG_LONG)-1;
   5397         val = __Pyx_PyInt_AsLongLong(tmp);
   5398         Py_DECREF(tmp);
   5399         return val;
   5400     }
   5401 }
   5402 
   5403 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
   5404     const signed long neg_one = (signed long)-1, const_zero = 0;
   5405     const int is_unsigned = neg_one > const_zero;
   5406 #if PY_VERSION_HEX < 0x03000000
   5407     if (likely(PyInt_Check(x))) {
   5408         long val = PyInt_AS_LONG(x);
   5409         if (is_unsigned && unlikely(val < 0)) {
   5410             PyErr_SetString(PyExc_OverflowError,
   5411                             "can't convert negative value to signed long");
   5412             return (signed long)-1;
   5413         }
   5414         return (signed long)val;
   5415     } else
   5416 #endif
   5417     if (likely(PyLong_Check(x))) {
   5418         if (is_unsigned) {
   5419             if (unlikely(Py_SIZE(x) < 0)) {
   5420                 PyErr_SetString(PyExc_OverflowError,
   5421                                 "can't convert negative value to signed long");
   5422                 return (signed long)-1;
   5423             }
   5424             return PyLong_AsUnsignedLong(x);
   5425         } else {
   5426             return PyLong_AsLong(x);
   5427         }
   5428     } else {
   5429         signed long val;
   5430         PyObject *tmp = __Pyx_PyNumber_Int(x);
   5431         if (!tmp) return (signed long)-1;
   5432         val = __Pyx_PyInt_AsSignedLong(tmp);
   5433         Py_DECREF(tmp);
   5434         return val;
   5435     }
   5436 }
   5437 
   5438 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
   5439     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
   5440     const int is_unsigned = neg_one > const_zero;
   5441 #if PY_VERSION_HEX < 0x03000000
   5442     if (likely(PyInt_Check(x))) {
   5443         long val = PyInt_AS_LONG(x);
   5444         if (is_unsigned && unlikely(val < 0)) {
   5445             PyErr_SetString(PyExc_OverflowError,
   5446                             "can't convert negative value to signed PY_LONG_LONG");
   5447             return (signed PY_LONG_LONG)-1;
   5448         }
   5449         return (signed PY_LONG_LONG)val;
   5450     } else
   5451 #endif
   5452     if (likely(PyLong_Check(x))) {
   5453         if (is_unsigned) {
   5454             if (unlikely(Py_SIZE(x) < 0)) {
   5455                 PyErr_SetString(PyExc_OverflowError,
   5456                                 "can't convert negative value to signed PY_LONG_LONG");
   5457                 return (signed PY_LONG_LONG)-1;
   5458             }
   5459             return PyLong_AsUnsignedLongLong(x);
   5460         } else {
   5461             return PyLong_AsLongLong(x);
   5462         }
   5463     } else {
   5464         signed PY_LONG_LONG val;
   5465         PyObject *tmp = __Pyx_PyNumber_Int(x);
   5466         if (!tmp) return (signed PY_LONG_LONG)-1;
   5467         val = __Pyx_PyInt_AsSignedLongLong(tmp);
   5468         Py_DECREF(tmp);
   5469         return val;
   5470     }
   5471 }
   5472 
   5473 #include "compile.h"
   5474 #include "frameobject.h"
   5475 #include "traceback.h"
   5476 
   5477 static void __Pyx_AddTraceback(const char *funcname) {
   5478     PyObject *py_srcfile = 0;
   5479     PyObject *py_funcname = 0;
   5480     PyObject *py_globals = 0;
   5481     PyCodeObject *py_code = 0;
   5482     PyFrameObject *py_frame = 0;
   5483 
   5484     #if PY_MAJOR_VERSION < 3
   5485     py_srcfile = PyString_FromString(__pyx_filename);
   5486     #else
   5487     py_srcfile = PyUnicode_FromString(__pyx_filename);
   5488     #endif
   5489     if (!py_srcfile) goto bad;
   5490     if (__pyx_clineno) {
   5491         #if PY_MAJOR_VERSION < 3
   5492         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
   5493         #else
   5494         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
   5495         #endif
   5496     }
   5497     else {
   5498         #if PY_MAJOR_VERSION < 3
   5499         py_funcname = PyString_FromString(funcname);
   5500         #else
   5501         py_funcname = PyUnicode_FromString(funcname);
   5502         #endif
   5503     }
   5504     if (!py_funcname) goto bad;
   5505     py_globals = PyModule_GetDict(__pyx_m);
   5506     if (!py_globals) goto bad;
   5507     py_code = PyCode_New(
   5508         0,            /*int argcount,*/
   5509         #if PY_MAJOR_VERSION >= 3
   5510         0,            /*int kwonlyargcount,*/
   5511         #endif
   5512         0,            /*int nlocals,*/
   5513         0,            /*int stacksize,*/
   5514         0,            /*int flags,*/
   5515         __pyx_empty_bytes, /*PyObject *code,*/
   5516         __pyx_empty_tuple,  /*PyObject *consts,*/
   5517         __pyx_empty_tuple,  /*PyObject *names,*/
   5518         __pyx_empty_tuple,  /*PyObject *varnames,*/
   5519         __pyx_empty_tuple,  /*PyObject *freevars,*/
   5520         __pyx_empty_tuple,  /*PyObject *cellvars,*/
   5521         py_srcfile,   /*PyObject *filename,*/
   5522         py_funcname,  /*PyObject *name,*/
   5523         __pyx_lineno,   /*int firstlineno,*/
   5524         __pyx_empty_bytes  /*PyObject *lnotab*/
   5525     );
   5526     if (!py_code) goto bad;
   5527     py_frame = PyFrame_New(
   5528         PyThreadState_GET(), /*PyThreadState *tstate,*/
   5529         py_code,             /*PyCodeObject *code,*/
   5530         py_globals,          /*PyObject *globals,*/
   5531         0                    /*PyObject *locals*/
   5532     );
   5533     if (!py_frame) goto bad;
   5534     py_frame->f_lineno = __pyx_lineno;
   5535     PyTraceBack_Here(py_frame);
   5536 bad:
   5537     Py_XDECREF(py_srcfile);
   5538     Py_XDECREF(py_funcname);
   5539     Py_XDECREF(py_code);
   5540     Py_XDECREF(py_frame);
   5541 }
   5542 
   5543 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
   5544     while (t->p) {
   5545         #if PY_MAJOR_VERSION < 3
   5546         if (t->is_unicode) {
   5547             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
   5548         } else if (t->intern) {
   5549             *t->p = PyString_InternFromString(t->s);
   5550         } else {
   5551             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
   5552         }
   5553         #else  /* Python 3+ has unicode identifiers */
   5554         if (t->is_unicode | t->is_str) {
   5555             if (t->intern) {
   5556                 *t->p = PyUnicode_InternFromString(t->s);
   5557             } else if (t->encoding) {
   5558                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
   5559             } else {
   5560                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
   5561             }
   5562         } else {
   5563             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
   5564         }
   5565         #endif
   5566         if (!*t->p)
   5567             return -1;
   5568         ++t;
   5569     }
   5570     return 0;
   5571 }
   5572 
   5573 /* Type Conversion Functions */
   5574 
   5575 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   5576    if (x == Py_True) return 1;
   5577    else if ((x == Py_False) | (x == Py_None)) return 0;
   5578    else return PyObject_IsTrue(x);
   5579 }
   5580 
   5581 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   5582   PyNumberMethods *m;
   5583   const char *name = NULL;
   5584   PyObject *res = NULL;
   5585 #if PY_VERSION_HEX < 0x03000000
   5586   if (PyInt_Check(x) || PyLong_Check(x))
   5587 #else
   5588   if (PyLong_Check(x))
   5589 #endif
   5590     return Py_INCREF(x), x;
   5591   m = Py_TYPE(x)->tp_as_number;
   5592 #if PY_VERSION_HEX < 0x03000000
   5593   if (m && m->nb_int) {
   5594     name = "int";
   5595     res = PyNumber_Int(x);
   5596   }
   5597   else if (m && m->nb_long) {
   5598     name = "long";
   5599     res = PyNumber_Long(x);
   5600   }
   5601 #else
   5602   if (m && m->nb_int) {
   5603     name = "int";
   5604     res = PyNumber_Long(x);
   5605   }
   5606 #endif
   5607   if (res) {
   5608 #if PY_VERSION_HEX < 0x03000000
   5609     if (!PyInt_Check(res) && !PyLong_Check(res)) {
   5610 #else
   5611     if (!PyLong_Check(res)) {
   5612 #endif
   5613       PyErr_Format(PyExc_TypeError,
   5614                    "__%s__ returned non-%s (type %.200s)",
   5615                    name, name, Py_TYPE(res)->tp_name);
   5616       Py_DECREF(res);
   5617       return NULL;
   5618     }
   5619   }
   5620   else if (!PyErr_Occurred()) {
   5621     PyErr_SetString(PyExc_TypeError,
   5622                     "an integer is required");
   5623   }
   5624   return res;
   5625 }
   5626 
   5627 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   5628   Py_ssize_t ival;
   5629   PyObject* x = PyNumber_Index(b);
   5630   if (!x) return -1;
   5631   ival = PyInt_AsSsize_t(x);
   5632   Py_DECREF(x);
   5633   return ival;
   5634 }
   5635 
   5636 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
   5637 #if PY_VERSION_HEX < 0x02050000
   5638    if (ival <= LONG_MAX)
   5639        return PyInt_FromLong((long)ival);
   5640    else {
   5641        unsigned char *bytes = (unsigned char *) &ival;
   5642        int one = 1; int little = (int)*(unsigned char*)&one;
   5643        return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   5644    }
   5645 #else
   5646    return PyInt_FromSize_t(ival);
   5647 #endif
   5648 }
   5649 
   5650 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   5651    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   5652    if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
   5653        return (size_t)-1;
   5654    } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
   5655        PyErr_SetString(PyExc_OverflowError,
   5656                        "value too large to convert to size_t");
   5657        return (size_t)-1;
   5658    }
   5659    return (size_t)val;
   5660 }
   5661 
   5662 
   5663 #endif /* Py_PYTHON_H */