mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 23:15:41 +00:00
Keep track of all allocated sources
This commit is contained in:
parent
e82c4afd50
commit
973b5faf25
2 changed files with 9 additions and 6 deletions
|
@ -504,8 +504,9 @@ void OpenAL_Output::init(const std::string &devname)
|
||||||
ALuint src = 0;
|
ALuint src = 0;
|
||||||
alGenSources(1, &src);
|
alGenSources(1, &src);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
mFreeSources.push_back(src);
|
mSources.push_back(src);
|
||||||
}
|
}
|
||||||
|
mFreeSources.insert(mFreeSources.begin(), mSources.begin(), mSources.end());
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
|
@ -521,11 +522,10 @@ void OpenAL_Output::deinit()
|
||||||
{
|
{
|
||||||
mStreamThread->removeAll();
|
mStreamThread->removeAll();
|
||||||
|
|
||||||
while(!mFreeSources.empty())
|
mFreeSources.clear();
|
||||||
{
|
if(mSources.size() > 0)
|
||||||
alDeleteSources(1, &mFreeSources.front());
|
alDeleteSources(mSources.size(), &mSources[0]);
|
||||||
mFreeSources.pop_front();
|
mSources.clear();
|
||||||
}
|
|
||||||
|
|
||||||
mBufferRefs.clear();
|
mBufferRefs.clear();
|
||||||
mUnusedBuffers.clear();
|
mUnusedBuffers.clear();
|
||||||
|
|
|
@ -21,6 +21,9 @@ namespace MWSound
|
||||||
ALCdevice *mDevice;
|
ALCdevice *mDevice;
|
||||||
ALCcontext *mContext;
|
ALCcontext *mContext;
|
||||||
|
|
||||||
|
typedef std::vector<ALuint> IDVec;
|
||||||
|
IDVec mSources;
|
||||||
|
|
||||||
typedef std::deque<ALuint> IDDq;
|
typedef std::deque<ALuint> IDDq;
|
||||||
IDDq mFreeSources;
|
IDDq mFreeSources;
|
||||||
IDDq mUnusedBuffers;
|
IDDq mUnusedBuffers;
|
||||||
|
|
Loading…
Reference in a new issue