- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrtmidi_python.cpp
More file actions
Latest commit
4237 lines (3987 loc) · 158 KB
/
Copy pathrtmidi_python.cpp
File metadata and controls
4237 lines (3987 loc) · 158 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Generated by Cython 0.20 on Wed Jan 22 22:57:24 2014 */
#definePY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#defineCYTHON_USE_PYLONG_INTERNALS0
#else
#include"pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#defineCYTHON_USE_PYLONG_INTERNALS1
#else
#defineCYTHON_USE_PYLONG_INTERNALS0
#endif
#endif
#endif
#include"Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#defineCYTHON_ABI"0_20"
#include<stddef.h>/* For offsetof */
#ifndef offsetof
#defineoffsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define__stdcall
#endif
#ifndef __cdecl
#define__cdecl
#endif
#ifndef __fastcall
#define__fastcall
#endif
#endif
#ifndef DL_IMPORT
#defineDL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#defineDL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#definePY_LONG_LONGLONG_LONG
#endif
#ifndef Py_HUGE_VAL
#definePy_HUGE_VALHUGE_VAL
#endif
#ifdef PYPY_VERSION
#defineCYTHON_COMPILING_IN_PYPY1
#defineCYTHON_COMPILING_IN_CPYTHON0
#else
#defineCYTHON_COMPILING_IN_PYPY0
#defineCYTHON_COMPILING_IN_CPYTHON1
#endif
#if CYTHON_COMPILING_IN_PYPY
#definePy_OptimizeFlag0
#endif
#if PY_VERSION_HEX < 0x02050000
typedefint Py_ssize_t;
#definePY_SSIZE_T_MAXINT_MAX
#definePY_SSIZE_T_MININT_MIN
#definePY_FORMAT_SIZE_T""
#defineCYTHON_FORMAT_SSIZE_T""
#definePyInt_FromSsize_t(z) PyInt_FromLong(z)
#definePyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o)
#definePyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
(PyErr_Format(PyExc_TypeError, \
"expected index value, got %.200s", Py_TYPE(o)->tp_name), \
(PyObject*)0))
#define__Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
!PyComplex_Check(o))
#definePyIndex_Check __Pyx_PyIndex_Check
#definePyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define__PYX_BUILD_PY_SSIZE_T"i"
#else
#define__PYX_BUILD_PY_SSIZE_T"n"
#defineCYTHON_FORMAT_SSIZE_T"z"
#define__Pyx_PyIndex_Check PyIndex_Check
#endif
#if PY_VERSION_HEX < 0x02060000
#definePy_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#definePy_TYPE(ob) (((PyObject*)(ob))->ob_type)
#definePy_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#definePyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#definePyBUF_SIMPLE0
#definePyBUF_WRITABLE0x0001
#definePyBUF_FORMAT0x0004
#definePyBUF_ND0x0008
#definePyBUF_STRIDES (0x0010 | PyBUF_ND)
#definePyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#definePyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#definePyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#definePyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#definePyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
#definePyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
typedefint (*getbufferproc)(PyObject *, Py_buffer *, int);
typedefvoid (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
#define__Pyx_BUILTIN_MODULE_NAME"__builtin__"
#define__Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyClass_Type
#else
#define__Pyx_BUILTIN_MODULE_NAME"builtins"
#define__Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_VERSION_HEX < 0x02060000
#definePyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
#definePy_TPFLAGS_CHECKTYPES0
#definePy_TPFLAGS_HAVE_INDEX0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#definePy_TPFLAGS_HAVE_NEWBUFFER0
#endif
#if PY_VERSION_HEX < 0x02060000
#definePy_TPFLAGS_HAVE_VERSION_TAG0
#endif
#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
#definePy_TPFLAGS_IS_ABSTRACT0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
#definePy_TPFLAGS_HAVE_FINALIZE0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#defineCYTHON_PEP393_ENABLED1
#define__Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
0 : _PyUnicode_Ready((PyObject *)(op)))
#define__Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define__Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define__Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
#define__Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
#define__Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#defineCYTHON_PEP393_ENABLED0
#define__Pyx_PyUnicode_READY(op) (0)
#define__Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define__Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define__Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
#define__Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
#define__Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#define__Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define__Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#define__Pyx_PyUnicode_Concat(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
PyNumber_Add(a, b) : PyUnicode_Concat(a, b))
#if PY_MAJOR_VERSION >= 3
#define__Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
#else
#define__Pyx_PyString_Format(a, b) PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
#definePyBaseString_Type PyUnicode_Type
#definePyStringObject PyUnicodeObject
#definePyString_Type PyUnicode_Type
#definePyString_Check PyUnicode_Check
#definePyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
#definePyBytesObject PyStringObject
#definePyBytes_Type PyString_Type
#definePyBytes_Check PyString_Check
#definePyBytes_CheckExact PyString_CheckExact
#definePyBytes_FromString PyString_FromString
#definePyBytes_FromStringAndSize PyString_FromStringAndSize
#definePyBytes_FromFormat PyString_FromFormat
#definePyBytes_DecodeEscape PyString_DecodeEscape
#definePyBytes_AsString PyString_AsString
#definePyBytes_AsStringAndSize PyString_AsStringAndSize
#definePyBytes_Size PyString_Size
#definePyBytes_AS_STRING PyString_AS_STRING
#definePyBytes_GET_SIZE PyString_GET_SIZE
#definePyBytes_Repr PyString_Repr
#definePyBytes_Concat PyString_Concat
#definePyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
#if PY_MAJOR_VERSION >= 3
#define__Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
#define__Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
#define__Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
PyString_Check(obj) || PyUnicode_Check(obj))
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#if PY_VERSION_HEX < 0x02060000
#definePySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#definePyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
#definePySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define__Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#definePyIntObject PyLongObject
#definePyInt_Type PyLong_Type
#definePyInt_Check(op) PyLong_Check(op)
#definePyInt_CheckExact(op) PyLong_CheckExact(op)
#definePyInt_FromString PyLong_FromString
#definePyInt_FromUnicode PyLong_FromUnicode
#definePyInt_FromLong PyLong_FromLong
#definePyInt_FromSize_t PyLong_FromSize_t
#definePyInt_FromSsize_t PyLong_FromSsize_t
#definePyInt_AsLong PyLong_AsLong
#definePyInt_AS_LONG PyLong_AS_LONG
#definePyInt_AsSsize_t PyLong_AsSsize_t
#definePyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#definePyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#definePyNumber_Int PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
#definePyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
typedeflong Py_hash_t;
#define__Pyx_PyInt_FromHash_t PyInt_FromLong
#define__Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define__Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define__Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
#define__Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
#define__Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
#define__Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
#define__Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
#define__Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
#define__Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
#definePyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
#define__Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define__Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define__Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define__Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define__Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define__Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define__Pyx_NAMESTR(n) ((char *)(n))
#define__Pyx_DOCSTR(n) ((char *)(n))
#else
#define__Pyx_NAMESTR(n) (n)
#define__Pyx_DOCSTR(n) (n)
#endif
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#defineCYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#defineCYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#defineCYTHON_INLINEinline
#else
#defineCYTHON_INLINE
#endif
#endif
#ifndef CYTHON_RESTRICT
#if defined(__GNUC__)
#defineCYTHON_RESTRICT __restrict__
#elif defined(_MSC_VER) && _MSC_VER >= 1400
#defineCYTHON_RESTRICT __restrict
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#defineCYTHON_RESTRICTrestrict
#else
#defineCYTHON_RESTRICT
#endif
#endif
#ifdef NAN
#define__PYX_NAN() ((float) NAN)
#else
staticCYTHON_INLINEfloat__PYX_NAN() {
/* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
a quiet NaN. */
float value;
memset(&value, 0xFF, sizeof(value));
return value;
}
#endif
#if PY_MAJOR_VERSION >= 3
#define__Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define__Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define__Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define__Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define__PYX_EXTERN_Cextern"C"
#else
#define__PYX_EXTERN_Cextern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define_USE_MATH_DEFINES
#endif
#include<math.h>
#define__PYX_HAVE__rtmidi_python
#define__PYX_HAVE_API__rtmidi_python
#include"string.h"
#include<string>
#include"ios"
#include"new"
#include"stdexcept"
#include"typeinfo"
#include<vector>
#include"RtMidi/RtMidi.h"
#ifdef _OPENMP
#include<omp.h>
#endif/* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#defineCYTHON_WITHOUT_ASSERTIONS
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# defineCYTHON_UNUSED__attribute__ ((__unused__))
# else
# defineCYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# defineCYTHON_UNUSED__attribute__ ((__unused__))
# else
# defineCYTHON_UNUSED
# endif
#endif
typedefstruct {PyObject **p; char *s; const Py_ssize_t n; constchar* encoding;
constchar is_unicode; constchar is_str; constchar intern; } __Pyx_StringTabEntry; /*proto*/
#define__PYX_DEFAULT_STRING_ENCODING_IS_ASCII0
#define__PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT0
#define__PYX_DEFAULT_STRING_ENCODING""
#define__Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define__Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define__Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
(sizeof(type) < sizeof(Py_ssize_t)) || \
(sizeof(type) > sizeof(Py_ssize_t) && \
likely(v < (type)PY_SSIZE_T_MAX || \
v == (type)PY_SSIZE_T_MAX) && \
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
v == (type)PY_SSIZE_T_MIN))) || \
(sizeof(type) == sizeof(Py_ssize_t) && \
(is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
v == (type)PY_SSIZE_T_MAX))) )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
staticCYTHON_INLINEchar* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define__Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((constchar*)s, strlen((constchar*)s))
#define__Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((constchar*)s, l)
#define__Pyx_PyBytes_FromString PyBytes_FromString
#define__Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
staticCYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#if PY_MAJOR_VERSION < 3
#define__Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define__Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
#define__Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
#define__Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define__Pyx_PyObject_AsSString(s) ((signedchar*) __Pyx_PyObject_AsString(s))
#define__Pyx_PyObject_AsUString(s) ((unsignedchar*) __Pyx_PyObject_AsString(s))
#define__Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s)
#define__Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
#define__Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((char*)s)
#define__Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s)
#define__Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
#if PY_MAJOR_VERSION < 3
staticCYTHON_INLINEsize_t__Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
const Py_UNICODE *u_end = u;
while (*u_end++) ;
return u_end - u - 1;
}
#else
#define__Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define__Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define__Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define__Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
#define__Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define__Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
staticCYTHON_INLINEint__Pyx_PyObject_IsTrue(PyObject*);
staticCYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
staticCYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
staticCYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define__pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define__pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define__pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
staticint __Pyx_sys_getdefaultencoding_not_ascii;
staticint__Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys = NULL;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
sys = PyImport_ImportModule("sys");
if (sys == NULL) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (constchar*) "getdefaultencoding", NULL);
if (default_encoding == NULL) goto bad;
if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
__Pyx_sys_getdefaultencoding_not_ascii = 0;
} else {
constchar* default_encoding_c = PyBytes_AS_STRING(default_encoding);
char ascii_chars[128];
int c;
for (c = 0; c < 128; c++) {
ascii_chars[c] = c;
}
__Pyx_sys_getdefaultencoding_not_ascii = 1;
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
if (ascii_chars_u == NULL) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
PyErr_Format(
PyExc_ValueError,
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
default_encoding_c);
goto bad;
}
}
Py_XDECREF(sys);
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
return0;
bad:
Py_XDECREF(sys);
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define__Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define__Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
staticchar* __PYX_DEFAULT_STRING_ENCODING;
staticint__Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys = NULL;
PyObject* default_encoding = NULL;
char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (sys == NULL) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (constchar*) "getdefaultencoding", NULL);
if (default_encoding == NULL) goto bad;
default_encoding_c = PyBytes_AS_STRING(default_encoding);
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
Py_DECREF(sys);
Py_DECREF(default_encoding);
return0;
bad:
Py_XDECREF(sys);
Py_XDECREF(default_encoding);
return -1;
}
#endif
#endif
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#definelikely(x) __builtin_expect(!!(x), 1)
#defineunlikely(x) __builtin_expect(!!(x), 0)
#else/* __GNUC__ > 2 ... */
#definelikely(x) (x)
#defineunlikely(x) (x)
#endif/* __GNUC__ > 2 ... */
#else/* __GNUC__ */
#definelikely(x) (x)
#defineunlikely(x) (x)
#endif/* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
staticint __pyx_lineno;
staticint __pyx_clineno = 0;
staticconstchar * __pyx_cfilenm= __FILE__;
staticconstchar *__pyx_filename;
staticconstchar *__pyx_f[] = {
"rtmidi_python.pyx",
"stringsource",
"stringsource",
};
/*--- Type declarations ---*/
struct__pyx_obj_13rtmidi_python_MidiBase;
struct__pyx_obj_13rtmidi_python_MidiOut;
struct__pyx_obj_13rtmidi_python_MidiIn;
/* "rtmidi_python.pyx":40
*
*
* cdef class MidiBase: # <<<<<<<<<<<<<<
* cdef RtMidi* baseptr(self):
* return NULL
*/
struct__pyx_obj_13rtmidi_python_MidiBase {
PyObject_HEAD
struct__pyx_vtabstruct_13rtmidi_python_MidiBase *__pyx_vtab;
};
/* "rtmidi_python.pyx":107
*
*
* cdef class MidiOut(MidiBase): # <<<<<<<<<<<<<<
* cdef RtMidiOut* thisptr
*
*/
struct__pyx_obj_13rtmidi_python_MidiOut {
struct__pyx_obj_13rtmidi_python_MidiBase __pyx_base;
RtMidiOut *thisptr;
};
/* "rtmidi_python.pyx":67
*
*
* cdef class MidiIn(MidiBase): # <<<<<<<<<<<<<<
* cdef RtMidiIn* thisptr
* cdef object py_callback
*/
struct__pyx_obj_13rtmidi_python_MidiIn {
struct__pyx_obj_13rtmidi_python_MidiBase __pyx_base;
RtMidiIn *thisptr;
PyObject *py_callback;
};
/* "rtmidi_python.pyx":40
*
*
* cdef class MidiBase: # <<<<<<<<<<<<<<
* cdef RtMidi* baseptr(self):
* return NULL
*/
struct__pyx_vtabstruct_13rtmidi_python_MidiBase {
RtMidi *(*baseptr)(struct__pyx_obj_13rtmidi_python_MidiBase *);
};
staticstruct__pyx_vtabstruct_13rtmidi_python_MidiBase *__pyx_vtabptr_13rtmidi_python_MidiBase;
/* "rtmidi_python.pyx":67
*
*
* cdef class MidiIn(MidiBase): # <<<<<<<<<<<<<<
* cdef RtMidiIn* thisptr
* cdef object py_callback
*/
struct__pyx_vtabstruct_13rtmidi_python_MidiIn {
struct__pyx_vtabstruct_13rtmidi_python_MidiBase __pyx_base;
};
staticstruct__pyx_vtabstruct_13rtmidi_python_MidiIn *__pyx_vtabptr_13rtmidi_python_MidiIn;
/* "rtmidi_python.pyx":107
*
*
* cdef class MidiOut(MidiBase): # <<<<<<<<<<<<<<
* cdef RtMidiOut* thisptr
*
*/
struct__pyx_vtabstruct_13rtmidi_python_MidiOut {
struct__pyx_vtabstruct_13rtmidi_python_MidiBase __pyx_base;
};
staticstruct__pyx_vtabstruct_13rtmidi_python_MidiOut *__pyx_vtabptr_13rtmidi_python_MidiOut;
#ifndef CYTHON_REFNANNY
#defineCYTHON_REFNANNY0
#endif
#if CYTHON_REFNANNY
typedefstruct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(constchar*, int, constchar*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(constchar *modname); /*proto*/
#define__Pyx_RefNannyDeclarationsvoid *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define__Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define__Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define__Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define__Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define__Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define__Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define__Pyx_RefNannyDeclarations
#define__Pyx_RefNannySetupContext(name, acquire_gil)
#define__Pyx_RefNannyFinishContext()
#define__Pyx_INCREF(r) Py_INCREF(r)
#define__Pyx_DECREF(r) Py_DECREF(r)
#define__Pyx_GOTREF(r)
#define__Pyx_GIVEREF(r)
#define__Pyx_XINCREF(r) Py_XINCREF(r)
#define__Pyx_XDECREF(r) Py_XDECREF(r)
#define__Pyx_XGOTREF(r)
#define__Pyx_XGIVEREF(r)
#endif/* CYTHON_REFNANNY */
#define__Pyx_XDECREF_SET(r, v) do { \
PyObject *tmp = (PyObject *) r; \
r = v; __Pyx_XDECREF(tmp); \
} while (0)
#define__Pyx_DECREF_SET(r, v) do { \
PyObject *tmp = (PyObject *) r; \
r = v; __Pyx_DECREF(tmp); \
} while (0)
#define__Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define__Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
#if CYTHON_COMPILING_IN_CPYTHON
staticCYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
PyTypeObject* tp = Py_TYPE(obj);
if (likely(tp->tp_getattro))
return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
if (likely(tp->tp_getattr))
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
returnPyObject_GetAttr(obj, attr_name);
}
#else
#define__Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
staticvoid__Pyx_RaiseDoubleKeywordsError(constchar* func_name, PyObject* kw_name); /*proto*/
staticint__Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
constchar* function_name); /*proto*/
staticvoid__Pyx_RaiseArgtupleInvalid(constchar* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
#if CYTHON_COMPILING_IN_CPYTHON
staticCYTHON_INLINEint__Pyx_ListComp_Append(PyObject* list, PyObject* x) {
PyListObject* L = (PyListObject*) list;
Py_ssize_t len = Py_SIZE(list);
if (likely(L->allocated > len)) {
Py_INCREF(x);
PyList_SET_ITEM(list, len, x);
Py_SIZE(list) = len+1;
return0;
}
returnPyList_Append(list, x);
}
#else
#define__Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif
#ifndef __PYX_FORCE_INIT_THREADS
#define__PYX_FORCE_INIT_THREADS0
#endif
staticCYTHON_INLINEvoid__Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
staticCYTHON_INLINEvoid__Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
staticvoid__Pyx_WriteUnraisable(constchar *name, int clineno,
int lineno, constchar *filename,
int full_traceback); /*proto*/
staticint__Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);
staticvoid__Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);
staticint__Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
staticCYTHON_INLINEunsignedint__Pyx_PyInt_As_unsigned_int(PyObject *);
#ifndef __Pyx_CppExn2PyErr
#include<new>
#include<typeinfo>
#include<stdexcept>
#include<ios>
staticvoid__Pyx_CppExn2PyErr() {
try {
if (PyErr_Occurred())
; // let the latest Python exn pass through and ignore the current one
else
throw;
} catch (const std::bad_alloc& exn) {
PyErr_SetString(PyExc_MemoryError, exn.what());
} catch (const std::bad_cast& exn) {
PyErr_SetString(PyExc_TypeError, exn.what());
} catch (const std::domain_error& exn) {
PyErr_SetString(PyExc_ValueError, exn.what());
} catch (const std::invalid_argument& exn) {
PyErr_SetString(PyExc_ValueError, exn.what());
} catch (const std::ios_base::failure& exn) {
PyErr_SetString(PyExc_IOError, exn.what());
} catch (const std::out_of_range& exn) {
PyErr_SetString(PyExc_IndexError, exn.what());
} catch (const std::overflow_error& exn) {
PyErr_SetString(PyExc_OverflowError, exn.what());
} catch (const std::range_error& exn) {
PyErr_SetString(PyExc_ArithmeticError, exn.what());
} catch (const std::underflow_error& exn) {
PyErr_SetString(PyExc_ArithmeticError, exn.what());
} catch (const std::exception& exn) {
PyErr_SetString(PyExc_RuntimeError, exn.what());
}
catch (...)
{
PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
}
}
#endif
staticCYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsignedint value);
staticCYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsignedchar value);
staticCYTHON_INLINEunsignedchar__Pyx_PyInt_As_unsigned_char(PyObject *);
staticCYTHON_INLINEsize_t__Pyx_PyInt_As_size_t(PyObject *);
staticCYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
staticCYTHON_INLINElong__Pyx_PyInt_As_long(PyObject *);
staticCYTHON_INLINEint__Pyx_PyInt_As_int(PyObject *);
staticint__Pyx_check_binary_version(void);
typedefstruct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct__Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
staticstruct__Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
staticint__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
staticvoid__pyx_insert_code_object(int code_line, PyCodeObject* code_object);
staticvoid__Pyx_AddTraceback(constchar *funcname, int c_line,
int py_line, constchar *filename); /*proto*/
staticint__Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'libc.string' */
/* Module declarations from 'libcpp.string' */
/* Module declarations from 'libcpp.vector' */
/* Module declarations from 'rtmidi_python' */
static PyTypeObject *__pyx_ptype_13rtmidi_python_MidiBase = 0;
static PyTypeObject *__pyx_ptype_13rtmidi_python_MidiOut = 0;
static PyTypeObject *__pyx_ptype_13rtmidi_python_MidiIn = 0;
staticvoid__pyx_f_13rtmidi_python_midi_in_callback(double, std::vector<unsignedchar> *, void *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector<unsignedchar> &); /*proto*/
static std::vector<unsignedchar> __pyx_convert_vector_from_py_unsigned_char(PyObject *); /*proto*/
#define__Pyx_MODULE_NAME"rtmidi_python"
int __pyx_module_is_main_rtmidi_python = 0;
/* Implementation of 'rtmidi_python' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_pf_13rtmidi_python_8MidiBase_open_port(struct__pyx_obj_13rtmidi_python_MidiBase *__pyx_v_self, PyObject *__pyx_v_port); /* proto */
static PyObject *__pyx_pf_13rtmidi_python_8MidiBase_2open_virtual_port(struct__pyx_obj_13rtmidi_python_MidiBase *__pyx_v_self, PyObject *__pyx_v_port_name); /* proto */
static PyObject *__pyx_pf_13rtmidi_python_8MidiBase_5ports___get__(struct__pyx_obj_13rtmidi_python_MidiBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_13rtmidi_python_8MidiBase_4close_port(struct__pyx_obj_13rtmidi_python_MidiBase *__pyx_v_self); /* proto */
staticint__pyx_pf_13rtmidi_python_6MidiIn___cinit__(struct__pyx_obj_13rtmidi_python_MidiIn *__pyx_v_self, PyObject *__pyx_v_client_name, PyObject *__pyx_v_queue_size_limit); /* proto */
staticvoid__pyx_pf_13rtmidi_python_6MidiIn_2__dealloc__(struct__pyx_obj_13rtmidi_python_MidiIn *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_13rtmidi_python_6MidiIn_8callback___get__(struct__pyx_obj_13rtmidi_python_MidiIn *__pyx_v_self); /* proto */
staticint__pyx_pf_13rtmidi_python_6MidiIn_8callback_2__set__(struct__pyx_obj_13rtmidi_python_MidiIn *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */
static PyObject *__pyx_pf_13rtmidi_python_6MidiIn_4ignore_types(struct__pyx_obj_13rtmidi_python_MidiIn *__pyx_v_self, PyObject *__pyx_v_midi_sysex, PyObject *__pyx_v_midi_time, PyObject *__pyx_v_midi_sense); /* proto */
static PyObject *__pyx_pf_13rtmidi_python_6MidiIn_6get_message(struct__pyx_obj_13rtmidi_python_MidiIn *__pyx_v_self); /* proto */
staticint__pyx_pf_13rtmidi_python_7MidiOut___cinit__(struct__pyx_obj_13rtmidi_python_MidiOut *__pyx_v_self, PyObject *__pyx_v_client_name); /* proto */
staticvoid__pyx_pf_13rtmidi_python_7MidiOut_2__dealloc__(struct__pyx_obj_13rtmidi_python_MidiOut *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_13rtmidi_python_7MidiOut_4send_message(struct__pyx_obj_13rtmidi_python_MidiOut *__pyx_v_self, PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_tp_new_13rtmidi_python_MidiBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_13rtmidi_python_MidiOut(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_13rtmidi_python_MidiIn(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
staticchar __pyx_k_main[] = "__main__";
staticchar __pyx_k_port[] = "port";
staticchar __pyx_k_test[] = "__test__";
staticchar __pyx_k_index[] = "index";
staticchar __pyx_k_ports[] = "ports";
staticchar __pyx_k_range[] = "range";
staticchar __pyx_k_RtMidi[] = "RtMidi";
staticchar __pyx_k_midi_time[] = "midi_time";
staticchar __pyx_k_port_name[] = "port_name";
staticchar __pyx_k_midi_sense[] = "midi_sense";
staticchar __pyx_k_midi_sysex[] = "midi_sysex";
staticchar __pyx_k_pyx_vtable[] = "__pyx_vtable__";
staticchar __pyx_k_client_name[] = "client_name";
staticchar __pyx_k_queue_size_limit[] = "queue_size_limit";
staticchar __pyx_k_RtMidi_Input_Client[] = "RtMidi Input Client";
staticchar __pyx_k_RtMidi_Output_Client[] = "RtMidi Output Client";
static PyObject *__pyx_n_s_RtMidi;
static PyObject *__pyx_kp_s_RtMidi_Input_Client;
static PyObject *__pyx_kp_s_RtMidi_Output_Client;
static PyObject *__pyx_n_s_client_name;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_midi_sense;
static PyObject *__pyx_n_s_midi_sysex;
static PyObject *__pyx_n_s_midi_time;
static PyObject *__pyx_n_s_port;
static PyObject *__pyx_n_s_port_name;
static PyObject *__pyx_n_s_ports;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_queue_size_limit;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_100;
static PyObject *__pyx_tuple_;
/* "rtmidi_python.pyx":41
*
* cdef class MidiBase:
* cdef RtMidi* baseptr(self): # <<<<<<<<<<<<<<
* return NULL
*
*/
static RtMidi *__pyx_f_13rtmidi_python_8MidiBase_baseptr(CYTHON_UNUSEDstruct__pyx_obj_13rtmidi_python_MidiBase *__pyx_v_self) {
RtMidi *__pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("baseptr", 0);
/* "rtmidi_python.pyx":42
* cdef class MidiBase:
* cdef RtMidi* baseptr(self):
* return NULL # <<<<<<<<<<<<<<
*
* def open_port(self, port=0):
*/
__pyx_r = NULL;
goto __pyx_L0;
/* "rtmidi_python.pyx":41
*
* cdef class MidiBase:
* cdef RtMidi* baseptr(self): # <<<<<<<<<<<<<<
* return NULL
*
*/
/* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "rtmidi_python.pyx":44
* return NULL
*
* def open_port(self, port=0): # <<<<<<<<<<<<<<
* if isinstance(port, int):
* port_number = port
*/
/* Python wrapper */
static PyObject *__pyx_pw_13rtmidi_python_8MidiBase_1open_port(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_13rtmidi_python_8MidiBase_1open_port(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_port = 0;
int __pyx_lineno = 0;
constchar *__pyx_filename = NULL;
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("open_port (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_port,0};
PyObject* values[1] = {0};
values[0] = ((PyObject *)__pyx_int_0);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case0:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_port);
if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open_port") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case0: break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_port = values[0];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("open_port", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("rtmidi_python.MidiBase.open_port", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
returnNULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_13rtmidi_python_8MidiBase_open_port(((struct__pyx_obj_13rtmidi_python_MidiBase *)__pyx_v_self), __pyx_v_port);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_13rtmidi_python_8MidiBase_open_port(struct__pyx_obj_13rtmidi_python_MidiBase *__pyx_v_self, PyObject *__pyx_v_port) {
PyObject *__pyx_v_port_number = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
unsignedint __pyx_t_6;