mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 03:44:05 +00:00
probably openal initialization fix
This commit is contained in:
parent
34d9ad0cbd
commit
20f976ddc7
1 changed files with 33 additions and 4 deletions
|
@ -426,6 +426,12 @@ void OpenAL_Output::init(const std::string &devname)
|
||||||
else
|
else
|
||||||
std::cout << "Opened \""<<alcGetString(mDevice, ALC_DEVICE_SPECIFIER)<<"\"" << std::endl;
|
std::cout << "Opened \""<<alcGetString(mDevice, ALC_DEVICE_SPECIFIER)<<"\"" << std::endl;
|
||||||
|
|
||||||
|
ALCint params[5];
|
||||||
|
// params[0] = ALC_MONO_SOURCES;
|
||||||
|
// params[1] = 10;
|
||||||
|
// params[2] = ALC_STEREO_SOURCES;
|
||||||
|
// params[3] = 10;
|
||||||
|
// params[4] = 0;
|
||||||
mContext = alcCreateContext(mDevice, NULL);
|
mContext = alcCreateContext(mDevice, NULL);
|
||||||
if(!mContext || alcMakeContextCurrent(mContext) == ALC_FALSE)
|
if(!mContext || alcMakeContextCurrent(mContext) == ALC_FALSE)
|
||||||
fail(std::string("Failed to setup context: ")+alcGetString(mDevice, alcGetError(mDevice)));
|
fail(std::string("Failed to setup context: ")+alcGetString(mDevice, alcGetError(mDevice)));
|
||||||
|
@ -433,6 +439,18 @@ void OpenAL_Output::init(const std::string &devname)
|
||||||
alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
|
alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
|
// ALCint size;
|
||||||
|
// alcGetIntegerv( mDevice, ALC_ATTRIBUTES_SIZE, 1, &size);
|
||||||
|
// std::vector<ALCint> attrs(size);
|
||||||
|
// alcGetIntegerv( mDevice, ALC_ALL_ATTRIBUTES, size, &attrs[0] );
|
||||||
|
// for(int i=0; i<attrs.size(); ++i)
|
||||||
|
// {
|
||||||
|
// if( attrs[i] == ALC_MONO_SOURCES )
|
||||||
|
// {
|
||||||
|
// std::cout << "max mono sources: " << attrs.at(i+1) << std::endl;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
ALCint maxmono=0, maxstereo=0;
|
ALCint maxmono=0, maxstereo=0;
|
||||||
alcGetIntegerv(mDevice, ALC_MONO_SOURCES, 1, &maxmono);
|
alcGetIntegerv(mDevice, ALC_MONO_SOURCES, 1, &maxmono);
|
||||||
alcGetIntegerv(mDevice, ALC_STEREO_SOURCES, 1, &maxstereo);
|
alcGetIntegerv(mDevice, ALC_STEREO_SOURCES, 1, &maxstereo);
|
||||||
|
@ -440,14 +458,25 @@ void OpenAL_Output::init(const std::string &devname)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ALCuint maxtotal = std::min<ALCuint>(maxmono+maxstereo, 256);
|
ALCuint maxtotal = 256;//std::min<ALCuint>(maxmono+maxstereo, 256);
|
||||||
for(size_t i = 0;i < maxtotal;i++)
|
bool stop = false;
|
||||||
|
for(size_t i = 0;i < maxtotal && !stop;i++)
|
||||||
{
|
{
|
||||||
ALuint src = 0;
|
ALuint src = 0;
|
||||||
alGenSources(1, &src);
|
alGenSources(1, &src);
|
||||||
throwALerror();
|
|
||||||
|
ALenum err = alGetError();
|
||||||
|
if(err != AL_NO_ERROR)
|
||||||
|
{
|
||||||
|
stop = true;
|
||||||
|
std::cout << "Stopping source generation at " << i << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
mFreeSources.push_back(src);
|
mFreeSources.push_back(src);
|
||||||
}
|
}
|
||||||
|
//throwALerror();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue