MCPcopy Create free account
hub / github.com/defold/defold / GetOrCreateGroup

Function GetOrCreateGroup

engine/sound/src/sound_openal.cpp:247–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245 }
246
247 static int GetOrCreateGroup(const char* group_name)
248 {
249 dmhash_t group_hash = dmHashString64(group_name);
250
251 SoundSystem* sound = g_SoundSystem;
252 if (sound->m_GroupMap.Full()) {
253 return -1;
254 }
255
256 if (sound->m_GroupMap.Get(group_hash)) {
257 return *sound->m_GroupMap.Get(group_hash);
258 }
259
260 uint32_t index = sound->m_GroupMap.Size();
261 SoundGroup* group = &sound->m_Groups[index];
262 group->m_NameHash = group_hash;
263 group->m_Gain = 1.0f;
264 group->m_IsMuted = false;
265 sound->m_GroupMap.Put(group_hash, index);
266 return index;
267 }
268
269 struct ThreadArgs {
270 SoundSystem* m_Sound;

Callers 2

InitializeInternalFunction · 0.70
AddGroupFunction · 0.70

Calls 4

FullMethod · 0.45
GetMethod · 0.45
SizeMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected