TORCS  1.3.9
The Open Racing Car Simulator
SoundInterface Class Referenceabstract

Sound interface. More...

#include <SoundInterface.h>

Inheritance diagram for SoundInterface:
Collaboration diagram for SoundInterface:

Public Member Functions

 SoundInterface (float sampling_rate, int n_channels)
 Make a new sound interface. More...
 
virtual ~SoundInterface ()
 Destructor - does nothing. More...
 
virtual void setNCars (int n_cars)=0
 Set the number of cars - must be defined in children classes. More...
 
virtual TorcsSoundaddSample (const char *filename, int flags=(ACTIVE_VOLUME|ACTIVE_PITCH), bool loop=false, bool static_pool=true)=0
 Add a new sample - must be defined in children classes. More...
 
virtual void initSharedSourcePool ()
 initialised the pool of shared sources More...
 
void setSkidSound (const char *sound_name)
 
void setRoadRideSound (const char *sound_name)
 
void setGrassRideSound (const char *sound_name)
 
void setCurbRideSound (const char *sound_name)
 
void setGrassSkidSound (const char *sound_name)
 
void setMetalSkidSound (const char *sound_name)
 
void setAxleSound (const char *sound_name)
 
void setTurboSound (const char *sound_name)
 
void setBackfireLoopSound (const char *sound_name)
 
void setCrashSound (const char *sound_name, int index)
 
void setBangSound (const char *sound_name)
 
void setBottomCrashSound (const char *sound_name)
 
void setBackfireSound (const char *sound_name)
 
void setGearChangeSound (const char *sound_name)
 
virtual void update (CarSoundData **car_sound_data, int n_cars, sgVec3 p_obs, sgVec3 u_obs, sgVec3 c_obs=NULL, sgVec3 a_obs=NULL)
 Update sound for a given observer. More...
 
virtual void muteForMenu ()
 
virtual float getGlobalGain ()
 
virtual void setGlobalGain (float g)
 

Protected Member Functions

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. More...
 
void SetMaxSoundCar (CarSoundData **car_sound_data, QueueSoundMap *smap)
 Using the smap->id, get the appropriate entry in car_sound_data and call apprioriate methods for smap->snd in order to play the sound. More...
 

Protected Attributes

float sampling_rate
 sampling rate More...
 
int n_channels
 number of channels More...
 
int n_engine_sounds
 number of simultaneous engines More...
 
int curCrashSnd
 holds current crash sound used - the sound cycles More...
 
TorcsSoundskid_sound [4]
 set of skid sounds, one per tyre More...
 
TorcsSoundroad_ride_sound
 rolling on normal road More...
 
TorcsSoundgrass_ride_sound
 rolling on dirt/grass More...
 
TorcsSoundcurb_ride_sound
 rolling on curb More...
 
TorcsSoundgrass_skid_sound
 skidding on dirt/grass More...
 
TorcsSoundmetal_skid_sound
 metal skidding on metal More...
 
TorcsSoundaxle_sound
 axle/gear spinning sound More...
 
TorcsSoundturbo_sound
 turbo spinning sound More...
 
TorcsSoundbackfire_loop_sound
 exhaust backfire sound More...
 
TorcsSoundcrash_sound [NB_CRASH_SOUND]
 list of crash sounds More...
 
TorcsSoundbang_sound
 sounds when suspension fully compressed More...
 
TorcsSoundbottom_crash_sound
 bang when crashing from a great height More...
 
TorcsSoundbackfire_sound
 one-off backfire sound More...
 
TorcsSoundgear_change_sound
 sound when changing gears More...
 
std::vector< TorcsSound * > sound_list
 keeps track of sounds used More...
 
SoundPriengpri
 the engine priority, used for sorting More...
 
QueueSoundMap road
 The following are mappings for sound prioritisation. More...
 
QueueSoundMap grass
 
QueueSoundMap grass_skid
 
QueueSoundMap curb
 
QueueSoundMap metal_skid
 
QueueSoundMap backfire_loop
 
QueueSoundMap turbo
 
QueueSoundMap axle
 

Detailed Description

Sound interface.

Definition at line 82 of file SoundInterface.h.

Constructor & Destructor Documentation

◆ SoundInterface()

SoundInterface::SoundInterface ( float  sampling_rate,
int  n_channels 
)

Make a new sound interface.

Definition at line 22 of file SoundInterface.cpp.

◆ ~SoundInterface()

virtual SoundInterface::~SoundInterface ( )
inlinevirtual

Destructor - does nothing.

Definition at line 132 of file SoundInterface.h.

Member Function Documentation

◆ addSample()

virtual TorcsSound* SoundInterface::addSample ( const char *  filename,
int  flags = (ACTIVE_VOLUME|ACTIVE_PITCH),
bool  loop = false,
bool  static_pool = true 
)
pure virtual

Add a new sample - must be defined in children classes.

Implemented in OpenalSoundInterface, and PlibSoundInterface.

◆ getGlobalGain()

virtual float SoundInterface::getGlobalGain ( )
inlinevirtual

Reimplemented in OpenalSoundInterface, and PlibSoundInterface.

Definition at line 232 of file SoundInterface.h.

◆ initSharedSourcePool()

virtual void SoundInterface::initSharedSourcePool ( void  )
inlinevirtual

initialised the pool of shared sources

Reimplemented in OpenalSoundInterface.

Definition at line 143 of file SoundInterface.h.

◆ muteForMenu()

virtual void SoundInterface::muteForMenu ( )
inlinevirtual

Reimplemented in OpenalSoundInterface.

Definition at line 231 of file SoundInterface.h.

◆ setAxleSound()

void SoundInterface::setAxleSound ( const char *  sound_name)
inline

Definition at line 178 of file SoundInterface.h.

Here is the call graph for this function:

◆ setBackfireLoopSound()

void SoundInterface::setBackfireLoopSound ( const char *  sound_name)
inline

Definition at line 188 of file SoundInterface.h.

Here is the call graph for this function:

◆ setBackfireSound()

void SoundInterface::setBackfireSound ( const char *  sound_name)
inline

Definition at line 212 of file SoundInterface.h.

Here is the call graph for this function:

◆ setBangSound()

void SoundInterface::setBangSound ( const char *  sound_name)
inline

Definition at line 200 of file SoundInterface.h.

Here is the call graph for this function:

◆ setBottomCrashSound()

void SoundInterface::setBottomCrashSound ( const char *  sound_name)
inline

Definition at line 206 of file SoundInterface.h.

Here is the call graph for this function:

◆ setCrashSound()

void SoundInterface::setCrashSound ( const char *  sound_name,
int  index 
)
inline

Definition at line 193 of file SoundInterface.h.

Here is the call graph for this function:

◆ setCurbRideSound()

void SoundInterface::setCurbRideSound ( const char *  sound_name)
inline

Definition at line 163 of file SoundInterface.h.

Here is the call graph for this function:

◆ setGearChangeSound()

void SoundInterface::setGearChangeSound ( const char *  sound_name)
inline

Definition at line 218 of file SoundInterface.h.

Here is the call graph for this function:

◆ setGlobalGain()

virtual void SoundInterface::setGlobalGain ( float  g)
inlinevirtual

Reimplemented in OpenalSoundInterface, and PlibSoundInterface.

Definition at line 233 of file SoundInterface.h.

◆ setGrassRideSound()

void SoundInterface::setGrassRideSound ( const char *  sound_name)
inline

Definition at line 158 of file SoundInterface.h.

Here is the call graph for this function:

◆ setGrassSkidSound()

void SoundInterface::setGrassSkidSound ( const char *  sound_name)
inline

Definition at line 168 of file SoundInterface.h.

Here is the call graph for this function:

◆ SetMaxSoundCar()

void SoundInterface::SetMaxSoundCar ( CarSoundData **  car_sound_data,
QueueSoundMap smap 
)
protected

Using the smap->id, get the appropriate entry in car_sound_data and call apprioriate methods for smap->snd in order to play the sound.

Definition at line 75 of file SoundInterface.cpp.

Here is the call graph for this function:

◆ setMetalSkidSound()

void SoundInterface::setMetalSkidSound ( const char *  sound_name)
inline

Definition at line 173 of file SoundInterface.h.

Here is the call graph for this function:

◆ setNCars()

virtual void SoundInterface::setNCars ( int  n_cars)
pure virtual

Set the number of cars - must be defined in children classes.

Implemented in OpenalSoundInterface, and PlibSoundInterface.

◆ setRoadRideSound()

void SoundInterface::setRoadRideSound ( const char *  sound_name)
inline

Definition at line 153 of file SoundInterface.h.

Here is the call graph for this function:

◆ setSkidSound()

void SoundInterface::setSkidSound ( const char *  sound_name)
inline

Definition at line 145 of file SoundInterface.h.

Here is the call graph for this function:

◆ setTurboSound()

void SoundInterface::setTurboSound ( const char *  sound_name)
inline

Definition at line 183 of file SoundInterface.h.

Here is the call graph for this function:

◆ SortSingleQueue()

void SoundInterface::SortSingleQueue ( CarSoundData **  car_sound_data,
QueueSoundMap smap,
int  n_cars 
)
protected

Find the max amplitude sound in car_sound_data and put it in smap.

Definition at line 57 of file SoundInterface.cpp.

◆ update()

