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

Method _createBuffer

Engine/source/sfx/sfxSystem.cpp:694–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692//-----------------------------------------------------------------------------
693
694SFXBuffer* SFXSystem::_createBuffer( const ThreadSafeRef< SFXStream >& stream, SFXDescription* description )
695{
696 // The buffers are created by the active
697 // device... without one we cannot do anything.
698 if ( !mDevice )
699 {
700 Con::errorf( "SFXSystem::_createBuffer - No sound device initialized!!" );
701 return NULL;
702 }
703
704 // Some sanity checking for streaming. If the stream isn't at least three packets
705 // in size given the current settings in "description", then turn off streaming.
706 // The device code *will* mess up if the stream input fails to match certain metrics.
707 // Just disabling streaming when it doesn't make sense is easier than complicating the
708 // device logic to account for bad metrics.
709
710 bool streamFlag = description->mIsStreaming;
711 if( description->mIsStreaming
712 && stream->getDuration() < description->mStreamPacketSize * 1000 * SFXInternal::SFXAsyncQueue::DEFAULT_STREAM_QUEUE_LENGTH )
713 description->mIsStreaming = false;
714
715 SFXBuffer* buffer = mDevice->createBuffer( stream, description );
716
717 description->mIsStreaming = streamFlag; // restore in case we stomped it
718 return buffer;
719}
720
721//-----------------------------------------------------------------------------
722

Callers 1

_createMethod · 0.45

Calls 3

errorfFunction · 0.50
getDurationMethod · 0.45
createBufferMethod · 0.45

Tested by

no test coverage detected