Looping music with intro in XNA using SoundEffect
- by Jordan Roher
I have two sound files:
Sound A is an 18 second intro designed to be played once
Sound B is a 1 minute looping track
I'd like to play Sound A once, then once Sound A is done, immediately play Sound B and keep looping Sound B until I tell it to stop. This is supposed to be looping town music in an RPG.
I've tried doing this in code using just SoundEffect, but there's a tiny yet noticeable gap between the end of Sound A and the beginning of Sound B. Even if I put monitoring code watching Sound A's SoundEffectInstance.State in the Update() function, I haven't been able to start Sound B exactly when Sound A finishes so that it's seamless.
I'd prefer to use SoundEffect because I can load WMA files rather than being stuck with WAVs in XACT.