TORCS  1.3.9
The Open Racing Car Simulator
CarSoundData Class Reference

Manages the source sound of each individual car. More...

#include <CarSoundData.h>

Collaboration diagram for CarSoundData:

Public Member Functions

 CarSoundData (int id, SoundInterface *sound_interface)
 
void setEngineSound (TorcsSound *engine_sound, float rpm_scale)
 
void setTurboParameters (bool turbo_on, float turbo_rpm, float turbo_lag)
 
TorcsSoundgetEngineSound ()
 
void copyEngPri (SoundPri &epri)
 
void setCarPosition (sgVec3 p)
 
void setCarSpeed (sgVec3 u)
 
void getCarPosition (sgVec3 p)
 
void getCarSpeed (sgVec3 u)
 
void setListenerPosition (sgVec3 p)
 
void update (tCarElt *car)
 

Public Attributes

SoundPri eng_pri
 
WheelSoundData wheel [4]
 
float attenuation
 global distance attenuation More...
 
float base_frequency
 engine base frequency for ~ 6000 rpm More...
 
float smooth_accel
 smoothed acceleration input More...
 
float pre_axle
 axle related More...
 
bool turbo_on
 use turbo sound More...
 
float turbo_rpm
 when turbo comes in More...
 
float turbo_ilag
 how fast turbo catches up with engine More...
 
QSoundChar engine
 
QSoundChar drag_collision
 
QSoundChar turbo
 
QSoundChar axle
 
QSoundChar engine_backfire
 
QSoundChar grass_skid
 
QSoundChar curb
 
QSoundChar grass
 
QSoundChar road
 
QSoundChar skid_metal
 
int prev_gear
 
bool gear_changing
 
bool bottom_crash
 
bool bang
 
bool crash
 

Protected Member Functions

void calculateAttenuation (tCarElt *car)
 Use inverse distance to calculate attenuation of sounds originating from this car. Useful for prioritisation of sounds. More...
 
void calculateEngineSound (tCarElt *car)
 Calculate characteristics of the engine sound. More...
 
void calculateBackfireSound (tCarElt *car)
 Calculate the frequency and amplitude of a looped backfiring sound. More...
 
void calculateTyreSound (tCarElt *car)
 
void calculateGearChangeSound (tCarElt *car)
 
void calculateCollisionSound (tCarElt *car)
 
bool isOffRoadSurface (const tTrackSeg *const seg)
 
tdble calculateRoughnessFreqency (const tTrackSeg *const seg)
 
void getDirtRoughnessParams (tCarElt *car, int wheelIndex, bool mainSurfaceIsOffroad, tdble roughnessFreq, tdble otherRoughnessFreq, tdble &dirtRoughnessFreq, tdble &dirtRoughness)
 
void handleDirtContribution (tdble dirtContribution, tdble dirtRoughnessFreq, tdble dirtRoughness, tdble wheelSkid, tdble tmpvol, tdble ride)
 
void handleRoadContribution (bool mainSurfaceIsOffroad, tdble roadContribution, tdble roughnessFreq, tdble otherRoughnessFreq, tdble tmpvol, tdble ride, int wheelIndex, tdble wheelSkid, tdble wheelSlipAccel, tdble wheelReaction)
 
void handleCurbContribution (tPrivCar *car, bool onOtherSurface, tdble otherSurfaceContribution, tdble curbRoughnessFreq, tdble otherRoughnessFreq, tdble tmpvol, tdble ride, int wheelIndex, tdble wheelReaction)
 

Protected Attributes

sgVec3 listener_position
 
sgVec3 position
 
sgVec3 speed
 
TorcsSoundengine_sound
 
SoundInterfacesound_interface
 

Detailed Description

Manages the source sound of each individual car.

Definition at line 25 of file CarSoundData.h.

Constructor & Destructor Documentation

◆ CarSoundData()

CarSoundData::CarSoundData ( int  id,
SoundInterface sound_interface 
)

Definition at line 22 of file CarSoundData.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ calculateAttenuation()

void CarSoundData::calculateAttenuation ( tCarElt car)
protected

