mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 10:55:57 -04:00
Add Mixer methods to reset sound/music finished handlers
This commit is contained in:
parent
433733df35
commit
c822b7a00a
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libSDL2pp - C++11 bindings/wrapper for SDL2
|
libSDL2pp - C++11 bindings/wrapper for SDL2
|
||||||
Copyright (C) 2015 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
Copyright (C) 2015-2016 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@ -119,6 +119,10 @@ void Mixer::SetChannelFinishedHandler(ChannelFinishedHandler channel_finished) {
|
|||||||
Mix_ChannelFinished(channel_finished);
|
Mix_ChannelFinished(channel_finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mixer::RemoveChannelFinishedHandler() {
|
||||||
|
Mix_ChannelFinished(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
int Mixer::IsChannelPlaying(int channel) const {
|
int Mixer::IsChannelPlaying(int channel) const {
|
||||||
return Mix_Playing(channel);
|
return Mix_Playing(channel);
|
||||||
}
|
}
|
||||||
@ -228,6 +232,10 @@ void Mixer::SetMusicFinishedHandler(MusicFinishedHandler music_finished) {
|
|||||||
Mix_HookMusicFinished(music_finished);
|
Mix_HookMusicFinished(music_finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mixer::RemoveMusicFinishedHandler() {
|
||||||
|
Mix_HookMusicFinished(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void Mixer::SetMusicHook(MusicHook&& hook) {
|
void Mixer::SetMusicHook(MusicHook&& hook) {
|
||||||
if (!hook) {
|
if (!hook) {
|
||||||
Mix_HookMusic(nullptr, nullptr);
|
Mix_HookMusic(nullptr, nullptr);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libSDL2pp - C++11 bindings/wrapper for SDL2
|
libSDL2pp - C++11 bindings/wrapper for SDL2
|
||||||
Copyright (C) 2015 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
Copyright (C) 2015-2016 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@ -357,6 +357,14 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetChannelFinishedHandler(ChannelFinishedHandler channel_finished);
|
void SetChannelFinishedHandler(ChannelFinishedHandler channel_finished);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Remove callback for when channel finishes playing
|
||||||
|
///
|
||||||
|
/// \see https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html#SEC37
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void RemoveChannelFinishedHandler();
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
///@{
|
///@{
|
||||||
@ -686,6 +694,14 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetMusicFinishedHandler(MusicFinishedHandler music_finished);
|
void SetMusicFinishedHandler(MusicFinishedHandler music_finished);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Remove a callback for when music stops
|
||||||
|
///
|
||||||
|
/// \see https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html#SEC69
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void RemoveMusicFinishedHandler();
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
///@{
|
///@{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user