Play an audio file asynchronously. Play the audio when a button is clicked, and it does not block the UI thread.
#include <nana/gui.hpp>
#include <nana/gui/widgets/button.hpp>
#include <nana/audio/player.hpp>
#include <nana/threads/pool.hpp>
int main()
{
#ifdef NANA_ENABLE_AUDIO
nana::audio::player player("../Examples/audio1.wav");
using namespace nana;
btn_wait.
caption(
"Play and wait 5 min !!!!");
{
player.play();
}));
{
player.play();
});
fm.show();
#ifdef NANA_AUTOMATIC_GUI_TESTING
1,
5,
[&btn]()
{
}
#endif
);
#endif //NANA_ENABLE_AUDIO
}