Skip to content

Commit d7069b5

Browse files
committed
feat: update windows opus
1 parent 77fe4d2 commit d7069b5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

interactions/api/voice/opus.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import sys
66
from enum import IntEnum
7+
from pathlib import Path
78
from typing import Any
89

910
import attr
@@ -130,11 +131,17 @@ class Encoder:
130131
def __init__(self) -> None:
131132
if sys.platform == "win32":
132133
architecture = "x64" if sys.maxsize > 32**2 else "x86"
133-
directory = os.path.dirname(os.path.abspath(__file__))
134-
name = os.path.join(directory, "../../bin", f"opus-{architecture}.dll")
134+
directory = Path(__file__).parent.parent.parent
135+
name = directory / f"bin/opus-{architecture}.dll"
136+
if not name.exists():
137+
raise RuntimeError("Could not find opus library.")
138+
name = str(name)
135139
else:
136140
name = ctypes.util.find_library("opus")
137141

142+
if name is None:
143+
raise RuntimeError("Could not find opus library.")
144+
138145
self.lib_opus = ctypes.cdll.LoadLibrary(name)
139146

140147
for func_name, opt in exported_functions.items():

interactions/bin/opus-x64.dll

62.6 KB
Binary file not shown.

interactions/bin/opus-x86.dll

98 KB
Binary file not shown.

0 commit comments

Comments
 (0)