MCPcopy Create free account
hub / github.com/ddnet/ddnet / LoadOpusFromMem

Method LoadOpusFromMem

src/engine/client/sound.cpp:627–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625}
626
627int CSound::LoadOpusFromMem(const void *pData, unsigned DataSize, bool ForceLoad, const char *pContextName)
628{
629 // no need to load sound when we are running with no sound
630 if(!m_SoundEnabled && !ForceLoad)
631 return -1;
632
633 CSample *pSample = AllocSample();
634 if(!pSample)
635 return -1;
636
637 if(!DecodeOpus(*pSample, pData, DataSize, pContextName))
638 {
639 UnloadSample(pSample->m_Index);
640 return -1;
641 }
642
643 RateConvert(*pSample);
644 return pSample->m_Index;
645}
646
647int CSound::LoadWVFromMem(const void *pData, unsigned DataSize, bool ForceLoad, const char *pContextName)
648{

Callers 4

OnMapLoadMethod · 0.80
AddSoundMethod · 0.80
ReplaceSoundMethod · 0.80
LoadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected