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

Method createSource

Engine/source/sfx/sfxSystem.cpp:528–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526//-----------------------------------------------------------------------------
527
528SFXSource* SFXSystem::createSource( SFXTrack* track,
529 const MatrixF* transform,
530 const VectorF* velocity )
531{
532 if( !track )
533 return NULL;
534
535 SFXSource* source = NULL;
536
537 // Try creating through a plugin first so that they
538 // always get the first shot and may override our
539 // logic here.
540
541 for( U32 i = 0; !source && i < mPlugins.size(); ++ i )
542 source = mPlugins[ i ]->createSource( track );
543
544 // If that failed, try our own logic using the track
545 // types that we know about.
546
547 if( !source )
548 {
549 if( !mDevice )
550 {
551 Con::errorf( "SFXSystem::createSource() - no device initialized!" );
552 return NULL;
553 }
554
555 if( dynamic_cast< SFXPlayList* >( track ) )
556 {
557 // Create a playback controller for the track.
558
559 SFXPlayList* playList = static_cast< SFXPlayList* >( track );
560 source = SFXController::_create( playList );
561 }
562 else if( dynamic_cast< SFXProfile* >( track ) )
563 {
564 // Create a sound.
565
566 SFXProfile* profile = static_cast< SFXProfile* >( track );
567 source = SFXSound::_create( mDevice, profile );
568 if( !source )
569 {
570 Con::errorf(
571 "SFXSystem::createSource() - Failed to create sound!\n"
572 " Profile: %s\n"
573 " Filename: %s",
574 profile->getName(),
575 profile->getSoundFileName().c_str() );
576 }
577 }
578 else
579 {
580 Con::errorf( "SFXSystem::createSource - cannot create source for %i (%s) of type '%s'",
581 track->getId(), track->getName(), track->getClassName() );
582 Con::errorf( "SFXSystem::createSource - maybe you are using the wrong SFX provider for this type of track" );
583 return NULL;
584 }
585 }

Callers 14

onNewDataBlockMethod · 0.45
ea_updateMethod · 0.45
ea_updateMethod · 0.45
_execInsnMethod · 0.45
sfxSystem.cppFile · 0.45
updateAudioStateMethod · 0.45
onNewDataBlockMethod · 0.45
setImageStateMethod · 0.45
onNewDataBlockMethod · 0.45
onNewDataBlockMethod · 0.45
_updateMethod · 0.45
onNewDataBlockMethod · 0.45

Calls 9

getSoundFileNameMethod · 0.80
getIdMethod · 0.65
errorfFunction · 0.50
sizeMethod · 0.45
getNameMethod · 0.45
c_strMethod · 0.45
getClassNameMethod · 0.45
setTransformMethod · 0.45
setVelocityMethod · 0.45

Tested by

no test coverage detected