I am currently using the following code (C #):
private static void PlayLoop(string filename) { Audio player = new Audio(filename); player.Play(); while (player.Playing) { if (player.CurrentPosition >= player.Duration) { player.SeekCurrentPosition(0, SeekPositionFlags.AbsolutePositioning); } System.Threading.Thread.Sleep(100); } }
This code works, and the file I'm playing is a loop. But, obviously, there is a small gap between each reproduction.
- I tried to reduce Thread.Sleep it to 10 or 5, but the gap remains.
- I also tried to completely remove it, but then the processor load increased to 100%, and there is still a small gap.
Is there any (simple) way to make playback in DirectX indifferent? This is not very important, since this is only a personal project, but if I do something stupid or otherwise completely wrong, I'd love to know.
Thanks in advance.
source share