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