diff --git a/examples/osgaudio/osgaudio.cpp b/examples/osgaudio/osgaudio.cpp index 8288b70..d0dcffb 100644 --- a/examples/osgaudio/osgaudio.cpp +++ b/examples/osgaudio/osgaudio.cpp @@ -66,11 +66,11 @@ class KeyboardHandler: public osgGA::GUIEventHandler { if (ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN) { - if (ea.getKey() == 32) + if (ea.getKey() == 32) { // Now push the soundstate to the queue so it will be played. - // Set any of the parameters that will be activated when it + // Set any of the parameters that will be activated when it // is head of the queue when the sound manager processes the soundstates later on. // Get the current position of the listener @@ -80,7 +80,7 @@ class KeyboardHandler: public osgGA::GUIEventHandler m_sound_state->setPosition(osg::Vec3(x,y,z)); m_sound_state->setPlay(true); // It will play! - m_sound_state->setPitch(1); + m_sound_state->setPitch(1); // Now push the event to the sound manager so it can play it whenever this // event reaches the top of the queue. A higher priority will move it to the top @@ -89,7 +89,7 @@ class KeyboardHandler: public osgGA::GUIEventHandler osgAudio::SoundManager::instance()->pushSoundEvent(m_sound_state.get(), priority); return true; } - else if (ea.getKey() == 'm') + else if (ea.getKey() == 'm') { // Toggle looping ambient music @@ -136,7 +136,7 @@ class KeyboardHandler: public osgGA::GUIEventHandler osg::AnimationPath* createAnimationPath(const osg::Vec3& center,float radius,double looptime) { - // set up the animation path + // set up the animation path osg::AnimationPath* animationPath = new osg::AnimationPath; animationPath->setLoopMode(osg::AnimationPath::LOOP); @@ -157,7 +157,7 @@ osg::AnimationPath* createAnimationPath(const osg::Vec3& center,float radius,dou yaw += yaw_delta; time += time_delta; } - return animationPath; + return animationPath; } osg::Node* createBase(const osg::Vec3& center,float radius) @@ -185,26 +185,40 @@ osg::Node* createBase(const osg::Vec3& center,float radius) //Just two colours - black and white. osg::Vec4Array* colors = new osg::Vec4Array; - colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white - colors->push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black - int numColors=colors->size(); - + osg::Vec4 availableColours[2]= + { + osg::Vec4(1.0f,1.0f,1.0f,1.0f), + osg::Vec4(0.0f,0.0f,0.0f,1.0f) + }; + int numColors=2; int numIndicesPerRow=numTilesX+1; osg::UByteArray* coordIndices = new osg::UByteArray; // assumes we are using less than 256 points... osg::UByteArray* colorIndices = new osg::UByteArray; + osg::DrawElements * primSet = new osg::DrawElementsUByte(osg::PrimitiveSet::TRIANGLES); for(iy=0;iypush_back(ix +(iy+1)*numIndicesPerRow); - coordIndices->push_back(ix +iy*numIndicesPerRow); - coordIndices->push_back((ix+1)+iy*numIndicesPerRow); - coordIndices->push_back((ix+1)+(iy+1)*numIndicesPerRow); + // three vertices per triangle. + // first triangle. + primSet->addElement(ix +(iy+1)*numIndicesPerRow); + primSet->addElement(ix +iy*numIndicesPerRow); + primSet->addElement((ix+1)+iy*numIndicesPerRow); + // second triangle. + primSet->addElement((ix+1)+iy*numIndicesPerRow); + primSet->addElement((ix+1)+(iy+1)*numIndicesPerRow); + primSet->addElement(ix +(iy+1)*numIndicesPerRow); // one color per quad - colorIndices->push_back((ix+iy)%numColors); +// colorIndices->push_back((ix+iy)%numColors); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); } } @@ -213,29 +227,27 @@ osg::Node* createBase(const osg::Vec3& center,float radius) normals->push_back(osg::Vec3(0.0f,0.0f,1.0f)); #if OSG_VERSION_GREATER_THAN(3,2,0) - deprecated_osg::Geometry* geom = new deprecated_osg::Geometry; + osg::Geometry* geom = new osg::Geometry; #else osg::Geometry* geom = new osg::Geometry; #endif geom->setVertexArray(coords); - geom->setVertexIndices(coordIndices); geom->setColorArray(colors); - geom->setColorIndices(colorIndices); #if OSG_VERSION_GREATER_THAN(3,2,0) - geom->setColorBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE); + geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); #else - geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); + geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); #endif geom->setNormalArray(normals); #if OSG_VERSION_GREATER_THAN(3,2,0) - geom->setNormalBinding(deprecated_osg::Geometry::BIND_OVERALL); + geom->setNormalBinding(osg::Geometry::BIND_OVERALL); #else geom->setNormalBinding(osg::Geometry::BIND_OVERALL); #endif - geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,coordIndices->size())); + geom->addPrimitiveSet(primSet); osg::Geode* geode = new osg::Geode; geode->addDrawable(geom); @@ -271,14 +283,14 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius) soundCB->setSoundState( createSoundState("bee.wav") ); glider->setUpdateCallback( soundCB.get() ); group->addChild(positioned); - - osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform; + + osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform; xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0,1.0)); xform->addChild(group.get()); - + model->addChild(xform); } - + osg::Node* cessna = osgDB::readNodeFile("cessna.osg"); if (cessna) { @@ -306,7 +318,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius) osgAudio::SoundState* createSoundState(const std::string& file) { // Create a sample, load a .wav file. - osgAudio::Sample* sample = + osgAudio::Sample* sample = osgAudio::SoundManager::instance()->getSample(file.c_str(), false); // Create a named sound state. osgAudio::SoundState* sound_state = new osgAudio::SoundState( file ); @@ -317,7 +329,7 @@ osgAudio::SoundState* createSoundState(const std::string& file) // Set its gain (volume) to 0.9 sound_state->setGain(0.9f); - + sound_state->setReferenceDistance(70); // Set its pitch to 1 (normal speed) @@ -358,7 +370,7 @@ int main( int argc, char **argv ) osg::notify(osg::NOTICE) << "Version: " << osgAudio::getVersion() << "\n\n" << std::endl; osg::notify(osg::NOTICE) << "\nPress space to play a sound once...\n" << std::endl; - try + try { // use an ArgumentParser object to manage the program arguments. osg::ArgumentParser arguments(&argc,argv); @@ -379,7 +391,7 @@ int main( int argc, char **argv ) // add the help handler viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage())); - + osg::ref_ptr keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); viewer.setCameraManipulator( keyswitchManipulator.get() ); @@ -413,25 +425,25 @@ int main( int argc, char **argv ) osgAudio::SoundManager::instance()->getEnvironment()->setUnitScale(3.28); // Create ONE (only one, otherwise the transformation of the listener and update for SoundManager will be - // called several times, which is not catastrophic, but unnecessary) + // called several times, which is not catastrophic, but unnecessary) // SoundRoot that will make sure the listener is updated and // to keep the internal state of the SoundManager updated // This could also be done manually, this is just a handy way of doing it. osg::ref_ptr sound_root = new osgAudio::SoundRoot; - + // Specify the camera from our viewer. The view matrix from this camera // will be used during update to set the Listener position. Note this // will not work if the viewer is rendering to multiple displays; will // need to select a slave camera. sound_root->setCamera( viewer.getCamera() ); - + // The position in the scenegraph of this node is not important. // Just as long as the cull traversal should be called after any changes to the SoundManager are made. // tilt the scene so the default eye position is looking down on the model. osg::MatrixTransform* rootnode = new osg::MatrixTransform; rootnode->setMatrix(osg::Matrix::rotate(osg::inDegrees(30.0f),1.0f,0.0f,0.0f)); rootnode->addChild(sound_root.get()); - + // load the nodes from the commandline arguments. osg::Node* model = createModel(); if (!model) @@ -457,7 +469,7 @@ int main( int argc, char **argv ) viewer.getEventHandlers().push_front(new KeyboardHandler(sound_state.get())); - // run optimization over the scene graph after the soundnodes are added + // run optimization over the scene graph after the soundnodes are added // otherwise in this case the transformation added earlier would dissapear. osgUtil::Optimizer optimzer; optimzer.optimize(rootnode); @@ -476,7 +488,7 @@ int main( int argc, char **argv ) } // Very important to call before end of main! - if (osg::Referenced::getDeleteHandler()) + if (osg::Referenced::getDeleteHandler()) { osg::Referenced::getDeleteHandler()->setNumFramesToRetainObjects(0); osg::Referenced::getDeleteHandler()->flushAll(); diff --git a/examples/osgaudiomultiple/osgaudiomultiple.cpp b/examples/osgaudiomultiple/osgaudiomultiple.cpp index c19a8a4..980f100 100644 --- a/examples/osgaudiomultiple/osgaudiomultiple.cpp +++ b/examples/osgaudiomultiple/osgaudiomultiple.cpp @@ -107,60 +107,69 @@ osg::Node* createBase(const osg::Vec3& center,float radius) //Just two colours - black and white. osg::Vec4Array* colors = new osg::Vec4Array; - colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white - colors->push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black - int numColors=colors->size(); - + osg::Vec4 availableColours[2]= + { + osg::Vec4(1.0f,1.0f,1.0f,1.0f), + osg::Vec4(0.0f,0.0f,0.0f,1.0f) + }; + int numColors=2; int numIndicesPerRow=numTilesX+1; osg::UByteArray* coordIndices = new osg::UByteArray; // assumes we are using less than 256 points... osg::UByteArray* colorIndices = new osg::UByteArray; + osg::DrawElements * primSet = new osg::DrawElementsUByte(osg::PrimitiveSet::TRIANGLES); for(iy=0;iypush_back(ix +(iy+1)*numIndicesPerRow); - coordIndices->push_back(ix +iy*numIndicesPerRow); - coordIndices->push_back((ix+1)+iy*numIndicesPerRow); - coordIndices->push_back((ix+1)+(iy+1)*numIndicesPerRow); + // three vertices per triangle. + // first triangle. + primSet->addElement(ix +(iy+1)*numIndicesPerRow); + primSet->addElement(ix +iy*numIndicesPerRow); + primSet->addElement((ix+1)+iy*numIndicesPerRow); + // second triangle. + primSet->addElement((ix+1)+iy*numIndicesPerRow); + primSet->addElement((ix+1)+(iy+1)*numIndicesPerRow); + primSet->addElement(ix +(iy+1)*numIndicesPerRow); // one color per quad - colorIndices->push_back((ix+iy)%numColors); +// colorIndices->push_back((ix+iy)%numColors); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); + colors->push_back(availableColours[(ix+iy)%numColors]); } } - // set up a single normal osg::Vec3Array* normals = new osg::Vec3Array; normals->push_back(osg::Vec3(0.0f,0.0f,1.0f)); #if OSG_VERSION_GREATER_THAN(3,2,0) - deprecated_osg::Geometry* geom = new deprecated_osg::Geometry; + osg::Geometry* geom = new osg::Geometry; #else osg::Geometry* geom = new osg::Geometry; #endif geom->setVertexArray(coords); - geom->setVertexIndices(coordIndices); geom->setColorArray(colors); - geom->setColorIndices(colorIndices); - #if OSG_VERSION_GREATER_THAN(3,2,0) - geom->setColorBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE); + geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); #else - geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); + geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); #endif geom->setNormalArray(normals); - #if OSG_VERSION_GREATER_THAN(3,2,0) - geom->setNormalBinding(deprecated_osg::Geometry::BIND_OVERALL); + geom->setNormalBinding(osg::Geometry::BIND_OVERALL); #else geom->setNormalBinding(osg::Geometry::BIND_OVERALL); #endif - geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,coordIndices->size())); + geom->addPrimitiveSet(primSet); osg::Geode* geode = new osg::Geode; geode->addDrawable(geom); diff --git a/include/openalpp/AudioBase.h b/include/openalpp/AudioBase.h index fa0d8a8..cbb650c 100644 --- a/include/openalpp/AudioBase.h +++ b/include/openalpp/AudioBase.h @@ -89,8 +89,7 @@ namespace openalpp { * @param is a flag for synchronous context. Values <0 indicates that the * default should be used. */ - AudioBase(int frequency=-1,int refresh=-1,int synchronous=-1, bool displayInitMsgs=false ) - throw (InitError); + AudioBase(int frequency=-1,int refresh=-1,int synchronous=-1, bool displayInitMsgs=false ); /** * Destructor. diff --git a/include/openalpp/AudioEnvironment.h b/include/openalpp/AudioEnvironment.h index f8e8372..64f1981 100644 --- a/include/openalpp/AudioEnvironment.h +++ b/include/openalpp/AudioEnvironment.h @@ -73,7 +73,7 @@ namespace openalpp { * Constructor. * @param displayInitMsgs When true, writes init messages to console. */ - AudioEnvironment( bool displayInitMsgs=false ) throw (InitError); + AudioEnvironment( bool displayInitMsgs=false ); /** * Constructor. @@ -84,8 +84,7 @@ namespace openalpp { * @param synchronous is true if the environment is synchronous * @param displayInitMsgs When true, writes init messages to console. */ - AudioEnvironment(int frequency,int refresh,bool synchronous,bool displayInitMsgs) - throw (InitError); + AudioEnvironment(int frequency,int refresh,bool synchronous,bool displayInitMsgs); /** @@ -95,21 +94,20 @@ namespace openalpp { * @param frequency is the playing frequency of the environment (in Hz) * @param refresh is the refresh rate of the environment (in Hz) */ - AudioEnvironment(int frequency,int refresh=-1) - throw (InitError); + AudioEnvironment(int frequency,int refresh=-1); /** * Sets the speed of sound in the environment. * This is used in Doppler calculations. * @param speed is the speed of sound in length units per second. */ - void setSoundVelocity(float speed) throw (ValueError,FatalError); + void setSoundVelocity(float speed); /** * Get the speed of sound in the environment. * @return speed of sound in length units per second. */ - float getSoundVelocity() throw (FatalError); + float getSoundVelocity(); /** * Sets the Doppler factor. @@ -117,13 +115,13 @@ namespace openalpp { * Doppler effect. * @param factor has a default value of one. */ - void setDopplerFactor(float factor) throw (ValueError,FatalError); + void setDopplerFactor(float factor); /** * Gets the Doppler factor. * @return Doppler factor. */ - float getDopplerFactor() throw (FatalError); + float getDopplerFactor(); /** * Sets global gain (volume). @@ -139,24 +137,24 @@ namespace openalpp { * Gets the global gain * @return global gain */ - float getGain() throw (FatalError); + float getGain(); /** * Sets the distance model used in attenuation calculations. * @param model is one of: None, InverseDistance, InverseDistanceClamped. */ - void setDistanceModel(DistanceModel model) throw (FatalError); + void setDistanceModel(DistanceModel model); /** * Gets the distance model used in attenuation calculations. * @return the model. */ - DistanceModel getDistanceModel() throw (FatalError); + DistanceModel getDistanceModel(); /** * Initiates Loki's reverb implementation. */ - void initiateReverb() throw (InitError); + void initiateReverb(); }; } diff --git a/include/openalpp/FileStream.h b/include/openalpp/FileStream.h index 1242c69..9f860d9 100644 --- a/include/openalpp/FileStream.h +++ b/include/openalpp/FileStream.h @@ -57,8 +57,7 @@ namespace openalpp { * @param buffersize is an optional parameter specifying how large the * buffer should be (in samples per second). */ - FileStream(const std::string& filename,const int buffersize=4096) - throw (NameError,InitError,FileError); + FileStream(const std::string& filename,const int buffersize=4096); /** * Copy constructor. diff --git a/include/openalpp/GroupSource.h b/include/openalpp/GroupSource.h index 5c70a7e..1500cfb 100644 --- a/include/openalpp/GroupSource.h +++ b/include/openalpp/GroupSource.h @@ -98,13 +98,13 @@ namespace openalpp { * @param y y coordinate. * @param z z coordinate. */ - GroupSource(float x = 0.0, float y = 0.0, float z = 0.0) throw (NameError); + GroupSource(float x = 0.0, float y = 0.0, float z = 0.0); /** * Same as SourceBase::Play, except that this mixes the sources in the * group if it haven't been done yet. */ - void play() throw (InitError,FileError); + void play(); /** * Mix all added sources into one. This function will be called by @@ -114,8 +114,7 @@ namespace openalpp { * separately * @param frequency is the frequency that will be used when mixing. */ - void mixSources(unsigned int frequency=22050) - throw (InitError,FileError,FatalError,MemoryError,ValueError); + void mixSources(unsigned int frequency=22050); /** * Includes a source in the group. @@ -124,21 +123,21 @@ namespace openalpp { * @param source is (a pointer to) the source to include. * @return identifier for the source. */ - ALuint includeSource(Source *source) throw (ValueError); + ALuint includeSource(Source *source); /** * Removes a source from the group. * This will of course require the remaining sources to be mixed again. * @param source is the source to exclude. */ - void excludeSource(const Source &source) throw (NameError); + void excludeSource(const Source &source); /** * Removes a source from the group. * This will of course require the remaining sources to be mixed again. * @param source is the identifier of the source to exclude. */ - void excludeSource(ALuint source) throw (NameError); + void excludeSource(ALuint source); /** * Copy constructor. diff --git a/include/openalpp/Sample.h b/include/openalpp/Sample.h index 9d49f96..907c7f6 100644 --- a/include/openalpp/Sample.h +++ b/include/openalpp/Sample.h @@ -43,7 +43,7 @@ namespace openalpp { * Constructor. * @param filename is name of file to load. */ - Sample(const std::string& filename ) throw (FileError); + Sample(const std::string& filename ); /** * Copy constructor. @@ -57,7 +57,7 @@ namespace openalpp { * @param size of data. * @param freq of data. */ - Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq) throw (FileError); + Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq); /** diff --git a/include/openalpp/SoundData.h b/include/openalpp/SoundData.h index a9edd37..bdf9ec5 100644 --- a/include/openalpp/SoundData.h +++ b/include/openalpp/SoundData.h @@ -55,8 +55,8 @@ namespace openalpp { virtual ~SoundBuffer(); public: - SoundBuffer() throw (NameError); - SoundBuffer(ALuint buffer_id) throw (NameError) { buffername_ = buffer_id; } + SoundBuffer(); + SoundBuffer(ALuint buffer_id) { buffername_ = buffer_id; } ALuint getName() {return buffername_;} }; public: @@ -69,7 +69,7 @@ namespace openalpp { /** * Constructor. */ - SoundData() throw (NameError,InitError); + SoundData(); diff --git a/include/openalpp/SourceBase.h b/include/openalpp/SourceBase.h index 742cb5f..dc4f564 100644 --- a/include/openalpp/SourceBase.h +++ b/include/openalpp/SourceBase.h @@ -254,7 +254,7 @@ namespace openalpp { * AudioEnviroment::InitiateReverb() must be called before this. * @param scale is the reverb scale [0.0-1.0]. */ - void setReverbScale(float scale) throw (InitError,ValueError); + void setReverbScale(float scale); /** * Set reverb delay for this source. @@ -262,19 +262,19 @@ namespace openalpp { * This is how many seconds back in time the echo will be. * @param delay is the delay [0.0-2.0] in seconds. */ - void setReverbDelay(float delay) throw (InitError,ValueError); + void setReverbDelay(float delay); /** * Get reverb delay for this source. * @return the delay. */ - float getReverbDelay() throw (InitError); + float getReverbDelay(); /** * Get reverb scale for this source. * @return the scale. */ - float getReverbScale() throw (InitError); + float getReverbScale(); /** * Link this source to another. @@ -284,19 +284,19 @@ namespace openalpp { * @return identifier for the linked source. This is also the OpenAL name for * it. */ - ALuint link(const SourceBase *source) throw (MemoryError); + ALuint link(const SourceBase *source); /** * Unlink this source from another. * @param source is the source to unlink. */ - void unlink(const SourceBase *source) throw (NameError); + void unlink(const SourceBase *source); /** * Unlink this source from another. * @param name is the name of the source to unlink. */ - void unlink(const ALuint name) throw (NameError); + void unlink(const ALuint name); /** * Unlink all sources from this. @@ -343,7 +343,7 @@ namespace openalpp { /** * Constructor. */ - SourceBase() throw (MemoryError,NameError); + SourceBase(); /** * Constructor. @@ -351,7 +351,7 @@ namespace openalpp { * @param y y coordinate. * @param z z coordinate. */ - SourceBase(float x,float y,float z) throw (MemoryError,NameError); + SourceBase(float x,float y,float z); /** * Copy constructor. @@ -372,7 +372,7 @@ namespace openalpp { * Initiate source. * Used by constructors. */ - void init() throw (MemoryError,NameError); + void init(); /** * Pointer to array of linked sources. diff --git a/include/openalpp/Stream.h b/include/openalpp/Stream.h index 4dfd0fd..50629d9 100644 --- a/include/openalpp/Stream.h +++ b/include/openalpp/Stream.h @@ -57,7 +57,7 @@ namespace openalpp { /** * Default constructor. */ - Stream() throw (NameError); + Stream(); /** * Copy constructor. diff --git a/include/osgAudio/BackendOpenALpp/AudioEnvironmentOpenALpp.h b/include/osgAudio/BackendOpenALpp/AudioEnvironmentOpenALpp.h index d5392b1..1782702 100644 --- a/include/osgAudio/BackendOpenALpp/AudioEnvironmentOpenALpp.h +++ b/include/osgAudio/BackendOpenALpp/AudioEnvironmentOpenALpp.h @@ -59,7 +59,7 @@ namespace osgAudio * Initialize the OpenALpp environment. * @param displayInitMsgs When set to true, init messages are written to console. */ - void init( bool displayInitMsgs=false ) throw (InitError); + void init( bool displayInitMsgs=false ); /** * Initialize the OpenALpp environment. @@ -70,8 +70,7 @@ namespace osgAudio * @param synchronous is true if the environment is synchronous * @param displayInitMsgs When set to true, init messages are written to console. */ - void init(int frequency,int refresh,bool synchronous,bool displayInitMsgs=false ) - throw (InitError); + void init(int frequency,int refresh,bool synchronous,bool displayInitMsgs=false ); /** @@ -81,21 +80,20 @@ namespace osgAudio * @param frequency is the playing frequency of the environment (in Hz) * @param refresh is the refresh rate of the environment (in Hz) */ - void init(int frequency,int refresh=-1) - throw (InitError); + void init(int frequency,int refresh=-1); /** * Sets the speed of sound in the environment. * This is used in Doppler calculations. * @param speed is the speed of sound in length units per second. */ - void setSoundVelocity(float speed) throw (ValueError,FatalError); + void setSoundVelocity(float speed); /** * Get the speed of sound in the environment. * @return speed of sound in length units per second. */ - float getSoundVelocity() throw (FatalError); + float getSoundVelocity(); /** * Sets the Doppler factor. @@ -103,13 +101,13 @@ namespace osgAudio * Doppler effect. * @param factor has a default value of one. */ - void setDopplerFactor(float factor) throw (ValueError,FatalError); + void setDopplerFactor(float factor); /** * Gets the Doppler factor. * @return Doppler factor. */ - float getDopplerFactor() throw (FatalError); + float getDopplerFactor(); /** * Sets the unit scale. Not used by OpenAL. @@ -118,13 +116,13 @@ namespace osgAudio * "This only affects doppler! If you keep your min/max distance, custom rolloff curves and positions in scale relative to each other the volume rolloff will not change. If you set this, the mindistance of a sound will automatically set itself to this value when it is created in case the user forgets to set the mindistance to match the new distancefactor." * @param factor has a default value of one. */ - void setUnitScale(float scale) throw (ValueError,FatalError); + void setUnitScale(float scale); /** * Gets the unit scale. Not used by OpenAL. * @return Unit scale. */ - float getUnitScale() throw (FatalError); + float getUnitScale(); /** * Sets global gain (volume). @@ -139,24 +137,24 @@ namespace osgAudio * Gets the global gain * @return global gain */ - float getGain() throw (FatalError); + float getGain(); /** * Sets the distance model used in attenuation calculations. * @param model is one of: None, InverseDistance, InverseDistanceClamped. */ - void setDistanceModel(DistanceModel model) throw (FatalError); + void setDistanceModel(DistanceModel model); /** * Gets the distance model used in attenuation calculations. * @return the model. */ - DistanceModel getDistanceModel() throw (FatalError); + DistanceModel getDistanceModel(); /** * Initiates reverb implementation. */ - void initiateReverb() throw (InitError); + void initiateReverb(); /** * Some audio subsystems require explicit periodic "update" calls to keep diff --git a/include/osgAudio/BackendOpenALpp/FileStreamOpenALpp.h b/include/osgAudio/BackendOpenALpp/FileStreamOpenALpp.h index 1bde15e..fbc864b 100644 --- a/include/osgAudio/BackendOpenALpp/FileStreamOpenALpp.h +++ b/include/osgAudio/BackendOpenALpp/FileStreamOpenALpp.h @@ -52,8 +52,7 @@ namespace osgAudio * @param buffersize is an optional parameter specifying how large the * buffer should be (in samples per second). */ - FileStream(const std::string& filename,const int buffersize=4096) - throw (NameError,InitError,FileError); + FileStream(const std::string& filename,const int buffersize=4096); /** * Copy constructor. diff --git a/include/osgAudio/BackendOpenALpp/SampleOpenALpp.h b/include/osgAudio/BackendOpenALpp/SampleOpenALpp.h index 96937b1..244e3ed 100644 --- a/include/osgAudio/BackendOpenALpp/SampleOpenALpp.h +++ b/include/osgAudio/BackendOpenALpp/SampleOpenALpp.h @@ -48,7 +48,7 @@ namespace osgAudio * Constructor. * @param filename is name of file to load. */ - Sample(const std::string& filename ) throw (FileError,NameError); + Sample(const std::string& filename ); /** * Copy constructor. @@ -63,7 +63,7 @@ namespace osgAudio * @param freq of data. */ // <<<>>> TODO: Create a portable way of specifying the format - //Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq) throw (FileError); + //Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq); /** * Get file name of loaded file. diff --git a/include/osgAudio/BackendOpenALpp/SourceOpenALpp.h b/include/osgAudio/BackendOpenALpp/SourceOpenALpp.h index 6cb7e54..5d06bac 100644 --- a/include/osgAudio/BackendOpenALpp/SourceOpenALpp.h +++ b/include/osgAudio/BackendOpenALpp/SourceOpenALpp.h @@ -361,7 +361,7 @@ namespace osgAudio * AudioEnviroment::InitiateReverb() must be called before this. * @param scale is the reverb scale [0.0-1.0]. */ - virtual void setReverbScale(float scale) throw (InitError,ValueError); + virtual void setReverbScale(float scale); /** * Set reverb delay for this source. @@ -369,19 +369,19 @@ namespace osgAudio * This is how many seconds back in time the echo will be. * @param delay is the delay [0.0-2.0] in seconds. */ - virtual void setReverbDelay(float delay) throw (InitError,ValueError); + virtual void setReverbDelay(float delay); /** * Get reverb delay for this source. * @return the delay. */ - virtual float getReverbDelay() throw (InitError); + virtual float getReverbDelay(); /** * Get reverb scale for this source. * @return the scale. */ - virtual float getReverbScale() throw (InitError); + virtual float getReverbScale(); /** * Link this source to another. @@ -392,21 +392,21 @@ namespace osgAudio * it. */ // <<<>>> May need to re-engineer - //virtual ALuint link(const SourceBase *source) throw (MemoryError); + //virtual ALuint link(const SourceBase *source); /** * Unlink this source from another. * @param source is the source to unlink. */ // <<<>>> May need to re-engineer - //virtual void unlink(const SourceBase *source) throw (NameError); + //virtual void unlink(const SourceBase *source); /** * Unlink this source from another. * @param name is the name of the source to unlink. */ // <<<>>> May need to re-engineer - //virtual void unlink(const ALuint name) throw (NameError); + //virtual void unlink(const ALuint name); /** * Unlink all sources from this. diff --git a/include/osgAudio/BackendOpenALpp/StreamOpenALpp.h b/include/osgAudio/BackendOpenALpp/StreamOpenALpp.h index 3e0b3c6..d7f285d 100644 --- a/include/osgAudio/BackendOpenALpp/StreamOpenALpp.h +++ b/include/osgAudio/BackendOpenALpp/StreamOpenALpp.h @@ -48,7 +48,7 @@ namespace osgAudio /** * Default constructor. */ - Stream() throw (NameError); + Stream(); /** * Copy constructor. diff --git a/include/osgAudio/Config.h b/include/osgAudio/Config.h new file mode 100644 index 0000000..26ee202 --- /dev/null +++ b/include/osgAudio/Config.h @@ -0,0 +1,35 @@ +/* -*-c++-*- */ +/** + * osgAudio - OpenSceneGraph Audio Library + * Copyright (C) 2010 AlphaPixel, LLC + * based on a fork of: + * Osg AL - OpenSceneGraph Audio Library + * Copyright (C) 2004 VRlab, Umeå University + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * Please see COPYING file for special static-link exemption to LGPL. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + + +#ifndef OSGAUDIO_CONFIG_H +#define OSGAUDIO_CONFIG_H 1 + +// we like the 0_ prefix in the CMake control UI, +// but C++ dislikes it, so this maps it over to unprefixed version + +#define ENABLE_SUBSYSTEM_OPENAL +/* #undef ENABLE_SUBSYSTEM_FMOD */ + +#endif /* OSGAUDIO_CONFIG_H */ diff --git a/include/osgAudio/SourceBase.h b/include/osgAudio/SourceBase.h index 0577c84..fab2de0 100644 --- a/include/osgAudio/SourceBase.h +++ b/include/osgAudio/SourceBase.h @@ -256,7 +256,7 @@ namespace osgAudio { * AudioEnviroment::InitiateReverb() must be called before this. * @param scale is the reverb scale [0.0-1.0]. */ - virtual void setReverbScale(float scale) throw (InitError,ValueError) = 0; + virtual void setReverbScale(float scale) = 0; /** * Set reverb delay for this source. @@ -264,19 +264,19 @@ namespace osgAudio { * This is how many seconds back in time the echo will be. * @param delay is the delay [0.0-2.0] in seconds. */ - virtual void setReverbDelay(float delay) throw (InitError,ValueError) = 0; + virtual void setReverbDelay(float delay) = 0; /** * Get reverb delay for this source. * @return the delay. */ - virtual float getReverbDelay() throw (InitError) = 0; + virtual float getReverbDelay() = 0; /** * Get reverb scale for this source. * @return the scale. */ - virtual float getReverbScale() throw (InitError) = 0; + virtual float getReverbScale() = 0; /** * Link this source to another. @@ -287,21 +287,21 @@ namespace osgAudio { * it. */ // <<<>>> May need to re-engineer - //virtual unsigned int link(const SourceBase *source) throw (MemoryError) = 0; + //virtual unsigned int link(const SourceBase *source) = 0; /** * Unlink this source from another. * @param source is the source to unlink. */ // <<<>>> May need to re-engineer - //virtual void unlink(const SourceBase *source) throw (NameError) = 0; + //virtual void unlink(const SourceBase *source) = 0; /** * Unlink this source from another. * @param name is the name of the source to unlink. */ // <<<>>> May need to re-engineer - //virtual void unlink(const unsigned int name) throw (NameError) = 0; + //virtual void unlink(const unsigned int name) = 0; /** * Unlink all sources from this. @@ -350,7 +350,7 @@ namespace osgAudio { /** * Constructor. */ - //SourceBase() throw (MemoryError,NameError); + //SourceBase() /** * Constructor. @@ -358,7 +358,7 @@ namespace osgAudio { * @param y y coordinate. * @param z z coordinate. */ - //SourceBase(float x,float y,float z) throw (MemoryError,NameError); + //SourceBase(float x,float y,float z); /** * Copy constructor. diff --git a/include/osgAudio/Version.h b/include/osgAudio/Version.h new file mode 100644 index 0000000..288cfbe --- /dev/null +++ b/include/osgAudio/Version.h @@ -0,0 +1,71 @@ +/* -*-c++-*- */ +/** + * osgAudio - OpenSceneGraph Audio Library + * (C) Copyright 2009-2011 by Kenneth Mark Bryden + * (programming by Chris 'Xenon' Hanson, AlphaPixel, LLC xenon at alphapixel.com) + * based on a fork of: + * Osg AL - OpenSceneGraph Audio Library + * Copyright (C) 2004 VRlab, Umeå University + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * Please see COPYING file for special static-link exemption to LGPL. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef OSGAUDIO_VERSION_H +#define OSGAUDIO_VERSION_H 1 + +#include + +#include + +/** + * \mainpage + * osgAudio is an library for integration of 3D sound APIs like OpenAL++ or FMOD into OpenSceneGraph. + * This project also includes the OpenAL++ library. OpenAL++ is a C++ abstraction layer + * on top of OpenAL with additional functionality of reading ogg-files, reference counting etc. + * + * OsgAudio has been tested on Windows and Linux. + * + */ + +#define OSGAUDIO_MAJOR_VERSION (2) +#define OSGAUDIO_MINOR_VERSION (0) +#define OSGAUDIO_SUB_VERSION (0) + +// C preprocessor integrated version number. +// The form is Mmmss, where: +// M is the major version +// mm is the minor version (zero-padded) +// ss is the sub version (zero padded) +// Use this in version-specific code, for example: +// #if( OSGAUDIO_VERSION > 20100 ) +// ... code specific to releases AFTER v2.01 +// #endif +#define OSGAUDIO_VERSION ( \ + ( OSGAUDIO_MAJOR_VERSION * 10000 ) + \ + ( OSGAUDIO_MINOR_VERSION * 100 ) + \ + OSGAUDIO_SUB_VERSION ) + +///Define whether we are using OpenAL or FMOD + +/// Integration of 3D Sound into OpenSceneGraph. +namespace osgAudio { + OSGAUDIO_EXPORT std::string getVersion(); + OSGAUDIO_EXPORT unsigned int getVersionNumber(); + OSGAUDIO_EXPORT std::string getLibraryName(); +} // namespace osgAudio + +#endif // OSGAUDIO_VERSION_H + diff --git a/src/openalpp/AudioBase.cpp b/src/openalpp/AudioBase.cpp index 821af3a..2575b19 100644 --- a/src/openalpp/AudioBase.cpp +++ b/src/openalpp/AudioBase.cpp @@ -30,9 +30,7 @@ using namespace openalpp; -AudioBase::AudioBase(int frequency,int refresh,int synchronous, bool displayInitMsgs ) -throw (InitError) -{ +AudioBase::AudioBase(int frequency,int refresh,int synchronous, bool displayInitMsgs ) { if( displayInitMsgs ) std::cout << "Initializing OpenAL." << std::endl; diff --git a/src/openalpp/AudioEnvironment.cpp b/src/openalpp/AudioEnvironment.cpp index c5a7ad8..be65462 100644 --- a/src/openalpp/AudioEnvironment.cpp +++ b/src/openalpp/AudioEnvironment.cpp @@ -27,21 +27,20 @@ using namespace openalpp; -AudioEnvironment::AudioEnvironment( bool displayInitMsgs ) throw (InitError) +AudioEnvironment::AudioEnvironment( bool displayInitMsgs ) : AudioBase( -1, -1, -1, displayInitMsgs ) { } AudioEnvironment::AudioEnvironment(int frequency,int refresh,bool synchronous, bool displayInitMsgs) -throw (InitError) : AudioBase(frequency,refresh,synchronous, displayInitMsgs ) { } -AudioEnvironment::AudioEnvironment(int frequency,int refresh) throw (InitError) +AudioEnvironment::AudioEnvironment(int frequency,int refresh) : AudioBase(frequency,refresh) { } -void AudioEnvironment::setSoundVelocity(float speed) throw(ValueError,FatalError){ +void AudioEnvironment::setSoundVelocity(float speed) { alDopplerVelocity(speed); ALenum error; if((error=alGetError())!=AL_FALSE) @@ -55,7 +54,7 @@ void AudioEnvironment::setSoundVelocity(float speed) throw(ValueError,FatalError } } -float AudioEnvironment::getSoundVelocity() throw (FatalError) { +float AudioEnvironment::getSoundVelocity() { ALfloat speed; alGetFloatv(AL_DOPPLER_VELOCITY,&speed); if(alGetError()!=AL_FALSE) // This isn't strictly necessary... @@ -63,8 +62,7 @@ float AudioEnvironment::getSoundVelocity() throw (FatalError) { return speed; } -void AudioEnvironment::setDopplerFactor(float factor) -throw (ValueError,FatalError) { +void AudioEnvironment::setDopplerFactor(float factor) { alDopplerFactor(factor); ALenum error; if((error=alGetError())!=AL_FALSE) @@ -78,7 +76,7 @@ throw (ValueError,FatalError) { } } -float AudioEnvironment::getDopplerFactor() throw (FatalError) { +float AudioEnvironment::getDopplerFactor() { ALfloat(factor); alGetFloatv(AL_DOPPLER_FACTOR,&factor); if(alGetError()!=AL_FALSE) // This isn't strictly necessary... @@ -99,7 +97,7 @@ void AudioEnvironment::setGain(float gain) { } } -float AudioEnvironment::getGain() throw (FatalError) { +float AudioEnvironment::getGain() { ALfloat gain; alGetListenerf(AL_GAIN,&gain); if(alGetError()!=AL_FALSE) // This isn't strictly necessary... @@ -107,8 +105,7 @@ float AudioEnvironment::getGain() throw (FatalError) { return gain; } -void AudioEnvironment::setDistanceModel(DistanceModel model) -throw (FatalError){ +void AudioEnvironment::setDistanceModel(DistanceModel model) { switch(model) { case(None): alDistanceModel(AL_NONE); @@ -129,7 +126,7 @@ throw (FatalError){ throw FatalError("alDistanceModel failed in AudioEnvironment::SetDistanceModel()"); } -DistanceModel AudioEnvironment::getDistanceModel() throw (FatalError) { +DistanceModel AudioEnvironment::getDistanceModel() { int almodel; alGetIntegerv(AL_DISTANCE_MODEL,&almodel); switch(almodel) { @@ -151,7 +148,7 @@ bool AudioBase::reverbinitiated_; void (*AudioBase::alReverbScale)(ALuint sid, ALfloat param); void (*AudioBase::alReverbDelay)(ALuint sid, ALfloat param); -void AudioEnvironment::initiateReverb() throw (InitError) { +void AudioEnvironment::initiateReverb() { if (reverbinitiated_) return; diff --git a/src/openalpp/FileStream.cpp b/src/openalpp/FileStream.cpp index aa6a24f..0ab9e1d 100644 --- a/src/openalpp/FileStream.cpp +++ b/src/openalpp/FileStream.cpp @@ -107,7 +107,7 @@ End of Vorbis callback functions using namespace openalpp; FileStream::FileStream(const std::string& filename,const int buffersize) -throw (NameError,InitError,FileError) : Stream() , filename_(filename) +: Stream() , filename_(filename) { FILE *filehandle=fopen(filename.c_str(),"rb"); if(!filehandle) diff --git a/src/openalpp/GroupSource.cpp b/src/openalpp/GroupSource.cpp index 7cc19b5..e49c78e 100644 --- a/src/openalpp/GroupSource.cpp +++ b/src/openalpp/GroupSource.cpp @@ -30,7 +30,7 @@ using namespace openalpp; -GroupSource::GroupSource(float x,float y,float z) throw (NameError) +GroupSource::GroupSource(float x,float y,float z) : SourceBase(x,y,z),mixed_(false) { alGenBuffers(1,&buffer_); if(alGetError()!=AL_FALSE) @@ -38,7 +38,7 @@ GroupSource::GroupSource(float x,float y,float z) throw (NameError) alSourcei(sourcename_,AL_BUFFER,buffer_); } -void GroupSource::play() throw (InitError,FileError) { +void GroupSource::play() { try { if(!mixed_) mixSources(); @@ -363,8 +363,7 @@ ALshort *GroupSource::applyFilters(Source *source,ALshort *buffer, return buffer; } -void GroupSource::mixSources(unsigned int frequency) -throw (InitError,FileError,FatalError,MemoryError,ValueError) { +void GroupSource::mixSources(unsigned int frequency) { ALsizei bsize=0,size=0,loadsize=0; ALenum format; ALboolean success; @@ -496,19 +495,19 @@ throw (InitError,FileError,FatalError,MemoryError,ValueError) { free(bdata); } -ALuint GroupSource::includeSource(Source *source) throw (ValueError) { +ALuint GroupSource::includeSource(Source *source) { if(source->isStreaming()) throw ValueError("Can't include streaming sources in group."); sources_.push_back(source); return source->getAlSource(); } -void GroupSource::excludeSource(const Source &source) throw (NameError) { +void GroupSource::excludeSource(const Source &source) { ALuint sourcename=source.getAlSource(); excludeSource(sourcename); } -void GroupSource::excludeSource(ALuint sourcename) throw (NameError) { +void GroupSource::excludeSource(ALuint sourcename) { for(unsigned int i=0;igetAlSource()) { sources_[i]=sources_[sources_.size()-1]; diff --git a/src/openalpp/Sample.cpp b/src/openalpp/Sample.cpp index 20eca6f..5240795 100644 --- a/src/openalpp/Sample.cpp +++ b/src/openalpp/Sample.cpp @@ -32,7 +32,7 @@ using namespace openalpp; -Sample::Sample(const std::string& filename) throw (FileError) +Sample::Sample(const std::string& filename) : SoundData(),filename_(filename) { #if OPENAL_VERSION < 2007 ALsizei size; @@ -82,7 +82,7 @@ Sample::Sample(const Sample &sample) : SoundData(sample), filename_(sample.filename_) { } -Sample::Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq) throw (FileError) +Sample::Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq) : SoundData() { ALenum error; diff --git a/src/openalpp/SoundData.cpp b/src/openalpp/SoundData.cpp index 7253c0c..d4edceb 100644 --- a/src/openalpp/SoundData.cpp +++ b/src/openalpp/SoundData.cpp @@ -26,7 +26,7 @@ using namespace openalpp; -SoundData::SoundBuffer::SoundBuffer() throw (NameError) : buffername_(0) { +SoundData::SoundBuffer::SoundBuffer() : buffername_(0) { alGenBuffers(1,&buffername_); if(alGetError()!=AL_FALSE) @@ -40,7 +40,7 @@ SoundData::SoundBuffer::~SoundBuffer() { } -SoundData::SoundData() throw (NameError,InitError) : AudioBase() { +SoundData::SoundData() : AudioBase() { buffer_=new SoundBuffer(); } diff --git a/src/openalpp/SourceBase.cpp b/src/openalpp/SourceBase.cpp index d1e9581..578acdf 100644 --- a/src/openalpp/SourceBase.cpp +++ b/src/openalpp/SourceBase.cpp @@ -34,7 +34,7 @@ using namespace openalpp; -void SourceBase::init() throw (MemoryError,NameError) { +void SourceBase::init() { alGenSources(1,&sourcename_); if(alGetError()!=AL_FALSE) throw NameError("Couldn't generate source name"); @@ -51,12 +51,12 @@ void SourceBase::init() throw (MemoryError,NameError) { streaming_=false; } -SourceBase::SourceBase() throw (MemoryError,NameError) : PositionedObject() { +SourceBase::SourceBase() : PositionedObject() { init(); } SourceBase::SourceBase(float x,float y,float z) -throw (MemoryError,NameError) : PositionedObject() { + : PositionedObject() { init(); setPosition(x,y,z); @@ -394,7 +394,7 @@ float SourceBase::getPitch() const { return pitch; } -void SourceBase::setReverbScale(float scale) throw (InitError,ValueError) { +void SourceBase::setReverbScale(float scale) { if(reverbinitiated_) { alReverbScale(sourcename_,scale); int error = alGetError(); @@ -409,7 +409,7 @@ void SourceBase::setReverbScale(float scale) throw (InitError,ValueError) { throw InitError("Reverb not initialized"); } -void SourceBase::setReverbDelay(float delay) throw (InitError,ValueError) { +void SourceBase::setReverbDelay(float delay) { if(reverbinitiated_) { alReverbDelay(sourcename_,delay); int error = alGetError(); @@ -424,19 +424,19 @@ void SourceBase::setReverbDelay(float delay) throw (InitError,ValueError) { throw InitError("Reverb not initialized"); } -float SourceBase::getReverbScale() throw (InitError) { +float SourceBase::getReverbScale() { if(!reverbinitiated_) throw InitError("Reverb not initialized"); return reverbscale_; } -float SourceBase::getReverbDelay() throw (InitError) { +float SourceBase::getReverbDelay() { if(!reverbinitiated_) throw InitError("Reverb not initialized"); return reverbdelay_; } -ALuint SourceBase::link(const SourceBase *source) throw (MemoryError) { +ALuint SourceBase::link(const SourceBase *source) { if(nlinkedsources_>=alloclinkedsources_) { alloclinkedsources_+=5; linkedsources_=(ALuint *)realloc(linkedsources_, @@ -448,7 +448,7 @@ ALuint SourceBase::link(const SourceBase *source) throw (MemoryError) { return source->getAlSource(); } -void SourceBase::unlink(const SourceBase *source) throw (NameError) { +void SourceBase::unlink(const SourceBase *source) { if(source->sourcename_==sourcename_) throw(NameError("Can't unlink a source from itself!")); for(unsigned int i=0;isetSoundVelocity (speed); } @@ -111,7 +110,7 @@ void AudioEnvironment::setSoundVelocity(float speed) throw(ValueError,FatalError catch(openalpp::FatalError error) { throw FatalError(error.what()); } } -float AudioEnvironment::getSoundVelocity() throw (FatalError) { +float AudioEnvironment::getSoundVelocity() { float speed; try { speed = _openalppAudioEnvironment->getSoundVelocity(); @@ -121,7 +120,7 @@ float AudioEnvironment::getSoundVelocity() throw (FatalError) { } void AudioEnvironment::setDopplerFactor(float factor) -throw (ValueError,FatalError) { +{ try { _openalppAudioEnvironment->setDopplerFactor (factor); } @@ -129,7 +128,7 @@ throw (ValueError,FatalError) { catch(openalpp::FatalError error) { throw FatalError(error.what()); } } -float AudioEnvironment::getDopplerFactor() throw (FatalError) { +float AudioEnvironment::getDopplerFactor() { float factor; try { factor = _openalppAudioEnvironment->getDopplerFactor(); @@ -138,11 +137,11 @@ float AudioEnvironment::getDopplerFactor() throw (FatalError) { return factor; } -void AudioEnvironment::setUnitScale(float scale) throw (ValueError,FatalError) { +void AudioEnvironment::setUnitScale(float scale) { _dummyUnitScale = scale; } -float AudioEnvironment::getUnitScale() throw (FatalError) { +float AudioEnvironment::getUnitScale() { return(_dummyUnitScale); } @@ -154,7 +153,7 @@ void AudioEnvironment::setGain(float gain) { catch(openalpp::FatalError error) { throw FatalError(error.what()); } } -float AudioEnvironment::getGain() throw (FatalError) { +float AudioEnvironment::getGain() { float gain; try { gain = _openalppAudioEnvironment->getGain(); @@ -164,14 +163,14 @@ float AudioEnvironment::getGain() throw (FatalError) { } void AudioEnvironment::setDistanceModel(DistanceModel model) -throw (FatalError){ +{ try { _openalppAudioEnvironment->setDistanceModel (_openalppDistanceModelTranslate[model]); } catch(openalpp::FatalError error) { throw FatalError(error.what()); } } -DistanceModel AudioEnvironment::getDistanceModel() throw (FatalError) { +DistanceModel AudioEnvironment::getDistanceModel() { DistanceModel dmodel; try { dmodel = _osgAudioDistanceModelTranslate[_openalppAudioEnvironment->getDistanceModel()]; @@ -181,7 +180,7 @@ DistanceModel AudioEnvironment::getDistanceModel() throw (FatalError) { } -void AudioEnvironment::initiateReverb() throw (InitError) { +void AudioEnvironment::initiateReverb() { try { _openalppAudioEnvironment->initiateReverb(); } diff --git a/src/osgAudio/BackendOpenALpp/FileStreamOpenALpp.cpp b/src/osgAudio/BackendOpenALpp/FileStreamOpenALpp.cpp index 05f068c..247423e 100644 --- a/src/osgAudio/BackendOpenALpp/FileStreamOpenALpp.cpp +++ b/src/osgAudio/BackendOpenALpp/FileStreamOpenALpp.cpp @@ -30,7 +30,6 @@ using namespace osgAudio; FileStream::FileStream(const std::string& filename,const int buffersize) -throw (NameError,InitError,FileError) : Stream(0) { try { _openalppStream = new openalpp::FileStream (filename, buffersize); diff --git a/src/osgAudio/BackendOpenALpp/SampleOpenALpp.cpp b/src/osgAudio/BackendOpenALpp/SampleOpenALpp.cpp index 451c09b..f9ee9ed 100644 --- a/src/osgAudio/BackendOpenALpp/SampleOpenALpp.cpp +++ b/src/osgAudio/BackendOpenALpp/SampleOpenALpp.cpp @@ -30,7 +30,7 @@ using namespace osgAudio; -Sample::Sample(const std::string& filename) throw (FileError,NameError) { +Sample::Sample(const std::string& filename) { try { _openalppSample = new openalpp::Sample (filename); } @@ -44,7 +44,7 @@ Sample::Sample(const Sample &sample) { // <<<>>> TODO: Create a portable way of specifying the format /* -Sample::Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq) throw (FileError) +Sample::Sample(ALenum format,ALvoid* data,ALsizei size,ALsizei freq) : SoundData() { // throw FileError("Error buffering sound"); } diff --git a/src/osgAudio/BackendOpenALpp/SourceOpenALpp.cpp b/src/osgAudio/BackendOpenALpp/SourceOpenALpp.cpp index 62a329e..4e585cd 100644 --- a/src/osgAudio/BackendOpenALpp/SourceOpenALpp.cpp +++ b/src/osgAudio/BackendOpenALpp/SourceOpenALpp.cpp @@ -288,7 +288,7 @@ float Source::getPitch() const { return _openalppSource->getPitch(); } -void Source::setReverbScale(float scale) throw (InitError,ValueError) { +void Source::setReverbScale(float scale) { try { _openalppSource->setReverbScale(scale); } @@ -296,7 +296,7 @@ void Source::setReverbScale(float scale) throw (InitError,ValueError) { catch(openalpp::InitError error) { throw InitError(error.what()); } } -void Source::setReverbDelay(float delay) throw (InitError,ValueError) { +void Source::setReverbDelay(float delay) { try { _openalppSource->setReverbDelay(delay); } @@ -304,14 +304,14 @@ void Source::setReverbDelay(float delay) throw (InitError,ValueError) { catch(openalpp::InitError error) { throw InitError(error.what()); } } -float Source::getReverbScale() throw (InitError) { +float Source::getReverbScale() { try { return _openalppSource->getReverbScale(); } catch(openalpp::InitError error) { throw InitError(error.what()); } } -float Source::getReverbDelay() throw (InitError) { +float Source::getReverbDelay() { try { return _openalppSource->getReverbDelay(); } @@ -320,21 +320,21 @@ float Source::getReverbDelay() throw (InitError) { // <<<>>> May need to re-engineer /* -unsigned int Source::link(const SourceBase *source) throw (MemoryError) { +unsigned int Source::link(const SourceBase *source) { try { return _openalppSource->link(source); } catch(openalpp::MemoryError error) { throw MemoryError(error.what()); } } -void Source::unlink(const SourceBase *source) throw (NameError) { +void Source::unlink(const SourceBase *source) { try { return _openalppSource->link(source); } catch(openalpp::MemoryError error) { throw MemoryError(error.what()); } } -void Source::unlink(const unsigned int name) throw (NameError) { +void Source::unlink(const unsigned int name) { try { _openalppSource->unlink(name); } diff --git a/src/osgAudio/BackendOpenALpp/StreamOpenALpp.cpp b/src/osgAudio/BackendOpenALpp/StreamOpenALpp.cpp index 4a14834..c03c64c 100644 --- a/src/osgAudio/BackendOpenALpp/StreamOpenALpp.cpp +++ b/src/osgAudio/BackendOpenALpp/StreamOpenALpp.cpp @@ -28,7 +28,7 @@ using namespace osgAudio; -Stream::Stream() throw (NameError) { +Stream::Stream() { try { _openalppStream = new openalpp::Stream (); }