TORCS  1.3.9
The Open Racing Car Simulator
PlibTorcsSound Class Reference

PLIB-specific torcs sound. More...

#include <TorcsSound.h>

Inheritance diagram for PlibTorcsSound:
Collaboration diagram for PlibTorcsSound:

Public Member Functions

 PlibTorcsSound (slScheduler *sched, const char *filename, int flags=(ACTIVE_VOLUME|ACTIVE_PITCH), bool loop=false)
 Create a new PLib sound. More...
 
virtual ~PlibTorcsSound ()
 Destructor. More...
 
virtual void setVolume (float vol)
 Set the volume. More...
 
virtual void play ()
 Start the sample. More...
 
virtual void start ()
 Start the sample. More...
 
virtual void stop ()
 Stop the sample. More...
 
virtual void resume ()
 Resume a paused sample. More...
 
virtual void pause ()
 Pause a sample. More...
 
virtual void update ()
 Update the plib sounds. More...
 
virtual bool isPlaying ()
 True if the sound is playing. More...
 
virtual bool isPaused ()
 Truye if the sound is paused. More...
 
- Public Member Functions inherited from TorcsSound
 TorcsSound (int flags=(ACTIVE_VOLUME|ACTIVE_PITCH))
 Consruct a sound. More...
 
virtual ~TorcsSound ()
 Destructor. More...
 
virtual void setPitch (float pitch)
 Set the pitch. More...
 
virtual void setLPFilter (float lp)
 Set the filter. More...
 
virtual void setSource (sgVec3 p, sgVec3 u)
 
virtual float getVolume ()
 
virtual float getPitch ()
 
virtual float getLPfilter ()
 
virtual void setReferenceDistance (float dist)
 
virtual void getSource (sgVec3 p, sgVec3 u)
 

Protected Attributes

slSample * sample
 sample data More...
 
slEnvelope * volume_env
 volume envelope More...
 
slEnvelope * pitch_env
 pitch envelope More...
 
slEnvelope * lowpass_env
 low pass filter envelope More...
 
slScheduler * sched
 plib sl scheduler (see sl.h) More...
 
bool playing
 Sound is playing. More...
 
bool paused
 sound is paused More...
 
- Protected Attributes inherited from TorcsSound
class SoundInterfaceiface
 Handler to the interface. More...
 
int flags
 Flags relating to what effects are to be used. More...
 
float MAX_VOL
 Maximum volume. More...
 
float volume
 Current volume. More...
 
float pitch
 Current pitch. More...
 
float lowpass
 Current low pass filter. More...
 
bool loop
 Whether it's a looping sound. More...
 

Detailed Description

PLIB-specific torcs sound.

Definition at line 94 of file TorcsSound.h.

Constructor & Destructor Documentation

◆ PlibTorcsSound()

PlibTorcsSound::PlibTorcsSound ( slScheduler *  sched,
const char *  filename,
int  flags = (ACTIVE_VOLUME|ACTIVE_PITCH),
bool  loop = false 
)

Create a new PLib sound.

It requires a scheduler to be set up and a filename to read data from.

Definition at line 42 of file TorcsSound.cpp.

◆ ~PlibTorcsSound()

PlibTorcsSound::~PlibTorcsSound ( )
virtual

Destructor.

Definition at line 93 of file TorcsSound.cpp.

Member Function Documentation

◆ isPaused()

virtual bool PlibTorcsSound::isPaused ( )
inlinevirtual

Truye if the sound is paused.

Implements TorcsSound.

Definition at line 124 of file TorcsSound.h.

◆ isPlaying()

virtual bool PlibTorcsSound::isPlaying ( )
inlinevirtual

True if the sound is playing.

Implements TorcsSound.

Definition at line 119 of file TorcsSound.h.

◆ pause()

void PlibTorcsSound::pause ( )
virtual

Pause a sample.

Implements TorcsSound.

Definition at line 162 of file TorcsSound.cpp.

◆ play()

void PlibTorcsSound::play ( )
virtual

Start the sample.

Implements TorcsSound.

Definition at line 129 of file TorcsSound.cpp.

Here is the call graph for this function:

◆ resume()

void PlibTorcsSound::resume ( )
virtual

Resume a paused sample.

Implements TorcsSound.

Definition at line 156 of file TorcsSound.cpp.

◆ setVolume()

void PlibTorcsSound::setVolume ( float  vol)
virtual

Set the volume.

Since plib does not support envelopes for one-shot samples, we pre-adjust their volume

Reimplemented from TorcsSound.

Definition at line 117 of file TorcsSound.cpp.

◆ start()

void PlibTorcsSound::start ( )
virtual

Start the sample.

Implements TorcsSound.

Definition at line 134 of file TorcsSound.cpp.

◆ stop()

void PlibTorcsSound::stop ( )
virtual

Stop the sample.

Implements TorcsSound.

Definition at line 148 of file TorcsSound.cpp.

◆ update()

void PlibTorcsSound::update ( )
virtual

Update the plib sounds.

This should be called as often as possible from the main sound code, probably by looping through all the sounds used.

Implements TorcsSound.

Definition at line 174 of file TorcsSound.cpp.

Member Data Documentation

◆ lowpass_env

slEnvelope* PlibTorcsSound::lowpass_env
protected

low pass filter envelope

Definition at line 99 of file TorcsSound.h.

◆ paused

bool PlibTorcsSound::paused
protected

sound is paused

Definition at line 102 of file TorcsSound.h.

◆ pitch_env

slEnvelope* PlibTorcsSound::pitch_env
protected

pitch envelope

Definition at line 98 of file TorcsSound.h.

◆ playing

bool PlibTorcsSound::playing
protected

Sound is playing.

Definition at line 101 of file TorcsSound.h.

◆ sample

slSample* PlibTorcsSound::sample
protected

sample data

Definition at line 96 of file TorcsSound.h.

◆ sched

slScheduler* PlibTorcsSound::sched
protected

plib sl scheduler (see sl.h)

Definition at line 100 of file TorcsSound.h.

◆ volume_env

slEnvelope* PlibTorcsSound::volume_env
protected

volume envelope

Definition at line 97 of file TorcsSound.h.


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