Colobot
Loading...
Searching...
No Matches
CALSound Class Reference
Inheritance diagram for CALSound:

Public Member Functions

bool Create () override
void Reset () override
bool Cache (SoundType, const std::string &) override
void 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
void PlayMusic (const std::string &filename, bool repeat, float fadeTime=2.0f) override
void StopMusic (float fadeTime=2.0f) override
bool IsPlayingMusic () override
void PlayPauseMusic (const std::string &filename, bool repeat) override
void StopPauseMusic () override
Public Member Functions inherited from CSoundInterface
void CacheAll ()

Member Function Documentation

◆ Create()

bool CALSound::Create ( )
overridevirtual

Function to initialize sound device

Reimplemented from CSoundInterface.

◆ Reset()

void CALSound::Reset ( )
overridevirtual

Stop all sounds and music and clean cache.

Reimplemented from CSoundInterface.

◆ Cache()

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.

◆ CacheMusic()

void 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. This function is executed asynchronously

Parameters
file- file to load

Reimplemented from CSoundInterface.

◆ IsCached()

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.

◆ IsCachedMusic()

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.

◆ GetEnable()

bool CALSound::GetEnable ( )
overridevirtual

Return if plugin is enabled

Returns
return true if plugin is enabled

Reimplemented from CSoundInterface.

◆ SetAudioVolume()

void CALSound::SetAudioVolume ( int volume)
overridevirtual

Change global sound volume

Parameters
volume- range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

◆ GetAudioVolume()

int CALSound::GetAudioVolume ( )
overridevirtual

Return global sound volume

Returns
global volume as int in range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

◆ SetMusicVolume()

void CALSound::SetMusicVolume ( int volume)
overridevirtual

Set music volume

Parameters
volume- range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

◆ GetMusicVolume()

int CALSound::GetMusicVolume ( )
overridevirtual

Return music volume

Returns
music volume as int in range from 0 to MAXVOLUME

Reimplemented from CSoundInterface.

◆ SetListener()

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.

◆ FrameMove()

void CALSound::FrameMove ( float rTime)
overridevirtual

Update data each frame

Parameters
rTime- time since last update

Reimplemented from CSoundInterface.

◆ Play() [1/2]

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.

◆ Play() [2/2]

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.

◆ FlushEnvelope()

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.

◆ AddEnvelope()

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.

◆ Position()

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.

◆ Frequency()

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.

◆ Stop()

bool CALSound::Stop ( int channel)
overridevirtual

Stop playing sound

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

Reimplemented from CSoundInterface.

◆ StopAll()

bool CALSound::StopAll ( )
overridevirtual

Stop playing all sounds

Returns
return true on success

Reimplemented from CSoundInterface.

◆ MuteAll()

bool CALSound::MuteAll ( bool mute)
overridevirtual

Mute/unmute all sounds

Parameters
mute
Returns
return true on success

Reimplemented from CSoundInterface.

◆ PlayMusic()

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

Start playing music This function is executed asynchronously

Parameters
filename- name of file to play
repeat- repeat playing
fadeTime- time of transition between music, 0 to disable

Reimplemented from CSoundInterface.

◆ StopMusic()

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

Stop playing music

Returns
nothing

Reimplemented from CSoundInterface.

◆ IsPlayingMusic()

bool CALSound::IsPlayingMusic ( )
overridevirtual

Check if music if playing

Returns
return true if music is playing

Reimplemented from CSoundInterface.

◆ PlayPauseMusic()

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

Start playing pause music This function is executed asynchronously

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

Reimplemented from CSoundInterface.

◆ StopPauseMusic()

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: