Sounds are working...BUT...I have to make ones I own so hang on until I do that.

This commit is contained in:
Zed A. Shaw 2024-08-25 22:09:13 -04:00
parent 7309ec2f40
commit 268d8abf52
5 changed files with 75 additions and 11 deletions

View file

@ -6,10 +6,10 @@
int main(int argc, char *argv[]) {
sf::SoundBuffer buffer;
sf::Sound click;
sf::Sound sound;
if(argc != 2) {
fmt::println("USAGE: audiotest click.mp3");
fmt::println("USAGE: audiotest [FILE]");
return 0;
}
@ -17,15 +17,16 @@ int main(int argc, char *argv[]) {
if(!buffer.loadFromFile(in_file)) {
fmt::println("Failed to load {}", in_file);
return 0;
}
click.setBuffer(buffer);
sound.setBuffer(buffer);
fmt::println("Playing {}. Hit ctrl-c to exit.", in_file);
while(true) {
click.play();
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
sound.play();
while(sound.getStatus() != sf::SoundSource::Status::Stopped) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
return 0;