Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with sound  (Read 1857 times)

0 Members and 1 Guest are viewing this topic.

fatih

  • Newbie
  • *
  • Posts: 6
    • View Profile
Problem with sound
« 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;
}

 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Problem with sound
« Reply #1 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.
Laurent Gomila - SFML developer

fatih

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with sound
« Reply #2 on: January 04, 2013, 03:11:14 pm »
Thank you a lot. It will help me in game programming.

 

anything