MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _create

Method _create

Engine/source/sfx/sfxSound.cpp:89–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87//-----------------------------------------------------------------------------
88
89SFXSound* 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

Callers

nothing calls this directly

Calls 11

_setBufferMethod · 0.80
getIdMethod · 0.65
errorfFunction · 0.50
getDescriptionMethod · 0.45
registerObjectMethod · 0.45
getBufferMethod · 0.45
deleteObjectMethod · 0.45
getNameMethod · 0.45
notifyMethod · 0.45
ptrMethod · 0.45
_createBufferMethod · 0.45

Tested by

no test coverage detected