Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Music Class Reference

Defines a class for loading and storing music. More...

#include <music.h>

Inheritance diagram for Music:
Resource

Public Member Functions

 ~Music () override
 
bool play (int loops=-1, int fadeIn=0)
 Plays the music.
 
- Public Member Functions inherited from Resource
 Resource ()=default
 
void incRef ()
 Increments the internal reference count.
 
void decRef (OrphanPolicy orphanPolicy=DeleteLater)
 Decrements the reference count.
 
const std::string & getIdPath () const
 Return the path identifying this resource.
 

Static Public Member Functions

static Musicload (SDL_RWops *rw)
 Loads a music from a buffer in memory.
 

Protected Member Functions

 Music (Mix_Music *music)
 
- Protected Member Functions inherited from Resource
virtual ~Resource ()=default
 

Protected Attributes

Mix_Music * mMusic
 

Additional Inherited Members

- Public Types inherited from Resource
enum  OrphanPolicy { DeleteLater , DeleteImmediately }
 

Detailed Description

Defines a class for loading and storing music.

Definition at line 31 of file music.h.

Constructor & Destructor Documentation

◆ ~Music()

Music::~Music ( )
override

Definition at line 31 of file music.cpp.

◆ Music()

Music::Music ( Mix_Music *  music)
protected

Definition at line 26 of file music.cpp.

Member Function Documentation

◆ load()

Music * Music::load ( SDL_RWops *  rw)
static

Loads a music from a buffer in memory.

Parameters
rwThe SDL_RWops to load the music data from.
Returns
nullptr if the an error occurred, a valid pointer otherwise.

Definition at line 36 of file music.cpp.

◆ play()

bool Music::play ( int  loops = -1,
int  fadeIn = 0 
)

Plays the music.

Parameters
loopsNumber of times to repeat the playback (-1 means forever).
fadeInDuration in milliseconds to fade in the music.
Returns
true if the playback started properly false otherwise.

Definition at line 47 of file music.cpp.

Member Data Documentation

◆ mMusic

Mix_Music* Music::mMusic
protected

Definition at line 61 of file music.h.


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