@SuperPokeunicorn wrote:
I'm trying to implement music in my game, but I'm running into an issue with the MediaPlayer. For some reason, the first song I play will play at full volume, no matter how many times I play it. However, as soon as I try playing another song, the volume is significantly reduced, even though MediaPlayer.volume is still set to 1. Even if I try switching back to the original song, the volume is still reduced.
I suspect this could have something to do with how I'm handling my Song variables. At the beginning to the game, I load all of my Songs into a Dictionary in a static ResourceManager class which I then call whenever I want to play a song. Do I need to load a fresh copy of each song whenever I want to play it or something? Anyway, here's my implementation if it helps:
public void LoadSong(String name)
{
ResourceManager.AddSong(name, Content.Load(name));
}public static void AddSong(string name, Song song)
{
songs[name] = song;
}public static void PlaySong(string name, bool loop = false, float volume = 1)
{
MediaPlayer.Stop();
MediaPlayer.IsRepeating = loop;
MediaPlayer.Volume = volume;
MediaPlayer.Play(songs[name]);
}Also, I'm using MP3 files if that makes a difference
Posts: 4
Participants: 2