MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _createBuffer

Method _createBuffer

Engine/source/sfx/sfxProfile.cpp:318–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316//-----------------------------------------------------------------------------
317
318SFXBuffer* SFXProfile::_createBuffer()
319{
320 SFXBuffer* buffer = 0;
321
322 // Try to create through SFXDevie.
323
324 if( mFilename != StringTable->EmptyString() && SFX )
325 {
326 buffer = SFX->_createBuffer( mFilename, mDescription );
327 if( buffer )
328 {
329 #ifdef TORQUE_DEBUG
330 const SFXFormat& format = buffer->getFormat();
331 Con::printf( "%s SFX: %s (%i channels, %i kHz, %.02f sec, %i kb)",
332 mDescription->mIsStreaming ? "Streaming" : "Loaded", mFilename,
333 format.getChannels(),
334 format.getSamplesPerSecond() / 1000,
335 F32( buffer->getDuration() ) / 1000.0f,
336 format.getDataLength( buffer->getDuration() ) / 1024 );
337 #endif
338 }
339 }
340
341 // If that failed, load through SFXResource.
342
343 if( !buffer )
344 {
345 Resource< SFXResource >& resource = getResource();
346 if( resource != NULL && SFX )
347 {
348 #ifdef TORQUE_DEBUG
349 const SFXFormat& format = resource->getFormat();
350 Con::printf( "%s SFX: %s (%i channels, %i kHz, %.02f sec, %i kb)",
351 mDescription->mIsStreaming ? "Streaming" : "Loading", resource->getFileName().c_str(),
352 format.getChannels(),
353 format.getSamplesPerSecond() / 1000,
354 F32( resource->getDuration() ) / 1000.0f,
355 format.getDataLength( resource->getDuration() ) / 1024 );
356 #endif
357
358 ThreadSafeRef< SFXStream > sfxStream = resource->openStream();
359 buffer = SFX->_createBuffer( sfxStream, mDescription );
360 }
361 }
362
363 return buffer;
364}
365
366//-----------------------------------------------------------------------------
367

Callers

nothing calls this directly

Calls 10

printfFunction · 0.85
EmptyStringMethod · 0.80
getFileNameMethod · 0.80
openStreamMethod · 0.80
getFormatMethod · 0.45
getChannelsMethod · 0.45
getSamplesPerSecondMethod · 0.45
getDurationMethod · 0.45
getDataLengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected