From 0798e53b0e9c60c40ea94c00dcd6a6d9bb9f0e7f Mon Sep 17 00:00:00 2001 From: Anthony Samms Date: Mon, 27 Oct 2025 01:14:53 -0400 Subject: [PATCH] disable all info logs from non game places --- PyTaiko.py | 3 ++- libs/audio.py | 11 ++++++++--- libs/audio/audio.c | 20 ++++++++++++++------ libs/audio/audio.h | 2 ++ libs/video.py | 2 +- scenes/game.py | 2 +- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/PyTaiko.py b/PyTaiko.py index 9a5ba57..aa518fb 100644 --- a/PyTaiko.py +++ b/PyTaiko.py @@ -104,6 +104,7 @@ def main(): current_screen = Screens.LOADING + audio.set_log_level(1) audio.init_audio_device() create_song_db() @@ -134,8 +135,8 @@ def main(): Screens.LOADING: load_screen } target = ray.load_render_texture(screen_width, screen_height) - ray.set_texture_filter(target.texture, ray.TextureFilter.TEXTURE_FILTER_TRILINEAR) ray.gen_texture_mipmaps(target.texture) + ray.set_texture_filter(target.texture, ray.TextureFilter.TEXTURE_FILTER_TRILINEAR) ray.rl_set_blend_factors_separate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE_MINUS_SRC_ALPHA, RL_FUNC_ADD, RL_FUNC_ADD) ray.set_exit_key(ord(global_data.config["keys_1p"]["exit_key"])) diff --git a/libs/audio.py b/libs/audio.py index 366c1c5..c1fc69e 100644 --- a/libs/audio.py +++ b/libs/audio.py @@ -39,6 +39,8 @@ ffi.cdef(""" void *ctxData; } music; + void set_log_level(int level); + // Device management void list_host_apis(void); void init_audio_device(PaHostApiIndex host_api, double sample_rate, unsigned long buffer_size); @@ -110,17 +112,17 @@ try: except OSError as e: print(f"Failed to load shared library: {e}") raise - + def get_short_path_name(long_path: str) -> str: """Convert long path to Windows short path (8.3 format)""" if platform.system() != 'Windows': return long_path - + # Get short path name buffer = ctypes.create_unicode_buffer(512) get_short_path = ctypes.windll.kernel32.GetShortPathNameW ret = get_short_path(long_path, buffer, 512) - + if ret: return buffer.value return long_path @@ -141,6 +143,9 @@ class AudioEngine: self.sounds_path = Path("Sounds") + def set_log_level(self, level: int): + lib.set_log_level(level) # type: ignore + def list_host_apis(self): """Prints a list of available host APIs to the console""" lib.list_host_apis() # type: ignore diff --git a/libs/audio/audio.c b/libs/audio/audio.c index 5ea4dd8..fb00fcc 100644 --- a/libs/audio/audio.c +++ b/libs/audio/audio.c @@ -24,13 +24,21 @@ #define LOG_WARNING 1 #define LOG_ERROR 2 +static int CURRENT_LOG_LEVEL = LOG_INFO; + +void set_log_level(int level) { + CURRENT_LOG_LEVEL = level; +} + #define TRACELOG(level, ...) do { \ - const char* level_str = (level == LOG_INFO) ? "INFO" : \ - (level == LOG_WARNING) ? "WARNING" : "ERROR"; \ - printf("[%s] AUDIO: ", level_str); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - fflush(stdout); \ + if (level >= CURRENT_LOG_LEVEL) { \ + const char* level_str = (level == LOG_INFO) ? "INFO" : \ + (level == LOG_WARNING) ? "WARNING" : "ERROR"; \ + printf("[%s] AUDIO: ", level_str); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + fflush(stdout); \ + } \ } while(0) #define FREE(ptr) do { if (ptr) { free(ptr); (ptr) = NULL; } } while(0) diff --git a/libs/audio/audio.h b/libs/audio/audio.h index bbbb1f6..bbd61a3 100644 --- a/libs/audio/audio.h +++ b/libs/audio/audio.h @@ -67,6 +67,8 @@ typedef struct music { void *ctxData; // Internal context data (file handle, decoder state, etc.) } music; +void set_log_level(int level); + // ============================================================================= // DEVICE MANAGEMENT // ============================================================================= diff --git a/libs/video.py b/libs/video.py index 86b3627..82f85ad 100644 --- a/libs/video.py +++ b/libs/video.py @@ -13,7 +13,7 @@ class VideoPlayer: self.is_finished_list = [False, False] self.video = VideoFileClip(path) if self.video.audio is not None: - self.video.audio.write_audiofile("cache/temp_audio.wav") + self.video.audio.write_audiofile("cache/temp_audio.wav", logger=None) self.audio = audio.load_music_stream(Path("cache/temp_audio.wav"), 'video') self.buffer_size = 10 # Number of frames to keep in memory diff --git a/scenes/game.py b/scenes/game.py index d405aed..4aae4ac 100644 --- a/scenes/game.py +++ b/scenes/game.py @@ -48,7 +48,7 @@ class GameScreen: self.end_ms = 0 self.start_delay = 1000 self.song_started = False - self.mask_shader = ray.load_shader("", "shader/mask.fs") + self.mask_shader = ray.load_shader("shader/outline.vs", "shader/mask.fs") def load_hitsounds(self): """Load the hit sounds"""