I’m using MediaPlayer to play background music. When I switch whatever song is playing I can see the ram usage increase by several MB (using the ‘Performance and Diagnostic Tool’) even though it’s a song that’s been preloaded. After a lot of song changes this could become a problem. I want to make the game use as little of the computers memory as possible. Does anyone know why this happens and or how to fix this?
Song song1;
Song song2;
protected override void LoadContent()
{
song1 = Content.Load<Song>("song1");
song2 = Content.Load<Song>("song2");
updateMusic();
}
void updateMusic()
{
if (gameState == "lvl1") { MediaPlayer.Play(song1); }
else if (gameState == "lvl2") { MediaPlayer.Play(song2);}
}