Some fixes and support for more than 2 voices
This commit is contained in:
1 parent
8890176e97
commit
bf1c00b5d1
10 files changed
+144
-62
No files matched your search
+51
-10
@@ -21,26 +21,65 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
public class CNotes
|
||||
{
|
||||
public class CVoiceNames
|
||||
{
|
||||
private readonly List<string> _Names = new List<string>();
|
||||
|
||||
public CVoiceNames() {}
|
||||
|
||||
public CVoiceNames(CVoiceNames names)
|
||||
{
|
||||
_Names.AddRange(names._Names);
|
||||
}
|
||||
|
||||
public string this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsSet(index))
|
||||
return _Names[index];
|
||||
return "Part " + (index + 1);
|
||||
}
|
||||
set
|
||||
{
|
||||
_Names.EnsureSize(index + 1, null);
|
||||
_Names[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSet(int index)
|
||||
{
|
||||
return _Names.Count > index && !string.IsNullOrEmpty(_Names[index]);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_Names.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<CVoice> _Voices = new List<CVoice>();
|
||||
public readonly CVoiceNames VoiceNames = new CVoiceNames();
|
||||
|
||||
public CNotes() {}
|
||||
|
||||
public CNotes(CNotes notes)
|
||||
{
|
||||
foreach (CVoice voice in notes._Voices)
|
||||
_Voices.Add(new CVoice(voice));
|
||||
VoiceNames = new CVoiceNames(notes.VoiceNames);
|
||||
}
|
||||
|
||||
public CVoice[] Voices
|
||||
{
|
||||
get { return _Voices.ToArray(); }
|
||||
}
|
||||
|
||||
public CNotes() {}
|
||||
|
||||
public int LinesCount
|
||||
public int VoiceCount
|
||||
{
|
||||
get { return _Voices.Count; }
|
||||
}
|
||||
|
||||
public CNotes(CNotes notes)
|
||||
{
|
||||
foreach (CVoice voice in notes._Voices)
|
||||
_Voices.Add(new CVoice(voice));
|
||||
}
|
||||
|
||||
public CVoice GetVoice(int index)
|
||||
{
|
||||
while (index >= _Voices.Count)
|
||||
@@ -79,9 +118,11 @@ namespace VocaluxeLib.Songs
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
public void Reset(bool resetVoices = false)
|
||||
{
|
||||
_Voices.Clear();
|
||||
if (resetVoices)
|
||||
VoiceNames.Reset();
|
||||
}
|
||||
|
||||
public void SetMedley(int startBeat, int endBeat)
|
||||
|
||||
Reference in new issue
Block a user