SFML community forums

Help => Audio => Topic started by: Spellbreaker on April 12, 2011, 08:11:31 pm

Title: Synchronized playing of multiple ogg files
Post by: Spellbreaker on April 12, 2011, 08:11:31 pm
Hey there!

For a couple of time, I am trying to write a small program that does nothing than playing three .ogg files 100 % synchronized. Since it seems it is not possible, I wonder if I can use a multichannel ogg ( three active channels ), and change the volume of the channels to fade between the actual songs?

I want to use this to make it possible to fade in / out additional instrument tracks.

I tried the following simple code :
Code: [Select]
   music1.OpenFromFile("mansion-present-hihat.ogg");
     music2.OpenFromFile("mansion-present-hihat.ogg");
     music3.OpenFromFile("mansion-present-hihat.ogg");
     music1.Play();
     music2.Play();
     music3.Play();


I also tried to add the folowing :
Code: [Select]

     music1.SetPlayingOffset(0);
     music2.SetPlayingOffset(music1.GetPlayingOffset());
     music3.SetPlayingOffset(music2.GetPlayingOffset());


Any Ideas?

Sincerly,

Spellbreaker.
[/code]
Title: Synchronized playing of multiple ogg files
Post by: Laurent on April 12, 2011, 10:05:41 pm
To be honest, I've never really thought about synchronization issues. I don't even know if you can do it without specialized APIs (I guess it depends on how accurate you want to be).