Hi,
first of all, thanks for SFML, which is the best multimedia library for C++ to me.
Recently, I've been trying to make a small music player in Rust. For this, I use Rust-SFML which is based on CSFML itself based on SFML. To solve some trouble, I came back to C++, and I have the following problem : once I pause a music, there's no way to resume the playing.
getStatus gives me
sf::Sound::Platying, but there's no sound in my earplugs.
I think it might be something stupid, but I can't see what.
#include <iostream>
#include <chrono>
#include <thread>
#include <cassert>
#include <SFML/Audio/Music.hpp>
#include <SFML/Audio/Sound.hpp>
int main(int argc, char *argv[])
{
sf::Music music;
if (!music.openFromFile("resources/orchestral.ogg")) {
return 1;
}
music.play();
assert(music.getStatus() == sf::Sound::Playing);
std::this_thread::sleep_for(std::chrono::seconds(5));
music.pause();
assert(music.getStatus() == sf::Sound::Paused);
music.play();
assert(music.getStatus() == sf::Sound::Playing);
std::this_thread::sleep_for(std::chrono::seconds(10));
return 0;
}
that I compile with
g++ -g -std=c++14 main.cpp -o main -lsfml-audio
I run on ArchLinux, I tried this with gcc 7.1.1 and clang 4.0.1, and I'm using SFML 2.4.2.
Do you have any hints ?
Thanks in advance !
EDIT : Added the
-g flag in the compilation command line for the
assert to be taken into account.