//
// Written by Curtis Olson, started April 2004.
//
-// Copyright (C) 2004 Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// A constant offset to be applied to the final source_pos
ALfloat offset_pos[3];
+ // The orientation of the sound (direction and cut-off angles)
+ ALfloat direction[3];
+ ALfloat inner, outer, outergain;
+
// Velocity of the source sound.
ALfloat source_vel[3];
later.)
*/
SGSoundSample( const char *path, const char *file, bool cleanup );
- SGSoundSample( unsigned char *_data, int len, int _freq );
+
+ /**
+ * Constructor.
+ * @param _data Pointer to a memory buffer containing the sample data
+ * @param len Byte length of array
+ * @param _freq Frequency of the provided data (bytes per second)
+ * @param cleanup Request clean up the intermediate data (this
+ should usually be true unless you want to manipulate the data
+ later.)
+ */
+ SGSoundSample( unsigned char *_data, int len, int _freq, bool cleanup );
+
~SGSoundSample();
/**
alSourcefv( source, AL_POSITION, final_pos );
}
+ /**
+ * Set the orientation of the sound source, both for direction
+ * and audio cut-off angles.
+ */
+ inline void set_orientation( ALfloat *dir, ALfloat inner_angle=360.0,
+ ALfloat outer_angle=360.0,
+ ALfloat outer_gain=0.0)
+ {
+ inner = inner_angle;
+ outer = outer_angle;
+ outergain = outer_gain;
+ alSourcefv( source, AL_DIRECTION, dir);
+ alSourcef( source, AL_CONE_INNER_ANGLE, inner );
+ alSourcef( source, AL_CONE_OUTER_ANGLE, outer );
+ alSourcef( source, AL_CONE_OUTER_GAIN, outergain );
+ }
+
/**
* Set velocity of sound source (uses same coordinate system as opengl)
*/