29 sched->setSafetyMargin (0.128f);
48 for (
unsigned int i=0; i<
sound_list.size(); i++) {
83 for (i = 0; i<n_cars; i++) {
87 for (i = 0; i<n_cars; i++) {
101 for (i = 0; i<n_cars; i++) {
117 float max_skid_vol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
118 int max_skid_id[4] = {0,0,0,0};
120 for (
id = 0;
id<n_cars;
id++) {
122 for (
int j=0; j<4; j++) {
124 if (skvol > max_skid_vol[j]) {
125 max_skid_vol[j] = skvol;
131 for (i = 0; i<4; i++) {
132 int id = max_skid_id[i];
180 for (
id = 0;
id<n_cars;
id++) {
181 float crash_threshold = 0.5f;
182 float gear_threshold = 0.75;
186 if (sound_data->
crash) {
191 if (
car_src[
id].a > crash_threshold) {
196 if (sound_data->
bang) {
197 if (
car_src[
id].a > crash_threshold) {
203 if (
car_src[
id].a > crash_threshold) {
209 if (
car_src[
id].a > gear_threshold) {
virtual void setVolume(float vol)
Set the volume.
virtual void setLPFilter(float lp)
Set the filter.
void update()
Calculate environmental parameters for current situation.
QSoundChar engine_backfire
static CarSoundData ** car_sound_data
TorcsSound * bang_sound
sounds when suspension fully compressed
int curCrashSnd
holds current crash sound used - the sound cycles
TorcsSound * getEngineSound()
virtual void setPitch(float pitch)
Set the pitch.
A queue containing mappings between sounds and sound sources.
TorcsSound * bottom_crash_sound
bang when crashing from a great height
QSoundChar CarSoundData::* schar
The calculated sound characteristic.
void setSource(sgVec3 p, sgVec3 u)
Set source position and velocity.
Manages the source sound of each individual car.
TorcsSound * backfire_loop_sound
exhaust backfire sound
virtual TorcsSound * addSample(const char *filename, int flags=(ACTIVE_VOLUME|ACTIVE_PITCH), bool loop=false, bool static_pool=true)
TorcsSound * grass_skid_sound
skidding on dirt/grass
TorcsSound * turbo_sound
turbo spinning sound
TorcsSound * road_ride_sound
rolling on normal road
void setListener(sgVec3 p, sgVec3 u)
Set listener position and velocity.
virtual slScheduler * getScheduler()
PLIB-specific torcs sound.
virtual void update(CarSoundData **car_sound_data, int n_cars, sgVec3 p_obs, sgVec3 u_obs, sgVec3 c_obs=NULL, sgVec3 a_obs=NULL)
QueueSoundMap backfire_loop
float f
Environmental frequency shift.
float attenuation
global distance attenuation
int n_channels
number of channels
TorcsSound * snd
The raw sound.
float a
Environmental attenuation.
virtual void setVolume(float vol)
Set the volume.
QSoundChar drag_collision
void SortSingleQueue(CarSoundData **car_sound_data, QueueSoundMap *smap, int n_cars)
Find the max amplitude sound in car_sound_data and put it in smap.
void getCarPosition(sgVec3 p)
QueueSoundMap road
The following are mappings for sound prioritisation.
float sampling_rate
sampling rate
virtual void setNCars(int n_cars)
TorcsSound * gear_change_sound
sound when changing gears
virtual ~PlibSoundInterface()
void getCarSpeed(sgVec3 u)
void copyEngPri(SoundPri &epri)
std::vector< TorcsSound * > sound_list
TorcsSound * crash_sound[NB_CRASH_SOUND]
list of crash sounds
TorcsSound * metal_skid_sound
metal skidding on metal
TorcsSound * grass_ride_sound
rolling on dirt/grass
PlibSoundInterface(float sampling_rate, int n_channels)
void SetMaxSoundCar(CarSoundData **car_sound_data, QueueSoundMap *smap)
int sortSndPriority(const void *a, const void *b)
TorcsSound * axle_sound
axle/gear spinning sound
TorcsSound * skid_sound[4]
set of skid sounds, one per tyre
int id
The id of the car producing the sound, used for retrieving doppler effects etc.
Sound priority, used to sort cars according to amplitude attenuation.