Monogame:歌被切断了

时间:2016-06-06 13:38:11

标签: c# audio monogame

出于某种原因,当我播放一首歌时,它会切断歌曲的最后一秒左右,即使重复也是如此。

这是一个Monogame错误,还是我做错了什么? 据我所知,在我的代码中没有什么不寻常的事情:

public static void Load(JoyGame game)
{
        s_Music = new Dictionary<string, Song>();

        MediaPlayer.MediaStateChanged += PlayLoop;

        string directory = Directory.GetCurrentDirectory() + "/Content/Music";
        string[] files = Directory.GetFiles(directory);

        for(int i = 0; i < files.Length; i++)
        {
            string name = FileNameExtractor.ExtractName(files[i], 3);
            s_Music.Add(name, game.Content.Load<Song>("Music/" + name + ".ogg"));
        }
}

public static void Play(string song)
{
        MediaPlayer.Stop();
        if(s_Music.ContainsKey(song + "Loop"))
        {
            s_CurrentSong = song + "Loop";
            MediaPlayer.Play(s_Music[s_CurrentSong]);
            MediaPlayer.IsRepeating = true;
        }
}

0 个答案:

没有答案