# HomuraHime Audio System Deep Analysis ## 1. VOICE LIMITS & CHANNEL MANAGEMENT ### UtageFmodVoiceManager **File:** `C:\Assets\4.Developer\Andy\UtageVoiceManager\UtageFmodVoiceManager.cs` | Method/Property | Description | Hook Point | |-----------------|-------------|------------| | `PlayVoice()` / `CoPlayVoice` | Coroutine for playing voice with lip sync | `Prefix` to modify voice data, `Postfix` to track playback | | `StopVoiceEvent()` | Stops currently playing voice | `Prefix` to prevent stop, `Postfix` to cleanup | | `get_CountVoice` | Gets current voice count | `Postfix` to limit voice count | | `get_CurrentVoiceCharacterLabel` | Current voice character label | `Postfix` to override character | | `get_DefaultVoiceFadeTime` | Default fade time for voice | `Postfix` to modify fade duration | | `set_DuckVolume` / `get_DuckVolume` | Duck volume property | `Postfix` to modify ducking | | `UpdateDucking` | Coroutine `d__47` | **KEY HOOK** - controls audio ducking coroutine | | `PlayVoiceEvent()` | Triggers voice events | `Prefix` to intercept event data | | `StopVoiceIgnoreLoop` | Stops voice ignoring loop setting | Direct patch target | ### FMODSoundManager **File:** `C:\Assets\1.HonoHime\Core\FMODUtility\Scripts\FMODSoundManager.cs` | Method/Property | Description | Hook Point | |----------------|-------------|------------| | `get_Volume` / `set_Volume` | Master volume control | `Postfix` to clamp/modify volume | | `SetVolumeImmediately()` | Immediate volume set (no fade) | `Prefix` to intercept | | `FMODSetVolume` | Coroutine for FMOD volume | `d__28` - can patch transition | | `get_SoundManager` | Access to sound manager | Property getter patch | | `VCASetting` | VCA (Velocity Controlled Amplifier) settings | Field patch for volume overrides | --- ## 2. AUDIO DUCKING SYSTEM ### Ducking Properties Found: ``` duckFadeTime - Fade time for ducking duckVolume - Volume level during ducking duckGroups - Audio groups that participate in ducking duckVelocity - Velocity tracking for ducking UpdateDucking - Main coroutine: `d__47` ``` ### SnapshotManager **File:** `C:\Assets\4.Developer\Andy\UtageVoiceManager\SnapshotManager.cs` | Method | Description | |--------|-------------| | `ApplySnapshot()` | Apply audio snapshot/ducking | | `ApplyStartSnapshot()` | Apply at start | | `GetCurrentSnapshot()` | Get active snapshot | | `GetSnapshotTypeDropdown()` | Dropdown selection | ### SnapshotHandle **File:** `C:\Assets\4.Developer\Andy\UtageVoiceManager\SnapshotHandle.cs` Manages individual snapshot instances for voice ducking. ### DEAudioFadeManager **File:** `C:\Assets\4.Developer\Andy\UtageVoiceManager\DEAudioFadeManager.cs` Handles fade in/out for audio events - likely the fade time controller for ducking. ### FmodReverbEventController **File:** `C:\Assets\4.Developer\Andy\UtageVoiceManager\FmodReverbEventController.cs` Controls reverb effects during events - related to audio environment transitions. --- ## 3. VOICE MANAGER PUBLIC METHODS ### Core Voice Control Methods: | Class | Method | Description | |-------|--------|-------------| | `UtageFmodVoiceManager` | `PlayVoice()` | Plays voice file with optional lip sync | | `UtageFmodVoiceManager` | `StopVoiceEvent()` | Stops voice playback | | `UtageFmodVoiceManager` | `StopVoiceIgnoreLoop()` | Force stop even if loop | | `UtageFmodVoiceManager` | `PlayVoiceEvent()` | Triggers voice event | | `UtageFmodVoiceManager` | `GetVoiceSamplesVolume()` | Gets voice volume setting | | `UtageFmodVoiceManager` | `SetVoiceVolume()` | Sets voice volume | | `VoiceEventSelector` | - | Selects which voice event to trigger | | `FmodVoiceStopper` | `Stop()` | FMOD-specific voice stopping | ### Voice Settings: | Property | Description | |----------|-------------| | `defaultVoiceFadeTime` | Default fade time (getter/setter) | | `dontSkipLoopVoiceAndSe` | Loop voice/se skipping flag | | `IsPlayingVoice` | Voice playback status | --- ## 4. FMOD EVENT TRIGGERING ### FMODSoundManager / FMODUtility **File:** `C:\Assets\1.HonoHime\Core\FMODUtility\Scripts\FMODSoundManager.cs` **File:** `C:\Assets\1.HonoHime\Core\FMODUtility\Scripts\FMODUtility.cs` | Method | Description | Hook Type | |--------|-------------|-----------| | `FMODUtilityStartEvent` | Start FMOD event | Prefix to intercept event path | | `FMODUtilityStopEvent` | Stop FMOD event | Prefix to prevent stop | | `FMODUtilitySetParameter` | Set FMOD parameter | Prefix to modify parameter value | | `GetEventReference()` | Get FMOD event reference | Postfix to modify event ref | ### FMOD Event Classes: | Class | File Path | |-------|-----------| | `FmodSFXEventRef` | `C:\Assets\4.Developer\HsiCheng\Script\Fmod\FmodSFXEventRef.cs` | | `FmodSFXEventSO` | `C:\Assets\4.Developer\HsiCheng\Script\Fmod\FmodSFXEventSO.cs` | | `FmodSFXEventDispatcher` | `C:\Assets\4.Developer\HsiCheng\Script\Fmod\FmodSFXEventDispatcher.cs` | | `FmodSFXEventCommunicator` | `C:\Assets\4.Developer\HsiCheng\Script\Fmod\FmodSFXEventCommunicator.cs` | ### MMFeedbacks Integration (More Mountains): | Class | Path | |-------|------| | `MMF_FMOD_GlobalPlayEvent` | `C:\Assets\1.HonoHime\Core\FMODUtility\Scripts\MMFeedbacks\` | | `MMF_FMOD_GlobalSetParameter` | Trigger global FMOD parameter | | `MMF_FMOD_ParameterTrigger` | Trigger with parameter | | `MMF_FMODUtilityPlayEventEmitter` | Play via event emitter | | `MMF_FMODUtilityStopEventEmitter` | Stop via event emitter | | `MMF_FMOD_MainBGM_ReplayCurrent` | Replay current BGM | ### FMOD Parameter Methods: ``` SetParameterByName() - Set parameter by string name SetParameterFloat() - Set float parameter SetParameterInt() - Set int parameter SetParameterBoolean() - Set bool parameter CheckSetParameter() - Validate parameter CheckSetParameterSub() - Sub-check logic ``` ### Scene Transition Controller: **File:** `C:\Assets\4.Developer\Andy\FMODBooster\FMODSceneTransitionController.cs` | Coroutine | Description | |-----------|-------------| | `d__6` | Initialize volume transitions on scene load | | `d__20` | Check/start fade events | | `d__12` | Stop after delay | --- ## 5. ENEMY AUDIO SYSTEM ### EnemyAttackBase **File:** `C:\Assets\1.HonoHime\Core\Character\Core\EnemyAttackBase.cs` | State/Action | Description | |--------------|-------------| | `Attack` | Attack state/action | | `Idle` | Idle state/action | | `AlertAction_LookAtTarget` | Alert when noticing player | | `AlertAction_MoveToTargetLastPosition` | Move to last known player position | ### EnemyActionManager **File:** `C:\Assets\1.HonoHime\Core\Character\EnemyActionManager\EnemyActionManager.cs` **File:** `C:\Assets\1.HonoHime\Core\Character\EnemyActionManager\EnemyAction.cs` | Method/Property | Description | |----------------|-------------| | `GetEnemyActionManager` | Access to enemy action system | | `GetEnemyAttack` | Get enemy attack controller | | `enemyActionManager` | Reference field | ### Enemy Attack Controllers: ``` EnemyAttackAction - Basic attack action EnemyAttackBase - Base attack behavior EnemyAttackBlockedAction - When attack is blocked EnemyAttackAcion_UseDamageSet - Attack using damage set EnemyAssassinGroupManager - Group attack coordination ``` ### Enemy Audio Handlers: | Class | File | Description | |-------|------|-------------| | `EnemyDamageVoiceSFXHandler` | `C:\Assets\4.Developer\Andy\EnemyDamageSFXHandler\EnemyDamageVoiceSFXHandler.cs` | Handles damage voice SFX | | `EnemyDamageVoiceSFXHandler|FeedbackVoice` | Feedback voice field | | `AudioComponent` | `C:\Assets\1.HonoHime\Core\Character\DamageSystem\Component\AudioComponent.cs` | Damage system audio | ### Enemy Attack States Found: ``` SukebanShibaTwin|JumpAttackState BoneGirl_GroundAttack|FinishState BoneGirl_GrabAttack|BoneGirl_GrabAttackState SukenBenSquadA|LeftRightDashAttackState AttackAction_TransitionSpecialArt AttackAction_Charge AttackAction_QuakingStrike ``` --- ## 6. CFVOICE SYSTEM ### CFVoiceEventUtility **File:** `C:\Assets\1.HonoHime\Core\...` (pattern found in strings) The CFVoice system triggers voice events based on game events: | Event Key | Description | |-----------|-------------| | `CFVoiceEventUtility|Battle` | Battle events | | `CFVoiceEventUtility|Challenge` | Challenge mode | | `CFVoiceEventUtility|Chip` | Chip collection | | `CFVoiceEventUtility|Enemy` | **Enemy-related** - important for enemy indicators | | `CFVoiceEventUtility|EventKey` | Generic event key | | `CFVoiceEventUtility|HH_Behaviour` | Character behavior events | | `CFVoiceEventUtility|HH_Skill` | Skill usage | | `CFVoiceEventUtility|Mission` | Mission events | | `CFVoiceEventUtility|Note` | Note collection | | `CFVoiceEventUtility|QTE` | QTE events | | `CFVoiceEventUtility|Rank` | Rank up | | `CFVoiceEventUtility|Reward` | Rewards | | `CFVoiceEventUtility|Senbei` | Item-related | | `CFVoiceEventUtility|Timer` | Timer events | | `CFVoiceEventUtility|Trap` | Trap activation | | `CFVoiceEventUtility|TreasureChest` | Chest opening | ### CFVoice Handlers: | Class | File | |-------|------| | `MissionCFVoiceHandler` | `C:\Assets\1.HonoHime\Core\Level\MissionController\MissionCFVoiceHandler.cs` | | `InventoryMonitorCFVoiceHandler` | `C:\Assets\4.Developer\Andy\FmodBGMController\Scripts\InventoryMonitorCFVoiceHandler.cs` | | `CommonFunctionVoiceHandler` | `C:\Assets\4.Developer\Andy\FmodFunctionVoice\CommonFunctionVoiceHandler.cs` | ### CFVoice Properties Found: ``` get_EVENT_CFVOICE_BATTLE get_EVENT_CFVOICE_ENEMY get_EVENT_CFVOICE_MISSION get_EVENT_CFVOICE_HPCHIP get_EVENT_CFVOICE_QTE_SHIKIGAMI get_EVENT_CFVOICE_QTE_FLURRYBARRIER PlayCFVoice ``` --- ## KEY HOOK POINTS FOR HARMONY PATCHES ### Audio Glitch Fixes: 1. **Voice Limit Fix** - Patch `UtageFmodVoiceManager.get_CountVoice` to enforce MAX_VOICES limit 2. **Ducking Glitch** - Patch `UpdateDucking` coroutine to fix fade timing issues 3. **Voice Cutoff Fix** - Patch `StopVoiceEvent` to properly handle crossfade before stopping ### Enemy Indicator Improvements: 1. **Alert Sound** - Hook into `CFVoiceEventUtility` with `Enemy` event key 2. **Attack Sound** - Patch `EnemyAttackBase.OnEnter` / `OnAttack` methods 3. **Idle Sound Loop** - Patch `EnemyAttackBase.Idle` state entry ### Priority Hook Targets: | Priority | Class | Method | Purpose | |----------|-------|--------|---------| | HIGH | `UtageFmodVoiceManager` | `UpdateDucking` | Fix ducking glitches | | HIGH | `UtageFmodVoiceManager` | `PlayVoice` | Voice limit enforcement | | HIGH | `CFVoiceEventUtility` | `PlayCFVoice` | Enemy voice routing | | MEDIUM | `FMODSoundManager` | `SetVolume` | Volume clamping | | MEDIUM | `FMODSceneTransitionController` | `InitVolumeTransition` | Scene transition audio | | MEDIUM | `EnemyDamageVoiceSFXHandler` | `FeedbackVoice` | Damage audio | | LOW | `SnapshotManager` | `ApplySnapshot` | Reverb/snapshot control | --- ## SOURCE FILE REFERENCE LIST ### Voice Management: - `C:\Assets\4.Developer\Andy\UtageVoiceManager\UtageFmodVoiceManager.cs` - `C:\Assets\4.Developer\Andy\UtageVoiceManager\UtageFmodVoiceSetting.cs` - `C:\Assets\4.Developer\Andy\UtageVoiceManager\VoiceEventSelector.cs` - `C:\Assets\4.Developer\Andy\UtageVoiceManager\FmodVoiceStopper.cs` - `C:\Assets\4.Developer\Andy\UtageVoiceManager\SnapshotManager.cs` - `C:\Assets\4.Developer\Andy\UtageVoiceManager\SnapshotHandle.cs` - `C:\Assets\4.Developer\Andy\UtageVoiceManager\DEAudioFadeManager.cs` - `C:\Assets\4.Developer\Andy\UtageVoiceManager\FmodSoundDebugger.cs` ### FMOD Core: - `C:\Assets\1.HonoHime\Core\FMODUtility\Scripts\FMODSoundManager.cs` - `C:\Assets\1.HonoHime\Core\FMODUtility\Scripts\FMODUtility.cs` - `C:\Assets\1.HonoHime\Core\FMODUtility\Scripts\FMODManager.cs` ### Enemy Audio: - `C:\Assets\1.HonoHime\Core\Character\Core\EnemyAttackBase.cs` - `C:\Assets\1.HonoHime\Core\Character\EnemyActionManager\EnemyActionManager.cs` - `C:\Assets\4.Developer\Andy\EnemyDamageSFXHandler\EnemyDamageVoiceSFXHandler.cs` - `C:\Assets\1.HonoHime\Core\Character\DamageSystem\Component\AudioComponent.cs` ### CFVoice System: - (Source path partially truncated, but class is `CFVoiceEventUtility`) - `C:\Assets\1.HonoHime\Core\Level\MissionController\MissionCFVoiceHandler.cs` - `C:\Assets\4.Developer\Andy\FmodFunctionVoice\CommonFunctionVoiceHandler.cs` ### Scene/BGM: - `C:\Assets\4.Developer\Andy\FMODBooster\FMODSceneTransitionController.cs` - `C:\Assets\4.Developer\Andy\FmodBGMController\Scripts\MainBGMManager.cs` - `C:\Assets\4.Developer\Andy\FmodBGMController\Scripts\FmodBGMController.cs` ### SFX Events: - `C:\Assets\4.Developer\HsiCheng\Script\Fmod\FmodSFXEventRef.cs` - `C:\Assets\4.Developer\HsiCheng\Script\Fmod\FmodSFXEventSO.cs` - `C:\Assets\4.Developer\HsiCheng\Script\Fmod\FmodSFXEventDispatcher.cs`