Hymn to Beauty
C++ 3D Engine
Component::SoundSource Class Reference

Component describing a sound source. More...

#include <SoundSource.hpp>

Inheritance diagram for Component::SoundSource:
Component::SuperComponent

Public Member Functions

 SoundSource ()
 Create new sound source. More...
 
 ~SoundSource ()
 Destructor. More...
 
void Serialize (Json::Value &node, bool load) override
 Save or load component values to/from JSON. More...
 
void SetPath (const std::string &path)
 Set the path to the sound file to play. More...
 
const std::string & GetPath () const
 Get the path to the sound file to play. More...
 
void Play ()
 Play the sound. More...
 
void Pause ()
 Pause the sound. More...
 
void Stop ()
 Stop the sound. More...
 
- Public Member Functions inherited from Component::SuperComponent
 SuperComponent ()
 Create new SuperComponent. More...
 
virtual ~SuperComponent ()
 Destructor. More...
 
void Kill ()
 Kill the component, will be removed at the end of the frame. More...
 
bool IsKilled () const
 Get whether component has been killed. More...
 

Public Attributes

float pitch = 1.0f
 Pitch. More...
 
float gain = 1.0f
 Gain. More...
 
bool loop = false
 Whether the sound should loop. More...
 
- Public Attributes inherited from Component::SuperComponent
Entityentity = nullptr
 Pointer to which entity this component corresponds. More...
 

Friends

class ::SoundManager
 

Detailed Description

Component describing a sound source.

Constructor & Destructor Documentation

◆ SoundSource()

SoundSource::SoundSource ( )

Create new sound source.

◆ ~SoundSource()

SoundSource::~SoundSource ( )

Destructor.

Member Function Documentation

◆ GetPath()

const std::string & SoundSource::GetPath ( ) const

Get the path to the sound file to play.

Returns
The path to the sound file to play.

◆ Pause()

void SoundSource::Pause ( )

Pause the sound.

◆ Play()

void SoundSource::Play ( )

Play the sound.

◆ Serialize()

void SoundSource::Serialize ( Json::Value &  node,
bool  load 
)
overridevirtual

Save or load component values to/from JSON.

Parameters
nodeThe JSON node to save to or load from.
loadWhether to load (otherwise saves).

Implements Component::SuperComponent.

◆ SetPath()

void SoundSource::SetPath ( const std::string &  path)

Set the path to the sound file to play.

@parma path Path to the sound file to play.

◆ Stop()

void SoundSource::Stop ( )

Stop the sound.

Friends And Related Function Documentation

◆ ::SoundManager

friend class ::SoundManager
friend

Member Data Documentation

◆ gain

float Component::SoundSource::gain = 1.0f

Gain.

◆ loop

bool Component::SoundSource::loop = false

Whether the sound should loop.

◆ pitch

float Component::SoundSource::pitch = 1.0f

Pitch.


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