Public Member Functions

Tiny2D::Sound Class Reference

Sound instance. More...

#include <Tiny2D.h>

List of all members.

Public Member Functions

 Sound ()
 Sound (const Sound &other)
 Copy constructor; internally creates new sound instance object (with its own state) and increases reference count of the sound resource.
 ~Sound ()
 Destroys the sound.
ResourceState GetState () const
 Gets resource state.
void operator= (const Sound &other)
 Copy operator; internally creates new sound instance object (with its own state) and increases reference count of the sound resource.
bool Create (const std::string &path, bool isMusic=false, bool immediate=true)
 Creates sound from a file; isMusic indicates whether this sound shall be played on the special music channel; 'immediate' set to true indicates to load it synchronously.
void Destroy (float fadeOutTime=0.0f)
 Destroys the sound (with optional sound fade out)
void SetVolume (float volume)
 Sets the volume of the sound; expects value within 0..1 range.
void Play (bool loop=false, float fadeInTime=0.2f)
 Starts playing the sound.
void Stop ()
 Stops playing the sound.
bool IsPlaying ()
 Checks whether sound is playing now.

Detailed Description

Sound instance.


Constructor & Destructor Documentation

Tiny2D::Sound::Sound (  )
Tiny2D::Sound::Sound ( const Sound other )

Copy constructor; internally creates new sound instance object (with its own state) and increases reference count of the sound resource.

Tiny2D::Sound::~Sound (  )

Destroys the sound.


Member Function Documentation

bool Tiny2D::Sound::Create ( const std::string &  path,
bool  isMusic = false,
bool  immediate = true 
)

Creates sound from a file; isMusic indicates whether this sound shall be played on the special music channel; 'immediate' set to true indicates to load it synchronously.

void Tiny2D::Sound::Destroy ( float  fadeOutTime = 0.0f )

Destroys the sound (with optional sound fade out)

ResourceState Tiny2D::Sound::GetState (  ) const

Gets resource state.

bool Tiny2D::Sound::IsPlaying (  )

Checks whether sound is playing now.

void Tiny2D::Sound::operator= ( const Sound other )

Copy operator; internally creates new sound instance object (with its own state) and increases reference count of the sound resource.

void Tiny2D::Sound::Play ( bool  loop = false,
float  fadeInTime = 0.2f 
)

Starts playing the sound.

void Tiny2D::Sound::SetVolume ( float  volume )

Sets the volume of the sound; expects value within 0..1 range.

void Tiny2D::Sound::Stop (  )

Stops playing the sound.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines