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

Method createSource

Engine/source/sfx/sfxSystem.cpp:531–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 12

_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
onNewDataBlockMethod · 0.45
onNewDataBlockMethod · 0.45
onNewDataBlockMethod · 0.45

Calls 8

errorfFunction · 0.85
sizeMethod · 0.45
getNameMethod · 0.45
c_strMethod · 0.45
getIdMethod · 0.45
getClassNameMethod · 0.45
setTransformMethod · 0.45
setVelocityMethod · 0.45

Tested by

no test coverage detected