SFML MUSIC (HELP!!!)

Hey, I was wondering if it was possible to play multiple music tracks at the same time. Does anyone know? (Music as in sf::Music music;) Is it possible to play two of those over each other? Thanks!
Last edited on
I played two tracks over each other just fine...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>

int main() {
  sf::RenderWindow rw;
  sf::Music track1, track2;
  if(!track1.openFromFile("s1.ogg")) {
    return -1;
  }
  if(!track2.openFromFile("s2.ogg")) {
    return -1;
  }
  rw.create(sf::VideoMode(500, 500), "Test", sf::Style::Close);
  track1.play();
  track2.play();
  while(rw.isOpen()) {
    static sf::Event ev;

    while(rw.pollEvent(ev)) {
      if(ev.type == sf::Event::KeyReleased) {
        if(ev.key.code == sf::Keyboard::Backspace) {
          rw.close();
        }
      }
    }

    rw.clear(sf::Color::Black);
    rw.display();
  }
  return 0;
}


Are you using the right formats? If I remember, SFML only supports certain audio formats.
Last edited on
Okay, thanks for the tip, I'll make sure my audio tracks are in the right format.
Topic archived. No new replies allowed.