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

Method onAdd

Engine/source/sfx/sfxSource.cpp:335–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333//-----------------------------------------------------------------------------
334
335bool SFXSource::onAdd()
336{
337 if( !Parent::onAdd() )
338 return false;
339
340 // Make sure we have a description.
341
342 if( !mDescription )
343 {
344 Con::errorf( "SFXSource::onAdd() - no description set on source %i (%s)", getId(), getName() );
345 return false;
346 }
347
348 // Set our initial properties.
349
350 _setVolume( mDescription->mVolume );
351 _setPitch( mDescription->mPitch );
352 _setPriority( mDescription->mPriority );
353 _setFadeTimes( mDescription->mFadeInTime, mDescription->mFadeOutTime );
354
355 _setMinMaxDistance( mDescription->mMinDistance, mDescription->mMaxDistance );
356 _setCone( F32( mDescription->mConeInsideAngle ),
357 F32( mDescription->mConeOutsideAngle ),
358 mDescription->mConeOutsideVolume );
359
360 // Add the parameters from the description.
361
362 for( U32 i = 0; i < SFXDescription::MaxNumParameters; ++ i )
363 {
364 StringTableEntry name = mDescription->mParameters[ i ];
365 if( name && name[ 0 ] )
366 _addParameter( name );
367 }
368
369 // Add the parameters from the track.
370
371 if( mTrack != NULL )
372 for( U32 i = 0; i < SFXTrack::MaxNumParameters; ++ i )
373 {
374 StringTableEntry name = mTrack->getParameter( i );
375 if( name && name[ 0 ] )
376 _addParameter( name );
377 }
378
379 // Add us to the description's source group.
380
381 if( mDescription->mSourceGroup )
382 mDescription->mSourceGroup->addObject( this );
383
384 // Add to source set.
385
386 if( Sim::getSFXSourceSet() )
387 Sim::getSFXSourceSet()->addObject( this );
388
389 // Register with SFX system.
390
391 SFX->_onAddSource( this );
392

Callers

nothing calls this directly

Calls 5

errorfFunction · 0.85
getParameterMethod · 0.80
_onAddSourceMethod · 0.80
getNameFunction · 0.50
addObjectMethod · 0.45

Tested by

no test coverage detected