Fix memory leak in SoundSystemWindows (#47)

* Fix memory leak in SoundSystemWindows

Add functionality to release LPDIRECTSOUND3DBUFFER8 when sound finished playing.

* Update minecraftcpp.vcxproj

same mistake again
This commit is contained in:
f
2023-08-10 09:05:13 +02:00
committed by GitHub
parent c445c255a3
commit ac4369f5b2
2 changed files with 24 additions and 6 deletions

View File

@@ -37,8 +37,15 @@ public:
virtual void stop(const std::string& sound);
virtual void playAt(const SoundDesc& sound, float x, float y, float z, float a, float b);
private:
struct BufferInfo
{
LPDIRECTSOUNDBUFFER buffer;
LPDIRECTSOUND3DBUFFER8 object3d;
};
bool m_available;
IDirectSound8* m_directsound;
LPDIRECTSOUND3DLISTENER8 m_listener;
std::vector<LPDIRECTSOUNDBUFFER> m_buffers;
std::vector<BufferInfo> m_buffers;
};