本文整理汇总了C++中misc::ConfigurationFileSection::retrieveString方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationFileSection::retrieveString方法的具体用法?C++ ConfigurationFileSection::retrieveString怎么用?C++ ConfigurationFileSection::retrieveString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc::ConfigurationFileSection
的用法示例。
在下文中一共展示了ConfigurationFileSection::retrieveString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void Listener::initialize(const Misc::ConfigurationFileSection& configFileSection)
{
/* Read the listener's name: */
std::string name=configFileSection.retrieveString("./name");
listenerName=new char[name.size()+1];
strcpy(listenerName,name.c_str());
/* Determine whether the listener is head-tracked: */
headTracked=configFileSection.retrieveValue<bool>("./headTracked",false);
if(headTracked)
{
/* Retrieve head tracking device pointer: */
headDevice=findInputDevice(configFileSection.retrieveString("./headDevice").c_str());
if(headDevice==0)
Misc::throwStdErr("Listener: Head device \"%s\" not found",configFileSection.retrieveString("./headDevice").c_str());
}
else
{
/* Retrieve fixed head position/orientation: */
headDeviceTransformation=configFileSection.retrieveValue<TrackerState>("./headDeviceTransformation");
}
/* Get head position and listening and up directions in head device coordinates: */
deviceHeadPosition=configFileSection.retrieveValue<Point>("./headPosition",Point::origin);
deviceListenDirection=configFileSection.retrieveValue<Vector>("./listenDirection",Vector(0,1,0));
deviceUpDirection=configFileSection.retrieveValue<Vector>("./upDirection",Vector(0,0,1));
}
示例2: viewer
ToolKillZoneFrustum::ToolKillZoneFrustum(const Misc::ConfigurationFileSection& configFileSection)
:ToolKillZone(configFileSection),
viewer(0),screen(0)
{
/* Get the viewer: */
std::string viewerName=configFileSection.retrieveString("./killZoneViewerName");
viewer=findViewer(viewerName.c_str());
if(viewer==0)
Misc::throwStdErr("ToolKillZoneFrustum::ToolKillZoneFrustum: Viewer %s not found",viewerName.c_str());
/* Get the screen: */
std::string screenName=configFileSection.retrieveString("./killZoneScreenName");
screen=findScreen(screenName.c_str());
if(screen==0)
Misc::throwStdErr("ToolKillZoneFrustum::ToolKillZoneFrustum: Screen %s not found",screenName.c_str());
/* Read box' center and size: */
Point boxCenter=configFileSection.retrieveValue<Point>("./killZoneCenter");
Vector boxSize=configFileSection.retrieveValue<Vector>("./killZoneSize");
/* Transform box center and size to screen coordinates: */
ONTransform screenT=screen->getScreenTransformation();
boxCenter=screenT.inverseTransform(boxCenter);
boxCenter[2]=Scalar(0);
boxSize=screenT.inverseTransform(boxSize);
boxSize[2]=Scalar(0);
box=Box(boxCenter-boxSize*Scalar(0.5),boxCenter+boxSize*Scalar(0.5));
}
示例3: initialize
void Viewer::initialize(const Misc::ConfigurationFileSection& configFileSection)
{
/* Read the viewer's name: */
std::string name=configFileSection.retrieveString("./name");
viewerName=new char[name.size()+1];
strcpy(viewerName,name.c_str());
/* Determine whether the viewer is head-tracked: */
headTracked=configFileSection.retrieveValue<bool>("./headTracked",false);
if(headTracked)
{
/* Retrieve head tracking device pointer: */
headDevice=findInputDevice(configFileSection.retrieveString("./headDevice").c_str());
if(headDevice==0)
Misc::throwStdErr("Viewer: Head device \"%s\" not found",configFileSection.retrieveString("./headDevice").c_str());
}
else
{
/* Retrieve fixed head position/orientation: */
headDeviceTransformation=configFileSection.retrieveValue<TrackerState>("./headDeviceTransformation");
}
/* Get view direction and eye positions in head device coordinates: */
deviceViewDirection=configFileSection.retrieveValue<Vector>("./viewDirection",Vector(0,1,0));
deviceMonoEyePosition=configFileSection.retrieveValue<Point>("./monoEyePosition",Point::origin);
deviceLeftEyePosition=configFileSection.retrieveValue<Point>("./leftEyePosition",Point::origin);
deviceRightEyePosition=configFileSection.retrieveValue<Point>("./rightEyePosition",Point::origin);
/* Create the viewer's light source: */
lightsource=getLightsourceManager()->createLightsource(true);
/* Get head light enable flag: */
if(!configFileSection.retrieveValue<bool>("./headLightEnabled",true))
lightsource->disable();
/* Get head light position and direction in head device coordinates: */
headLightDevicePosition=configFileSection.retrieveValue<Point>("./headLightPosition",Point::origin);
headLightDeviceDirection=configFileSection.retrieveValue<Vector>("./headLightDirection",Vector(0,1,0));
/* Retrieve head light settings: */
GLLight::Color headLightColor=configFileSection.retrieveValue<GLLight::Color>("./headLightColor",GLLight::Color(1.0f,1.0f,1.0f));
lightsource->getLight().diffuse=headLightColor;
lightsource->getLight().specular=headLightColor;
lightsource->getLight().spotCutoff=configFileSection.retrieveValue<GLfloat>("./headLightSpotCutoff",180.0f);
lightsource->getLight().spotExponent=configFileSection.retrieveValue<GLfloat>("./headLightSpotExponent",0.0f);
/* Initialize transient state if head tracking is disabled: */
if(!headTracked)
{
/* Initialize transient state: */
Point hlp=headDeviceTransformation.transform(headLightDevicePosition);
lightsource->getLight().position=GLLight::Position(GLfloat(hlp[0]),GLfloat(hlp[1]),GLfloat(hlp[2]),1.0f);
Vector hld=headDeviceTransformation.transform(headLightDeviceDirection);
hld.normalize();
lightsource->getLight().spotDirection=GLLight::SpotDirection(GLfloat(hld[0]),GLfloat(hld[1]),GLfloat(hld[2]));
}
}
示例4: movieFile
TheoraMovieSaver::TheoraMovieSaver(const Misc::ConfigurationFileSection& configFileSection)
:MovieSaver(configFileSection),
movieFile(IO::openFile(configFileSection.retrieveString("./movieFileName").c_str(),IO::File::WriteOnly)),
oggStream(1),
theoraBitrate(0),theoraQuality(32),theoraGopSize(32),
imageExtractor(0)
{
movieFile->setEndianness(Misc::LittleEndian);
/* Read the encoder parameters: */
theoraBitrate=configFileSection.retrieveValue<int>("./movieBitrate",theoraBitrate);
if(theoraBitrate<0)
theoraBitrate=0;
theoraQuality=configFileSection.retrieveValue<int>("./movieQuality",theoraQuality);
if(theoraQuality<0)
theoraQuality=0;
if(theoraQuality>63)
theoraQuality=63;
theoraGopSize=configFileSection.retrieveValue<int>("./movieGopSize",theoraGopSize);
if(theoraGopSize<1)
theoraGopSize=1;
/* Set the Theora frame rate and adjust the initially configured frame rate: */
theoraFrameRate=int(frameRate+0.5);
frameRate=theoraFrameRate;
frameInterval=Misc::Time(1.0/frameRate);
}
示例5: xyzhpr
InputDeviceAdapterVisBox::InputDeviceAdapterVisBox(InputDeviceManager* sInputDeviceManager,const Misc::ConfigurationFileSection& configFileSection)
:InputDeviceAdapter(sInputDeviceManager),
xyzhpr((const float*)-1)
{
/* Retrieve the shared memory key from the configuration file: */
key_t sharedMemoryKey=key_t(configFileSection.retrieveValue<int>("./sharedMemoryKey",0xDEAD));
/* Try attaching to the shared memory segment: */
int sharedMemoryID=shmget(sharedMemoryKey,6*sizeof(float),0777);
if(sharedMemoryID<0)
Misc::throwStdErr("InputDeviceAdapterVisBox::InputDeviceAdapterVisBox: Could not attach to shared memory segment using key %x",int(sharedMemoryKey));
/* Get the pointer to the tracker state variables: */
xyzhpr=reinterpret_cast<const float*>(shmat(sharedMemoryID,0,SHM_RDONLY));
if(xyzhpr==(const float*)-1)
Misc::throwStdErr("InputDeviceAdapterVisBox::InputDeviceAdapterVisBox: Could not map shared memory segment using key %x",int(sharedMemoryKey));
/* Allocate new adapter state arrays: */
numInputDevices=1;
inputDevices=new InputDevice*[numInputDevices];
/* Create new input device: */
std::string deviceName=configFileSection.retrieveString("./name");
inputDevices[0]=inputDeviceManager->createInputDevice(deviceName.c_str(),InputDevice::TRACK_POS|InputDevice::TRACK_DIR|InputDevice::TRACK_ORIENT,0,0,true);
inputDevices[0]->setDeviceRayDirection(configFileSection.retrieveValue<Vector>("./deviceRayDirection",Vector(0,1,0)));
/* Initialize the new device's glyph from the current configuration file section: */
Glyph& deviceGlyph=inputDeviceManager->getInputGraphManager()->getInputDeviceGlyph(inputDevices[0]);
deviceGlyph.configure(configFileSection,"./deviceGlyphType","./deviceGlyphMaterial");
/* Set device's linear and angular velocities to zero, because we don't know any better: */
inputDevices[0]->setLinearVelocity(Vector::zero);
inputDevices[0]->setAngularVelocity(Vector::zero);
}
示例6: configure
void Glyph::configure(const Misc::ConfigurationFileSection& configFileSection,const char* glyphTypeTagName,const char* glyphMaterialTagName)
{
/* Retrieve glyph type as string: */
std::string glyphTypeName=configFileSection.retrieveString(glyphTypeTagName,"None");
if(glyphTypeName!="None")
{
if(glyphTypeName=="Cone")
glyphType=CONE;
else if(glyphTypeName=="Cube")
glyphType=CUBE;
else if(glyphTypeName=="Sphere")
glyphType=SPHERE;
else if(glyphTypeName=="Crossball")
glyphType=CROSSBALL;
else if(glyphTypeName=="Box")
glyphType=BOX;
else if(glyphTypeName=="Cursor")
glyphType=CURSOR;
else
Misc::throwStdErr("GlyphRenderer::Glyph: Invalid glyph type %s",glyphTypeName.c_str());
enabled=true;
glyphMaterial=configFileSection.retrieveValue<GLMaterial>(glyphMaterialTagName,glyphMaterial);
}
else
enabled=false;
}
示例7: alDevice
SoundContext::SoundContext(const Misc::ConfigurationFileSection& configFileSection,VruiState* sVruiState)
:vruiState(sVruiState),
#ifdef VRUI_USE_OPENAL
alDevice(0),alContext(0),
#endif
contextData(0),
listener(findListener(configFileSection.retrieveString("./listenerName").c_str()))
{
#ifdef VRUI_USE_OPENAL
/* Open the OpenAL device: */
std::string alDeviceName=configFileSection.retrieveValue<std::string>("./deviceName","Default");
alDevice=alcOpenDevice(alDeviceName!="Default"?alDeviceName.c_str():0);
if(alDevice==0)
Misc::throwStdErr("SoundContext::SoundContext: Could not open OpenAL sound device %s",alDeviceName.c_str());
/* Create an OpenAL context: */
alContext=alcCreateContext(alDevice,0);
if(alContext==0)
{
alcCloseDevice(alDevice);
Misc::throwStdErr("SoundContext::SoundContext: Could not create OpenAL context for sound device %s",alDeviceName.c_str());
}
#endif
/* Create an AL context data object: */
contextData=new ALContextData(101);
/* Initialize the sound context's OpenAL context: */
makeCurrent();
/* Initialize application sound state: */
if(vruiState->perSoundInitFunction!=0)
vruiState->perSoundInitFunction(*contextData,vruiState->perSoundInitFunctionData);
}
示例8: configure
void Glyph::configure(const Misc::ConfigurationFileSection& configFileSection,const char* glyphTypeTagName,const char* glyphMaterialTagName)
{
/* Retrieve glyph type as string and set it: */
setGlyphType(configFileSection.retrieveString(glyphTypeTagName,"None").c_str());
/* Retrieve the glyph material: */
glyphMaterial=configFileSection.retrieveValue<GLMaterial>(glyphMaterialTagName,glyphMaterial);
}
示例9: getInputDeviceDataFileName
std::string InputDeviceDataSaver::getInputDeviceDataFileName(const Misc::ConfigurationFileSection& configFileSection)
{
/* Retrieve the base file name: */
std::string inputDeviceDataFileName=configFileSection.retrieveString("./inputDeviceDataFileName");
/* Make the file name unique: */
char numberedFileName[1024];
Misc::createNumberedFileName(inputDeviceDataFileName.c_str(),4,numberedFileName);
return numberedFileName;
}
示例10: numInputDevices
InputDeviceDataSaver::InputDeviceDataSaver(const Misc::ConfigurationFileSection& configFileSection,InputDeviceManager& inputDeviceManager)
:inputDeviceDataFile(getInputDeviceDataFileName(configFileSection).c_str(),"wb",Misc::File::LittleEndian),
numInputDevices(inputDeviceManager.getNumInputDevices()),
inputDevices(new InputDevice*[numInputDevices]),
soundRecorder(0),
firstFrame(true)
{
/* Save number of input devices: */
inputDeviceDataFile.write<int>(numInputDevices);
/* Save layout of all input devices in the input device manager: */
for(int i=0;i<numInputDevices;++i)
{
/* Get pointer to the input device: */
inputDevices[i]=inputDeviceManager.getInputDevice(i);
/* Save input device's layout: */
char name[40];
strncpy(name,inputDevices[i]->getDeviceName(),40);
name[39]='\0';
inputDeviceDataFile.write(name,40);
inputDeviceDataFile.write<int>(inputDevices[i]->getTrackType());
inputDeviceDataFile.write<int>(inputDevices[i]->getNumButtons());
inputDeviceDataFile.write<int>(inputDevices[i]->getNumValuators());
inputDeviceDataFile.write(inputDevices[i]->getDeviceRayDirection().getComponents(),3);
}
/* Check if the user wants to record a commentary track: */
std::string soundFileName=configFileSection.retrieveString("./soundFileName","");
if(soundFileName!="")
{
try
{
/* Create a sound data format for recording: */
Sound::SoundDataFormat soundFormat;
soundFormat.bitsPerSample=configFileSection.retrieveValue<int>("./sampleResolution",soundFormat.bitsPerSample);
soundFormat.samplesPerFrame=configFileSection.retrieveValue<int>("./numChannels",soundFormat.samplesPerFrame);
soundFormat.framesPerSecond=configFileSection.retrieveValue<int>("./sampleRate",soundFormat.framesPerSecond);
/* Create a sound recorder for the given sound file name: */
char numberedFileName[1024];
soundRecorder=new Sound::SoundRecorder(soundFormat,Misc::createNumberedFileName(soundFileName.c_str(),4,numberedFileName));
}
catch(std::runtime_error error)
{
/* Print a message, but carry on: */
std::cerr<<"InputDeviceDataSaver: Disabling sound recording due to exception "<<error.what()<<std::endl;
}
}
}
示例11: configFileSection
VisletManager::VisletManager(const Misc::ConfigurationFileSection& sConfigFileSection)
:Plugins::FactoryManager<VisletFactory>(sConfigFileSection.retrieveString("./visletDsoNameTemplate",SYSVISLETDSONAMETEMPLATE)),
configFileSection(sConfigFileSection)
{
typedef std::vector<std::string> StringList;
/* Get additional search paths from configuration file section and add them to the factory manager: */
StringList visletSearchPaths=configFileSection.retrieveValue<StringList>("./visletSearchPaths",StringList());
for(StringList::const_iterator vspIt=visletSearchPaths.begin();vspIt!=visletSearchPaths.end();++vspIt)
{
/* Add the path: */
getDsoLocator().addPath(*vspIt);
}
}
示例12: createInputDevice
void InputDeviceAdapter::createInputDevice(int deviceIndex,const Misc::ConfigurationFileSection& configFileSection)
{
/* Read input device name: */
std::string name=configFileSection.retrieveString("./name");
/* Determine input device type: */
int trackType=InputDevice::TRACK_NONE;
std::string trackTypeString=configFileSection.retrieveString("./trackType","None");
if(trackTypeString=="None")
trackType=InputDevice::TRACK_NONE;
else if(trackTypeString=="3D")
trackType=InputDevice::TRACK_POS;
else if(trackTypeString=="Ray")
trackType=InputDevice::TRACK_POS|InputDevice::TRACK_DIR;
else if(trackTypeString=="6D")
trackType=InputDevice::TRACK_POS|InputDevice::TRACK_DIR|InputDevice::TRACK_ORIENT;
else
Misc::throwStdErr("InputDeviceAdapter: Unknown tracking type \"%s\"",trackTypeString.c_str());
/* Determine numbers of buttons and valuators: */
int numButtons=configFileSection.retrieveValue<int>("./numButtons",0);
int numValuators=configFileSection.retrieveValue<int>("./numValuators",0);
/* Create new input device as a physical device: */
InputDevice* newDevice=inputDeviceManager->createInputDevice(name.c_str(),trackType,numButtons,numValuators,true);
Vector deviceRayDirection=configFileSection.retrieveValue<Vector>("./deviceRayDirection",Vector(0,1,0));
Scalar deviceRayStart=configFileSection.retrieveValue<Scalar>("./deviceRayStart",-getInchFactor());
newDevice->setDeviceRay(deviceRayDirection,deviceRayStart);
/* Initialize the new device's glyph from the current configuration file section: */
Glyph& deviceGlyph=inputDeviceManager->getInputGraphManager()->getInputDeviceGlyph(newDevice);
deviceGlyph.configure(configFileSection,"./deviceGlyphType","./deviceGlyphMaterial");
/* Save the new input device: */
inputDevices[deviceIndex]=newDevice;
}
示例13: render
ToolKillZone::ToolKillZone(const Misc::ConfigurationFileSection& configFileSection)
:baseDevice(0),
render(true),
material(getWidgetMaterial()),
modelVersion(1)
{
/* Retrieve the name of the base device (if any) from the configuration file: */
std::string baseDeviceName=configFileSection.retrieveString("./killZoneBaseDevice","");
if(baseDeviceName!="")
{
/* Attach the kill zone to the base device: */
baseDevice=getInputDeviceManager()->findInputDevice(baseDeviceName.c_str());
if(baseDevice==0)
Misc::throwStdErr("ToolKillZone: Unknown base input device \"%s\"",baseDeviceName.c_str());
}
/* Retrieve the render flag: */
render=configFileSection.retrieveValue<bool>("./killZoneRender",render);
/* Retrieve the model material: */
material=configFileSection.retrieveValue<GLMaterial>("./killZoneMaterial",material);
}
示例14: createInputDevice
void InputDeviceAdapterHID::createInputDevice(int deviceIndex,const Misc::ConfigurationFileSection& configFileSection)
{
/* Read input device name: */
std::string name=configFileSection.retrieveString("./name");
/* Read HID's vendor / product IDs: */
std::string deviceVendorProductId=configFileSection.retrieveString("./deviceVendorProductId");
/* Split ID string into vendor ID / product ID: */
char* colonPtr;
unsigned int vendorId=strtoul(deviceVendorProductId.c_str(),&colonPtr,16);
char* endPtr;
unsigned int productId=strtoul(colonPtr+1,&endPtr,16);
if(*colonPtr!=':'||*endPtr!='\0')
Misc::throwStdErr("InputDeviceAdapterHID::InputDeviceAdapterHID: Malformed vendorId:productId string \"%s\" for device %s",deviceVendorProductId.c_str(),name.c_str());
/* Get the device index: */
int matchingDeviceIndex=configFileSection.retrieveValue<int>("./deviceIndex",0);
/* Create list of all available /dev/input/eventX devices, in numerical order: */
struct dirent** eventFiles=0;
int numEventFiles=scandir("/dev/input",&eventFiles,isEventFile,versionsort);
/* Check all event files for the wanted device: */
int deviceFd=-1;
for(int eventFileIndex=0;eventFileIndex<numEventFiles;++eventFileIndex)
{
/* Open the event file: */
char eventFileName[256];
snprintf(eventFileName,sizeof(eventFileName),"/dev/input/%s",eventFiles[eventFileIndex]->d_name);
int eventFd=open(eventFileName,O_RDONLY);
if(eventFd>=0)
{
/* Get device information: */
input_id deviceInformation;
if(ioctl(eventFd,EVIOCGID,&deviceInformation)>=0)
{
if(deviceInformation.vendor==vendorId&&deviceInformation.product==productId)
{
/* We have a match: */
if(matchingDeviceIndex==0)
{
/* We have a winner! */
deviceFd=eventFd;
break;
}
/* Try again on the next matching device: */
--matchingDeviceIndex;
}
}
/* This is not the device you are looking for, go to the next: */
close(eventFd);
}
}
/* Destroy list of event files: */
for(int i=0;i<numEventFiles;++i)
free(eventFiles[i]);
free(eventFiles);
/* Check if a matching device was found: */
if(deviceFd<0)
Misc::throwStdErr("InputDeviceAdapterHID::InputDeviceAdapterHID: No match for vendorId:productId \"%s\" for device %s",deviceVendorProductId.c_str(),name.c_str());
/* Create a new device structure: */
Device newDevice;
newDevice.deviceFd=deviceFd;
/* Query all feature types of the device: */
unsigned char featureTypeBits[EV_MAX/8+1];
memset(featureTypeBits,0,EV_MAX/8+1);
if(ioctl(deviceFd,EVIOCGBIT(0,sizeof(featureTypeBits)),featureTypeBits)<0)
Misc::throwStdErr("InputDeviceAdapterHID::InputDeviceAdapterHID: Unable to query device feature types for device %s",name.c_str());
/* Count the number of keys: */
newDevice.numButtons=0;
/* Query the number of keys/buttons on the device: */
if(featureTypeBits[EV_KEY/8]&(1<<(EV_KEY%8)))
{
/* Query key features: */
unsigned char keyBits[KEY_MAX/8+1];
memset(keyBits,0,KEY_MAX/8+1);
if(ioctl(deviceFd,EVIOCGBIT(EV_KEY,sizeof(keyBits)),keyBits)<0)
Misc::throwStdErr("InputDeviceAdapterHID::InputDeviceAdapterHID: Unable to query keys for device %s",name.c_str());
/* Initialize the key translation array: */
newDevice.keyMap.reserve(KEY_MAX+1);
for(int i=0;i<=KEY_MAX;++i)
{
if(keyBits[i/8]&(1<<(i%8)))
{
newDevice.keyMap.push_back(newDevice.numButtons);
++newDevice.numButtons;
}
else
newDevice.keyMap.push_back(-1);
}
//.........这里部分代码省略.........
示例15: alDevice
SoundContext::SoundContext(const Misc::ConfigurationFileSection& configFileSection,VruiState* sVruiState)
:vruiState(sVruiState),
#if ALSUPPORT_CONFIG_HAVE_OPENAL
alDevice(0),alContext(0),
#endif
contextData(0),
listener(findListener(configFileSection.retrieveString("./listenerName").c_str())),
speedOfSound(float(getMeterFactor())*343.0f),
dopplerFactor(1.0f),
distanceAttenuationModel(CONSTANT)
{
/* Set sound context parameters from configuration file: */
speedOfSound=configFileSection.retrieveValue<float>("./speedOfSound",speedOfSound);
dopplerFactor=configFileSection.retrieveValue<float>("./dopplerFactor",dopplerFactor);
distanceAttenuationModel=configFileSection.retrieveValue<DistanceAttenuationModel>("./distanceAttenuationModel",distanceAttenuationModel);
#if ALSUPPORT_CONFIG_HAVE_OPENAL
/* Open the OpenAL device: */
std::string alDeviceName=configFileSection.retrieveValue<std::string>("./deviceName","Default");
alDevice=alcOpenDevice(alDeviceName!="Default"?alDeviceName.c_str():0);
if(alDevice==0)
Misc::throwStdErr("SoundContext::SoundContext: Could not open OpenAL sound device \"%s\"",alDeviceName.c_str());
/* Create a list of context attributes: */
ALCint alContextAttributes[9];
ALCint* attPtr=alContextAttributes;
if(configFileSection.hasTag("./mixerFrequency"))
{
*(attPtr++)=ALC_FREQUENCY;
*(attPtr++)=configFileSection.retrieveValue<ALCint>("./mixerFrequency");
}
if(configFileSection.hasTag("./refreshFrequency"))
{
*(attPtr++)=ALC_REFRESH;
*(attPtr++)=configFileSection.retrieveValue<ALCint>("./refreshFrequency");
}
if(configFileSection.hasTag("./numMonoSources"))
{
*(attPtr++)=ALC_MONO_SOURCES;
*(attPtr++)=configFileSection.retrieveValue<ALCint>("./numMonoSources");
}
if(configFileSection.hasTag("./numStereoSources"))
{
*(attPtr++)=ALC_STEREO_SOURCES;
*(attPtr++)=configFileSection.retrieveValue<ALCint>("./numStereoSources");
}
*(attPtr++)=ALC_INVALID;
/* Create an OpenAL context: */
alContext=alcCreateContext(alDevice,alContextAttributes);
if(alContext==0)
{
alcCloseDevice(alDevice);
Misc::throwStdErr("SoundContext::SoundContext: Could not create OpenAL context for sound device %s",alDeviceName.c_str());
}
#endif
/* Create an AL context data object: */
contextData=new ALContextData(101);
/* Initialize the sound context's OpenAL context: */
makeCurrent();
#if ALSUPPORT_CONFIG_HAVE_OPENAL
/* Set global OpenAL parameters: */
alSpeedOfSound(speedOfSound);
alDopplerFactor(dopplerFactor);
switch(distanceAttenuationModel)
{
case CONSTANT:
alDistanceModel(AL_NONE);
break;
case INVERSE:
alDistanceModel(AL_INVERSE_DISTANCE);
break;
case INVERSE_CLAMPED:
alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
break;
case LINEAR:
alDistanceModel(AL_LINEAR_DISTANCE);
break;
case LINEAR_CLAMPED:
alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
break;
case EXPONENTIAL:
alDistanceModel(AL_EXPONENT_DISTANCE);
break;
case EXPONENTIAL_CLAMPED:
alDistanceModel(AL_EXPONENT_DISTANCE_CLAMPED);
break;
}
#endif
}