TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
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 TorcsSound * addSample (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 SharedSourcePool * getSourcePool (void)
Public Member Functions inherited from SoundInterface
 SoundInterface (float sampling_rate, int n_channels)
 Make a new sound interface.
virtual ~SoundInterface ()
 Destructor - does nothing.
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.
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.

Protected Attributes

SoundSource * car_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
SharedSourcePool * sourcepool
Protected Attributes inherited from SoundInterface
float sampling_rate
 sampling rate
int n_channels
 number of channels
int n_engine_sounds
 number of simultaneous engines
int curCrashSnd
 holds current crash sound used - the sound cycles
TorcsSound * skid_sound [4]
 set of skid sounds, one per tyre
TorcsSound * road_ride_sound
 rolling on normal road
TorcsSound * grass_ride_sound
 rolling on dirt/grass
TorcsSound * curb_ride_sound
 rolling on curb
TorcsSound * grass_skid_sound
 skidding on dirt/grass
TorcsSound * metal_skid_sound
 metal skidding on metal
TorcsSound * axle_sound
 axle/gear spinning sound
TorcsSound * turbo_sound
 turbo spinning sound
TorcsSound * backfire_loop_sound
 exhaust backfire sound
TorcsSound * crash_sound [NB_CRASH_SOUND]
 list of crash sounds
TorcsSound * bang_sound
 sounds when suspension fully compressed
TorcsSound * bottom_crash_sound
 bang when crashing from a great height
TorcsSound * backfire_sound
 one-off backfire sound
TorcsSound * gear_change_sound
 sound when changing gears
std::vector< TorcsSound * > sound_list
 keeps track of sounds used
SoundPri * engpri
 the engine priority, used for sorting
QueueSoundMap road
 The following are mappings for sound prioritisation.
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.

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.

Here is the call graph for this function:

◆ ~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.

◆ 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:
  • C:/Users/berni/Development/torcs_git/torcs-code/torcs/torcs/src/modules/graphic/ssggraph/SoundInterface.h
  • C:/Users/berni/Development/torcs_git/torcs-code/torcs/torcs/src/modules/graphic/ssggraph/OpenalSoundInterface.cpp