Thrive
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
thrive::SoundSourceComponent Class Reference

A component for sound sources. More...

#include <sound_source_system.h>

Inheritance diagram for thrive::SoundSourceComponent:
thrive::Component

Public Member Functions

Sound * addSound (std::string name, std::string filename)
 Adds a new sound. More...
 
void removeSound (std::string name)
 Removes a sound by name. More...
 
void playSound (std::string name)
 Plays a sound This is equivalent to playing the sound directly. More...
 
void interpose (std::string name, int fadeTime)
 Interrupts the current ambient sound and interposes a new one Does nothing for non-ambient sound sources. More...
 
void queueSound (std::string name)
 Queues up an ambient sound to be played after the current one Does nothing for non-ambient sound sources. More...
 
void interruptPlaying ()
 Stops playing of all songs.
 
void load (const StorageContainer &storage) override
 Loads the component. More...
 
StorageContainer storage () const override
 Serializes the component. More...
 
- Public Member Functions inherited from thrive::Component
virtual ~Component ()=0
 Destructor.
 
bool isVolatile () const
 A volatile component is not serialized during a save. More...
 
EntityId owner () const
 The entity this component belongs to. More...
 
void setVolatile (bool isVolatile)
 Sets the volatile flag. More...
 
void setOwner (EntityId owner)
 Sets the component's owner. More...
 
virtual ComponentTypeId typeId () const =0
 The component's type id.
 
virtual std::string typeName () const =0
 The component's type name.
 

Static Public Member Functions

static luabind::scope luaBindings ()
 Lua bindings. More...
 
- Static Public Member Functions inherited from thrive::Component
static luabind::scope luaBindings ()
 Lua bindings. More...
 

Public Attributes

TouchableValue< bool > m_ambientSoundSource = false
 Whether this source as an ambient soundsource with no 3d position.
 
TouchableValue< bool > m_autoLoop = false
 Whether this source auto loops. More...
 
TouchableValue< float > m_volumeMultiplier = 1.0f
 Volume multiplier that is applied to all associated sounds.
 

Friends

class SoundSourceSystem
 

Detailed Description

A component for sound sources.

Member Function Documentation

Sound * SoundSourceComponent::addSound ( std::string  name,
std::string  filename 
)

Adds a new sound.

Parameters
nameThe name of the sound (must be unique)
filenameThe file to play
Returns
A reference to the new sound
void SoundSourceComponent::interpose ( std::string  name,
int  fadeTime 
)

Interrupts the current ambient sound and interposes a new one Does nothing for non-ambient sound sources.

Parameters
nameThe name of the song that is to interpose
fadeTimeThe time the transition should take
void SoundSourceComponent::load ( const StorageContainer &  storage)
overridevirtual

Loads the component.

Parameters
storage

Implements thrive::Component.

luabind::scope SoundSourceComponent::luaBindings ( )
static

Lua bindings.

Exposes:

Returns
void SoundSourceComponent::playSound ( std::string  name)

Plays a sound This is equivalent to playing the sound directly.

Parameters
nameThe name of the sound
void SoundSourceComponent::queueSound ( std::string  name)

Queues up an ambient sound to be played after the current one Does nothing for non-ambient sound sources.

Parameters
nameThe name of the song to queue up
void SoundSourceComponent::removeSound ( std::string  name)

Removes a sound by name.

Parameters
name
StorageContainer SoundSourceComponent::storage ( ) const
overridevirtual

Serializes the component.

Returns

Implements thrive::Component.

Member Data Documentation

TouchableValue<bool> thrive::SoundSourceComponent::m_autoLoop = false

Whether this source auto loops.

Auto looping sound sources will automatically keep playing sounds from the added sounds and fade between them


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