mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 04:49:57 -04:00
Capture the default microphone for Ocarina input streams
This commit is contained in:
31
tests/audio_input_check.py
Normal file
31
tests/audio_input_check.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Build and run the input-audio regression checks without game files or recording hardware.
|
||||
|
||||
Windows: python tests/audio_input_check.py --toolchain C:/msys64/ucrt64
|
||||
Linux: python tests/audio_input_check.py (clang and SDL3 development files via pkg-config)
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
ap = argparse.ArgumentParser(description=__doc__)
|
||||
ap.add_argument('--toolchain', type=Path)
|
||||
a = ap.parse_args()
|
||||
out = root / 'build' / 'audio-input-check'
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
env = dict(os.environ)
|
||||
if a.toolchain:
|
||||
env['PATH'] = str(a.toolchain / 'bin') + os.pathsep + env.get('PATH', '')
|
||||
cc = str(a.toolchain / 'bin' / 'clang.exe')
|
||||
flags = ['-L', str(a.toolchain / 'lib'), '-lSDL3']
|
||||
else:
|
||||
cc = shutil.which('clang') or 'cc'
|
||||
flags = shlex.split(subprocess.check_output(['pkg-config', '--cflags', '--libs', 'sdl3'], text=True))
|
||||
exe = out / ('audio-input-check.exe' if os.name == 'nt' else 'audio-input-check')
|
||||
subprocess.run([cc, '-std=gnu11', '-O2', '-fno-strict-aliasing', '-Wall', '-Wextra', '-Werror',
|
||||
'-I', str(root / 'runtime'), str(root / 'tests' / 'audio_input_check.c'),
|
||||
'-o', str(exe), *flags], env=env, check=True)
|
||||
subprocess.run([str(exe)], env=env, timeout=15, check=True)
|
||||
Reference in New Issue
Block a user