Game Develop C++ Platform: Music Class Reference

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Public Attributes | List of all members
Music Class Reference
Sound engine

Used to play a music. More...

`#include <Music.h>`

## Public Member Functions

bool | OpenFromFile (const std::string &filename)
| Open the music from a file. More...
void | SetBuffer (const char *newbuffer, std::size_t size)
| Change music buffer. More...
bool | OpenFromMemory (std::size_t size)
void | Play ()
| Play the music.
void | Pause ()
| Pause the music.
void | Stop ()
| Stop the music.
sf::Music::Status | GetStatus () const
| Get the music status. More...
void | SetLoop (bool loop)
void | SetVolume (float volume_)
| Change the music volume. More...
float | GetVolume () const
| Get the music volume.
void | SetPitch (float newPitch)
| Change the music pitch.
float | GetPitch () const
| Get the music pitch.
void | SetPlayingOffset (unsigned int timeOffset)
| Change the current playing position of the music. More...
unsigned int | GetPlayingOffset () const
| Return the current playing position of the music, in seconds.
void | UpdateVolume ()
| Internal member functions to update music volume according to global volume. More...

## Public Attributes

sf::Music | music
| SFML Music.
char * | buffer
| Music buffer when music have been loaded from memory.

## Detailed Description

Used to play a music.

## Member Function Documentation

sf::Music::Status Music::GetStatus | ( | ) |  | const

inline

Get the music status.

Returns
  sf::Music::Paused, sf::Music::Playing or sf::Music::Stopped.

bool Music::OpenFromFile | ( | const std::string & | filename) |  |

Open the music from a file.

Example :

Music myMusic;
myMusic.OpenFromFile("sound.ogg");
myMusic.Play();

bool Music::OpenFromMemory | ( | std::size_t | size) |  |

Open sound stored in buffer ( See SetBuffer ).

Parameters

  size | The buffer size.

void Music::SetBuffer | ( | const char * | newbuffer,
|  | std::size_t | size
| ) |  |

Change music buffer.

You must call OpenFromMemory after to use this buffer.

void Music::SetLoop | ( | bool | loop) |  |

Make music looping or not.

Parameters

  loop | true to activate looping.

void Music::SetPlayingOffset | ( | unsigned int | timeOffset) |  |

inline

Change the current playing position of the music.

Parameters

  timeOffset | The new playing position, in seconds.

void Music::SetVolume | ( | float | volume_) |  |

Change the music volume.

Parameters

  volume | The new volume, between 0 and 100.

Here is the call graph for this function:

void Music::UpdateVolume | ( | ) |  |

Internal member functions to update music volume according to global volume.

Called by the sound manager when the global volume is updated.

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

- Music.h
- Music.cpp