diff --git a/tools/audio_player.py b/tools/audio_player.py index b88d0b0..821cb17 100644 --- a/tools/audio_player.py +++ b/tools/audio_player.py @@ -35,7 +35,10 @@ def play(self, data, sr, loop_start, loop_end, msg=None): sd.sleep(100) if msg: if loop_start is None or loop_start is None: - msg(f'■ Press space bar to play') + try: + msg(f'■ Press space bar to play') + except RuntimeError as e: + pass def stop(self, msg=None): if self.is_playing.is_set(): diff --git a/tools/base_tool_UI.py b/tools/base_tool_UI.py index 7fb23e9..a600b31 100644 --- a/tools/base_tool_UI.py +++ b/tools/base_tool_UI.py @@ -315,9 +315,9 @@ def lw_drop_event(self, event): event.ignore() def closeEvent(self, event): - print(f'{self.objectName()} closed') + self.player.stop(msg=None) self.removeEventFilter(self) - self.player.stop() + print(f'{self.objectName()} closed') event.accept() def disable_focus(self): diff --git a/tools/loop_tool_UI.pyw b/tools/loop_tool_UI.pyw index ac5a718..185b945 100644 --- a/tools/loop_tool_UI.pyw +++ b/tools/loop_tool_UI.pyw @@ -24,12 +24,13 @@ from pathlib import Path from PyQt5 import QtGui, QtCore -import UI.loop_tool as gui import loop_sample as ls from audio_player import play_notification from base_tool_UI import BaseToolUi, launch from common_ui_utils import add_ctx, resource_path from sample_utils import Sample +# import UI.loop_tool as gui +from tools.UI import loop_tool as gui # from simple_logger import SimpleLogger diff --git a/tools/rename_tool_UI.pyw b/tools/rename_tool_UI.pyw index ffff16f..7d9f087 100644 --- a/tools/rename_tool_UI.pyw +++ b/tools/rename_tool_UI.pyw @@ -33,7 +33,9 @@ from pathlib import Path from PyQt5 import QtWidgets, QtGui, Qt, QtCore -import UI.rename_tool as gui +# import UI.rename_tool as gui +from tools.UI import rename_tool as gui + import sample_utils as st from audio_player import play_notification from base_tool_UI import BaseToolUi, launch diff --git a/tools/smp2ds_UI.pyw b/tools/smp2ds_UI.pyw index 67d41a1..a197cf7 100644 --- a/tools/smp2ds_UI.pyw +++ b/tools/smp2ds_UI.pyw @@ -30,13 +30,14 @@ from PyQt5 import QtGui, QtCore, Qt from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox import smp_to_dspreset as smp2ds -from UI import smp_to_ds as gui from audio_player import play_notification from common_prefs_utils import Node, get_settings, set_settings, read_settings, write_settings from common_ui_utils import add_ctx, add_insert_ctx, popup_menu from common_ui_utils import beautify_str, resource_path, resource_path_alt, shorten_path from jsonFile import read_json from smp_to_dspreset import __version__ +# import UI.smp_to_ds as gui +from tools.UI import smp_to_ds as gui class Smp2dsUi(gui.Ui_smp_to_ds_ui, QMainWindow): diff --git a/tools/split_tool_UI.pyw b/tools/split_tool_UI.pyw index 1c1efce..3fd9090 100644 --- a/tools/split_tool_UI.pyw +++ b/tools/split_tool_UI.pyw @@ -23,12 +23,13 @@ from pathlib import Path from PyQt5 import QtGui, QtCore -import UI.split_tool as gui import split_audio as sa from audio_player import play_notification from base_tool_UI import BaseToolUi, launch from common_ui_utils import add_ctx, get_documents_directory, resource_path from sample_utils import Sample +# import UI.split_tool as gui +from tools.UI import split_tool as gui try: import crepe diff --git a/tools/st_tool_UI.pyw b/tools/st_tool_UI.pyw index 955cd46..b62c8f8 100644 --- a/tools/st_tool_UI.pyw +++ b/tools/st_tool_UI.pyw @@ -20,21 +20,21 @@ import os import threading import traceback from functools import partial -from glob import glob from pathlib import Path from typing import cast import soundfile as sf from PyQt5 import QtWidgets, QtGui, QtCore -import UI.st_tool as gui import pseudo_stereo as ps from audio_player import play_notification from base_tool_UI import BaseToolUi, launch from common_audio_utils import rms -from common_ui_utils import add_ctx, replace_widget, FilePathLabel, resource_path +from common_ui_utils import add_ctx, replace_widget, FilePathLabel, resource_path, resource_path_alt from file_utils import resolve_overwriting from sample_utils import Sample +# import UI.st_tool as gui +from tools.UI import st_tool as gui from utils import append_metadata, set_md_tags __version__ = '1.1.0' @@ -307,7 +307,7 @@ class StToolUi(gui.Ui_st_tool_mw, BaseToolUi): def get_ir_samples(self, ir_subdir='dh_ir'): self.ir_samples = [] - ir_path = resource_path(self.base_dir / ir_subdir, as_str=False) + ir_path = resource_path_alt(self.base_dir / ir_subdir, parent_dir='', as_str=False) if ir_path.is_dir(): for ext in self.file_types: ir_smp = ir_path.glob(f'*{ext}') diff --git a/tools/upsample_tool_UI.pyw b/tools/upsample_tool_UI.pyw index 8041547..33273bf 100644 --- a/tools/upsample_tool_UI.pyw +++ b/tools/upsample_tool_UI.pyw @@ -18,7 +18,6 @@ import soundfile as sf from PyQt5 import QtWidgets, QtGui, QtCore from scipy import interpolate -import UI.upsample_tool as gui import noise_reduction as nr from audio_player import play_notification from base_tool_UI import BaseToolUi, launch @@ -28,11 +27,12 @@ from file_utils import resolve_overwriting from loop_sample import db_to_lin from sample_utils import Sample from split_audio import envelope_transform +from subprocess_utils import DisableShellWindows +# import UI.upsample_tool as gui +from tools.UI import upsample_tool as gui from upsample import audio_upsample from utils import append_metadata, set_md_tags -from subprocess_utils import DisableShellWindows - __version__ = '1.1.0'