TORCS  1.3.9
The Open Racing Car Simulator
OpenalSoundInterface Class Reference

#include <SoundInterface.h>

Inheritance diagram for OpenalSoundInterface:
Collaboration diagram for OpenalSoundInterface:

Classes

struct  SoundChar_
 

Public Member Functions

 OpenalSoundInterface (float sampling_rate, int n_channels)
 
virtual ~OpenalSoundInterface ()
 
virtual void setNCars (int n_cars)
 
virtual TorcsSoundaddSample (const char *filename, int flags=(ACTIVE_VOLUME|ACTIVE_PITCH), bool loop=false, bool static_pool=true)
 
virtual void update (CarSoundData **car_sound_data, int n_cars, sgVec3 p_obs, sgVec3 u_obs, sgVec3 c_obs, sgVec3 a_obs)
 
virtual void muteForMenu ()
 
virtual float getGlobalGain ()
 
virtual void initSharedSourcePool ()
 
virtual void setGlobalGain (float g)
 
virtual bool getStaticSource (ALuint *source)
 
virtual SharedSourcePoolgetSourcePool (void)
 
- Public Member Functions inherited from SoundInterface
 SoundInterface (float sampling_rate, int n_channels)
 Make a new sound interface. More...
 
virtual ~SoundInterface ()
 Destructor - does nothing. 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)
 

Protected Member Functions

void DopplerShift (SoundChar *sound, float *p_src, float *u_src, float *p, float *u)
 
virtual void SetMaxSoundCar (CarSoundData **car_sound_data, QueueSoundMap *smap)
 
- Protected Member Functions inherited from SoundInterface
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

SoundSourcecar_src
 
SoundSource tyre_src [4]
 
ALCcontext * cc
 
ALCdevice * dev
 
float global_gain
 
int OSI_MAX_BUFFERS
 
int OSI_MAX_SOURCES
 
int OSI_MAX_STATIC_SOURCES
 
int n_static_sources_in_use
 
SharedSourcePoolsourcepool
 
- Protected Attributes inherited from SoundInterface
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
 

Static Protected Attributes

static const int OSI_MIN_DYNAMIC_SOURCES = 4
 Define this to use the OpenAL Doppler. More...
 

Private Types

typedef struct OpenalSoundInterface::SoundChar_ SoundChar
 

Detailed Description

Definition at line 279 of file SoundInterface.h.

Member Typedef Documentation

◆ SoundChar

Constructor & Destructor Documentation

◆ OpenalSoundInterface()

OpenalSoundInterface::OpenalSoundInterface ( float  sampling_rate,
int  n_channels 
)

Definition at line 31 of file OpenalSoundInterface.cpp.

◆ ~OpenalSoundInterface()

OpenalSoundInterface::~OpenalSoundInterface ( )
virtual

Definition at line 149 of file OpenalSoundInterface.cpp.

Member Function Documentation

◆ addSample()

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

Implements SoundInterface.

Definition at line 171 of file OpenalSoundInterface.cpp.

◆ DopplerShift()

void OpenalSoundInterface::DopplerShift ( SoundChar sound,
float *  p_src,
float *  u_src,
float *  p,
float *  u 
)
protected

◆ getGlobalGain()

virtual float OpenalSoundInterface::getGlobalGain ( )
inlinevirtual

Reimplemented from SoundInterface.

Definition at line 309 of file SoundInterface.h.

◆ getSourcePool()

virtual SharedSourcePool* OpenalSoundInterface::getSourcePool ( void  )
inlinevirtual

Definition at line 318 of file SoundInterface.h.

◆ getStaticSource()

bool OpenalSoundInterface::getStaticSource ( ALuint *  source)
virtual

Definition at line 388 of file OpenalSoundInterface.cpp.

◆ initSharedSourcePool()

void OpenalSoundInterface::initSharedSourcePool ( void  )
virtual

Reimplemented from SoundInterface.

Definition at line 379 of file OpenalSoundInterface.cpp.

Here is the call graph for this function:

◆ muteForMenu()

void OpenalSoundInterface::muteForMenu ( )
virtual

Reimplemented from SoundInterface.

Definition at line 373 of file OpenalSoundInterface.cpp.

◆ setGlobalGain()

virtual void OpenalSoundInterface::setGlobalGain ( float  g)
inlinevirtual

Reimplemented from SoundInterface.

Definition at line 311 of file SoundInterface.h.

◆ SetMaxSoundCar()

void OpenalSoundInterface::SetMaxSoundCar ( CarSoundData **  car_sound_data,
QueueSoundMap smap 
)
protectedvirtual

Definition at line 405 of file OpenalSoundInterface.cpp.

Here is the call graph for this function:

◆ setNCars()

void OpenalSoundInterface::setNCars ( int  n_cars)
virtual

Implements SoundInterface.

Definition at line 164 of file OpenalSoundInterface.cpp.

◆ update()

void OpenalSoundInterface::update ( CarSoundData **  car_sound_data,
int  n_cars,
sgVec3  p_obs,
sgVec3  u_obs,
sgVec3  c_obs,
sgVec3  a_obs 
)
virtual

Reimplemented from SoundInterface.

Definition at line 178 of file OpenalSoundInterface.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ car_src

SoundSource* OpenalSoundInterface::car_src
protected

Definition at line 285 of file SoundInterface.h.

◆ cc

ALCcontext* OpenalSoundInterface::cc
protected

Definition at line 287 of file SoundInterface.h.

◆ dev

ALCdevice* OpenalSoundInterface::dev
protected

Definition at line 288 of file SoundInterface.h.

◆ global_gain

float OpenalSoundInterface::global_gain
protected

Definition at line 289 of file SoundInterface.h.

◆ n_static_sources_in_use

int OpenalSoundInterface::n_static_sources_in_use
protected

Definition at line 293 of file SoundInterface.h.

◆ OSI_MAX_BUFFERS

int OpenalSoundInterface::OSI_MAX_BUFFERS
protected

Definition at line 290 of file SoundInterface.h.

◆ OSI_MAX_SOURCES

int OpenalSoundInterface::OSI_MAX_SOURCES
protected

Definition at line 291 of file SoundInterface.h.

◆ OSI_MAX_STATIC_SOURCES

int OpenalSoundInterface::OSI_MAX_STATIC_SOURCES
protected

Definition at line 292 of file SoundInterface.h.

◆ OSI_MIN_DYNAMIC_SOURCES

const int OpenalSoundInterface::OSI_MIN_DYNAMIC_SOURCES = 4
staticprotected

Define this to use the OpenAL Doppler.

Definition at line 295 of file SoundInterface.h.

◆ sourcepool

SharedSourcePool* OpenalSoundInterface::sourcepool
protected

Definition at line 294 of file SoundInterface.h.

◆ tyre_src

SoundSource OpenalSoundInterface::tyre_src[4]
protected

Definition at line 286 of file SoundInterface.h.


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