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

Method GetWaveDuration

engine/PoseidonOpenAL/SoundSystemOAL.cpp:254–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254float SoundSystemOAL::GetWaveDuration(const char* filename)
255{
256 // SoundLoadFile dispatches by extension (.ogg/.wav, else .wss); WSSLoadFile alone returned
257 // null for .ogg, so any OGG duration query (speech/dialog clips, soundLength) read as 0.
258 WaveStream* s = SoundLoadFile(filename);
259 if (!s)
260 return 0.f;
261 WAVEFORMATEX fmt;
262 s->GetFormat(fmt);
263 float dur = fmt.nAvgBytesPerSec > 0
264 ? static_cast<float>(s->GetUncompressedSize()) / static_cast<float>(fmt.nAvgBytesPerSec)
265 : 0.f;
266 s->Release();
267 return dur;
268}
269
270IWave* SoundSystemOAL::CreateEmptyWave(float duration)
271{

Callers

nothing calls this directly

Calls 4

SoundLoadFileFunction · 0.85
GetFormatMethod · 0.45
GetUncompressedSizeMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected