}
// 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),
#endif
playing(false),
no_Doppler_effect(_no_Doppler_effect)
- {
+{
SGPath samplepath( path );
if ( strlen(file) ) {
samplepath.append( file );
}
// 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),
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 );
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
}
}
}
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];
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);
#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
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.
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();
/**
* 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 );
/**