Looping music with intro in XNA using SoundEffect
Posted
by Jordan Roher
on Stack Overflow
See other posts from Stack Overflow
or by Jordan Roher
Published on 2010-05-11T16:17:34Z
Indexed on
2010/05/11
17:14 UTC
Read the original article
Hit count: 437
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.
© Stack Overflow or respective owner