Sounds are working...BUT...I have to make ones I own so hang on until I do that.
This commit is contained in:
parent
7309ec2f40
commit
268d8abf52
5 changed files with 75 additions and 11 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue