[Openal] Failed to Open Device in Linux
Casey Borders
thebeast.13 at gmail.com
Sun Dec 9 03:42:55 PST 2007
This is the code I use to initialize OpenAL and it works fine on Windows,
but crashes every time in Linux when the call to alcOpenDevice() fails. I
have even tried hard coding the NULL and that still fails. It says "OGRE
EXCEPTION(40961:): Failed to open Device: OpenAL Error: The specified source
name is not valid in initializeDevice"
I am sure there is something that I am doing incorrectly for Linux, but for
the life of me I can't figure out what it is! Here's the code:
void SoundManager::initializeDevice(const Ogre::String& deviceName)
{
Ogre::LogManager::getSingleton().logMessage("OpenAL Devices");
Ogre::LogManager::getSingleton().logMessage("--------------");
std::stringstream ss;
// List devices in log and see if the sugested device is in the list
Ogre::StringVector deviceList = getDeviceList();
bool deviceInList = false;
Ogre::StringVector::iterator deviceItr;
for(deviceItr = deviceList.begin(); deviceItr != deviceList.end() &&
(*deviceItr).compare("") != 0; deviceItr++)
{
deviceInList = (*deviceItr).compare(deviceName) == 0;
ss << " * " << (*deviceItr);
Ogre::LogManager::getSingleton().logMessage(ss.str());
ss.clear(); ss.str("");
}
// If the suggested device is in the list we use it, otherwise
select the default device
mDevice = alcOpenDevice(deviceInList ? deviceName.c_str() : NULL);
CheckError(alcGetError(mDevice), "Failed to open Device");
CheckCondition(mDevice != NULL, 13, "Failed to open audio device");
Ogre::LogManager::getSingleton().logMessage("Choosing: " +
Ogre::String(alcGetString(mDevice, ALC_DEVICE_SPECIFIER)));
// Create OpenAL Context
mContext = alcCreateContext(mDevice, NULL);
CheckError(alcGetError(mDevice), "Failed to create Context");
CheckCondition(mContext != NULL, 13, "Failed to create OpenAL
Context");
alcMakeContextCurrent(mContext);
CheckError(alcGetError(mDevice), "Failed to set current context");
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://opensource.creative.com/pipermail/openal/attachments/20071209/113df94e/attachment.html
More information about the Openal
mailing list