Use inverse distance to calculate attenuation of sounds originating from this car. Useful for prioritisation of sounds.

Definition at line 119 of file CarSoundData.cpp.

◆ calculateBackfireSound()

void CarSoundData::calculateBackfireSound ( tCarElt car)
protected

Calculate the frequency and amplitude of a looped backfiring sound.

Definition at line 186 of file CarSoundData.cpp.

◆ calculateCollisionSound()

void CarSoundData::calculateCollisionSound ( tCarElt car)
protected

Definition at line 478 of file CarSoundData.cpp.

◆ calculateEngineSound()

void CarSoundData::calculateEngineSound ( tCarElt car)
protected

Calculate characteristics of the engine sound.

Definition at line 135 of file CarSoundData.cpp.

◆ calculateGearChangeSound()

void CarSoundData::calculateGearChangeSound ( tCarElt car)
protected

Definition at line 468 of file CarSoundData.cpp.

◆ calculateRoughnessFreqency()

tdble CarSoundData::calculateRoughnessFreqency ( const tTrackSeg *const  seg)
protected

Definition at line 341 of file CarSoundData.cpp.

◆ calculateTyreSound()

void CarSoundData::calculateTyreSound ( tCarElt car)
protected

Definition at line 200 of file CarSoundData.cpp.

Here is the call graph for this function:

◆ copyEngPri()

void CarSoundData::copyEngPri ( SoundPri epri)
inline

Definition at line 108 of file CarSoundData.h.

◆ getCarPosition()

void CarSoundData::getCarPosition ( sgVec3  p)
inline

Definition at line 121 of file CarSoundData.h.

◆ getCarSpeed()

void CarSoundData::getCarSpeed ( sgVec3  u)
inline

Definition at line 127 of file CarSoundData.h.

◆ getDirtRoughnessParams()

void CarSoundData::getDirtRoughnessParams ( tCarElt car,
int  wheelIndex,
bool  mainSurfaceIsOffroad,
tdble  roughnessFreq,
tdble  otherRoughnessFreq,
tdble dirtRoughnessFreq,
tdble dirtRoughness 
)
protected

Definition at line 351 of file CarSoundData.cpp.

◆ getEngineSound()

TorcsSound* CarSoundData::getEngineSound ( )
inline

Definition at line 107 of file CarSoundData.h.

◆ handleCurbContribution()

void CarSoundData::handleCurbContribution ( tPrivCar car,
bool  onOtherSurface,
tdble  otherSurfaceContribution,
tdble  curbRoughnessFreq,
tdble  otherRoughnessFreq,
tdble  tmpvol,
tdble  ride,
int  wheelIndex,
tdble  wheelReaction 
)
protected

Definition at line 434 of file CarSoundData.cpp.

◆ handleDirtContribution()

void CarSoundData::handleDirtContribution ( tdble  dirtContribution,
tdble  dirtRoughnessFreq,
tdble  dirtRoughness,
tdble  wheelSkid,
tdble  tmpvol,
tdble  ride 
)
protected

Definition at line 370 of file CarSoundData.cpp.

◆ handleRoadContribution()

void CarSoundData::handleRoadContribution ( bool  mainSurfaceIsOffroad,
tdble  roadContribution,
tdble  roughnessFreq,
tdble  otherRoughnessFreq,
tdble  tmpvol,
tdble  ride,
int  wheelIndex,
tdble  wheelSkid,
tdble  wheelSlipAccel,
tdble  wheelReaction 
)
protected

Definition at line 396 of file CarSoundData.cpp.

◆ isOffRoadSurface()

bool CarSoundData::isOffRoadSurface ( const tTrackSeg *const  seg)
protected

Definition at line 329 of file CarSoundData.cpp.

◆ setCarPosition()

void CarSoundData::setCarPosition ( sgVec3  p)
inline

Definition at line 109 of file CarSoundData.h.

◆ setCarSpeed()

void CarSoundData::setCarSpeed ( sgVec3  u)
inline

Definition at line 115 of file CarSoundData.h.

◆ setEngineSound()

void CarSoundData::setEngineSound ( TorcsSound engine_sound,
float  rpm_scale 
)

Definition at line 85 of file CarSoundData.cpp.

◆ setListenerPosition()

void CarSoundData::setListenerPosition ( sgVec3  p)
inline

Definition at line 133 of file CarSoundData.h.

◆ setTurboParameters()

void CarSoundData::setTurboParameters ( bool  turbo_on,
float  turbo_rpm,
float  turbo_lag 
)

Definition at line 91 of file CarSoundData.cpp.

◆ update()

void CarSoundData::update ( tCarElt car)

Definition at line 101 of file CarSoundData.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ attenuation

float CarSoundData::attenuation

global distance attenuation

Definition at line 85 of file CarSoundData.h.

◆ axle

QSoundChar CarSoundData::axle

Definition at line 95 of file CarSoundData.h.

◆ bang

bool CarSoundData::bang

Definition at line 142 of file CarSoundData.h.

◆ base_frequency

float CarSoundData::base_frequency

engine base frequency for ~ 6000 rpm

Definition at line 86 of file CarSoundData.h.

◆ bottom_crash

bool CarSoundData::bottom_crash

Definition at line 141 of file CarSoundData.h.

◆ crash

bool CarSoundData::crash

Definition at line 143 of file CarSoundData.h.

◆ curb

QSoundChar CarSoundData::curb

Definition at line 98 of file CarSoundData.h.

◆ drag_collision

QSoundChar CarSoundData::drag_collision

Definition at line 93 of file CarSoundData.h.

◆ eng_pri

SoundPri CarSoundData::eng_pri

Definition at line 83 of file CarSoundData.h.

◆ engine

QSoundChar CarSoundData::engine

Definition at line 92 of file CarSoundData.h.

◆ engine_backfire

QSoundChar CarSoundData::engine_backfire

Definition at line 96 of file CarSoundData.h.

◆ engine_sound

TorcsSound* CarSoundData::engine_sound
protected

Definition at line 30 of file CarSoundData.h.

◆ gear_changing

bool CarSoundData::gear_changing

Definition at line 140 of file CarSoundData.h.

◆ grass

QSoundChar CarSoundData::grass

Definition at line 99 of file CarSoundData.h.

◆ grass_skid

QSoundChar CarSoundData::grass_skid

Definition at line 97 of file CarSoundData.h.

◆ listener_position

sgVec3 CarSoundData::listener_position
protected

Definition at line 27 of file CarSoundData.h.

◆ position

sgVec3 CarSoundData::position
protected

Definition at line 28 of file CarSoundData.h.

◆ pre_axle

float CarSoundData::pre_axle

axle related

Definition at line 88 of file CarSoundData.h.

◆ prev_gear

int CarSoundData::prev_gear

Definition at line 102 of file CarSoundData.h.

◆ road

QSoundChar CarSoundData::road

Definition at line 100 of file CarSoundData.h.

◆ skid_metal

QSoundChar CarSoundData::skid_metal

Definition at line 101 of file CarSoundData.h.

◆ smooth_accel

float CarSoundData::smooth_accel

smoothed acceleration input

Definition at line 87 of file CarSoundData.h.

◆ sound_interface

SoundInterface* CarSoundData::sound_interface
protected

Definition at line 31 of file CarSoundData.h.

◆ speed

sgVec3 CarSoundData::speed
protected

Definition at line 29 of file CarSoundData.h.

◆ turbo

QSoundChar CarSoundData::turbo

Definition at line 94 of file CarSoundData.h.

◆ turbo_ilag

float CarSoundData::turbo_ilag

how fast turbo catches up with engine

Definition at line 91 of file CarSoundData.h.

◆ turbo_on

bool CarSoundData::turbo_on

use turbo sound

Definition at line 89 of file CarSoundData.h.

◆ turbo_rpm

float CarSoundData::turbo_rpm

when turbo comes in

Definition at line 90 of file CarSoundData.h.

◆ wheel

WheelSoundData CarSoundData::wheel[4]

Definition at line 84 of file CarSoundData.h.


The documentation for this class was generated from the following files: