MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SoundLength

Function SoundLength

engine/Poseidon/Game/Commands/GameStateExtUi.cpp:952–963  ·  view source on GitHub ↗

soundLength "classname" — duration in seconds of the CfgSounds entry's clip, resolved for the current voice language exactly as say/playSound do (FindSound applies the per-language " . . " suffix). Returns 0 for a subtitle-only entry or an unresolved key. Cutscene scripts can pace dialog to the real clip regardless of language, e.g. unit say "x00v05"; ~ (soundLength "x00v05") + 0.4

Source from the content-addressed store, hash-verified

950// Cutscene scripts can pace dialog to the real clip regardless of language, e.g.
951// unit say "x00v05"; ~ (soundLength "x00v05") + 0.4
952GameValue SoundLength(const GameState* state, GameValuePar oper1)
953{
954 GameStringType name = oper1;
955 SoundPars pars;
956 pars.name = "";
957 FindSound(name, pars);
958 if (pars.name.GetLength() <= 0 || !GSoundsys)
959 {
960 return 0.0f;
961 }
962 return GSoundsys->GetWaveDuration(pars.name);
963}
964
965GameValue VoiceLanguage(const GameState* /*state*/)
966{

Callers

nothing calls this directly

Calls 3

FindSoundFunction · 0.85
GetLengthMethod · 0.45
GetWaveDurationMethod · 0.45

Tested by

no test coverage detected