Skip to content

feat: Add AudioManager; Music/SFX modding support - #1384

Merged
EttyKitty merged 6 commits into
mainfrom
feat/audio-manager
Jul 24, 2026
Merged

feat: Add AudioManager; Music/SFX modding support#1384
EttyKitty merged 6 commits into
mainfrom
feat/audio-manager

Conversation

@EttyKitty

@EttyKitty EttyKitty commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary by cubic

Adds AudioManager to centralize music and SFX with runtime modding and context playlists. Smooth crossfades replace direct audio calls, with macro-based SFX and settings-driven volume.

  • New Features

    • Runtime-loaded music/SFX with user overrides; shipped Custom Files/Audio act as defaults. Folders auto-create.
    • Context playlists for menu, sector, battle, creation, defeat, diplomacy, and post-battle with random non-repeating selection and crossfades.
    • Built-in asset fallback when no external files exist.
    • Simple API: play_playlist(context), play_track(name), play_sfx(name), stop_music(fade_ms).
    • Added datafiles/audio_modding.md with folder structure, contexts, and override priority.
  • Refactors

    • Replaced audio_* calls with global.audio_manager across menus, combat, creation, buttons, and UI; removed scr_music and legacy controller fields; added scr_predicate helpers for fade-out callbacks.
    • Initialize AudioManager and discover() on startup; SettingsManager.apply_audio() now sets master gain and forwards music/SFX volume to AudioManager.
    • Adopted SFX macros (e.g., SFX_CLICK, SFX_IDENTIFY, SFX_END_TURN, SFX_STC) to avoid string typos.
    • Fixed diplomacy-to-sector playlist transition; saved marine captures to Screenshots/ with clearer filenames; minor logging tidy-up.

Written for commit 740537b. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added Size: Big Type: Feature Adds something new labels Jul 24, 2026
@EttyKitty EttyKitty changed the title feat: Add AudioManager and modding feat: Add AudioManager; Music/SFX modding Jul 24, 2026
@EttyKitty EttyKitty changed the title feat: Add AudioManager; Music/SFX modding feat: Add AudioManager; Music/SFX modding support Jul 24, 2026
Comment thread scripts/AudioManager/AudioManager.gml Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Roast 🔥

Verdict: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
💡 suggestion 1
🤏 nitpick 2
🚨 critical 0
⚠️ warning 0
Issue Details (click to expand)
File Line Roast
scripts/AudioManager/AudioManager.gml 49 USER_SFX_DIR has a double slash ("SFX//") — a typo that should be "SFX/"
objects/obj_defeat/Step_0.gml 9 Missing semicolon on global.audio_manager.stop_music(2000)
scripts/AudioManager/AudioManager.gml 6 Header comments claim shipped=working_directory/Audio/ and user=AppData/Local/ChapterMaster/Audio/, but actual code uses working_directory + "/Custom Files/Audio/" and program_directory + "Audio/"

🏆 Best part: The AudioManager architecture is actually solid — context-based playlists with crossfading and user/shipped file override is a genuinely good modding foundation. I didn't expect to write anything nice, but here we are.

💀 Worst part: That header comment at line 6 is confidently wrong about both directory paths. It's like giving someone directions to the wrong city while insisting you know the way.

📊 Overall: Like a Guardsman who forgot his ammo but remembered his ceremonial sword — the intent is noble, the execution needs a mag-load.

Files Reviewed (3 files)
  • scripts/AudioManager/AudioManager.gml - 2 issues
  • objects/obj_defeat/Step_0.gml - 1 issue

Fix these issues in Kilo Cloud

Previous Review Summaries (4 snapshots, latest commit 669a8d6)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 669a8d6)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (2 files)
  • datafiles/audio_modding.md
  • scripts/ColourItem/ColourItem.gml

Previous review (commit 0c57b7f)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (1 file)
  • scripts/ColourItem/ColourItem.gml

Previous review (commit deac269)

