Meteor2D  dev internal
Meteor is a lightweight 2D game engine.
Loading...
Searching...
No Matches
meteor::MAudioSource Class Reference

This class represents an audio source in the game world. More...

#include <audiosource.h>

Inheritance diagram for meteor::MAudioSource:

Public Member Functions

 MAudioSource (std::string clipPath, bool loop, bool autoStart)
 Construnctor.
 
void onExit () override
 
void play ()
 Plays audio clip.
 
bool isPaused ()
 
void pause ()
 Pause playback.
 
void stop ()
 Pause playback and reset to the begining.
 
bool isLooped ()
 
void setIsLooped (bool loop)
 Set playback loop status.
 
float getVolume ()
 
void setVolume (float volume)
 Set volume level of playback.
 
float getPlaybackSpeed ()
 
void setPlaybackSpeed (float playbackSpeed)
 Set playback speed.
 
- Public Member Functions inherited from meteor::MSpatialEntity
 MSpatialEntity ()
 Default constructor, instantiates at root level.
 
 MSpatialEntity (MSpatialEntity *parent)
 Parameterised constructor.
 
SVector2 getPosition ()
 
SVector2 getLocalPosition ()
 
void setLocalPosition (float x, float y)
 Sets local position of the entity.
 
void setLocalPosition (SVector2 pos)
 Sets local position of the entity.
 
float getRotation ()
 
float getLocalRotation ()
 
void setLocalRotation (float localRotation)
 Sets local rotation of the entity in x-axis.
 
SVector2 getLocalScale ()
 
void setLocalScale (float x, float y)
 Sets local scale.
 
void setLocalScale (SVector2 scale)
 brief Sets local scale
 
MSpatialEntitygetParent ()
 
std::vector< MSpatialEntity * > * getChildren ()
 
void addChild (MSpatialEntity *entity)
 Adds a child to this entity.
 
void removeChild (MSpatialEntity *entity)
 Remove a child from this entity.
 
template<typename T >
T * find (std::string name)
 Recursively searches for a SpatialEntity within this sub-tree.
 
virtual void onStart ()
 
virtual void onUpdate (float deltaTime)
 
- Public Member Functions inherited from meteor::MEntity
virtual bool equals (MEntity *other)
 Checks equality between two entities.
 
std::string getName ()
 
void setName (std::string name)
 Sets name of entity.
 
virtual std::string toString ()
 Get this object as a string.
 

Additional Inherited Members

- Protected Member Functions inherited from meteor::MSpatialEntity
void updatePositions ()
 
void updateRotations ()
 
void updateScale ()
 
void updateChildren (float deltaTime)
 
- Protected Attributes inherited from meteor::MSpatialEntity
SVector2 localPosition
 
SVector2 localScale
 
SVector2 position
 
float rotation
 
float localRotation
 
MSpatialEntityparent = NULL
 
std::vector< MSpatialEntity * > * children = NULL
 
- Protected Attributes inherited from meteor::MEntity
std::string name
 

Detailed Description

This class represents an audio source in the game world.

Constructor & Destructor Documentation

◆ MAudioSource()

meteor::MAudioSource::MAudioSource ( std::string clipPath,
bool loop,
bool autoStart )

Construnctor.

Parameters
clipPathpath to clip
looploop status of the clip
autoStartstart playing automatically

Member Function Documentation

◆ getPlaybackSpeed()

float meteor::MAudioSource::getPlaybackSpeed ( )
Returns
Playback speed.

◆ getVolume()

float meteor::MAudioSource::getVolume ( )
Returns
Current playback volume level.

◆ isLooped()

bool meteor::MAudioSource::isLooped ( )
Returns
Loop status of playback.

◆ isPaused()

bool meteor::MAudioSource::isPaused ( )
Returns
get playback pause status.

◆ onExit()

void meteor::MAudioSource::onExit ( )
overridevirtual

Reimplemented from meteor::MSpatialEntity.

◆ setIsLooped()

void meteor::MAudioSource::setIsLooped ( bool loop)

Set playback loop status.

Parameters
Loopnew loop status boolean.

◆ setPlaybackSpeed()

void meteor::MAudioSource::setPlaybackSpeed ( float playbackSpeed)

Set playback speed.

Parameters
playbackSpeednew playback speed value.

◆ setVolume()

void meteor::MAudioSource::setVolume ( float volume)

Set volume level of playback.

Parameters
volumevalue between 0 and 1.