SFML: sound and music

This article is part of a tutorial dedicated to SFML. The reader may consult the other parts of the tutorial by following this link : SFML tutorial.

This example shows how to play music and sound.

 * \file    main.cpp
 * \brief   Music and sound examples (https://www.lucidarme.me/?p=6127)
 * \author  Philippe Lucidarme
 * \version 1.0
 * \date    12/20/2016


// Wait for ms milliseconds
void delay_ms(int ms)
    sf::Clock Timer;
    while (Timer.getElapsedTime().asMilliseconds()5;vol--)

    // Stop music
    std::cout << "Stop music" << std::endl;
    return 0;

Download from Git

Files, sharders and source codes can be downloaded for GitLab : https://gitlab.com/philippe.lucidarme/sfml_tutorial/tree/master/part_009

<- Back to SFML tutorial main menu

Leave a Reply

Your email address will not be published. Required fields are marked *