SFML community forums

Help => Audio => Topic started by: fatih on January 04, 2013, 01:59:51 pm

Title: Problem with sound
Post by: fatih on January 04, 2013, 01:59:51 pm
I have created project to check music(is it working or what ever). I loaded two musics from project file, first i play one music then in play second music , and there is strange sound playing, pls help. sorry for my english.
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

using namespace std;

int main()
{
    sf::Music Pocetak;
    if(!Pocetak.OpenFromFile("marioprvizvuk.ogg"))return 1;

    sf::Music Nastavak;
    if(!Nastavak.OpenFromFile("mariodrugizvuk.ogg"))return 1;
int e=1;
Pocetak.Play();
for(int i=1;i<=10000000;i++){}
    while(e)
    {
        Nastavak.Play();
    }
    return 0;
}

 
Title: Re: Problem with sound
Post by: Laurent on January 04, 2013, 02:10:39 pm
Why do you play the second music in an infinite loop? It will never have the time to play, since everytime it loops it will be restarted.
Title: Re: Problem with sound
Post by: fatih on January 04, 2013, 03:11:14 pm
Thank you a lot. It will help me in game programming.