mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Keep track of all allocated sources
This commit is contained in:
parent
e82c4afd50
commit
973b5faf25
@ -504,8 +504,9 @@ void OpenAL_Output::init(const std::string &devname)
|
||||
ALuint src = 0;
|
||||
alGenSources(1, &src);
|
||||
throwALerror();
|
||||
mFreeSources.push_back(src);
|
||||
mSources.push_back(src);
|
||||
}
|
||||
mFreeSources.insert(mFreeSources.begin(), mSources.begin(), mSources.end());
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
@ -521,11 +522,10 @@ void OpenAL_Output::deinit()
|
||||
{
|
||||
mStreamThread->removeAll();
|
||||
|
||||
while(!mFreeSources.empty())
|
||||
{
|
||||
alDeleteSources(1, &mFreeSources.front());
|
||||
mFreeSources.pop_front();
|
||||
}
|
||||
mFreeSources.clear();
|
||||
if(mSources.size() > 0)
|
||||
alDeleteSources(mSources.size(), &mSources[0]);
|
||||
mSources.clear();
|
||||
|
||||
mBufferRefs.clear();
|
||||
mUnusedBuffers.clear();
|
||||
|
@ -21,6 +21,9 @@ namespace MWSound
|
||||
ALCdevice *mDevice;
|
||||
ALCcontext *mContext;
|
||||
|
||||
typedef std::vector<ALuint> IDVec;
|
||||
IDVec mSources;
|
||||
|
||||
typedef std::deque<ALuint> IDDq;
|
||||
IDDq mFreeSources;
|
||||
IDDq mUnusedBuffers;
|
||||
|
Loading…
x
Reference in New Issue
Block a user