Audio 1: the simulation names no sound; delete the dead Wwise path on EquippedItem
Removes EquippedItem's SoundBank, AudioEvents/AudioParameters, every FireAudioEvent/PlaySound/StopSound/SetAudioParameter overload and Update's AudioStats loop, the four audio enums, WwiseMetadata and WwiseSoundBinding, the weapon/reactor/thruster call sites, and the Wwise Sounds counters in FireControlPerWeaponTests (Announced and Starts keep the refused-round pins). Catalog keys 21, 22 and 13-15 stay, unread. Builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6b6e7c7c26
commit
2102affb09
11 changed files with 7 additions and 259 deletions
|
|
@ -145,7 +145,6 @@ public class ChargedWeapon : InstantWeapon
|
|||
if (_charging)
|
||||
{
|
||||
_charge += dt / ChargeTime;
|
||||
Item.SetAudioParameter(SpecialAudioParameter.ChargeLevel, saturate(_charge));
|
||||
if (!_charged)
|
||||
{
|
||||
AddHeat(ChargeHeat * (dt / ChargeTime));
|
||||
|
|
@ -162,7 +161,6 @@ public class ChargedWeapon : InstantWeapon
|
|||
_coolingDown = true;
|
||||
_charge = 0;
|
||||
OnFailed?.Invoke();
|
||||
Item.FireAudioEvent(ChargedWeaponAudioEvent.Fail);
|
||||
CauseDamage(_data.FailureDamage);
|
||||
}
|
||||
}
|
||||
|
|
@ -177,7 +175,6 @@ public class ChargedWeapon : InstantWeapon
|
|||
if(!_charging && CanFire && !FireControl.Refuses(this, Entity))
|
||||
{
|
||||
OnStartCharging?.Invoke();
|
||||
Item.FireAudioEvent(ChargedWeaponAudioEvent.Start);
|
||||
_charging = true;
|
||||
_charged = false;
|
||||
}
|
||||
|
|
@ -193,7 +190,6 @@ public class ChargedWeapon : InstantWeapon
|
|||
_charge = 0;
|
||||
}
|
||||
OnStopCharging?.Invoke();
|
||||
Item.FireAudioEvent(ChargedWeaponAudioEvent.Stop);
|
||||
_charging = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior, IPowerCo
|
|||
}
|
||||
}
|
||||
|
||||
var firedThisFrame = false;
|
||||
_burstTimer += dt;
|
||||
while (_burstRemaining > 0 && _burstTimer > 0)
|
||||
{
|
||||
|
|
@ -280,11 +279,6 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior, IPowerCo
|
|||
// Evaluate it into a local first.
|
||||
var shotId = FireControl.Fire(this, Item, Entity);
|
||||
OnFire?.Invoke(shotId);
|
||||
if(!firedThisFrame)
|
||||
{
|
||||
Item.FireAudioEvent(WeaponAudioEvent.Fire);
|
||||
firedThisFrame = true;
|
||||
}
|
||||
CauseWearDamage(1);
|
||||
AddHeat(Heat);
|
||||
Entity.SetSignature(this, SignatureChannel.LaunchFlash, Visibility, Item);
|
||||
|
|
|
|||
|
|
@ -94,8 +94,6 @@ public class Reactor : Behavior
|
|||
Draw = 0;
|
||||
}
|
||||
|
||||
Item.SetAudioParameter(SpecialAudioParameter.Intensity, max(.25f, 1 - 1 / CurrentLoadRatio));
|
||||
|
||||
AddHeat(heat);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ public class Thruster : Behavior, IPowerConsumer
|
|||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
Item.SetAudioParameter(SpecialAudioParameter.Intensity, _input);
|
||||
// Cut 7 (docs/stats-and-power-target.md): "continuous consumers brown out ... through a power supply
|
||||
// curve on their performance stats." Thrust below is a plain Evaluate() read, so once the catalog's own
|
||||
// Thrust stat carries a PowerSupply term, a partial grant already comes back reduced -- this gate no
|
||||
|
|
|
|||
|
|
@ -2149,7 +2149,6 @@ public class EquippedItem : IStatContext
|
|||
|
||||
private bool _thermalOnline;
|
||||
private bool _durabilityOnline;
|
||||
public WwiseMetaSoundBank SoundBank;
|
||||
|
||||
public Behavior[] Behaviors { get; }
|
||||
public Dictionary<int, BehaviorGroup> BehaviorGroups { get; }
|
||||
|
|
@ -2175,10 +2174,6 @@ public class EquippedItem : IStatContext
|
|||
public ReadOnlyReactiveProperty<bool> Active { get; }
|
||||
public ItemManager ItemManager { get; }
|
||||
|
||||
public Subject<uint> AudioEvents { get; } = new Subject<uint>();
|
||||
public Subject<(uint id, float v)> AudioParameters { get; } = new Subject<(uint id, float v)>();
|
||||
public Dictionary<uint, float> AudioParameterValues { get; } = new Dictionary<uint, float>();
|
||||
|
||||
private float oldTemperature;
|
||||
public float Temperature
|
||||
{
|
||||
|
|
@ -2190,77 +2185,6 @@ public class EquippedItem : IStatContext
|
|||
}
|
||||
}
|
||||
|
||||
public void FireAudioEvent(uint eventId, bool skipVerify = false)
|
||||
{
|
||||
if(SoundBank != null && (skipVerify || SoundBank.IncludedEvents.Any(o => o.Id == eventId)))
|
||||
AudioEvents.OnNext(eventId);
|
||||
}
|
||||
|
||||
public void FireAudioEvent(WwiseSoundBinding soundBinding)
|
||||
{
|
||||
FireAudioEvent(soundBinding.PlayEvent);
|
||||
}
|
||||
|
||||
public void PlaySound(WwiseLoopingSoundBinding soundBinding)
|
||||
{
|
||||
FireAudioEvent(soundBinding.PlayEvent);
|
||||
}
|
||||
|
||||
public void StopSound(WwiseLoopingSoundBinding soundBinding)
|
||||
{
|
||||
FireAudioEvent(soundBinding.StopEvent);
|
||||
}
|
||||
|
||||
public void FireAudioEvent(WeaponAudioEvent weaponAudioEvent)
|
||||
{
|
||||
if (SoundBank == null) return;
|
||||
var eventObject = SoundBank.GetEvent(weaponAudioEvent);
|
||||
if (eventObject == null)
|
||||
{
|
||||
ItemManager.Log($"Attempted to trigger {Enum.GetName(typeof(WeaponAudioEvent), weaponAudioEvent)} weapon audio event, but the soundbank doesn't support it!");
|
||||
return;
|
||||
}
|
||||
FireAudioEvent(eventObject.Id, true);
|
||||
}
|
||||
|
||||
public void FireAudioEvent(ChargedWeaponAudioEvent weaponAudioEvent)
|
||||
{
|
||||
if (SoundBank == null) return;
|
||||
var eventObject = SoundBank.GetEvent(weaponAudioEvent);
|
||||
if (eventObject == null)
|
||||
{
|
||||
ItemManager.Log($"Attempted to trigger {Enum.GetName(typeof(ChargedWeaponAudioEvent), weaponAudioEvent)} weapon audio event, but the soundbank doesn't support it!");
|
||||
return;
|
||||
}
|
||||
FireAudioEvent(eventObject.Id, true);
|
||||
}
|
||||
|
||||
public void SetAudioParameter(uint id, float v, bool skipVerify = false)
|
||||
{
|
||||
if (SoundBank != null && (skipVerify || SoundBank.GameParameters.Any(o => o.Id == id)))
|
||||
{
|
||||
AudioParameterValues[id] = v;
|
||||
AudioParameters.OnNext((id, v));
|
||||
}
|
||||
}
|
||||
|
||||
// public void SetAudioParameter(WwiseParameterBinding binding)
|
||||
// {
|
||||
// FireAudioEvent(binding.Parameter);
|
||||
// }
|
||||
|
||||
public void SetAudioParameter(SpecialAudioParameter p, float v)
|
||||
{
|
||||
if (SoundBank == null) return;
|
||||
var metaObject = SoundBank.GetParameter(p);
|
||||
if (metaObject == null)
|
||||
{
|
||||
ItemManager.Log($"Attempted to set {Enum.GetName(typeof(ChargedWeaponAudioEvent), p)} audio parameter, but the soundbank doesn't support it!");
|
||||
return;
|
||||
}
|
||||
SetAudioParameter(metaObject.Id, v, true);
|
||||
}
|
||||
|
||||
public EquippedItem(ItemManager itemManager, EquippableItem item, int2 position, Entity entity, HardpointData hardpoint)
|
||||
{
|
||||
ItemManager = itemManager;
|
||||
|
|
@ -2460,11 +2384,6 @@ public class EquippedItem : IStatContext
|
|||
|
||||
public void Update(float delta)
|
||||
{
|
||||
foreach (var audioStat in Data.AudioStats)
|
||||
{
|
||||
SetAudioParameter(audioStat.Parameter, Evaluate(audioStat.Stat));
|
||||
}
|
||||
|
||||
if (Active.Value)
|
||||
{
|
||||
foreach (var group in BehaviorGroups.Values)
|
||||
|
|
|
|||
|
|
@ -203,34 +203,6 @@ public enum TemperatureUnit
|
|||
Fahrenheit
|
||||
}
|
||||
|
||||
public enum WeaponAudioEvent
|
||||
{
|
||||
Fire,
|
||||
Hit,
|
||||
Miss
|
||||
}
|
||||
|
||||
public enum ChargedWeaponAudioEvent
|
||||
{
|
||||
Start,
|
||||
Stop,
|
||||
Fail
|
||||
}
|
||||
|
||||
public enum SpecialAudioParameter
|
||||
{
|
||||
ShipVelocity,
|
||||
ChargeLevel,
|
||||
TargetLock,
|
||||
Intensity,
|
||||
}
|
||||
|
||||
public enum LoopingAudioEvent
|
||||
{
|
||||
Play,
|
||||
Stop
|
||||
}
|
||||
|
||||
public enum MusicType
|
||||
{
|
||||
Overworld,
|
||||
|
|
|
|||
|
|
@ -1,92 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
[JsonObject]
|
||||
public class WwiseMetadataFile
|
||||
{
|
||||
public WwiseMetaSoundBanksInfo SoundBanksInfo;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class WwiseMetaSoundBanksInfo
|
||||
{
|
||||
public WwiseMetaSoundBank[] SoundBanks;
|
||||
|
||||
private Dictionary<uint, WwiseMetaSoundBank> _soundBanks;
|
||||
public WwiseMetaSoundBank GetSoundBank(uint id)
|
||||
{
|
||||
if (_soundBanks == null) _soundBanks = SoundBanks.ToDictionary(sb => sb.Id);
|
||||
return _soundBanks[id];
|
||||
}
|
||||
|
||||
private Dictionary<string, WwiseMetaSoundBank> _soundBankNames;
|
||||
public WwiseMetaSoundBank GetSoundBank(string name)
|
||||
{
|
||||
if (_soundBankNames == null) _soundBankNames = SoundBanks.ToDictionary(sb => sb.ShortName);
|
||||
return _soundBankNames[name];
|
||||
}
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class WwiseMetaSoundBank
|
||||
{
|
||||
public uint Id;
|
||||
public string ShortName;
|
||||
public string ObjectPath;
|
||||
public WwiseMetaObject[] IncludedEvents;
|
||||
public WwiseMetaObject[] GameParameters;
|
||||
|
||||
public WwiseMetaObject GetEvent(WeaponAudioEvent weaponAudioEvent)
|
||||
{
|
||||
return weaponAudioEvent switch
|
||||
{
|
||||
WeaponAudioEvent.Fire => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_fire")),
|
||||
WeaponAudioEvent.Hit => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_hit")),
|
||||
WeaponAudioEvent.Miss => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_miss")),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(weaponAudioEvent), weaponAudioEvent, null)
|
||||
};
|
||||
}
|
||||
|
||||
public WwiseMetaObject GetEvent(ChargedWeaponAudioEvent chargedWeaponAudioEvent)
|
||||
{
|
||||
return chargedWeaponAudioEvent switch
|
||||
{
|
||||
ChargedWeaponAudioEvent.Start => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_charge_play")),
|
||||
ChargedWeaponAudioEvent.Stop => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_charge_stop")),
|
||||
ChargedWeaponAudioEvent.Fail => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_fail")),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(chargedWeaponAudioEvent), chargedWeaponAudioEvent, null)
|
||||
};
|
||||
}
|
||||
|
||||
public WwiseMetaObject GetEvent(LoopingAudioEvent loopingAudioEvent)
|
||||
{
|
||||
return loopingAudioEvent switch
|
||||
{
|
||||
LoopingAudioEvent.Play => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_play")),
|
||||
LoopingAudioEvent.Stop => IncludedEvents?.FirstOrDefault(e => e.Name.EndsWith("_stop")),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(loopingAudioEvent), loopingAudioEvent, null)
|
||||
};
|
||||
}
|
||||
|
||||
public WwiseMetaObject GetParameter(SpecialAudioParameter audioParameter)
|
||||
{
|
||||
return audioParameter switch
|
||||
{
|
||||
SpecialAudioParameter.ShipVelocity => GameParameters?.FirstOrDefault(p => p.Name == "ship_velocity"),
|
||||
SpecialAudioParameter.ChargeLevel => GameParameters?.FirstOrDefault(p => p.Name == "charge_level"),
|
||||
SpecialAudioParameter.TargetLock => GameParameters?.FirstOrDefault(p => p.Name == "target_locking"),
|
||||
SpecialAudioParameter.Intensity => GameParameters?.FirstOrDefault(p => p.Name == "sfx_shared_intensity"),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(audioParameter), audioParameter, null)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class WwiseMetaObject
|
||||
{
|
||||
public uint Id;
|
||||
public string Name;
|
||||
public string ObjectPath;
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0a12363ee8ef43b399bf91ca099947a9
|
||||
timeCreated: 1619664281
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class WwiseSoundBinding
|
||||
{
|
||||
[Key(0), JsonProperty("playEvent")]
|
||||
public uint PlayEvent;
|
||||
}
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class WwiseLoopingSoundBinding : WwiseSoundBinding
|
||||
{
|
||||
[Key(1), JsonProperty("stopEvent")]
|
||||
public uint StopEvent;
|
||||
}
|
||||
|
||||
// public class WwiseParameterBinding
|
||||
// {
|
||||
// [Key(0), JsonProperty("parameter")]
|
||||
// public uint Parameter;
|
||||
// }
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2e128c1cb68f481c9a846344e8283014
|
||||
timeCreated: 1619729875
|
||||
Loading…
Reference in a new issue