refactor: remove effect badges and clear active effects on player reset
This commit is contained in:
14 files changed
+31
-42
No files matched your search
@@ -9,7 +9,6 @@ class AudioEffect(ABC):
|
||||
id: str
|
||||
name: str
|
||||
description: str
|
||||
badge: str
|
||||
icon: str
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -17,7 +17,6 @@ class DistortionEffect(AudioEffect):
|
||||
id = "distortion"
|
||||
name = "Przester"
|
||||
description = "Ekstremalne podbicie głośności (1000%) z przesterem"
|
||||
badge = "1000%"
|
||||
icon = "zap"
|
||||
|
||||
def __init__(self, multiplier: float = 10.0) -> None:
|
||||
|
||||
@@ -12,7 +12,6 @@ class FourthDensityEffect(AudioEffect):
|
||||
id = "fourth_density"
|
||||
name = "Czwarta gęstość"
|
||||
description = "Pływający ton (sinusoidalna zmiana pitch z okresem ~1 sekundy)"
|
||||
badge = "~1s PITCH"
|
||||
icon = "sparkles"
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -11,7 +11,6 @@ class MuffledEffect(AudioEffect):
|
||||
id = "muffled"
|
||||
name = "Pod wodą"
|
||||
description = "Filtr dolnoprzepustowy (dźwięk przytłumiony / zza ściany)"
|
||||
badge = "LOWPASS"
|
||||
icon = "waves"
|
||||
|
||||
def __init__(self, alpha: float = 0.085) -> None:
|
||||
|
||||
@@ -31,7 +31,6 @@ def get_available_effects_metadata() -> list[dict[str, Any]]:
|
||||
"id": effect.id,
|
||||
"name": effect.name,
|
||||
"description": effect.description,
|
||||
"badge": effect.badge,
|
||||
"icon": effect.icon,
|
||||
}
|
||||
for effect in create_default_effects()
|
||||
|
||||
@@ -12,7 +12,6 @@ class RobotEffect(AudioEffect):
|
||||
id = "robot"
|
||||
name = "Robot"
|
||||
description = "Metaliczny, robotyczny głos cyborga (ring modulation ~65Hz)"
|
||||
badge = "CYBORG"
|
||||
icon = "bot"
|
||||
|
||||
def __init__(self, freq_hz: float = 65.0, mix: float = 0.85) -> None:
|
||||
|
||||
@@ -11,7 +11,6 @@ class ToasterEffect(AudioEffect):
|
||||
id = "toaster"
|
||||
name = "Dźwięk z tostera"
|
||||
description = "Memiczny dźwięk z mikrofalówki / kalkulatora (bitcrusher 5-bit, aliasing)"
|
||||
badge = "8-BIT"
|
||||
icon = "radio"
|
||||
|
||||
def __init__(self, bit_depth: int = 5, downsample: int = 6) -> None:
|
||||
|
||||
@@ -19,7 +19,6 @@ class TremoloEffect(AudioEffect):
|
||||
id = "tremolo"
|
||||
name = "Tremolo"
|
||||
description = "Pulsowanie amplitudy (efekt wibracji głośności)"
|
||||
badge = "LFO"
|
||||
icon = "activity"
|
||||
|
||||
def __init__(self, freq_hz: float = 4.0, depth: float = 0.6) -> None:
|
||||
|
||||
@@ -32,6 +32,7 @@ class GuildMusicState:
|
||||
self.queue.clear()
|
||||
self.current = None
|
||||
self.index = -1
|
||||
self.active_effects.clear()
|
||||
|
||||
|
||||
def find(self, track_id: str) -> YTDLSource | None:
|
||||
|
||||
@@ -103,6 +103,7 @@ class MusicPlayer:
|
||||
self._playback_tokens[guild_id] = self._playback_tokens.get(guild_id, 0) + 1
|
||||
self._interrupted_playbacks.discard(guild_id)
|
||||
self.state(guild_id).reset()
|
||||
self._apply_volume(guild_id)
|
||||
|
||||
def has_saved_queue(self, guild_id: int) -> bool:
|
||||
return bool(self._queues and self._queues.exists(guild_id))
|
||||
@@ -236,6 +237,10 @@ class MusicPlayer:
|
||||
def is_effect_active(self, guild_id: int, effect_id: str) -> bool:
|
||||
return effect_id in self.state(guild_id).active_effects
|
||||
|
||||
def clear_effects(self, guild_id: int) -> None:
|
||||
self.state(guild_id).active_effects.clear()
|
||||
self._apply_volume(guild_id)
|
||||
|
||||
|
||||
|
||||
def set_loop_mode(self, guild_id: int, mode: LoopMode) -> None:
|
||||
|
||||
Reference in new issue
Block a user