coding style fixes
This commit is contained in:
@@ -85,7 +85,7 @@ SGSoundSample::SGSoundSample() :
|
||||
}
|
||||
|
||||
// constructor
|
||||
SGSoundSample::SGSoundSample( const char *path, const char *file , bool _no_Doppler_effect ) :
|
||||
SGSoundSample::SGSoundSample( const char *path, const char *file, bool _no_Doppler_effect ) :
|
||||
buffer(0),
|
||||
source(0),
|
||||
pitch(1.0),
|
||||
@@ -99,7 +99,7 @@ SGSoundSample::SGSoundSample( const char *path, const char *file , bool _no_Dopp
|
||||
#endif
|
||||
playing(false),
|
||||
no_Doppler_effect(_no_Doppler_effect)
|
||||
{
|
||||
{
|
||||
SGPath samplepath( path );
|
||||
if ( strlen(file) ) {
|
||||
samplepath.append( file );
|
||||
@@ -155,7 +155,7 @@ SGSoundSample::SGSoundSample( const char *path, const char *file , bool _no_Dopp
|
||||
}
|
||||
|
||||
// constructor
|
||||
SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq , bool _no_Doppler_effect ) :
|
||||
SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq, bool _no_Doppler_effect ) :
|
||||
buffer(0),
|
||||
source(0),
|
||||
pitch(1.0),
|
||||
@@ -267,9 +267,9 @@ SGSoundSample::bind_source() {
|
||||
alSourcef( source, AL_GAIN, volume );
|
||||
#else
|
||||
print_openal_error("bind_sources return");
|
||||
alSourcef( source, AL_PITCH, pitch *doppler_pitch_factor );
|
||||
alGetError(); //ignore if the pitch is clamped by the driver
|
||||
alSourcef( source, AL_GAIN, volume *doppler_volume_factor );
|
||||
alSourcef( source, AL_PITCH, pitch * doppler_pitch_factor );
|
||||
alGetError(); // ignore if the pitch is clamped by the driver
|
||||
alSourcef( source, AL_GAIN, volume * doppler_volume_factor );
|
||||
#endif
|
||||
alSourcefv( source, AL_POSITION, source_pos );
|
||||
alSourcefv( source, AL_DIRECTION, direction );
|
||||
@@ -302,7 +302,7 @@ SGSoundSample::set_pitch( double p ) {
|
||||
print_openal_error("set_pitch");
|
||||
#else
|
||||
alSourcef( source, AL_PITCH, pitch * doppler_pitch_factor );
|
||||
alGetError(); //ignore if the pitch is clamped by the driver
|
||||
alGetError(); // ignore if the pitch is clamped by the driver
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -385,7 +385,7 @@ SGSoundSample::set_orientation( ALfloat *dir, ALfloat inner_angle,
|
||||
}
|
||||
|
||||
void
|
||||
SGSoundSample::set_source_vel( ALfloat *vel , ALfloat *listener_vel ) {
|
||||
SGSoundSample::set_source_vel( ALfloat *vel, ALfloat *listener_vel ) {
|
||||
if (no_Doppler_effect) {
|
||||
source_vel[0] = listener_vel[0];
|
||||
source_vel[1] = listener_vel[1];
|
||||
@@ -416,8 +416,8 @@ SGSoundSample::set_source_vel( ALfloat *vel , ALfloat *listener_vel ) {
|
||||
sgAddVec3( final_pos, source_pos, offset_pos );
|
||||
mfp = sgLengthVec3(final_pos);
|
||||
if (mfp > 1e-6) {
|
||||
double vls = - sgScalarProductVec3( listener_vel, final_pos ) / mfp;
|
||||
double vss = - sgScalarProductVec3( source_vel, final_pos ) / mfp;
|
||||
double vls = -sgScalarProductVec3( listener_vel, final_pos ) / mfp;
|
||||
double vss = -sgScalarProductVec3( source_vel, final_pos ) / mfp;
|
||||
if (fabs(340 - vss) > 1e-6)
|
||||
{
|
||||
doppler = (340 - vls) / (340 - vss);
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#define USE_OPEN_AL_DOPPLER_WITH_FIXED_LISTENER better than nothing
|
||||
#endif
|
||||
#else
|
||||
//the Open_AL Doppler calculation seem to be buggy on windows
|
||||
// the Open_AL Doppler calculation seems to be buggy on windows
|
||||
#define USE_SOFTWARE_DOPPLER seem to be necessary
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
should usually be true unless you want to manipulate the data
|
||||
later.)
|
||||
*/
|
||||
SGSoundSample( const char *path, const char *file , bool no_Doppler_effect = true );
|
||||
SGSoundSample( const char *path, const char *file, bool no_Doppler_effect = true );
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
should usually be true unless you want to manipulate the data
|
||||
later.)
|
||||
*/
|
||||
SGSoundSample( unsigned char *_data, int len, int _freq , bool no_Doppler_effect = true );
|
||||
SGSoundSample( unsigned char *_data, int len, int _freq, bool no_Doppler_effect = true );
|
||||
|
||||
~SGSoundSample();
|
||||
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
/**
|
||||
* Set velocity of sound source (uses same coordinate system as opengl)
|
||||
*/
|
||||
void set_source_vel( ALfloat *vel , ALfloat *listener_vel );
|
||||
void set_source_vel( ALfloat *vel, ALfloat *listener_vel );
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -345,6 +345,6 @@ void SGSoundMgr::set_source_vel_all( ALfloat *vel ) {
|
||||
sample_map_iterator sample_end = samples.end();
|
||||
for ( ; sample_current != sample_end; ++sample_current ) {
|
||||
SGSoundSample *sample = sample_current->second;
|
||||
sample->set_source_vel( vel , listener_vel );
|
||||
sample->set_source_vel( vel, listener_vel );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user