Verdict: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
⚠️ warning 1
💡 suggestion 0
🤏 nitpick 0
🚨 critical 0
Issue Details (click to expand)
File Line Roast
scripts/AudioManager/AudioManager.gml 227 Cache key collision: context tracks with the same filename share a stream because _name is used instead of a compound key like _context + "/" + _name.

🏆 Best part: The AudioManager architecture is actually solid — context-based playlists with crossfading and user/shipped file override is a genuinely good modding foundation. I didn't expect to write anything nice, but here we are.

💀 Worst part: __resolve_context_track's own doc comment promises a compound cache key, then the very next line uses a bare filename. It's like writing "I will not forget" on a sticky note and then immediately forgetting.

📊 Overall: Like a Guardsman who forgot his ammo but remembered his ceremonial sword — the intent is noble, the execution needs a mag-load.

Files Reviewed (26 files)
  • ChapterMaster.yyp
  • objects/obj_controller/Alarm_7.gml
  • objects/obj_controller/Create_0.gml
  • objects/obj_controller/Step_0.gml
  • objects/obj_creation/Create_0.gml
  • objects/obj_creation/Step_0.gml
  • objects/obj_formation_bar/Create_0.gml
  • objects/obj_main_menu/Create_0.gml
  • objects/obj_main_menu/Draw_0.gml
  • objects/obj_ncombat/Alarm_7.gml
  • objects/obj_ncombat/Create_0.gml
  • objects/obj_persistent/Create_0.gml
  • objects/obj_saveload/Destroy_0.gml
  • objects/obj_turn_end/Alarm_1.gml
  • scripts/Armamentarium/Armamentarium.gml
  • scripts/AudioManager/AudioManager.gml - 1 issue
  • scripts/AudioManager/AudioManager.yy
  • scripts/SettingsManager/SettingsManager.gml
  • scripts/scr_buttons/scr_buttons.gml
  • scripts/scr_controller_helpers/scr_controller_helpers.gml
  • scripts/scr_creation/scr_creation.gml
  • scripts/scr_librarium/scr_librarium.gml
  • scripts/scr_predicate/scr_predicate.gml
  • scripts/scr_music/scr_music.yy (renamed)
  • scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml

Fix these issues in Kilo Cloud

Previous review (commit 395485c)

Verdict: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
⚠️ warning 1
💡 suggestion 0
🤏 nitpick 0
🚨 critical 0
Issue Details (click to expand)
File Line Roast
scripts/AudioManager/AudioManager.gml 227 Cache key collision: context tracks with the same filename share a stream because _name is used instead of a compound key like _context + "/" + _name.

🏆 Best part: The AudioManager architecture is actually solid — context-based playlists with crossfading and user/shipped file override is a genuinely good modding foundation. I didn't expect to write anything nice, but here we are.

💀 Worst part: __resolve_context_track's own doc comment promises a compound cache key, then the very next line uses a bare filename. It's like writing "I will not forget" on a sticky note and then immediately forgetting.

📊 Overall: Like a Guardsman who forgot his ammo but remembered his ceremonial sword — the intent is noble, the execution needs a mag-load.

