【发布时间】:2011-11-14 17:14:32
【问题描述】:
我正在尝试创建一个程序,该程序将根据您提供的起始音符计算不同的音阶。
我列举了不同的笔记:
public enum NoteValue
{
A = 0,
Asharp = 1,
B = 2,
C = 3,
Csharp = 4,
D = 5,
Dsharp = 6,
E = 7,
F = 8,
Fsharp = 9,
G = 10,
Gsharp = 11
}
然后我有一个设置每个音符的方法
public void setNotes(NoteValue startingNote)
{
//Creates an array of notes the size that is specified
theNote = new Note[(numberOfNotes)];
//Sets the notes
theNote[0] = new Note(startingNote);
theNote[1] = new Note((startingNote + step[1]));
theNote[2] = new Note((startingNote + step[2] + step[1]));
theNote[3] = new Note((startingNote + step[3] + step[2] + step[1]));
theNote[4] = new Note((startingNote + step[4] + step[3] + step[2] + step[1]));
theNote[5] = new Note((startingNote + step[5] + step[4] + step[3] + step[2] + step[1]));
theNote[6] = new Note((startingNote - step[7]));
Console.WriteLine("{0} \n{1} \n{2} \n{3} \n{4} \n{5} \n{6}",
theNote[0].value, theNote[1].value, theNote[2].value, theNote[3].value,
theNote[4].value, theNote[5].value, theNote[6].value);
}
我遇到的问题是,如果它以 G 开头(在我的枚举中是 10), 它只会在 G# 之后开始打印数字。我可以让它回来吗 11点后回到0,而不是继续下去?
我会得到这样的东西(主要规模):
G 12 14 15 17 19
而不是
G 一种 乙 C D 乙 F#
有没有办法解决这个问题?谢谢。
【问题讨论】: