Skip to content

Commit 9e55e73

Browse files
authored
Fix architecture detection on Windows ARM64 (#631)
1 parent e8e7bef commit 9e55e73

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎.github/workflows/sounddevice-data.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
arch: 'x86'
1717
- os: windows-11-arm
1818
arch: 'arm64'
19+
- os: windows-11-arm
20+
arch: 'x64'
1921
runs-on: ${{ matrix.os }}
2022
steps:
2123
- name: Set up Python
@@ -25,7 +27,7 @@ jobs:
2527
architecture: ${{ matrix.arch }}
2628
- name: Double-check Python version
2729
run: |
28-
python --version
30+
python --version --version
2931
- name: Clone Git repository (with submodules)
3032
uses: actions/checkout@v7
3133
with:
@@ -36,6 +38,7 @@ jobs:
3638
run: |
3739
python -m pip install .
3840
- name: Import module
41+
shell: bash
3942
run: |
4043
python -m sounddevice
4144
python -c "import sounddevice as sd; print(sd._libname)"
@@ -45,6 +48,7 @@ jobs:
4548
python -c "import sounddevice as sd; assert not any(a['name'] == 'ASIO' for a in sd.query_hostapis())"
4649
- name: Import module (using the ASIO DLL)
4750
if: startsWith(matrix.os, 'windows')
51+
shell: bash
4852
env:
4953
SD_ENABLE_ASIO: 1
5054
run: |

‎setup.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import platform
3+
import sysconfig
34
from setuptools import setup
45

56
MACOSX_VERSIONS = '.'.join([
@@ -11,7 +12,8 @@
1112
system = os.environ.get('PYTHON_SOUNDDEVICE_PLATFORM', platform.system())
1213
machine = platform.machine().lower()
1314
architecture0 = os.environ.get('PYTHON_SOUNDDEVICE_ARCHITECTURE',
14-
'arm64' if machine in ['arm64', 'aarch64'] else platform.architecture()[0])
15+
'arm64' if 'arm64' in sysconfig.get_platform() or 'aarch64' in sysconfig.get_platform()
16+
else platform.architecture()[0])
1517

1618
if system == 'Darwin':
1719
libname = 'libportaudio.dylib'

‎src/sounddevice.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import os as _os
5656
import platform as _platform
5757
import sys as _sys
58+
import sysconfig as _sysconfig
5859
from ctypes.util import find_library as _find_library
5960
from _sounddevice import ffi as _ffi
6061

@@ -75,7 +76,7 @@
7576
if _platform.system() == 'Darwin':
7677
_libname = 'libportaudio.dylib'
7778
elif _platform.system() == 'Windows':
78-
if _platform.machine().lower() in ('arm64', 'aarch64'):
79+
if 'arm64' in _sysconfig.get_platform() or 'aarch64' in _sysconfig.get_platform():
7980
_platform_suffix = 'arm64'
8081
else:
8182
_platform_suffix = _platform.architecture()[0]

0 commit comments

Comments
 (0)