Loading...
Searching...
No Matches
CSoundInterface Class Reference

Sound plugin interface. More...

`#include <src/sound/sound.h>`

Inheritance diagram for CSoundInterface:
[legend]

## Public Member Functions

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

## Detailed Description

Sound plugin interface.

## Member Function Documentation

## Create()

bool CSoundInterface::Create | ( |  | ) |

virtual

Function to initialize sound device

Reimplemented in CALSound.

## CacheAll()

void CSoundInterface::CacheAll | ( |  | ) |

Function called to cache all sound effect files. Function calls CSoundInterface::Cache() for each file

## Reset()

void CSoundInterface::Reset | ( |  | ) |

virtual

Stop all sounds and music and clean cache.

Reimplemented in CALSound.

## Cache()

bool CSoundInterface::Cache | ( | SoundType | sound,
|  | const std::string & | file )

virtual

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 in CALSound.

## CacheMusic()

void CSoundInterface::CacheMusic | ( | const std::string & | file | ) |

virtual

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 in CALSound.

## IsCached()

bool CSoundInterface::IsCached | ( | SoundType | sound | ) |

virtual

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 in CALSound.

## IsCachedMusic()

bool CSoundInterface::IsCachedMusic | ( | const std::string & | file | ) |

virtual

Function called to check if music file was cached.

Parameters

  file | - file to check

Returns
  return true if the file was cached

Reimplemented in CALSound.

## GetEnable()

bool CSoundInterface::GetEnable | ( |  | ) |

virtual

Return if plugin is enabled

Returns
  return true if plugin is enabled

Reimplemented in CALSound.

## SetAudioVolume()

void CSoundInterface::SetAudioVolume | ( | int | volume | ) |

virtual

Change global sound volume

Parameters

  volume | - range from 0 to MAXVOLUME

Reimplemented in CALSound.

## GetAudioVolume()

int CSoundInterface::GetAudioVolume | ( |  | ) |

virtual

Return global sound volume

Returns
  global volume as int in range from 0 to MAXVOLUME

Reimplemented in CALSound.

## SetMusicVolume()

void CSoundInterface::SetMusicVolume | ( | int | volume | ) |

virtual

Set music volume

Parameters

  volume | - range from 0 to MAXVOLUME

Reimplemented in CALSound.

## GetMusicVolume()

int CSoundInterface::GetMusicVolume | ( |  | ) |

virtual

Return music volume

Returns
  music volume as int in range from 0 to MAXVOLUME

Reimplemented in CALSound.

## SetListener()

void CSoundInterface::SetListener | ( | const Math::Vector & | eye,
|  | const Math::Vector & | lookat )

virtual

Set listener position

Parameters

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

Reimplemented in CALSound.

## FrameMove()

void CSoundInterface::FrameMove | ( | float | rTime | ) |

virtual

Update data each frame

Parameters

  rTime | - time since last update

Reimplemented in CALSound.

## Play() [1/2]

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

virtual

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 in CALSound.

## Play() [2/2]

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

virtual

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 in CALSound.

## FlushEnvelope()

bool CSoundInterface::FlushEnvelope | ( | int | channel | ) |

virtual

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

Parameters

  channel | - channel to work on

Returns
  return true on success

Reimplemented in CALSound.

## AddEnvelope()

bool CSoundInterface::AddEnvelope | ( | int | channel,
|  | float | amplitude,
|  | float | frequency,
|  | float | time,
|  | SoundNext | oper )

virtual

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 in CALSound.

## Position()

bool CSoundInterface::Position | ( | int | channel,
|  | const Math::Vector & | pos )

virtual

Set sound position in space

Parameters

  channel | - channel to work on
  pos | - new positino of a sound

Returns
  return true on success

Reimplemented in CALSound.

## Frequency()

bool CSoundInterface::Frequency | ( | int | channel,
|  | float | frequency )

virtual

Set sound frequency

Parameters

  channel | - channel to work on
  frequency | - change sound frequency

Returns
  return true on success

Reimplemented in CALSound.

## Stop()

bool CSoundInterface::Stop | ( | int | channel | ) |

virtual

Stop playing sound

Parameters

  channel | - channel to work on

Returns
  return true on success

Reimplemented in CALSound.

## StopAll()

bool CSoundInterface::StopAll | ( |  | ) |

virtual

Stop playing all sounds

Returns
  return true on success

Reimplemented in CALSound.

## MuteAll()

bool CSoundInterface::MuteAll | ( | bool | mute | ) |

virtual

Mute/unmute all sounds

Parameters

  mute |

Returns
  return true on success

Reimplemented in CALSound.

## PlayMusic()

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

virtual

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 in CALSound.

## StopMusic()

void CSoundInterface::StopMusic | ( | float | fadeTime = 2.0f | ) |

virtual

Stop playing music

Returns
  nothing

Reimplemented in CALSound.

## IsPlayingMusic()

bool CSoundInterface::IsPlayingMusic | ( |  | ) |

virtual

Check if music if playing

Returns
  return true if music is playing

Reimplemented in CALSound.

## PlayPauseMusic()

void CSoundInterface::PlayPauseMusic | ( | const std::string & | filename,
|  | bool | repeat )

virtual

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 in CALSound.

## StopPauseMusic()

void CSoundInterface::StopPauseMusic | ( |  | ) |

virtual

Stop playing pause music and return to the mission music

Returns
  nothing

Reimplemented in CALSound.

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

- src/sound/sound.h
- src/sound/sound.cpp