| 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) |