List and edit in-memory sounds in soundbanks

This commit is contained in:
2026-10-09 20:12:10 +02:00
parent 61bbf26f3b
commit 5d6c2447f7
36 changed files with 71568 additions and 54823 deletions

View File

@@ -28,17 +28,26 @@ _RULES = [
(r"^SPEECH_CHAR_", "Speech", "Character lines"),
(r"^SPEECH_(CH|SEQUENCE|STEEL|MUSEUM|CHURCH|COURT|UNDER|GCPD|ZP1)_", "Speech", "Story missions"),
(r"^SPEECH_(GAME|MAP|AUGMENTED|FORENSICS|TEMP)_", "Speech", "Gameplay & hints"),
(r"^NPC_", "Ambience", "Crowds"),
(r"^NPC_.*CROWD", "Ambience", "Crowds"),
(r"^SPEECH_", "Speech", "Other speech"),
(r"^MUSIC_PDLC", "Music", "Music (DLC)"),
(r"^MUSIC", "Music", "Music"),
(r"^(MUSIC|MUS_)", "Music", "Music"),
(r"^(AMB|PSA)_", "Ambience", "Ambience"),
(r"^PSO_", "Ambience", "Ambient emitters"),
(r"^WND_", "Ambience", "Wind"),
(r"^WTR_", "Ambience", "Weather"),
(r"^P?VOL_", "Ambience", "Room tone"),
(r"^SEQ_", "SFX", "Scripted sequences"),
(r"FOOTSTEP", "SFX", "Footsteps"),
(r"^(CHR|NPC)_.*(COMBAT|BONEBREAK|BODYFALL)", "SFX", "Combat"),
(r"^(SEQ|MTN)_", "SFX", "Scripted sequences"),
(r"^OBJ_", "SFX", "Objects"),
(r"^(PX|PHY)_", "SFX", "Physics"),
(r"^WPN_", "SFX", "Weapons"),
(r"^CHR_", "SFX", "Character foley"),
(r"^DVC_", "SFX", "Gadgets"),
(r"^(GUI|SBJ)_", "SFX", "Interface"),
(r"^VFX_", "SFX", "Visual effects"),
(r"^NPC_", "SFX", "Enemies & NPCs"),
(r"^(CHR|GEN)_", "SFX", "Character foley"),
(r"^GLOBAL", "SFX", "Global"),
]
_RULES = [(re.compile(p), g, c) for p, g, c in _RULES]
@@ -46,9 +55,10 @@ _RULES = [(re.compile(p), g, c) for p, g, c in _RULES]
GROUPS = ("Speech", "Music", "Ambience", "SFX", "Unknown")
def classify(name: str, pack: str = None):
"""-> (group, category). `pack` = name of the stream pack a media belongs to, if any."""
n = name.upper()
def classify(name: str, pack: str = None, bank: str = None):
"""-> (group, category). `pack` = name of the stream pack a media belongs to, if any; `bank` = name of
the soundbank holding an in-memory sound (its prefix is more reliable than event names)."""
n = (bank or name).upper()
if pack:
p = pack.upper()
if p.startswith("MUSIC"):