1
votes

I am pretty new to XNA, and I have been trying to figure this problem out for a while now.. Needless to say, I couldn't (hence the question!!)

I've been trying to use XNA to mess around with audio, and it seems to work well. However, there are a few songs that dont get played, although all the music files that I am trying to play are in MP3 format.

The results of the simple testing I've done were as follows (assuming "SongB" is the song that doesn't plays)

  • MediaPlayer.Play(SongA) --> Works
  • MediaPlayer.Play(SongB) --> No sound
  • MediaPlayer.Play(SongC) --> Works

if I had a list which had the songs listed, and a program that plays the next song when "next()" is called:

int playingIdx = 0;

SongList[0] = SongA;
SongList[1] = SongB;
SongList[2] = SongC;

void next()
{
    PlayingIdx++;
    MediaPlayer.Play(SongList[PlayingIdx]);
}

Then when PlayingIdx = 1, SongB is skipped, and the program plays SongC. Did anyone encounter something similar? Or is there a certain type of MP3 that XNA can play?

1
I'm guessing that you don't get any errors, and you're sure that other applications can play the file?Daniel Figueroa
are you sure the playingidx has the right value?AD.Net
Just note, if MediaPlayer hasn't finished playing the last song, the next song won't play.Chris C
The playingIdx and the next() example is just something I have noticed. I wrote a quick program where I can search for a song and play it. There are a few songs that I was never able to play, although my Windows Media Player can play them (and I can stream them to my xbox to play it as well), which is what my question is.Osama Ennasr
To clarify the playingIdx issue, the code segment: MediaPlayer.Play(SongsList[1]) and the code segment MediaPlayer.Play(SongsList[2]) both result in playing SongCOsama Ennasr

1 Answers

1
votes

My guess would be that XNA player is just too sensible to some format inconsistencies than most of audio players. Try to decode and then reencode song that causes problem. For this task you can use LAME, for instance:

lame --mp3input --strictly-enforce-ISO song.mp3 fixed_song.mp3

Other than that would try to rearrange order of songs just to check out that it doesn't matter.