virtual void SoundInterface::update ( CarSoundData **  car_sound_data,
int  n_cars,
sgVec3  p_obs,
sgVec3  u_obs,
sgVec3  c_obs = NULL,
sgVec3  a_obs = NULL 
)
inlinevirtual

Update sound for a given observer.

Reimplemented in OpenalSoundInterface, and PlibSoundInterface.

Definition at line 224 of file SoundInterface.h.

Member Data Documentation

◆ axle

QueueSoundMap SoundInterface::axle
protected

Definition at line 114 of file SoundInterface.h.

◆ axle_sound

TorcsSound* SoundInterface::axle_sound
protected

axle/gear spinning sound

Definition at line 94 of file SoundInterface.h.

◆ backfire_loop

QueueSoundMap SoundInterface::backfire_loop
protected

Definition at line 112 of file SoundInterface.h.

◆ backfire_loop_sound

TorcsSound* SoundInterface::backfire_loop_sound
protected

exhaust backfire sound

Definition at line 96 of file SoundInterface.h.

◆ backfire_sound

TorcsSound* SoundInterface::backfire_sound
protected

one-off backfire sound

Definition at line 100 of file SoundInterface.h.

◆ bang_sound

TorcsSound* SoundInterface::bang_sound
protected

sounds when suspension fully compressed

Definition at line 98 of file SoundInterface.h.

◆ bottom_crash_sound

TorcsSound* SoundInterface::bottom_crash_sound
protected

bang when crashing from a great height

Definition at line 99 of file SoundInterface.h.

◆ crash_sound

TorcsSound* SoundInterface::crash_sound[NB_CRASH_SOUND]
protected

list of crash sounds

Definition at line 97 of file SoundInterface.h.

◆ curb

QueueSoundMap SoundInterface::curb
protected

Definition at line 110 of file SoundInterface.h.

◆ curb_ride_sound

TorcsSound* SoundInterface::curb_ride_sound
protected

rolling on curb

Definition at line 91 of file SoundInterface.h.

◆ curCrashSnd

int SoundInterface::curCrashSnd
protected

holds current crash sound used - the sound cycles

Definition at line 87 of file SoundInterface.h.

◆ engpri

SoundPri* SoundInterface::engpri
protected

the engine priority, used for sorting

Definition at line 104 of file SoundInterface.h.

◆ gear_change_sound

TorcsSound* SoundInterface::gear_change_sound
protected

sound when changing gears

Definition at line 101 of file SoundInterface.h.

◆ grass

QueueSoundMap SoundInterface::grass
protected

Definition at line 108 of file SoundInterface.h.

◆ grass_ride_sound

TorcsSound* SoundInterface::grass_ride_sound
protected

rolling on dirt/grass

Definition at line 90 of file SoundInterface.h.

◆ grass_skid

QueueSoundMap SoundInterface::grass_skid
protected

Definition at line 109 of file SoundInterface.h.

◆ grass_skid_sound

TorcsSound* SoundInterface::grass_skid_sound
protected

skidding on dirt/grass

Definition at line 92 of file SoundInterface.h.

◆ metal_skid

QueueSoundMap SoundInterface::metal_skid
protected

Definition at line 111 of file SoundInterface.h.

◆ metal_skid_sound

TorcsSound* SoundInterface::metal_skid_sound
protected

metal skidding on metal

Definition at line 93 of file SoundInterface.h.

◆ n_channels

int SoundInterface::n_channels
protected

number of channels

Definition at line 85 of file SoundInterface.h.

◆ n_engine_sounds

int SoundInterface::n_engine_sounds
protected

number of simultaneous engines

Definition at line 86 of file SoundInterface.h.

◆ road

QueueSoundMap SoundInterface::road
protected

The following are mappings for sound prioritisation.

Definition at line 107 of file SoundInterface.h.

◆ road_ride_sound

TorcsSound* SoundInterface::road_ride_sound
protected

rolling on normal road

Definition at line 89 of file SoundInterface.h.

◆ sampling_rate

float SoundInterface::sampling_rate
protected

sampling rate

Definition at line 84 of file SoundInterface.h.

◆ skid_sound

TorcsSound* SoundInterface::skid_sound[4]
protected

set of skid sounds, one per tyre

Definition at line 88 of file SoundInterface.h.

◆ sound_list

std::vector<TorcsSound*> SoundInterface::sound_list
protected

keeps track of sounds used

Definition at line 103 of file SoundInterface.h.

◆ turbo

QueueSoundMap SoundInterface::turbo
protected

Definition at line 113 of file SoundInterface.h.

◆ turbo_sound

TorcsSound* SoundInterface::turbo_sound
protected

turbo spinning sound

Definition at line 95 of file SoundInterface.h.


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