diff --git a/.github/workflows/pr_to_master.yml b/.github/workflows/pr_to_master.yml index 82bb2f58..377fff3b 100644 --- a/.github/workflows/pr_to_master.yml +++ b/.github/workflows/pr_to_master.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -28,9 +28,11 @@ jobs: run: pipx run twine check --strict dist/* - name: Upload sdist - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: sdist path: dist/*.tar.gz + compression-level: 0 build_wheels: name: Build wheels on ${{ matrix.os }} @@ -38,64 +40,29 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - uses: ilammy/msvc-dev-cmd@v1 if: matrix.os == 'windows-latest' - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: | - 3.9 - 3.10 - 3.11 - 3.12 - pypy3.9 - pypy3.10 - - name: Build wheels - uses: pypa/cibuildwheel@v2.16 + uses: pypa/cibuildwheel@v4.2.1 env: # Skip trying to test arm64 builds on Intel Macs CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64" - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - path: wheelhouse/*.whl - - build_arch_wheels: - name: Build wheels on Linux ${{ matrix.arch }} - runs-on: ubuntu-20.04 - strategy: - matrix: - arch: [aarch64] - steps: - - - uses: actions/checkout@v3 - with: - submodules: true - - - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - - name: Build wheels - uses: pypa/cibuildwheel@v2.16 - env: - CIBW_ARCHS: ${{ matrix.arch }} - - name: Verify clean directory run: git diff --exit-code shell: bash - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: bdist-${{ matrix.os }} path: wheelhouse/*.whl + compression-level: 0 diff --git a/.github/workflows/push_to_master.yml b/.github/workflows/push_to_master.yml index 16e27655..dd71041e 100644 --- a/.github/workflows/push_to_master.yml +++ b/.github/workflows/push_to_master.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -28,9 +28,11 @@ jobs: run: pipx run twine check --strict dist/* - name: Upload sdist - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: sdist path: dist/*.tar.gz + compression-level: 0 build_wheels: name: Build wheels on ${{ matrix.os }} @@ -38,84 +40,47 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - uses: ilammy/msvc-dev-cmd@v1 if: matrix.os == 'windows-latest' - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: | - 3.9 - 3.10 - 3.11 - 3.12 - pypy3.9 - pypy3.10 - - name: Build wheels - uses: pypa/cibuildwheel@v2.16 + uses: pypa/cibuildwheel@v4.2.1 env: # Skip trying to test arm64 builds on Intel Macs CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64" - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - path: wheelhouse/*.whl - - build_arch_wheels: - name: Build wheels on Linux ${{ matrix.arch }} - runs-on: ubuntu-20.04 - strategy: - matrix: - arch: [aarch64] - steps: - - - uses: actions/checkout@v3 - with: - submodules: true - - - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - - name: Build wheels - uses: pypa/cibuildwheel@v2.16 - env: - CIBW_ARCHS: ${{ matrix.arch }} - - name: Verify clean directory run: git diff --exit-code shell: bash - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: bdist-${{ matrix.os }} path: wheelhouse/*.whl + compression-level: 0 upload_pypi: - needs: [build_arch_wheels, build_wheels, build_sdist] + needs: [build_wheels, build_sdist] runs-on: ubuntu-latest environment: PyPI release if: github.ref == 'refs/heads/develop' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - # unpacks default artifact into dist/ - # if `name: artifact` is omitted, the action will create extra parent dir - name: artifact path: dist + merge-multiple: true - name: Publish distribution to Test PyPI - uses: pypa/gh-action-pypi-publish@v1.8.6 + uses: pypa/gh-action-pypi-publish@release/v1 with: skip_existing: true user: __token__ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dbad2474..d04ca973 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -32,91 +32,56 @@ jobs: run: pipx run twine check --strict dist/* - name: Upload sdist - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: sdist path: dist/*.tar.gz + compression-level: 0 build_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v with: submodules: true - uses: ilammy/msvc-dev-cmd@v1 if: matrix.os == 'windows-latest' - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: | - 3.9 - 3.10 - 3.11 - 3.12 - pypy3.9 - pypy3.10 - - name: Build wheels - uses: pypa/cibuildwheel@v2.16 + uses: pypa/cibuildwheel@v4.2.1 env: # Skip trying to test arm64 builds on Intel Macs CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64" - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - path: wheelhouse/*.whl - - build_arch_wheels: - name: Build wheels on Linux ${{ matrix.arch }} - runs-on: ubuntu-20.04 - strategy: - matrix: - arch: [aarch64] - steps: - - - uses: actions/checkout@v3 - with: - submodules: true - - - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - - name: Build wheels - uses: pypa/cibuildwheel@v2.16 - env: - CIBW_ARCHS: ${{ matrix.arch }} - - name: Verify clean directory run: git diff --exit-code shell: bash - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: bdist-${{ matrix.os }} path: wheelhouse/*.whl + compression-level: 0 upload_pypi: - needs: [build_arch_wheels, build_wheels, build_sdist] + needs: [build_wheels, build_sdist] runs-on: ubuntu-latest environment: PyPI release steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - # unpacks default artifact into dist/ - # if `name: artifact` is omitted, the action will create extra parent dir - name: artifact path: dist + merge-multiple: true - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.6 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/AUTHORS.md b/AUTHORS.md index 9e38a1d1..1e5cd9ff 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -19,6 +19,7 @@ - Benoit Pierre - Bruno Enten - Marek Szuba +- s0600204 (GitHub user) ## Testing diff --git a/CHANGELOG.md b/CHANGELOG.md index d18fe7ed..557a2279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,31 @@ For details and minor changes, please see the [version control log messages](https://github.com/SpotlightKid/python-rtmidi/commits/master). +## 1.6.0 (2025-04-18) + +Project infrastructure: + +- Support Python 3.13, drop support for Python 3.8 (#214): +- Set minimum required Python version 3.9 in `pyproject.toml`. +- Added Python 3.13 to CI builds and removed 3.8. +- Added Python 3.13 to classifiers in `pyproject.toml` and removed 3.8. +- Added Python 3.13 to `tox.ini` and removed 3.8. +- Updated minimum supported Python version mentioned in readme etc. +- Updated latest Python version mentioned in Windows install docs. +- Fixed compiler config in meson.build for alternative compilers on + Windows (#213, thanks @s0600204). +- Updated dev requirements with `pip-tools` (#215). + +Changes: + +- Update rtmidi sub-module's `python-rtmidi` branch to be based on latest + HEAD of `master` branch (fixes #204). + +Fixes / Features: + +- Add `set_buffer_size` method to `MidiIn` class (fixes #200). + + ## 1.5.8 (2023-11-20) Fixes: diff --git a/INSTALL-windows.md b/INSTALL-windows.md index 4debd572..674ca290 100644 --- a/INSTALL-windows.md +++ b/INSTALL-windows.md @@ -1,7 +1,7 @@ # How to install python-rtmidi from source on Windows These instructions should work for installing `python-rtmidi` from source with -Python 3.8+ in the 64-bit or 32-bit versions (you can run the latter on Windows +Python 3.9+ in the 64-bit or 32-bit versions (you can run the latter on Windows 64-bit versions with no problems). Please follow all the steps below in the exact order. @@ -10,8 +10,8 @@ Please follow all the steps below in the exact order. You probably need administrator rights for some or all of the following steps. -1. Install the latest release of Python (3.12 at the time of writing, at least - 3.8+) from to the default +1. Install the latest release of Python (3.13 at the time of writing, at least + 3.9+) from to the default location (e.g. `C:\Python312`). You can install either or both the 32-bit and the 64-bit version. diff --git a/README.md b/README.md index 7460de95..504e7311 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Windows (MultiMedia System) operating systems. provides a thin wrapper around the RtMidi C++ interface. The API is basically the same as the C++ one but with the naming scheme of classes, methods and parameters adapted to the Python PEP-8 conventions and requirements of the -Python package naming structure. **python-rtmidi** supports Python 3 (3.8+). +Python package naming structure. **python-rtmidi** supports Python 3 (3.9+). The [documentation] provides installation instructions, a history of changes per release and an API reference. diff --git a/examples/advanced/send_all.py b/examples/advanced/send_all.py index b6a6d3c1..cdd06025 100644 --- a/examples/advanced/send_all.py +++ b/examples/advanced/send_all.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Send all notes and CCs with all possible values an all 16 channels.""" +"""Send all notes and CCs with all possible values on all 16 channels.""" import argparse import logging @@ -60,12 +60,13 @@ for chan in channels: for note in range(128): log.debug( - f"Sending NOTE ON: ch={chan+1:02}, note={note:03}, vel={args.velocity:03}" + f"Sending NOTE ON: ch={chan + 1:02}, note={note:03}, vel={args.velocity:03}" ) midiout.send_message([NOTE_ON | chan, note, args.velocity]) time.sleep(args.delay) log.debug( - f"Sending NOTE OFF: ch={chan+1:02}, note={note:03}, vel={args.off_velocity:03}" + f"Sending NOTE OFF: ch={chan + 1:02}, " + f"note={note:03}, vel={args.off_velocity:03}" ) midiout.send_message([NOTE_OFF | chan, note, args.off_velocity]) time.sleep(args.delay) @@ -73,7 +74,7 @@ for chan in channels: for cc in range(128): for val in range(128): - log.debug(f"Sending CONTROL_CHANGE: ch={chan+1:02}, cc={cc:03}, val={val:03}") + log.debug(f"Sending CONTROL_CHANGE: ch={chan + 1:02}, cc={cc:03}, val={val:03}") midiout.send_message([CONTROL_CHANGE | chan, cc, val]) time.sleep(args.delay) except (EOFError, KeyboardInterrupt): diff --git a/examples/joystick/joystick2midi.py b/examples/joystick/joystick2midi.py index 5f72235e..c3a0a009 100644 --- a/examples/joystick/joystick2midi.py +++ b/examples/joystick/joystick2midi.py @@ -75,9 +75,9 @@ def update(self, value, threshold): while not done: # Possible joystick actions: JOYAXISMOTION, JOYBALLMOTION, JOYBUTTONDOWN, # JOYBUTTONUP, JOYHATMOTION - for event in pygame.event.get(): # User did something. - if event.type == pygame.QUIT: # If user clicked close. - done = True # Flag that we are done so we exit this loop. + for event in pygame.event.get(): # User did something. + if event.type == pygame.QUIT: # If user clicked close. + done = True # Flag that we are done so we exit this loop. elif event.type == pygame.JOYBUTTONUP: print("Joystick button {} released.".format(event.button)) if event.button == 2: # 'X' button @@ -104,7 +104,6 @@ def update(self, value, threshold): print("SEND: {!r}".format(msg)) midiout.send_message(msg) - # Limit poll rate to UPDATES_PER_SECOND. clock.tick(UPDATES_PER_SECOND) except KeyboardInterrupt: diff --git a/meson.build b/meson.build index d748e2f7..f1efb3cd 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'python-rtmidi', 'cpp', - version: '1.5.8', + version: '1.6.0', license: 'MIT', default_options: [ 'warning_level=2', @@ -55,7 +55,7 @@ elif host_machine.system().to_lower() == 'darwin' # API coremidi_dep = dependency( 'appleframeworks', - modules: ['coreaudio', 'coremidi', 'foundation'], + modules: ['CoreAudio', 'CoreMIDI', 'Foundation'], required: jack_not_found ) alsa_dep = disabler() diff --git a/pyproject.toml b/pyproject.toml index e28c53f3..88dcde00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,11 +28,13 @@ classifiers = [ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Topic :: Multimedia :: Sound/Audio :: MIDI", "Topic :: Software Development :: Libraries :: Python Modules", ] @@ -63,11 +65,11 @@ file = "LICENSE.md" [tool.black] line-length = 99 target-version = [ - "py38", "py39", "py310", "py311", "py312", + "py313", ] [tool.isort] @@ -96,10 +98,11 @@ manylinux-aarch64-image = "manylinux_2_28" test-requires = "pytest" test-command = "pytest -v -m ci {package}/tests" -# Install system library [tool.cibuildwheel.linux] -build = ["cp3{9,10,11,12}-manylinux*", "pp3{9,10}-manylinux*"] +build = ["cp3{9,10,11,12,13,14,15}-manylinux*", "pp3{9,10,11}-manylinux*"] archs = ["auto64"] +enable = ["pypy", "pypy-eol"] +# Install system libraries before-all = [ "dnf -y install alsa-lib-devel alsa-utils", "curl -o jack2-1.9.22.tar.gz https://codeload.github.com/jackaudio/jack2/tar.gz/refs/tags/v1.9.22", @@ -112,9 +115,9 @@ before-all = [ repair-wheel-command = "auditwheel repair --exclude libasound.so.2 --lib-sdir . -w {dest_dir} {wheel}" [tool.cibuildwheel.macos] -build = "cp3{9,10,11,12}-macosx*" +build = "cp3{9,10,11,12,13,14,15}-macosx*" archs = ["x86_64", "arm64"] [tool.cibuildwheel.windows] -build = "cp3{9,10,11,12}-win*" +build = "cp3{9,10,11,12,13,14,15}-win*" archs = ["AMD64"] diff --git a/requirements-dev.txt b/requirements-dev.txt index c382aac5..9966b550 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,51 +1,57 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile --no-emit-index-url --strip-extras requirements-dev.in # alabaster==0.7.16 # via sphinx -babel==2.14.0 +babel==2.17.0 # via sphinx -build==1.2.1 +build==1.2.2.post1 # via pip-tools -cachetools==5.3.3 +cachetools==5.5.1 # via tox -certifi==2024.2.2 +certifi==2025.1.31 # via requests chardet==5.2.0 # via tox -charset-normalizer==3.3.2 +charset-normalizer==3.4.1 # via requests -click==8.1.7 +click==8.1.8 # via pip-tools colorama==0.4.6 # via tox -coverage==7.4.4 +coverage==7.6.11 # via -r requirements-dev.in -cython==3.0.10 +cython==3.0.11 # via -r requirements-dev.in -distlib==0.3.8 +distlib==0.3.9 # via virtualenv -docutils==0.20.1 +docutils==0.21.2 # via # myst-parser # sphinx # sphinx-rtd-theme -filelock==3.13.4 +exceptiongroup==1.3.1 + # via pytest +filelock==3.17.0 # via # tox # virtualenv -flake8==7.0.0 +flake8==7.1.1 # via -r requirements-dev.in -idna==3.7 +idna==3.10 # via requests imagesize==1.4.1 # via sphinx +importlib-metadata==8.7.1 + # via + # build + # sphinx iniconfig==2.0.0 # via pytest -jinja2==3.1.3 +jinja2==3.1.6 # via # myst-parser # sphinx @@ -53,87 +59,103 @@ markdown-it-py==3.0.0 # via # mdit-py-plugins # myst-parser -markupsafe==2.1.5 +markupsafe==3.0.2 # via jinja2 mccabe==0.7.0 # via flake8 -mdit-py-plugins==0.4.0 +mdit-py-plugins==0.4.2 # via myst-parser mdurl==0.1.2 # via markdown-it-py -myst-parser==2.0.0 +myst-parser==3.0.1 # via -r requirements-dev.in -packaging==24.0 +packaging==24.2 # via # build # pyproject-api # pytest # sphinx # tox + # wheel pip-tools==7.4.1 # via -r requirements-dev.in -platformdirs==4.2.0 +platformdirs==4.3.6 # via # tox # virtualenv -pluggy==1.4.0 +pluggy==1.5.0 # via # pytest # tox -pycodestyle==2.11.1 +pycodestyle==2.12.1 # via flake8 pydocstyle==6.3.0 # via -r requirements-dev.in pyflakes==3.2.0 # via flake8 -pygments==2.17.2 +pygments==2.19.1 # via sphinx -pyproject-api==1.6.1 +pyproject-api==1.9.0 # via tox -pyproject-hooks==1.0.0 +pyproject-hooks==1.2.0 # via # build # pip-tools -pytest==8.1.1 +pytest==8.3.4 # via -r requirements-dev.in -pyyaml==6.0.1 +pyyaml==6.0.2 # via myst-parser -requests==2.31.0 +requests==2.32.3 # via sphinx snowballstemmer==2.2.0 # via # pydocstyle # sphinx -sphinx==7.2.6 +sphinx==7.4.7 # via # -r requirements-dev.in # myst-parser # sphinx-rtd-theme # sphinxcontrib-jquery -sphinx-rtd-theme==2.0.0 +sphinx-rtd-theme==3.0.2 # via -r requirements-dev.in -sphinxcontrib-applehelp==1.0.8 +sphinxcontrib-applehelp==2.0.0 # via sphinx -sphinxcontrib-devhelp==1.0.6 +sphinxcontrib-devhelp==2.0.0 # via sphinx -sphinxcontrib-htmlhelp==2.0.5 +sphinxcontrib-htmlhelp==2.1.0 # via sphinx sphinxcontrib-jquery==4.1 # via sphinx-rtd-theme sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.7 +sphinxcontrib-qthelp==2.0.0 # via sphinx -sphinxcontrib-serializinghtml==1.1.10 +sphinxcontrib-serializinghtml==2.0.0 # via sphinx -tox==4.14.2 +tomli==2.4.0 + # via + # build + # pip-tools + # pyproject-api + # pytest + # sphinx + # tox +tox==4.24.1 # via -r requirements-dev.in -urllib3==2.2.1 +typing-extensions==4.15.0 + # via + # exceptiongroup + # myst-parser + # tox +urllib3==2.3.0 # via requests -virtualenv==20.25.1 +virtualenv==20.29.1 # via tox -wheel==0.43.0 +wheel==0.46.2 # via pip-tools +zipp==3.23.0 + # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/rtmidi/meson.build b/rtmidi/meson.build index f96a95c2..42585d2a 100644 --- a/rtmidi/meson.build +++ b/rtmidi/meson.build @@ -26,7 +26,7 @@ endif if winmm_support defines += ['-D__WINDOWS_MM__'] - if meson.get_compiler('cpp').get_id() != 'gcc' + if meson.get_compiler('cpp').get_argument_syntax() == 'msvc' defines += ['/EHsc'] endif dependencies += [winmm_dep] diff --git a/rtmidi/midiutil.py b/rtmidi/midiutil.py index ccb03f47..b695efd0 100644 --- a/rtmidi/midiutil.py +++ b/rtmidi/midiutil.py @@ -70,7 +70,7 @@ def list_available_ports(ports=None, midiio=None): """List MIDI ports given or available on given MIDI I/O instance.""" if ports is None: ports = midiio.get_ports() - type_ = " input" if isinstance(midiio, rtmidi.MidiIn) else " ouput" + type_ = " input" if isinstance(midiio, rtmidi.MidiIn) else " output" else: type_ = '' diff --git a/src/_rtmidi.pyx b/src/_rtmidi.pyx index 3019ffe8..00c9e5ca 100644 --- a/src/_rtmidi.pyx +++ b/src/_rtmidi.pyx @@ -19,7 +19,7 @@ and Windows (MultiMedia System) operating systems. provides a thin wrapper around the RtMidi C++ interface. The API is basically the same as the C++ one but with the naming scheme of classes, methods and parameters adapted to the Python PEP-8 conventions and requirements of the -Python package naming structure. **python-rtmidi** supports Python 3 (3.8+). +Python package naming structure. **python-rtmidi** supports Python 3 (3.9+). Usage example @@ -194,6 +194,7 @@ cdef extern from "RtMidi.h": double getMessage(vector[unsigned char] *message) except * void ignoreTypes(bool midiSysex, bool midiTime, bool midiSense) except * void setCallback(RtMidiCallback callback, void *data) except * + void setBufferSize(unsigned int size, unsigned int count) except * cdef cppclass RtMidiOut(RtMidi): Api RtMidiOut(Api rtapi, string clientName) except + @@ -923,14 +924,8 @@ cdef class MidiIn(MidiBase): buffer overflows. **Windows note:** the Windows Multi Media API uses fixed size buffers - for the reception of sysex messages, whose number and size is set at - compile time. Sysex messages longer than the buffer size can not be - received properly when using the Windows Multi Media API. - - The default distribution of python-rtmidi sets the number of sysex - buffers to four and the size of each to 8192 bytes. To change these - values, edit the ``RT_SYSEX_BUFFER_COUNT`` and ``RT_SYSEX_BUFFER_SIZE`` - preprocessor defines in ``RtMidi.cpp`` and recompile. + for the reception of sysex messages. You can change the number and + size of the buffers with the ``set_buffer_size`` method. """ self.thisptr.ignoreTypes(sysex, timing, active_sense) @@ -960,6 +955,10 @@ cdef class MidiIn(MidiBase): self._callback = (func, data) self.thisptr.setCallback(&_cb_func, self._callback) + def set_buffer_size(self, size, count): + """Set the size and number of MIDI input buffers.""" + self.thisptr.setBufferSize(size, count) + cdef class MidiOut(MidiBase): """Midi output client interface. diff --git a/src/rtmidi b/src/rtmidi index f6ea40d4..8cae607d 160000 --- a/src/rtmidi +++ b/src/rtmidi @@ -1 +1 @@ -Subproject commit f6ea40d406affaed540d16c54372a0230a84f22b +Subproject commit 8cae607d5e9a04f888e5f78699d6a1bbae26688a diff --git a/tests/test_basic.py b/tests/test_basic.py index 60360845..b9716465 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -53,7 +53,7 @@ def test_get_compiled_api_by_name(self): def test_get_rtmidi_version(self): version = rtmidi.get_rtmidi_version() self.assertTrue(isinstance(version, str)) - self.assertEqual(version, '5.0.0') + self.assertEqual(version, '6.0.0') def test_nondummy_api_present(self): # Make sure at least one actual API has been compiled diff --git a/tests/test_rtmidi.py b/tests/test_rtmidi.py index 66273603..5f32acbb 100644 --- a/tests/test_rtmidi.py +++ b/tests/test_rtmidi.py @@ -120,6 +120,10 @@ def callback(event, data): time.sleep(self.DELAY) self.assertEqual(messages, []) + def test_set_buffer_size(self): + self.midi_in.set_buffer_size(1024, 4) + self.test_callback() + def set_up_loopback(self): # TODO: find better solution than this hack-ish strategy to find out # the port number of the virtual output port, which we have to use, diff --git a/tox.ini b/tox.ini index 41a5501f..f62856e7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = flake8, py38, py39, py310, py311, py312 +envlist = flake8, py39, py310, py311, py312, py313, py314, py315 skip_missing_interpreters = True isolated_build = True