Restructing the source layout to make it nicer.
This commit is contained in:
parent
fff182b457
commit
cc3bb171e1
14 changed files with 166 additions and 33 deletions
|
@ -1,33 +0,0 @@
|
|||
#include <SFML/Audio.hpp>
|
||||
#include <thread> // for sleep_for
|
||||
#include <iostream>
|
||||
#include <fmt/core.h>
|
||||
#include <chrono>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
sf::SoundBuffer buffer;
|
||||
sf::Sound sound;
|
||||
|
||||
if(argc != 2) {
|
||||
fmt::println("USAGE: audiotest [FILE]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *in_file = argv[1];
|
||||
|
||||
if(!buffer.loadFromFile(in_file)) {
|
||||
fmt::println("Failed to load {}", in_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sound.setBuffer(buffer);
|
||||
|
||||
fmt::println("Playing {}. Hit ctrl-c to exit.", in_file);
|
||||
|
||||
sound.play();
|
||||
while(sound.getStatus() != sf::SoundSource::Status::Stopped) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue