MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / BGMWrapper

Method BGMWrapper

LuaSTGPlus/ResourceMgr.cpp:393–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393ResMusic::BGMWrapper::BGMWrapper(fcyRefPointer<f2dSoundDecoder> pOrg, fDouble LoopStart, fDouble LoopEnd)
394 : m_pDecoder(pOrg)
395{
396 LASSERT(pOrg);
397
398 // �������
399 m_TotalSample = m_pDecoder->GetBufferSize() / m_pDecoder->GetBlockAlign();
400
401 if (LoopStart < 0)
402 LoopStart = 0;
403 m_pLoopStartSample = (fuInt)(LoopStart * m_pDecoder->GetSamplesPerSec());
404
405 if (LoopEnd <= 0)
406 m_pLoopEndSample = m_TotalSample;
407 else
408 m_pLoopEndSample = min(m_TotalSample, (fuInt)(LoopEnd * m_pDecoder->GetSamplesPerSec()));
409
410 if (m_pLoopEndSample < m_pLoopStartSample)
411 std::swap(m_pLoopStartSample, m_pLoopEndSample);
412
413 if (m_pLoopEndSample == m_pLoopStartSample)
414 throw fcyException("ResMusic::BGMWrapper::BGMWrapper", "Invalid loop period.");
415}
416
417////////////////////////////////////////////////////////////////////////////////
418/// ResFX

Callers

nothing calls this directly

Calls 3

GetBufferSizeMethod · 0.80
GetBlockAlignMethod · 0.80
GetSamplesPerSecMethod · 0.80

Tested by

no test coverage detected