X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fsound%2Fsample_openal.cxx;h=2eb4910d2bf73426a7e3ec4029c875790cb89c03;hb=c8953c6275647ab7a5593554bbb8cf5e9bd11279;hp=124ad93904d64497db156ce88877b42064d0177e;hpb=1cff7fcfea3ae156f820133d6fca0960d3fbb1e2;p=simgear.git diff --git a/simgear/sound/sample_openal.cxx b/simgear/sound/sample_openal.cxx index 124ad939..2eb4910d 100644 --- a/simgear/sound/sample_openal.cxx +++ b/simgear/sound/sample_openal.cxx @@ -16,10 +16,13 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id$ +#ifdef HAVE_CONFIG_H +# include +#endif #if defined( __APPLE__ ) # define AL_ILLEGAL_ENUM AL_INVALID_ENUM @@ -118,14 +121,15 @@ SGSoundSample::SGSoundSample( const char *path, const char *file) : if (buffer == AL_NONE) { ALenum error = alutGetError (); print_openal_error("constructor (alutCreateBufferFromFile)"); - throw sg_exception("Failed to load wav file: "+string(alutGetErrorString (error))); + throw sg_io_exception("Failed to load wav file: ", + sg_location(string(alutGetErrorString (error)))); } #else // // pre 1.0 alut version // - ALvoid* data = load_file(path, file) + ALvoid* data = load_file(path, file); // Copy data to the internal OpenAL buffer alBufferData( buffer, format, data, size, freq ); @@ -141,8 +145,7 @@ SGSoundSample::SGSoundSample( const char *path, const char *file) : } // constructor -SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq, - bool cleanup) : +SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq ) : buffer(0), source(0), pitch(1.0), @@ -180,10 +183,6 @@ SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq, throw sg_exception("Failed to buffer data."); } - if ( cleanup ) { - free(_data); - } - print_openal_error("constructor return"); } @@ -339,6 +338,9 @@ SGSoundSample::set_orientation( ALfloat *dir, ALfloat inner_angle, inner = inner_angle; outer = outer_angle; outergain = outer_gain; + direction[0] = dir[0]; + direction[1] = dir[1]; + direction[2] = dir[2]; if (playing) { alSourcefv( source, AL_DIRECTION, dir); alSourcef( source, AL_CONE_INNER_ANGLE, inner ); @@ -388,7 +390,8 @@ SGSoundSample::load_file(const char *path, const char *file) ALfloat freqf; data = alutLoadMemoryFromFile(samplepath.c_str(), &format, &size, &freqf ); if (data == NULL) { - throw sg_exception("Failed to load wav file."); + throw sg_io_exception("Failed to load wav file.", + sg_location(samplepath.str())); } freq = (ALsizei)freqf; #else @@ -400,7 +403,8 @@ SGSoundSample::load_file(const char *path, const char *file) &format, &data, &size, &freq, &loop ); # endif if ( print_openal_error("constructor (alutLoadWAVFile)") ) { - throw sg_exception("Failed to load wav file."); + throw sg_io_exception("Failed to load wav file.", + sg_location(samplepath.str())); } #endif