Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-python-rtmidi for openSUSE:Factory checked in at 2021-06-24 18:22:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-rtmidi (Old) and /work/SRC/openSUSE:Factory/.python-python-rtmidi.new.2625 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-rtmidi" Thu Jun 24 18:22:29 2021 rev:7 rq:901576 version:1.4.9 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-rtmidi/python-python-rtmidi.changes 2021-02-10 21:30:45.630316876 +0100 +++ /work/SRC/openSUSE:Factory/.python-python-rtmidi.new.2625/python-python-rtmidi.changes 2021-06-24 18:22:46.948930081 +0200 @@ -1,0 +2,17 @@ +Wed Jun 23 17:28:07 UTC 2021 - Mia Herkt <m...@0x0.st> + +- Update to 1.4.9 +Changes: + * Synced with upstream RtMidi_ + (fixes gh#SpotlightKid/python-rtmidi#89). +- Changes in 1.4.8: +Fixes: + * Fixed command line parsing in ``midiclock.py`` example script. + * Fixed Windows builds on AppVeyor CI. +Changes: + * Release GIL in ``MidiOut.send_message`` so that on backend APIs + where this operation is blocking (``WINDOWS_MM``), multiple + Python threads using this method on different ``MidiOut`` + instances can run concurently. + +------------------------------------------------------------------- Old: ---- python-rtmidi-1.4.7.tar.gz New: ---- python-rtmidi-1.4.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-rtmidi.spec ++++++ --- /var/tmp/diff_new_pack.nLAXnf/_old 2021-06-24 18:22:47.484930675 +0200 +++ /var/tmp/diff_new_pack.nLAXnf/_new 2021-06-24 18:22:47.488930679 +0200 @@ -18,12 +18,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-python-rtmidi -Version: 1.4.7 +Version: 1.4.9 Release: 0 Summary: Python binding for the RtMidi C++ library License: MIT Group: Development/Languages/Python -URL: https://chrisarndt.de/projects/python-rtmidi/ +URL: https://spotlightkid.github.io/python-rtmidi/ Source: https://files.pythonhosted.org/packages/source/p/python-rtmidi/python-rtmidi-%{version}.tar.gz BuildRequires: %{python_module Sphinx} BuildRequires: %{python_module devel} @@ -32,10 +32,10 @@ BuildRequires: c++_compiler BuildRequires: fdupes BuildRequires: pkgconfig -BuildRequires: python > 3.5 BuildRequires: python-rpm-macros BuildRequires: pkgconfig(alsa) BuildRequires: pkgconfig(jack) +BuildRequires: python(abi) > 3.5 %python_subpackages %description ++++++ python-rtmidi-1.4.7.tar.gz -> python-rtmidi-1.4.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/CHANGELOG.rst new/python-rtmidi-1.4.9/CHANGELOG.rst --- old/python-rtmidi-1.4.7/CHANGELOG.rst 2021-01-27 20:35:59.000000000 +0100 +++ new/python-rtmidi-1.4.9/CHANGELOG.rst 2021-04-26 18:58:09.000000000 +0200 @@ -5,6 +5,32 @@ <https://github.com/SpotlightKid/python-rtmidi/commits/master>`_. +2021-04-26 version 1.4.9 +------------------------ + +Fixes: + * Fixed Windows build for 64-bit Python 3.9 on AppVeyor CI. + +Changes: + * The SysEx reception buffer size for the Windows MM backend was changed + from 8096 to 8196. + * Synced with upstream RtMidi_ (3dc525baf3cac345cdd3511316571c20b47f30b5, + fixes #89). + + +2021-04-26 version 1.4.8 +------------------------ + +Fixes: + * Fixed Windows builds on AppVeyor CI. + * Fixed command line parsing in ``midiclock.py`` example script. + +Changes: + * Release GIL in ``MidiOut.send_message`` so that on backend APIs where + this operation is blocking (``WINDOWS_MM``), multiple Python threads + using this method on different ``MidiOut`` instances can run concurently. + + 2021-01-27 version 1.4.7 ------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/INSTALL.rst new/python-rtmidi-1.4.9/INSTALL.rst --- old/python-rtmidi-1.4.7/INSTALL.rst 2021-01-27 21:31:22.000000000 +0100 +++ new/python-rtmidi-1.4.9/INSTALL.rst 2021-04-26 19:44:07.000000000 +0200 @@ -101,8 +101,8 @@ version, extract and install it, use the following commands:: $ pip download python-rtmidi - $ tar -xzf python-rtmidi-1.4.7.tar.gz - $ cd python-rtmidi-1.4.7 + $ tar -xzf python-rtmidi-1.4.9.tar.gz + $ cd python-rtmidi-1.4.9 $ python setup.py install On Linux or macOS / OS X, if you want to install python-rtmidi into the @@ -162,9 +162,9 @@ If you want to change the Cython source file ``_rtmidi.pyx`` or want to recompile ``_rtmidi.cpp`` with a newer Cython version, you'll need to install Cython >= 0.28. The ``_rtmidi.cpp`` file in the current source distribution -(version 1.4.7) is tagged with:: +(version 1.4.9) is tagged with:: - /* Generated by Cython 0.29.21 */ + /* Generated by Cython 0.29.23 */ RtMidi (and therefore python-rtmidi) supports several low-level MIDI frameworks on different operating systems. Only one of the available options needs to be diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/LICENSE.txt new/python-rtmidi-1.4.9/LICENSE.txt --- old/python-rtmidi-1.4.7/LICENSE.txt 2020-10-15 15:09:26.000000000 +0200 +++ new/python-rtmidi-1.4.9/LICENSE.txt 2021-01-27 21:58:15.000000000 +0100 @@ -1,11 +1,11 @@ Copyright & License =================== -python-rtmidi was written by Christopher Arndt, 2012 - 2020. +python-rtmidi was written by Christopher Arndt, 2012 - 2021. The software is released unter the MIT License: -Copyright (c) 2012 - 2020 Christopher Arndt +Copyright (c) 2012 - 2021 Christopher Arndt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/PKG-INFO new/python-rtmidi-1.4.9/PKG-INFO --- old/python-rtmidi-1.4.7/PKG-INFO 2021-01-27 21:31:22.253417700 +0100 +++ new/python-rtmidi-1.4.9/PKG-INFO 2021-04-26 19:44:07.755232800 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: python-rtmidi -Version: 1.4.7 +Version: 1.4.9 Summary: A Python binding for the RtMidi C++ library implemented using Cython. Home-page: https://github.com/SpotlightKid/python-rtmidi Author: Christopher Arndt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/docs/conf.py new/python-rtmidi-1.4.9/docs/conf.py --- old/python-rtmidi-1.4.7/docs/conf.py 2020-10-15 15:09:26.000000000 +0200 +++ new/python-rtmidi-1.4.9/docs/conf.py 2021-01-27 21:58:15.000000000 +0100 @@ -62,7 +62,7 @@ # General information about the project. project = setupcfg['metadata']['name'] -copyright = u'2012 - 2020, %s' % setupcfg['metadata']['author'] +copyright = u'2012 - 2021, %s' % setupcfg['metadata']['author'] # The version info for the project you're documenting, acts as replacement # for |version| and |release|, also used in various other places throughout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/examples/advanced/midiclock.py new/python-rtmidi-1.4.9/examples/advanced/midiclock.py --- old/python-rtmidi-1.4.7/examples/advanced/midiclock.py 2020-10-15 15:09:26.000000000 +0200 +++ new/python-rtmidi-1.4.9/examples/advanced/midiclock.py 2021-04-04 15:25:46.000000000 +0200 @@ -9,6 +9,7 @@ """ +import argparse import time from collections import deque @@ -51,10 +52,15 @@ def main(args=None): - clock = MIDIClockReceiver(float(args[0]) if args else None) + ap = argparse.ArgumentParser(usage=__doc__.splitlines()[0]) + ap.add_argument('-p', '--port', help="MIDI input port index / name.") + ap.add_argument('bpm', type=int, default=120, help="Starting BPM.") + args = ap.parse_args(args) + + clock = MIDIClockReceiver(args.bpm) try: - m_in, port_name = open_midiinput(args[0] if args else None) + m_in, port_name = open_midiinput(args.port) except (EOFError, KeyboardInterrupt): return 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/python_rtmidi.egg-info/PKG-INFO new/python-rtmidi-1.4.9/python_rtmidi.egg-info/PKG-INFO --- old/python-rtmidi-1.4.7/python_rtmidi.egg-info/PKG-INFO 2021-01-27 21:31:13.000000000 +0100 +++ new/python-rtmidi-1.4.9/python_rtmidi.egg-info/PKG-INFO 2021-04-26 19:43:59.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: python-rtmidi -Version: 1.4.7 +Version: 1.4.9 Summary: A Python binding for the RtMidi C++ library implemented using Cython. Home-page: https://github.com/SpotlightKid/python-rtmidi Author: Christopher Arndt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/requirements-dev.txt new/python-rtmidi-1.4.9/requirements-dev.txt --- old/python-rtmidi-1.4.7/requirements-dev.txt 2020-10-15 15:09:26.000000000 +0200 +++ new/python-rtmidi-1.4.9/requirements-dev.txt 2021-04-25 21:01:24.000000000 +0200 @@ -14,7 +14,7 @@ idna==2.8 imagesize==1.2.0 iniconfig==1.0.1 -Jinja2==2.11.2 +Jinja2==2.11.3 MarkupSafe==1.1.1 mccabe==0.6.1 mock==4.0.2 @@ -22,11 +22,11 @@ packaging==20.4 pbr==5.5.0 pluggy==0.13.1 -py==1.9.0 +py==1.10.0 pycodestyle==2.6.0 pydocstyle==5.1.1 pyflakes==2.2.0 -Pygments==2.7.1 +Pygments==2.7.4 pyparsing==2.4.7 pytest==6.1.1 pytz==2020.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/rtmidi/version.py new/python-rtmidi-1.4.9/rtmidi/version.py --- old/python-rtmidi-1.4.7/rtmidi/version.py 2021-01-27 15:55:48.000000000 +0100 +++ new/python-rtmidi-1.4.9/rtmidi/version.py 2021-04-26 19:40:18.000000000 +0200 @@ -1 +1 @@ -version = '1.4.7' +version = '1.4.9' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/src/_rtmidi.cpp new/python-rtmidi-1.4.9/src/_rtmidi.cpp --- old/python-rtmidi-1.4.7/src/_rtmidi.cpp 2021-01-27 21:31:13.000000000 +0100 +++ new/python-rtmidi-1.4.9/src/_rtmidi.cpp 2021-04-26 19:43:59.000000000 +0200 @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.21 */ +/* Generated by Cython 0.29.23 */ /* BEGIN: Cython Metadata { @@ -45,15 +45,17 @@ } END: Cython Metadata */ +#ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ #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 < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_21" -#define CYTHON_HEX_VERSION 0x001D15F0 +#define CYTHON_ABI "0_29_23" +#define CYTHON_HEX_VERSION 0x001D17F0 #define CYTHON_FUTURE_DIVISION 1 #include <stddef.h> #ifndef offsetof @@ -1541,11 +1543,10 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidi_3a__3a_Api(enum RtMidi::Api value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidiError_3a__3a_Type(enum RtMidiError::Type value); +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif /* CppExceptionConversion.proto */ #ifndef __Pyx_CppExn2PyErr @@ -1589,14 +1590,14 @@ } #endif -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value); +/* None.proto */ +static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); /* proto */ /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidi_3a__3a_Api(enum RtMidi::Api value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidiError_3a__3a_Type(enum RtMidiError::Type value); /* CIntFromPy.proto */ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); @@ -1610,6 +1611,15 @@ /* CIntFromPy.proto */ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* CIntFromPy.proto */ static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *); @@ -9438,7 +9448,7 @@ /* Python wrapper */ static PyObject *__pyx_pw_6rtmidi_7_rtmidi_7MidiOut_9send_message(PyObject *__pyx_v_self, PyObject *__pyx_v_message); /*proto*/ -static char __pyx_doc_6rtmidi_7_rtmidi_7MidiOut_8send_message[] = "MidiOut.send_message(self, message)\nSend a MIDI message to the output port.\n\n The message must be passed as an iterable yielding integers, each\n element representing one byte of the MIDI message.\n\n Normal MIDI messages have a length of one to three bytes, but you can\n also send system exclusive messages, which can be arbitrarily long, via\n this method.\n\n No check is made whether the passed data constitutes a valid MIDI\n message but if it is longer than 3 bytes, the value of the first byte\n must be a start-of-sysex status byte, i.e. 0xF0.\n\n Exceptions:\n\n ``ValueError``\n Raised if ``message`` argument is empty or more than 3 bytes long\n and not a SysEx message.\n\n "; +static char __pyx_doc_6rtmidi_7_rtmidi_7MidiOut_8send_message[] = "MidiOut.send_message(self, message)\nSend a MIDI message to the output port.\n\n The message must be passed as an iterable yielding integers, each\n element representing one byte of the MIDI message.\n\n Normal MIDI messages have a length of one to three bytes, but you can\n also send system exclusive messages, which can be arbitrarily long, via\n this method.\n\n No check is made whether the passed data constitutes a valid MIDI\n message but if it is longer than 3 bytes, the value of the first byte\n must be a start-of-sysex status byte, i.e. 0xF0.\n\n .. note:: with some backend APIs (notably ```WINDOWS_MM``) this function\n blocks until the whole message is sent. While sending the message\n the global interpreter lock is released, so multiple Python threads\n can send messages using *different* MidiOut instances concurr ently.\n\n Exceptions:\n\n ``ValueError``\n Raised if ``message`` argument is empty or more than 3 bytes long\n and not a SysEx message.\n\n "; static PyObject *__pyx_pw_6rtmidi_7_rtmidi_7MidiOut_9send_message(PyObject *__pyx_v_self, PyObject *__pyx_v_message) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -9467,31 +9477,31 @@ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("send_message", 0); - /* "src/_rtmidi.pyx":1094 + /* "src/_rtmidi.pyx":1099 * cdef vector[unsigned char] msg_v * * if not message: # <<<<<<<<<<<<<< * raise ValueError("'message' must not be empty.") * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_message); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1094, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_message); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1099, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (unlikely(__pyx_t_2)) { - /* "src/_rtmidi.pyx":1095 + /* "src/_rtmidi.pyx":1100 * * if not message: * raise ValueError("'message' must not be empty.") # <<<<<<<<<<<<<< * * if len(message) > 3 and message[0] != 0xF0: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1095, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1095, __pyx_L1_error) + __PYX_ERR(0, 1100, __pyx_L1_error) - /* "src/_rtmidi.pyx":1094 + /* "src/_rtmidi.pyx":1099 * cdef vector[unsigned char] msg_v * * if not message: # <<<<<<<<<<<<<< @@ -9500,45 +9510,45 @@ */ } - /* "src/_rtmidi.pyx":1097 + /* "src/_rtmidi.pyx":1102 * raise ValueError("'message' must not be empty.") * * if len(message) > 3 and message[0] != 0xF0: # <<<<<<<<<<<<<< * raise ValueError("'message' longer than 3 bytes but does not " * "start with 0xF0.") */ - __pyx_t_4 = PyObject_Length(__pyx_v_message); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1097, __pyx_L1_error) + __pyx_t_4 = PyObject_Length(__pyx_v_message); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1102, __pyx_L1_error) __pyx_t_1 = ((__pyx_t_4 > 3) != 0); if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L5_bool_binop_done; } - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_message, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1097, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_message, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_NeObjC(__pyx_t_3, __pyx_int_240, 0xF0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1097, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_NeObjC(__pyx_t_3, __pyx_int_240, 0xF0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1097, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_1; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_2)) { - /* "src/_rtmidi.pyx":1098 + /* "src/_rtmidi.pyx":1103 * * if len(message) > 3 and message[0] != 0xF0: * raise ValueError("'message' longer than 3 bytes but does not " # <<<<<<<<<<<<<< * "start with 0xF0.") * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1098, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 1098, __pyx_L1_error) + __PYX_ERR(0, 1103, __pyx_L1_error) - /* "src/_rtmidi.pyx":1097 + /* "src/_rtmidi.pyx":1102 * raise ValueError("'message' must not be empty.") * * if len(message) > 3 and message[0] != 0xF0: # <<<<<<<<<<<<<< @@ -9547,7 +9557,7 @@ */ } - /* "src/_rtmidi.pyx":1101 + /* "src/_rtmidi.pyx":1106 * "start with 0xF0.") * * for c in message: # <<<<<<<<<<<<<< @@ -9558,26 +9568,26 @@ __pyx_t_5 = __pyx_v_message; __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1106, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1106, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1106, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } @@ -9587,7 +9597,7 @@ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1101, __pyx_L1_error) + else __PYX_ERR(0, 1106, __pyx_L1_error) } break; } @@ -9596,22 +9606,22 @@ __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_3); __pyx_t_3 = 0; - /* "src/_rtmidi.pyx":1102 + /* "src/_rtmidi.pyx":1107 * * for c in message: * msg_v.push_back(c) # <<<<<<<<<<<<<< * - * self.thisptr.sendMessage(&msg_v) + * with nogil: */ - __pyx_t_7 = __Pyx_PyInt_As_unsigned_char(__pyx_v_c); if (unlikely((__pyx_t_7 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 1102, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_As_unsigned_char(__pyx_v_c); if (unlikely((__pyx_t_7 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 1107, __pyx_L1_error) try { __pyx_v_msg_v.push_back(__pyx_t_7); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 1102, __pyx_L1_error) + __PYX_ERR(0, 1107, __pyx_L1_error) } - /* "src/_rtmidi.pyx":1101 + /* "src/_rtmidi.pyx":1106 * "start with 0xF0.") * * for c in message: # <<<<<<<<<<<<<< @@ -9621,12 +9631,52 @@ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/_rtmidi.pyx":1104 + /* "src/_rtmidi.pyx":1109 + * msg_v.push_back(c) + * + * with nogil: # <<<<<<<<<<<<<< + * self.thisptr.sendMessage(&msg_v) + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "src/_rtmidi.pyx":1110 + * + * with nogil: + * self.thisptr.sendMessage(&msg_v) # <<<<<<<<<<<<<< + */ + __pyx_v_self->thisptr->sendMessage((&__pyx_v_msg_v)); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 1110, __pyx_L10_error) + } + + /* "src/_rtmidi.pyx":1109 * msg_v.push_back(c) * - * self.thisptr.sendMessage(&msg_v) # <<<<<<<<<<<<<< + * with nogil: # <<<<<<<<<<<<<< + * self.thisptr.sendMessage(&msg_v) */ - __pyx_v_self->thisptr->sendMessage((&__pyx_v_msg_v)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1104, __pyx_L1_error) + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L10_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L11:; + } + } /* "src/_rtmidi.pyx":1071 * return self.thisptr.getCurrentApi() @@ -11221,25 +11271,25 @@ __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "src/_rtmidi.pyx":1095 + /* "src/_rtmidi.pyx":1100 * * if not message: * raise ValueError("'message' must not be empty.") # <<<<<<<<<<<<<< * * if len(message) > 3 and message[0] != 0xF0: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_message_must_not_be_empty); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1095, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_message_must_not_be_empty); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1100, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "src/_rtmidi.pyx":1098 + /* "src/_rtmidi.pyx":1103 * * if len(message) > 3 and message[0] != 0xF0: * raise ValueError("'message' longer than 3 bytes but does not " # <<<<<<<<<<<<<< * "start with 0xF0.") * */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_message_longer_than_3_bytes_but); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 1098, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_message_longer_than_3_bytes_but); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 1103, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); @@ -12919,7 +12969,7 @@ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + } else if (__Pyx_PyFastCFunction_Check(func)) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } @@ -15359,68 +15409,6 @@ Py_XDECREF(py_frame); } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidi_3a__3a_Api(enum RtMidi::Api value) { - const enum RtMidi::Api neg_one = (enum RtMidi::Api) ((enum RtMidi::Api) 0 - (enum RtMidi::Api) 1), const_zero = (enum RtMidi::Api) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(enum RtMidi::Api) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum RtMidi::Api) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum RtMidi::Api) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(enum RtMidi::Api) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum RtMidi::Api) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(enum RtMidi::Api), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidiError_3a__3a_Type(enum RtMidiError::Type value) { - const enum RtMidiError::Type neg_one = (enum RtMidiError::Type) ((enum RtMidiError::Type) 0 - (enum RtMidiError::Type) 1), const_zero = (enum RtMidiError::Type) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(enum RtMidiError::Type) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum RtMidiError::Type) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum RtMidiError::Type) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(enum RtMidiError::Type) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum RtMidiError::Type) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(enum RtMidiError::Type), - little, !is_unsigned); - } -} - /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) @@ -15443,56 +15431,45 @@ return (target_type) value;\ } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { - const unsigned char neg_one = (unsigned char) ((unsigned char) 0 - (unsigned char) 1), const_zero = (unsigned char) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(unsigned char) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(unsigned char) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(unsigned char), - little, !is_unsigned); - } +/* None */ +static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) { + int err; + #ifdef WITH_THREAD + PyGILState_STATE _save = PyGILState_Ensure(); + #endif + err = !!PyErr_Occurred(); + #ifdef WITH_THREAD + PyGILState_Release(_save); + #endif + return err; } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { - const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidi_3a__3a_Api(enum RtMidi::Api value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum RtMidi::Api neg_one = (enum RtMidi::Api) -1, const_zero = (enum RtMidi::Api) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(unsigned int) < sizeof(long)) { + if (sizeof(enum RtMidi::Api) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { + } else if (sizeof(enum RtMidi::Api) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(enum RtMidi::Api) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(unsigned int) <= sizeof(long)) { + if (sizeof(enum RtMidi::Api) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(enum RtMidi::Api) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -15500,30 +15477,37 @@ { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(unsigned int), + return _PyLong_FromByteArray(bytes, sizeof(enum RtMidi::Api), little, !is_unsigned); } } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__RtMidiError_3a__3a_Type(enum RtMidiError::Type value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum RtMidiError::Type neg_one = (enum RtMidiError::Type) -1, const_zero = (enum RtMidiError::Type) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { + if (sizeof(enum RtMidiError::Type) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { + } else if (sizeof(enum RtMidiError::Type) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(enum RtMidiError::Type) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(long) <= sizeof(long)) { + if (sizeof(enum RtMidiError::Type) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(enum RtMidiError::Type) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -15531,14 +15515,21 @@ { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), + return _PyLong_FromByteArray(bytes, sizeof(enum RtMidiError::Type), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { - const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -15727,7 +15718,14 @@ /* CIntFromPy */ static CYTHON_INLINE enum RtMidi::Api __Pyx_PyInt_As_enum__RtMidi_3a__3a_Api(PyObject *x) { - const enum RtMidi::Api neg_one = (enum RtMidi::Api) ((enum RtMidi::Api) 0 - (enum RtMidi::Api) 1), const_zero = (enum RtMidi::Api) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum RtMidi::Api neg_one = (enum RtMidi::Api) -1, const_zero = (enum RtMidi::Api) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -15916,7 +15914,14 @@ /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -16105,7 +16110,14 @@ /* CIntFromPy */ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { - const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -16292,9 +16304,130 @@ return (size_t) -1; } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned char) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(unsigned char) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned char), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(unsigned int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned int), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { - const unsigned char neg_one = (unsigned char) ((unsigned char) 0 - (unsigned char) 1), const_zero = (unsigned char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -16483,7 +16616,14 @@ /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/src/_rtmidi.pyx new/python-rtmidi-1.4.9/src/_rtmidi.pyx --- old/python-rtmidi-1.4.7/src/_rtmidi.pyx 2021-01-27 17:33:44.000000000 +0100 +++ new/python-rtmidi-1.4.9/src/_rtmidi.pyx 2021-04-26 17:11:54.000000000 +0200 @@ -200,7 +200,7 @@ cdef cppclass RtMidiOut(RtMidi): Api RtMidiOut(Api rtapi, string clientName) except + Api getCurrentApi() - void sendMessage(vector[unsigned char] *message) except * + void sendMessage(vector[unsigned char] *message) nogil except * # internal functions @@ -1082,6 +1082,11 @@ message but if it is longer than 3 bytes, the value of the first byte must be a start-of-sysex status byte, i.e. 0xF0. + .. note:: with some backend APIs (notably ```WINDOWS_MM``) this function + blocks until the whole message is sent. While sending the message + the global interpreter lock is released, so multiple Python threads + can send messages using *different* MidiOut instances concurrently. + Exceptions: ``ValueError`` @@ -1101,4 +1106,5 @@ for c in message: msg_v.push_back(c) - self.thisptr.sendMessage(&msg_v) + with nogil: + self.thisptr.sendMessage(&msg_v) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/src/rtmidi/RtMidi.cpp new/python-rtmidi-1.4.9/src/rtmidi/RtMidi.cpp --- old/python-rtmidi-1.4.7/src/rtmidi/RtMidi.cpp 2020-04-14 19:41:00.000000000 +0200 +++ new/python-rtmidi-1.4.9/src/rtmidi/RtMidi.cpp 2021-04-26 18:50:00.000000000 +0200 @@ -40,11 +40,31 @@ #include "RtMidi.h" #include <sstream> -#if defined(__MACOSX_CORE__) - #if TARGET_OS_IPHONE +#if (TARGET_OS_IPHONE == 1) + #define AudioGetCurrentHostTime CAHostTimeBase::GetCurrentTime #define AudioConvertHostTimeToNanos CAHostTimeBase::ConvertToNanos - #endif + + #include <mach/mach_time.h> + class CTime2nsFactor + { + public: + CTime2nsFactor() + { + mach_timebase_info_data_t tinfo; + mach_timebase_info(&tinfo); + Factor = (double)tinfo.numer / tinfo.denom; + } + static double Factor; + }; + double CTime2nsFactor::Factor; + static CTime2nsFactor InitTime2nsFactor; + #undef AudioGetCurrentHostTime + #undef AudioConvertHostTimeToNanos + #define AudioGetCurrentHostTime (uint64_t) mach_absolute_time + #define AudioConvertHostTimeToNanos(t) t *CTime2nsFactor::Factor + #define EndianS32_BtoN(n) n + #endif // Default for Windows is to add an identifier to the port names; this @@ -57,7 +77,7 @@ // // **************************************************************** // -#if !defined(__LINUX_ALSA__) && !defined(__UNIX_JACK__) && !defined(__MACOSX_CORE__) && !defined(__WINDOWS_MM__) +#if !defined(__LINUX_ALSA__) && !defined(__UNIX_JACK__) && !defined(__MACOSX_CORE__) && !defined(__WINDOWS_MM__) && !defined(TARGET_IPHONE_OS) #define __RTMIDI_DUMMY__ #endif @@ -78,6 +98,7 @@ std::string getPortName( unsigned int portNumber ); protected: + MIDIClientRef getCoreMidiClientSingleton(const std::string& clientName) throw(); void initialize( const std::string& clientName ); }; @@ -97,6 +118,7 @@ void sendMessage( const unsigned char *message, size_t size ); protected: + MIDIClientRef getCoreMidiClientSingleton(const std::string& clientName) throw(); void initialize( const std::string& clientName ); }; @@ -718,10 +740,13 @@ // MIDI input. We convert the system specific time stamps to delta // time values. -// OS-X CoreMIDI header files. -#include <CoreMIDI/CoreMIDI.h> -#include <CoreAudio/HostTime.h> -#include <CoreServices/CoreServices.h> +// OS-X CoreMIDI header files. (<CoreMIDI/CoreMIDI.h> moved to RtMidi.h) + +// these are not available on iOS. +#if (TARGET_OS_IPHONE == 0) + #include <CoreAudio/HostTime.h> + #include <CoreServices/CoreServices.h> +#endif // A structure to hold variables related to the CoreMIDI API // implementation. @@ -734,6 +759,21 @@ MIDISysexSendRequest sysexreq; }; + +static MIDIClientRef CoreMidiClientSingleton = 0; + +void RtMidi_setCoreMidiClientSingleton(MIDIClientRef client){ + CoreMidiClientSingleton = client; +} + +void RtMidi_disposeCoreMidiClientSingleton(){ + if (CoreMidiClientSingleton == 0){ + return; + } + MIDIClientDispose( CoreMidiClientSingleton ); + CoreMidiClientSingleton = 0; +} + //*********************************************************************// // API: OS-X // Class Definitions: MidiInCore @@ -901,24 +941,37 @@ // Cleanup. CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); - MIDIClientDispose( data->client ); if ( data->endpoint ) MIDIEndpointDispose( data->endpoint ); delete data; } +MIDIClientRef MidiInCore::getCoreMidiClientSingleton(const std::string& clientName) throw() { + + if (CoreMidiClientSingleton == 0){ + // Set up our client. + MIDIClientRef client; + + CFStringRef name = CFStringCreateWithCString( NULL, clientName.c_str(), kCFStringEncodingASCII ); + OSStatus result = MIDIClientCreate(name, NULL, NULL, &client ); + if ( result != noErr ) { + std::ostringstream ost; + ost << "MidiInCore::initialize: error creating OS-X MIDI client object (" << result << ")."; + errorString_ = ost.str(); + error( RtMidiError::DRIVER_ERROR, errorString_ ); + return 0; + } + CFRelease( name ); + + CoreMidiClientSingleton = client; + } + + return CoreMidiClientSingleton; +} + void MidiInCore :: initialize( const std::string& clientName ) { // Set up our client. - MIDIClientRef client; - CFStringRef name = CFStringCreateWithCString( NULL, clientName.c_str(), kCFStringEncodingASCII ); - OSStatus result = MIDIClientCreate(name, NULL, NULL, &client ); - if ( result != noErr ) { - std::ostringstream ost; - ost << "MidiInCore::initialize: error creating OS-X MIDI client object (" << result << ")."; - errorString_ = ost.str(); - error( RtMidiError::DRIVER_ERROR, errorString_ ); - return; - } + MIDIClientRef client = getCoreMidiClientSingleton(clientName); // Save our api-specific connection information. CoreMidiData *data = (CoreMidiData *) new CoreMidiData; @@ -926,7 +979,6 @@ data->endpoint = 0; apiData_ = (void *) data; inputData_.apiData = (void *) data; - CFRelease( name ); } void MidiInCore :: openPort( unsigned int portNumber, const std::string &portName ) @@ -962,7 +1014,6 @@ CFRelease( portNameRef ); if ( result != noErr ) { - MIDIClientDispose( data->client ); errorString_ = "MidiInCore::openPort: error creating OS-X MIDI input port."; error( RtMidiError::DRIVER_ERROR, errorString_ ); return; @@ -972,7 +1023,6 @@ MIDIEndpointRef endpoint = MIDIGetSource( portNumber ); if ( endpoint == 0 ) { MIDIPortDispose( port ); - MIDIClientDispose( data->client ); errorString_ = "MidiInCore::openPort: error getting MIDI input source reference."; error( RtMidiError::DRIVER_ERROR, errorString_ ); return; @@ -982,7 +1032,6 @@ result = MIDIPortConnectSource( port, endpoint, NULL ); if ( result != noErr ) { MIDIPortDispose( port ); - MIDIClientDispose( data->client ); errorString_ = "MidiInCore::openPort: error connecting OS-X MIDI input port."; error( RtMidiError::DRIVER_ERROR, errorString_ ); return; @@ -1225,31 +1274,43 @@ // Cleanup. CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); - MIDIClientDispose( data->client ); if ( data->endpoint ) MIDIEndpointDispose( data->endpoint ); delete data; } +MIDIClientRef MidiOutCore::getCoreMidiClientSingleton(const std::string& clientName) throw() { + + if (CoreMidiClientSingleton == 0){ + // Set up our client. + MIDIClientRef client; + + CFStringRef name = CFStringCreateWithCString( NULL, clientName.c_str(), kCFStringEncodingASCII ); + OSStatus result = MIDIClientCreate(name, NULL, NULL, &client ); + if ( result != noErr ) { + std::ostringstream ost; + ost << "MidiInCore::initialize: error creating OS-X MIDI client object (" << result << ")."; + errorString_ = ost.str(); + error( RtMidiError::DRIVER_ERROR, errorString_ ); + return 0; + } + CFRelease( name ); + + CoreMidiClientSingleton = client; + } + + return CoreMidiClientSingleton; +} + void MidiOutCore :: initialize( const std::string& clientName ) { // Set up our client. - MIDIClientRef client; - CFStringRef name = CFStringCreateWithCString( NULL, clientName.c_str(), kCFStringEncodingASCII ); - OSStatus result = MIDIClientCreate(name, NULL, NULL, &client ); - if ( result != noErr ) { - std::ostringstream ost; - ost << "MidiInCore::initialize: error creating OS-X MIDI client object (" << result << ")."; - errorString_ = ost.str(); - error( RtMidiError::DRIVER_ERROR, errorString_ ); - return; - } + MIDIClientRef client = getCoreMidiClientSingleton(clientName); // Save our api-specific connection information. CoreMidiData *data = (CoreMidiData *) new CoreMidiData; data->client = client; data->endpoint = 0; apiData_ = (void *) data; - CFRelease( name ); } unsigned int MidiOutCore :: getPortCount() @@ -1312,7 +1373,6 @@ OSStatus result = MIDIOutputPortCreate( data->client, portNameRef, &port ); CFRelease( portNameRef ); if ( result != noErr ) { - MIDIClientDispose( data->client ); errorString_ = "MidiOutCore::openPort: error creating OS-X MIDI output port."; error( RtMidiError::DRIVER_ERROR, errorString_ ); return; @@ -1322,7 +1382,6 @@ MIDIEndpointRef destination = MIDIGetDestination( portNumber ); if ( destination == 0 ) { MIDIPortDispose( port ); - MIDIClientDispose( data->client ); errorString_ = "MidiOutCore::openPort: error getting MIDI output destination reference."; error( RtMidiError::DRIVER_ERROR, errorString_ ); return; @@ -2295,7 +2354,7 @@ void MidiOutAlsa :: sendMessage( const unsigned char *message, size_t size ) { - int result; + long result; AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); unsigned int nBytes = static_cast<unsigned int> (size); if ( nBytes > data->bufferSize ) { @@ -2315,25 +2374,38 @@ } } - snd_seq_event_t ev; - snd_seq_ev_clear( &ev ); - snd_seq_ev_set_source( &ev, data->vport ); - snd_seq_ev_set_subs( &ev ); - snd_seq_ev_set_direct( &ev ); for ( unsigned int i=0; i<nBytes; ++i ) data->buffer[i] = message[i]; - result = snd_midi_event_encode( data->coder, data->buffer, (long)nBytes, &ev ); - if ( result < (int)nBytes ) { - errorString_ = "MidiOutAlsa::sendMessage: event parsing error!"; - error( RtMidiError::WARNING, errorString_ ); - return; - } - // Send the event. - result = snd_seq_event_output( data->seq, &ev ); - if ( result < 0 ) { - errorString_ = "MidiOutAlsa::sendMessage: error sending MIDI message to port."; - error( RtMidiError::WARNING, errorString_ ); - return; + unsigned int offset = 0; + while (offset < nBytes) { + snd_seq_event_t ev; + snd_seq_ev_clear( &ev ); + snd_seq_ev_set_source( &ev, data->vport ); + snd_seq_ev_set_subs( &ev ); + snd_seq_ev_set_direct( &ev ); + result = snd_midi_event_encode( data->coder, data->buffer + offset, + (long)(nBytes - offset), &ev ); + if ( result < 0 ) { + errorString_ = "MidiOutAlsa::sendMessage: event parsing error!"; + error( RtMidiError::WARNING, errorString_ ); + return; + } + + if ( ev.type == SND_SEQ_EVENT_NONE ) { + errorString_ = "MidiOutAlsa::sendMessage: incomplete message!"; + error( RtMidiError::WARNING, errorString_ ); + return; + } + + offset += result; + + // Send the event. + result = snd_seq_event_output( data->seq, &ev ); + if ( result < 0 ) { + errorString_ = "MidiOutAlsa::sendMessage: error sending MIDI message to port."; + error( RtMidiError::WARNING, errorString_ ); + return; + } } snd_seq_drain_output( data->seq ); } @@ -2388,7 +2460,7 @@ return u8str; } -#define RT_SYSEX_BUFFER_SIZE 8096 +#define RT_SYSEX_BUFFER_SIZE 8196 #define RT_SYSEX_BUFFER_COUNT 4 // A structure to hold variables related to the CoreMIDI API diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rtmidi-1.4.7/src/rtmidi/RtMidi.h new/python-rtmidi-1.4.9/src/rtmidi/RtMidi.h --- old/python-rtmidi-1.4.7/src/rtmidi/RtMidi.h 2020-04-14 19:41:00.000000000 +0200 +++ new/python-rtmidi-1.4.9/src/rtmidi/RtMidi.h 2021-04-26 18:45:12.000000000 +0200 @@ -65,6 +65,7 @@ #include <string> #include <vector> + /************************************************************************/ /*! \class RtMidiError \brief Exception handling class for RtMidi. @@ -523,6 +524,7 @@ RtMidiErrorCallback errorCallback_; bool firstErrorOccurred_; void *errorCallbackUserData_; + }; class RTMIDI_DLL_PUBLIC MidiInApi : public MidiApi @@ -626,4 +628,13 @@ inline void RtMidiOut :: sendMessage( const unsigned char *message, size_t size ) { static_cast<MidiOutApi *>(rtapi_)->sendMessage( message, size ); } inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData ); } +#if defined(__APPLE__) || defined(__MACOSX_CORE__) + +#include <CoreMIDI/CoreMIDI.h> + +void RtMidi_setCoreMidiClientSingleton(MIDIClientRef client); +void RtMidi_disposeCoreMidiClientSingleton(); + +#endif /* __APPLE__ */ + #endif