| 443 | //----------------------------------------------------------------------------- |
| 444 | |
| 445 | bool SFXDescription::onAdd() |
| 446 | { |
| 447 | if ( !Parent::onAdd() ) |
| 448 | return false; |
| 449 | |
| 450 | Sim::getSFXDescriptionSet()->addObject( this ); |
| 451 | |
| 452 | // Convert a legacy 'channel' field, if we have one. |
| 453 | |
| 454 | static const char* sChannel = StringTable->insert( "channel" ); |
| 455 | const char* channelValue = getDataField( sChannel, NULL ); |
| 456 | if( channelValue && channelValue[ 0 ] ) |
| 457 | { |
| 458 | ConsoleValue result = Con::evaluatef( "return sfxOldChannelToGroup( %s );", channelValue ); |
| 459 | const char* group = result.getString(); |
| 460 | if( !Sim::findObject( group, mSourceGroup ) ) |
| 461 | Con::errorf( "SFXDescription::onAdd - could not resolve channel '%s' to SFXSource", channelValue ); |
| 462 | } |
| 463 | |
| 464 | // Validate the data we'll be passing to |
| 465 | // the audio layer. |
| 466 | validate(); |
| 467 | |
| 468 | return true; |
| 469 | } |
| 470 | |
| 471 | //----------------------------------------------------------------------------- |
| 472 | |