 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
1 #ifndef RAYLIB_CPP_INCLUDE_MUSIC_HPP_
2 #define RAYLIB_CPP_INCLUDE_MUSIC_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
15 Music(const ::Music& music) {
22 Music(
const std::string& fileName) {
23 set(::LoadMusicStream(fileName.c_str()));
29 Music(
const std::string& fileType,
unsigned char* data,
int dataSize) {
30 set(::LoadMusicStreamFromMemory(fileType.c_str(), data, dataSize));
41 GETTERSETTER(
unsigned int, SampleCount, sampleCount)
42 GETTERSETTER(
bool, Looping, looping)
43 GETTERSETTER(
int, CtxType, ctxType)
44 GETTERSETTER(
void*, CtxData, ctxData)
55 ::UnloadMusicStream(*
this);
62 ::PlayMusicStream(*
this);
70 ::UpdateMusicStream(*
this);
78 ::StopMusicStream(*
this);
86 ::PauseMusicStream(*
this);
94 ::ResumeMusicStream(*
this);
102 return ::IsMusicPlaying(*
this);
109 ::SetMusicVolume(*
this, volume);
117 ::SetMusicPitch(*
this, pitch);
125 return ::GetMusicTimeLength(*
this);
132 return ::GetMusicTimePlayed(*
this);
136 inline void set(const ::Music& music) {
137 ctxType = music.ctxType;
138 ctxData = music.ctxData;
139 looping = music.looping;
140 sampleCount = music.sampleCount;
141 stream = music.stream;
146 #endif // RAYLIB_CPP_INCLUDE_MUSIC_HPP_
Music(const std::string &fileType, unsigned char *data, int dataSize)
Load music stream from memory.
All raylib-cpp classes and functions appear in the raylib namespace.
Music & SetPitch(float pitch)
Set pitch for music.
Music & Stop()
Stop music playing.
Music & SetVolume(float volume)
Set volume for music.
Music & Resume()
Resume music playing.
Music & Play()
Start music playing.
Music & Pause()
Pause music playing.
bool IsPlaying() const
Check if music is playing.
~Music()
Unload music stream.
Music(const std::string &fileName)
Load music stream from file.
void Unload()
Unload music stream.
Music stream type (audio file streaming from memory)
AudioStream management functions.
Music & Update()
Updates buffers for music streaming.
float GetTimeLength() const
Get music time length (in seconds)
float GetTimePlayed() const
Get current music time played (in seconds)