hot fixes

This commit is contained in:
Anthony Samms
2025-09-15 14:04:08 -04:00
parent 9f454fbed3
commit cfc58dd75f
2 changed files with 19 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
import cffi
import platform
from pathlib import Path
from typing import Optional
import numpy as np
@@ -103,14 +104,27 @@ ffi.cdef("""
""")
# Load the compiled C library
# You'll need to compile your C code into a shared library first
# gcc -shared -fPIC -o libaudio.so audio.c -lportaudio -lsndfile -lpthread
try:
lib = ffi.dlopen("libs/audio_c/libaudio.so") # Adjust path as needed
if platform.system() == "Windows":
lib = ffi.dlopen("libaudio.dll") # or "libaudio.dll" if that's the compiled name
elif platform.system() == "Darwin":
lib = ffi.dlopen("libaudio.dylib")
else: # Assume Linux/Unix
lib = ffi.dlopen("libaudio.so")
except OSError as e:
print(f"Failed to load libaudio.so: {e}")
print("Make sure to compile your C code first:")
print(f"Failed to load shared library: {e}")
print("Make sure to compile your C code first.")
if platform.system() == "Linux":
print("Example:")
print("gcc -shared -fPIC -o libaudio.so audio.c -lportaudio -lsndfile -lpthread")
elif platform.system() == "Windows":
print("On Windows, make sure you've built a DLL with MinGW or MSVC:")
print("Example with MinGW:")
print("gcc -shared -o libaudio.dll audio.c -lportaudio -lsndfile -lpthread")
elif platform.system() == "Darwin":
print("On macOS:")
print("gcc -dynamiclib -o libaudio.dylib audio.c -lportaudio -lsndfile -lpthread")
raise
class AudioEngine:

View File

@@ -1,5 +1,4 @@
import pyray as ray
import sounddevice as sd
from libs.audio import audio
from libs.utils import (
@@ -76,16 +75,8 @@ class SettingsScreen:
"""Cycle through predefined string values"""
current_value = self.config[section][key]
hostapis = sd.query_hostapis()
audio_devices = []
if isinstance(hostapis, tuple):
for api in hostapis:
if isinstance(api, dict):
audio_devices.append(api['name'])
options = {
'language': ['ja', 'en'],
'device_type': audio_devices
}
if key in options: