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++) {
94 car_src[id].setListener (p_obs, u_obs);
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];
137 skid_sound[i]->setPitch (sound_data[i].skid.f * mod_f);
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) {
struct WheelSoundData_ WheelSoundData
int sortSndPriority(const void *a, const void *b)
struct QSoundChar_ QSoundChar
struct QueueSoundMap_ QueueSoundMap
A queue containing mappings between sounds and sound sources.
int sortSndPriority(const void *a, const void *b)
struct SoundPri_ SoundPri
Sound priority, used to sort cars according to amplitude attenuation.
Manages the source sound of each individual car.
QSoundChar engine_backfire
float attenuation
global distance attenuation
QSoundChar drag_collision
virtual TorcsSound * addSample(const char *filename, int flags=(ACTIVE_VOLUME|ACTIVE_PITCH), bool loop=false, bool static_pool=true)
virtual ~PlibSoundInterface()
virtual slScheduler * getScheduler()
void SetMaxSoundCar(CarSoundData **car_sound_data, QueueSoundMap *smap)
PlibSoundInterface(float sampling_rate, int n_channels)
virtual void setNCars(int n_cars)
std::vector< TorcsSound * > sound_list
virtual void update(CarSoundData **car_sound_data, int n_cars, sgVec3 p_obs, sgVec3 u_obs, sgVec3 c_obs=NULL, sgVec3 a_obs=NULL)
PLIB-specific torcs sound.
virtual void setVolume(float vol)
Set the volume.
SoundInterface(float sampling_rate, int n_channels)
Make a new sound interface.
TorcsSound * turbo_sound
turbo spinning sound
QueueSoundMap backfire_loop
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.
TorcsSound * metal_skid_sound
metal skidding on metal
TorcsSound * backfire_loop_sound
exhaust backfire sound
TorcsSound * grass_skid_sound
skidding on dirt/grass
TorcsSound * axle_sound
axle/gear spinning sound
TorcsSound * skid_sound[4]
set of skid sounds, one per tyre
TorcsSound * grass_ride_sound
rolling on dirt/grass
QueueSoundMap road
The following are mappings for sound prioritisation.
float sampling_rate
sampling rate
TorcsSound * crash_sound[NB_CRASH_SOUND]
list of crash sounds
TorcsSound * road_ride_sound
rolling on normal road
int n_channels
number of channels
TorcsSound * gear_change_sound
sound when changing gears
TorcsSound * bottom_crash_sound
bang when crashing from a great height
int curCrashSnd
holds current crash sound used - the sound cycles
TorcsSound * bang_sound
sounds when suspension fully compressed
virtual void setPitch(float pitch)
Set the pitch.
virtual void setLPFilter(float lp)
Set the filter.
virtual void setVolume(float vol)
Set the volume.
static CarSoundData ** car_sound_data
int id
The id of the car producing the sound, used for retrieving doppler effects etc.
QSoundChar CarSoundData::* schar
The calculated sound characteristic.
TorcsSound * snd
The raw sound.