fix bad commit I just made

This commit is contained in:
Yonokid
2025-05-02 00:22:05 -04:00
parent 2fda744f9b
commit 08394cf97a
2 changed files with 13 additions and 8 deletions

View File

@@ -7,7 +7,9 @@ from threading import Lock, Thread
import pyray as ray
from numpy import (
abs,
abs as np_abs,
)
from numpy import (
column_stack,
float32,
frombuffer,
@@ -17,6 +19,9 @@ from numpy import (
uint8,
zeros,
)
from numpy import (
max as np_max,
)
os.environ["SD_ENABLE_ASIO"] = "1"
import sounddevice as sd
@@ -550,7 +555,7 @@ class ASIOEngine:
output *= self.master_volume
# Apply simple limiter to prevent clipping
max_val = max(abs(output))
max_val = np_max(np_abs(output))
if max_val > 1.0:
output = output / max_val

View File

@@ -1,5 +1,5 @@
import cv2
import pyray as ray
from cv2 import CAP_PROP_FPS, COLOR_BGR2RGB, VideoCapture, cvtColor
from libs.audio import audio
from libs.utils import get_current_ms
@@ -13,8 +13,8 @@ class VideoPlayer:
self.last_frame = self.current_frame
self.frame_index = 0
self.frames = []
self.cap = cv2.VideoCapture(self.video_path)
self.fps = self.cap.get(cv2.CAP_PROP_FPS)
self.cap = VideoCapture(self.video_path)
self.fps = self.cap.get(CAP_PROP_FPS)
self.is_finished_list = [False, False, False] # Added third flag for frame conversion
self.all_frames_converted = False
audio_path = path[:-4] + '.ogg'
@@ -32,7 +32,7 @@ class VideoPlayer:
success, frame = self.cap.read()
while success:
timestamp = (frame_count / self.fps * 1000)
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
frame_rgb = cvtColor(frame, COLOR_BGR2RGB)
new_frame = ray.Image(frame_rgb.tobytes(), frame_rgb.shape[1], frame_rgb.shape[0], 1, ray.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R8G8B8)
self.frames.append((timestamp, new_frame))
success, frame = self.cap.read()
@@ -50,7 +50,7 @@ class VideoPlayer:
return
if not self.cap.isOpened():
self.cap = cv2.VideoCapture(self.video_path)
self.cap = VideoCapture(self.video_path)
if not self.cap.isOpened():
raise ValueError("Error: Could not open video file.")
@@ -58,7 +58,7 @@ class VideoPlayer:
success, frame = self.cap.read()
if success:
timestamp = (len(self.frames) / self.fps * 1000)
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
frame_rgb = cvtColor(frame, COLOR_BGR2RGB)
new_frame = ray.Image(frame_rgb.tobytes(), frame_rgb.shape[1], frame_rgb.shape[0], 1, ray.PixelFormat.PIXELFORMAT_UNCOMPRESSED_R8G8B8)
self.frames.append((timestamp, new_frame))
else: