| 87 | //----------------------------------------------------------------------------- |
| 88 | |
| 89 | SFXSound* SFXSound::_create( SFXDevice *device, SFXProfile *profile ) |
| 90 | { |
| 91 | AssertFatal( profile, "SFXSound::_create() - Got a null profile!" ); |
| 92 | |
| 93 | SFXDescription* desc = profile->getDescription(); |
| 94 | if ( !desc ) |
| 95 | { |
| 96 | Con::errorf( "SFXSound::_create() - Profile has null description!" ); |
| 97 | return NULL; |
| 98 | } |
| 99 | |
| 100 | // Create the sound and register it. |
| 101 | |
| 102 | SFXSound* sound = new SFXSound( profile, desc ); |
| 103 | sound->registerObject(); |
| 104 | |
| 105 | // Initialize the buffer. |
| 106 | |
| 107 | SFXBuffer* buffer = profile->getBuffer(); |
| 108 | if( !buffer ) |
| 109 | { |
| 110 | sound->deleteObject(); |
| 111 | |
| 112 | Con::errorf( "SFXSound::_create() - Could not create device buffer!" ); |
| 113 | return NULL; |
| 114 | } |
| 115 | |
| 116 | sound->_setBuffer( buffer ); |
| 117 | |
| 118 | // The sound is a console object... register it. |
| 119 | |
| 120 | |
| 121 | #ifdef DEBUG_SPEW |
| 122 | Platform::outputDebugString( "[SFXSound] new sound '%i' with profile '%i' (\"%s\")", |
| 123 | sound->getId(), profile->getId(), profile->getName() ); |
| 124 | #endif |
| 125 | |
| 126 | // Hook up reloading. |
| 127 | |
| 128 | profile->getChangedSignal().notify( sound, &SFXSound::_onProfileChanged ); |
| 129 | |
| 130 | return sound; |
| 131 | } |
| 132 | |
| 133 | //----------------------------------------------------------------------------- |
| 134 |
nothing calls this directly
no test coverage detected