MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / StreamOnComplete

Method StreamOnComplete

CrySoundSystem/SoundBuffer.cpp:357–387  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

355
356//////////////////////////////////////////////////////////////////////////
357void CSoundBuffer::StreamOnComplete(IReadStream *pStream, unsigned nError)
358{
359 GUARD_HEAP;
360 FUNCTION_PROFILER( m_pSoundSystem->GetSystem(),PROFILE_SOUND );
361 if (nError)
362 {
363 m_bLoadFailure=true;
364 LoadFailed();
365 return;
366 }
367 //use unmanaged channels/indexes, any other type creates problems
368#ifndef CS_VERSION_372
369 CS_SAMPLE *pSample=CS_Sample_Load(CS_UNMANAGED, (const char*)pStream->GetBuffer(), GetFModFlags(m_bLooping) | CS_LOADMEMORY, pStream->GetBytesRead());
370#else
371 // 3.7
372 CS_SAMPLE *pSample=CS_Sample_Load(CS_UNMANAGED, (const char*)pStream->GetBuffer(), GetFModFlags(m_bLooping) | CS_LOADMEMORY, 0, pStream->GetBytesRead());
373#endif
374 if (!pSample)
375 {
376 m_pSoundSystem->m_pILog->LogToFile("Warning: Cannot load sample sound %s\n", m_Props.sName.c_str());
377 m_bLoadFailure=true;
378 LoadFailed();
379 return;
380 }
381 //set the sound source
382 SetSample(pSample);
383 //CS_Sample_SetMode(pSample, m_bLooping ? CS_LOOP_NORMAL : CS_LOOP_OFF);
384 CS_Sample_SetMode(pSample, GetFModFlags(m_bLooping));
385 SoundLoaded();
386 //TRACE("Sound-Streaming for %s finished.", m_Props.sName.c_str());
387}

Callers 1

FinalizeIOMethod · 0.45

Calls 5

GetBytesReadMethod · 0.80
GetSystemMethod · 0.45
GetBufferMethod · 0.45
LogToFileMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected