Colobot
Public Member Functions | List of all members
CALSound Class Reference
Inheritance diagram for CALSound:
Inheritance graph
[legend]

Public Member Functions

bool Create () override
 
bool Cache (SoundType, const std::string &) override
 
bool CacheMusic (const std::string &) override
 
bool IsCached (SoundType) override
 
bool IsCachedMusic (const std::string &) override
 
bool GetEnable () override
 
void SetAudioVolume (int volume) override
 
int GetAudioVolume () override
 
void SetMusicVolume (int volume) override
 
int GetMusicVolume () override
 
void SetListener (const Math::Vector &eye, const Math::Vector &lookat) override
 
void FrameMove (float rTime) override
 
int Play (SoundType sound, float amplitude=1.0f, float frequency=1.0f, bool loop=false) override
 
int Play (SoundType sound, const Math::Vector &pos, float amplitude=1.0f, float frequency=1.0f, bool loop=false) override
 
bool FlushEnvelope (int channel) override
 
bool AddEnvelope (int channel, float amplitude, float frequency, float time, SoundNext oper) override
 
bool Position (int channel, const Math::Vector &pos) override
 
bool Frequency (int channel, float frequency) override
 
bool Stop (int channel) override
 
bool StopAll () override
 
bool MuteAll (bool mute) override
 
bool PlayMusic (const std::string &filename, bool repeat, float fadeTime=2.0f) override
 
bool RestartMusic () override
 
void SuspendMusic () override
 
void StopMusic (float fadeTime=2.0f) override
 
bool IsPlayingMusic () override
 
bool PlayPauseMusic (const std::string &filename, bool repeat) override
 
void StopPauseMusic () override
 
- Public Member Functions inherited from CSoundInterface
void CacheAll ()
 
void CacheCommonMusic ()
 

Member Function Documentation

bool CALSound::Create ( )
overridevirtual

Function to initialize sound device

Reimplemented from CSoundInterface.

bool CALSound::Cache ( SoundType  sound,
const std::string &  file 
)
overridevirtual

Function called to cache sound effect file. This function is called by plugin interface for each file.

Parameters
sound- id of a file, will be used to identify sound files
file- file to load
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::CacheMusic ( const std::string &  file)
overridevirtual

Function called to cache music file. This function is called by CRobotMain for each file used in the mission.

Parameters
file- file to load
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::IsCached ( SoundType  sound)
overridevirtual

Function to check if sound effect file was cached.

Parameters
sound- id of a sound effect file
Returns
return true if the file was cached

Reimplemented from CSoundInterface.

bool CALSound::IsCachedMusic ( const std::string &  file)
overridevirtual

Function called to check if music file was cached.

Parameters
file- file to check
Returns
return true if the file was cached

Reimplemented from CSoundInterface.

bool CALSound::GetEnable ( )
overridevirtual

Return if plugin is enabled

Returns
return true if plugin is enabled

Reimplemented from CSoundInterface.

void CALSound::SetAudioVolume ( int  volume)
overridevirtual

Change global sound volume

Parameters
volume- range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

int CALSound::GetAudioVolume ( )
overridevirtual

Return global sound volume

Returns
global volume as int in range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

void CALSound::SetMusicVolume ( int  volume)
overridevirtual

Set music volume

Parameters
volume- range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

int CALSound::GetMusicVolume ( )
overridevirtual

Return music volume

Returns
music volume as int in range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

void CALSound::SetListener ( const Math::Vector eye,
const Math::Vector lookat 
)
overridevirtual

Set listener position

Parameters
eye- position of listener
lookat- direction listener is looking at

Reimplemented from CSoundInterface.

void CALSound::FrameMove ( float  rTime)
overridevirtual

Update data each frame

Parameters
rTime- time since last update

Reimplemented from CSoundInterface.

int CALSound::Play ( SoundType  sound,
float  amplitude = 1.0f,
float  frequency = 1.0f,
bool  loop = false 
)
overridevirtual

Play specific sound

Parameters
sound- sound to play
amplitude- change amplitude of sound before playing
frequency- change sound frequency before playing (0.5 octave down, 2.0 octave up)
loop- loop sound
Returns
identifier of channel that sound will be played on

Reimplemented from CSoundInterface.

int CALSound::Play ( SoundType  sound,
const Math::Vector pos,
float  amplitude = 1.0f,
float  frequency = 1.0f,
bool  loop = false 
)
overridevirtual

Play specific sound

Parameters
sound- sound to play
pos- position of sound in space
amplitude- change amplitude of sound before playing
frequency- change sound frequency before playing (0.5 octave down, 2.0 octave up)
loop- loop sound
Returns
identifier of channel that sound will be played on

Reimplemented from CSoundInterface.

bool CALSound::FlushEnvelope ( int  channel)
overridevirtual

Remove all operations that would be made on sound in channel.

Parameters
channel- channel to work on
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::AddEnvelope ( int  channel,
float  amplitude,
float  frequency,
float  time,
SoundNext  oper 
)
overridevirtual

Add envelope to sound. Envelope is a operatino that will be performend on sound in future like changing frequency

Parameters
channel- channel to work on
amplitude- change amplitude
frequency- change frequency
time- when to change (sample time)
oper- operation to perform
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::Position ( int  channel,
const Math::Vector pos 
)
overridevirtual

Set sound position in space

Parameters
channel- channel to work on
pos- new positino of a sound
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::Frequency ( int  channel,
float  frequency 
)
overridevirtual

Set sound frequency

Parameters
channel- channel to work on
frequency- change sound frequency
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::Stop ( int  channel)
overridevirtual

Stop playing sound

Parameters
channel- channel to work on
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::StopAll ( )
overridevirtual

Stop playing all sounds

Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::MuteAll ( bool  mute)
overridevirtual

Mute/unmute all sounds

Parameters
mute
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::PlayMusic ( const std::string &  filename,
bool  repeat,
float  fadeTime = 2.0f 
)
overridevirtual

Start playing music

Parameters
filename- name of file to play
repeat- repeat playing
fadeTime- time of transition between music
Returns
return true on success

Reimplemented from CSoundInterface.

bool CALSound::RestartMusic ( )
overridevirtual

Restart music

Returns
return true on success

Reimplemented from CSoundInterface.

void CALSound::SuspendMusic ( )
overridevirtual

Susspend playing music

Returns
nothing

Reimplemented from CSoundInterface.

void CALSound::StopMusic ( float  fadeTime = 2.0f)
overridevirtual

Stop playing music

Returns
nothing

Reimplemented from CSoundInterface.

bool CALSound::IsPlayingMusic ( )
overridevirtual

Check if music if playing

Returns
return true if music is playing

Reimplemented from CSoundInterface.

bool CALSound::PlayPauseMusic ( const std::string &  filename,
bool  repeat 
)
overridevirtual

Start playing pause music

Parameters
filename- name of file to play
repeat- repeat playing
Returns
return true on success

Reimplemented from CSoundInterface.

void CALSound::StopPauseMusic ( )
overridevirtual

Stop playing pause music and return to the mission music

Returns
nothing

Reimplemented from CSoundInterface.


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