因此,我正在做一個簡單的鋼琴並嘗試遍歷存儲音符的集合,但SoundPlayer不想在「無調試模式」下正確播放它們,只播放最後一個一。然而,當我把一個斷點它起着所有這些使用SoundPlayer從集合中播放音樂
public static List<MusicNote> music = new List<MusicNote>(15);
public static void PlayAll()
{
SoundPlayer sp = new SoundPlayer();
for (int i = 0; i <= music.Count - 1; i++)
{
string text = music[i].pitch.ToString();
sp.SoundLocation = (@"c:\my path here\" + text + ".wav");
sp.Play();
sp.Stop();
}
}
間距僅僅是序號鏈接到文件中。
在此先感謝
不客氣的兄弟,你需要給我們至少一個投票或標記答案:) –