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

Function DeleteSoundData

engine/sound/src/sound.cpp:855–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

853 }
854
855 Result DeleteSoundData(HSoundData sound_data)
856 {
857 DM_MUTEX_OPTIONAL_SCOPED_LOCK(g_SoundSystem->m_Mutex);
858
859 sound_data->m_RefCount --;
860 if (sound_data->m_RefCount > 0)
861 {
862 return RESULT_OK;
863 }
864
865 if (sound_data->m_Data != 0x0)
866 free((void*) sound_data->m_Data);
867
868 SoundSystem* sound = g_SoundSystem;
869 DM_PROPERTY_ADD_U32(rmtp_SoundDataSize, -((int32_t)sizeof(SoundData) + (int32_t)sound_data->m_Size));
870 sound->m_SoundDataPool.Push(sound_data->m_Index);
871 DM_PROPERTY_SET_U32(rmtp_SoundDataCount, sound->m_SoundDataPool.Size());
872 sound_data->m_Index = 0xffff;
873
874 return RESULT_OK;
875 }
876
877 // Called by the decoders in the context of a dmSound update loop (MixInstances), the the mutex acquired
878 Result SoundDataRead(HSoundData sound_data, uint32_t offset, uint32_t size, void* out, uint32_t* out_size)

Callers 7

NewSoundDataInternalFunction · 0.70
DeleteSoundInstanceFunction · 0.70
TEST_PFunction · 0.50
TESTFunction · 0.50
DecodeAndTimeMethod · 0.50
DestroyResourceFunction · 0.50
ResSoundDataRecreateFunction · 0.50

Calls 3

freeFunction · 0.85
PushMethod · 0.45
SizeMethod · 0.45

Tested by 3

TEST_PFunction · 0.40
TESTFunction · 0.40
DecodeAndTimeMethod · 0.40