Files Reviewed (26 files)
  • ChapterMaster.yyp
  • objects/obj_controller/Alarm_7.gml
  • objects/obj_controller/Create_0.gml
  • objects/obj_controller/Step_0.gml
  • objects/obj_creation/Create_0.gml
  • objects/obj_creation/Step_0.gml
  • objects/obj_formation_bar/Create_0.gml
  • objects/obj_main_menu/Create_0.gml
  • objects/obj_main_menu/Draw_0.gml
  • objects/obj_ncombat/Alarm_7.gml
  • objects/obj_ncombat/Create_0.gml
  • objects/obj_persistent/Create_0.gml
  • objects/obj_saveload/Destroy_0.gml
  • objects/obj_turn_end/Alarm_1.gml
  • scripts/Armamentarium/Armamentarium.gml
  • scripts/AudioManager/AudioManager.gml - 1 issue
  • scripts/AudioManager/AudioManager.yy
  • scripts/SettingsManager/SettingsManager.gml
  • scripts/scr_buttons/scr_buttons.gml
  • scripts/scr_controller_helpers/scr_controller_helpers.gml
  • scripts/scr_creation/scr_creation.gml
  • scripts/scr_librarium/scr_librarium.gml
  • scripts/scr_predicate/scr_predicate.gml
  • scripts/scr_music/scr_music.yy (renamed)
  • scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 187.8K · Output: 86.7K · Cached: 3.5M

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 26 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/AudioManager/AudioManager.gml
Comment thread scripts/SettingsManager/SettingsManager.gml
Comment thread scripts/scr_buttons/scr_buttons.gml
Comment thread scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml Outdated
Comment thread objects/obj_controller/Alarm_7.gml
Comment thread scripts/AudioManager/AudioManager.gml Outdated
Comment thread scripts/AudioManager/AudioManager.gml
Comment thread objects/obj_saveload/Destroy_0.gml Outdated
Comment thread objects/obj_formation_bar/Create_0.gml Outdated
Comment thread scripts/AudioManager/AudioManager.gml Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/AudioManager/AudioManager.gml
@EttyKitty
EttyKitty force-pushed the feat/audio-manager branch from deac269 to 0c57b7f Compare July 24, 2026 19:23
@github-actions github-actions Bot added the Type: Docs Changes to documentation files label Jul 24, 2026
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Jul 24, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@EttyKitty
EttyKitty force-pushed the feat/audio-manager branch from 669a8d6 to 740537b Compare July 24, 2026 19:46
@EttyKitty
EttyKitty merged commit 1fd3774 into main Jul 24, 2026
6 checks passed
@EttyKitty
EttyKitty deleted the feat/audio-manager branch July 24, 2026 19:47

USER_AUDIO_DIR = program_directory + "Audio/";
USER_MUSIC_DIR = USER_AUDIO_DIR + "Music/";
USER_SFX_DIR = USER_AUDIO_DIR + "SFX//";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: USER_SFX_DIR got an extra slash — "SFX//" instead of "SFX/". This typo is the audio equivalent of putting two right socks on. The OS will probably tolerate it, but it's embarrassing.

🩹 The Fix:

Suggested change
USER_SFX_DIR = USER_AUDIO_DIR + "SFX//";
USER_SFX_DIR = USER_AUDIO_DIR + "SFX/";

📏 Severity: nitpick


Reply with @kilocode-bot fix it to have Kilo Code address this issue.


if (fadeout == 1) {
audio_sound_gain(snd_defeat, 0, 2000);
global.audio_manager.stop_music(2000)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: Missing semicolon on stop_music(2000). The old code had it, the new code dropped it. This is the coding equivalent of forgetting your keys — you might still get in the house, but it's awkward.

🩹 The Fix:

Suggested change
global.audio_manager.stop_music(2000)
global.audio_manager.stop_music(2000);

📏 Severity: nitpick


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

/// crossfading, and volume control.
///
/// Audio loading tiers (user overrides shipped):
/// 1. Shipped: `working_directory/Audio/`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: These header comments are lying harder than a Guardsman's recruitment poster. They claim shipped audio lives at working_directory/Audio/ and user audio at AppData/Local/ChapterMaster/Audio/, but the actual code uses working_directory + "/Custom Files/Audio/" for shipped and program_directory + "Audio/" for user. Anyone reading the comments will drop their mod files in the wrong place and wonder why nothing works.

🩹 The Fix: Update the header to match the real paths:

Suggested change
/// 1. Shipped: `working_directory/Audio/`
/// Audio loading tiers (user overrides shipped):
/// 1. Shipped: `working_directory/Custom Files/Audio/`
/// 2. User: `Audio/` (relative -> program_directory + "Audio/")

📏 Severity: suggestion


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Big Type: Docs Changes to documentation files Type: Feature Adds something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant