Renamed ambiguous Notes classes

This commit is contained in:
Flamefire committed 2013-04-26 17:47:26 +02:00
1 parent 63c0688886
commit f43817efd0
14 files changed
+142 -170

No files matched your search

@@ -18,6 +18,7 @@
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using VocaluxeLib.Menu;
@@ -198,9 +199,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_SelectSlides[_SelectSlideSongSource].Clear();
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource);
string[] playlists = CBase.Playlist.GetPlaylistNames();
List<string> playlists = CBase.Playlist.GetPlaylistNames();
_SelectSlides[_SelectSlidePlaylist].Clear();
for (int i = 0; i < playlists.Length; i++)
for (int i = 0; i < playlists.Count; i++)
{
string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
-1
View File
@@ -1194,7 +1194,6 @@ namespace Vocaluxe.Base
bmp.UnlockBits(bmpData);
bmp.Save(fileName);
}*/
}
}
+6 -6
View File
@@ -229,7 +229,7 @@ namespace Vocaluxe.Base
(_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
Players[p].SongFinished = true;
CLine[] lines = song.Notes.GetLines(Players[p].LineNr).Line;
CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines;
int line = -1;
for (int j = 0; j < lines.Length; j++)
@@ -293,7 +293,7 @@ namespace Vocaluxe.Base
// valid
//CSound.RecordSetTone(p, Tone);
double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat /
song.Notes.GetLines(Players[p].LineNr).Points;
song.Notes.GetVoice(Players[p].LineNr).Points;
if (notes[note].NoteType == ENoteType.Golden)
Players[p].PointsGoldenNotes += points;
@@ -302,8 +302,8 @@ namespace Vocaluxe.Base
// update player notes (sung notes)
if (Players[p].SingLine[line].NoteCount > 0)
{
CNote nt = Players[p].SingLine[line].LastNote;
if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit)
CNote lastNote = Players[p].SingLine[line].LastNote;
if (notes[note].StartBeat == beat || lastNote.EndBeat + 1 != beat || lastNote.Tone != tone || !lastNote.Hit)
Players[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType));
else
Players[p].SingLine[line].IncLastNoteLength();
@@ -318,8 +318,8 @@ namespace Vocaluxe.Base
{
if (Players[p].SingLine[line].NoteCount > 0)
{
CNote nt = Players[p].SingLine[line].LastNote;
if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit)
CNote lastNote = Players[p].SingLine[line].LastNote;
if (lastNote.Tone == tonePlayer && lastNote.EndBeat + 1 == beat && !lastNote.Hit)
Players[p].SingLine[line].IncLastNoteLength();
else
Players[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
+2 -2
View File
@@ -778,9 +778,9 @@ namespace Vocaluxe.Base
CPlaylists.SetPlaylistName(playlistID, name);
}
public string[] GetPlaylistNames()
public List<string> GetPlaylistNames()
{
return CPlaylists.GetPlaylistNames();
return CPlaylists.PlaylistNames;
}
public string GetPlaylistName(int playlistID)
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Vocaluxe.Base
public event EventHandler ObjectChanged = delegate { };
protected bool _Changed = true;
protected void _NotifyObservers()
private void _NotifyObservers()
{
ObjectChanged.Invoke(this, null);
}
+2 -12
View File
@@ -36,14 +36,14 @@ namespace Vocaluxe.Base
get { return _Playlists.ToArray(); }
}
public static IEnumerable<string> PlaylistNames
public static List<string> PlaylistNames
{
get
{
List<string> names = new List<string>();
for (int i = 0; i < _Playlists.Count; i++)
names.Add(_Playlists[i].PlaylistName);
return names.ToArray();
return names;
}
}
@@ -94,16 +94,6 @@ namespace Vocaluxe.Base
return _Playlists[playlistID].PlaylistName;
}
public static string[] GetPlaylistNames()
{
List<string> result = new List<string>();
foreach (CPlaylistFile playlist in _Playlists)
result.Add(playlist.PlaylistName);
return result.ToArray();
}
public static void SetPlaylistName(int playlistID, string name)
{
if (playlistID >= _Playlists.Count || playlistID < 0)
+2 -5
View File
@@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
@@ -97,11 +98,7 @@ namespace Vocaluxe.Base
{
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
bool contains = true;
foreach (string str in searchStrings)
contains &= search.Contains(str);
if (contains)
if (searchStrings.All(search.Contains))
_FilteredSongs.Add(song);
}
}
+1 -3
View File
@@ -64,14 +64,12 @@ namespace Vocaluxe.Base
return 0f;
}
public static float CalculateFPS()
public static void CalculateFPS()
{
float ms = GetMilliseconds();
if (ms > 0)
_Fps = 1 / ms;
return _Fps * 1000f;
}
public static double GetFPS()
+1 -1
View File
@@ -199,7 +199,7 @@ namespace Vocaluxe.GameModes
song.Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap;
// set lines to medley mode
song.Notes.SetMedley(song.Notes.GetLines(0).Line[0].FirstNoteBeat, song.ShortEnd);
song.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd);
break;
}
+52 -56
View File
@@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Vocaluxe.Base;
using VocaluxeLib.Menu;
@@ -665,7 +666,7 @@ namespace Vocaluxe.Screens
_TimerDuetText2.Stop();
_TimerDuetText2.Reset();
if (song.Notes.Lines.Length != 2)
if (song.Notes.Voices.Length != 2)
_TimerSongText.Start();
_StartSong();
@@ -719,21 +720,21 @@ namespace Vocaluxe.Screens
CWebcam.Close();
}
private int _FindCurrentLine(CLines lines, CLine[] line, CSong song)
private int _FindCurrentLine(CVoice voice, CLine[] lines, CSong song)
{
float currentTime = _CurrentTime - song.Gap;
//We are only interested in the last matching line, so either do not check further after line[j].StartBeat > _CurrentBeat or go backwards!
int j = lines.FindPreviousLine(_CurrentBeat);
int j = voice.FindPreviousLine(_CurrentBeat);
for (; j >= 0; j--)
{
float firstNoteTime = CGame.GetTimeFromBeats(line[j].FirstNoteBeat, song.BPM);
float firstNoteTime = CGame.GetTimeFromBeats(lines[j].FirstNoteBeat, song.BPM);
//Earlist possible line break is 10s before first note
if (firstNoteTime <= currentTime + 10f)
{
//First line has no predecessor or line has to be shown
if (j == 0 || firstNoteTime - CConfig.MinLineBreakTime <= currentTime)
return j;
float lastNoteTime = CGame.GetTimeFromBeats(line[j - 1].LastNoteBeat, song.BPM);
float lastNoteTime = CGame.GetTimeFromBeats(lines[j - 1].LastNoteBeat, song.BPM);
//No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn)
if (lastNoteTime + CConfig.MicDelay / 1000f * 1.5f >= currentTime)
return j - 1;
@@ -760,31 +761,31 @@ namespace Vocaluxe.Screens
if (i > 1)
break; // for later
CLines lines = song.Notes.GetLines(i);
CLine[] line = lines.Line;
CVoice voice = song.Notes.GetVoice(i);
CLine[] lines = voice.Lines;
// find current line
int nr = _FindCurrentLine(lines, line, song);
int nr = _FindCurrentLine(voice, lines, song);
if (nr != -1)
{
for (int j = 0; j < CGame.NumPlayer; j++)
{
if (CGame.Players[j].LineNr == i)
_SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr);
_SingNotes[_SingBars].SetLines(_NoteLines[j], lines, nr);
}
if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet)
{
_Lyrics[_LyricMain].SetLine(line[nr]);
_Lyrics[_LyricMainTop].SetLine(line[nr]);
_TimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM);
_RemainingTimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM);
_Lyrics[_LyricMain].SetLine(lines[nr]);
_Lyrics[_LyricMainTop].SetLine(lines[nr]);
_TimeToFirstNote = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - lines[nr].StartBeat, song.BPM);
_RemainingTimeToFirstNote = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM);
if (line.Length >= nr + 2)
if (lines.Length >= nr + 2)
{
_Lyrics[_LyricSub].SetLine(line[nr + 1]);
_Lyrics[_LyricSubTop].SetLine(line[nr + 1]);
_Lyrics[_LyricSub].SetLine(lines[nr + 1]);
_Lyrics[_LyricSubTop].SetLine(lines[nr + 1]);
}
else
{
@@ -794,12 +795,12 @@ namespace Vocaluxe.Screens
}
if (i == 0 && song.IsDuet)
{
_Lyrics[_LyricMainDuet].SetLine(line[nr]);
_TimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM);
_RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM);
_Lyrics[_LyricMainDuet].SetLine(lines[nr]);
_TimeToFirstNoteDuet = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - lines[nr].StartBeat, song.BPM);
_RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM);
if (line.Length >= nr + 2)
_Lyrics[_LyricSubDuet].SetLine(line[nr + 1]);
if (lines.Length >= nr + 2)
_Lyrics[_LyricSubDuet].SetLine(lines[nr + 1]);
else
_Lyrics[_LyricSubDuet].Clear();
}
@@ -1061,22 +1062,22 @@ namespace Vocaluxe.Screens
if (song == null || !song.NotesLoaded)
return null;
float[] alpha = new float[song.Notes.Lines.Length * 2];
float[] alpha = new float[song.Notes.Voices.Length * 2];
float currentTime = _CurrentTime - song.Gap;
for (int i = 0; i < song.Notes.LinesCount; i++)
{
CLines lines = song.Notes.GetLines(i);
CLine[] line = lines.Line;
CVoice voice = song.Notes.GetVoice(i);
CLine[] lines = voice.Lines;
// find current line for lyric sub fading
int currentLineSub = _FindCurrentLine(lines, line, song);
int currentLineSub = _FindCurrentLine(voice, lines, song);
// find current line for lyric main fading
int currentLine = 0;
for (int j = 0; j < line.Length; j++)
for (int j = 0; j < lines.Length; j++)
{
if (line[j].FirstNoteBeat <= _CurrentBeat)
if (lines[j].FirstNoteBeat <= _CurrentBeat)
currentLine = j;
}
@@ -1085,31 +1086,31 @@ namespace Vocaluxe.Screens
alpha[i * 2 + 1] = 1f;
// main line alpha
if (currentLine == 0 && currentTime < CGame.GetTimeFromBeats(line[currentLine].FirstNoteBeat, song.BPM))
if (currentLine == 0 && currentTime < CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM))
{
// first main line and fist note is not reached
// => fade in
float diff = CGame.GetTimeFromBeats(line[currentLine].FirstNoteBeat, song.BPM) - currentTime;
float diff = CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM) - currentTime;
if (diff > dt)
alpha[i * 2] = 1f - (diff - dt) / rt;
}
else if (currentLine < line.Length - 1 && CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM) < currentTime &&
CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) > currentTime)
else if (currentLine < lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime &&
CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) > currentTime)
{
// current position is between two lines
// time between the to lines
float diff = CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) -
CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM);
float diff = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) -
CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
// fade only if there is enough time for fading
if (diff > 3.3f * dt)
{
// time elapsed since last line
float last = currentTime - CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM);
float last = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
// time to next line
float next = CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) - currentTime;
float next = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) - currentTime;
if (last < next)
{
@@ -1124,18 +1125,18 @@ namespace Vocaluxe.Screens
}
}
}
else if (currentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM) < currentTime)
else if (currentLine == lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime)
{
// last main line and last note was reached
// => fade out
float diff = currentTime - CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM);
float diff = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
alpha[i * 2] = 1f - diff / rt;
}
// sub
if (currentLineSub < line.Length - 2)
if (currentLineSub < lines.Length - 2)
{
float diff = CGame.GetTimeFromBeats(line[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime;
float diff = CGame.GetTimeFromBeats(lines[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime;
if (diff > dt)
alpha[i * 2 + 1] = 1f - (diff - dt) / rt;
@@ -1338,26 +1339,21 @@ namespace Vocaluxe.Screens
if (totalTime <= 0f)
return;
CLines[] partLines = song.Notes.Lines;
foreach (CLines partLine in partLines)
foreach (CVoice voice in song.Notes.Voices)
{
CLine[] line = partLine.Line;
for (int j = 0; j < line.Length; j++)
foreach (CLine line in voice.Lines.Where(line => line.VisibleInTimeLine))
{
if (line[j].VisibleInTimeLine)
{
STimeRect trect = new STimeRect {StartBeat = line[j].FirstNoteBeat, EndBeat = line[j].EndBeat};
trect.Rect = GetNewStatic(new STexture(-1),
new SColorF(1f, 1f, 1f, 1f),
new SRectF(
stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.StartBeat, song.BPM) + song.Gap - song.Start) / totalTime),
stat.Rect.Y,
stat.Rect.W * (CGame.GetTimeFromBeats(trect.EndBeat - trect.StartBeat, song.BPM) / totalTime),
stat.Rect.H,
stat.Rect.Z));
STimeRect trect = new STimeRect {StartBeat = line.FirstNoteBeat, EndBeat = line.EndBeat};
trect.Rect = GetNewStatic(new STexture(-1),
new SColorF(1f, 1f, 1f, 1f),
new SRectF(
stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.StartBeat, song.BPM) + song.Gap - song.Start) / totalTime),
stat.Rect.Y,
stat.Rect.W * (CGame.GetTimeFromBeats(trect.EndBeat - trect.StartBeat, song.BPM) / totalTime),
stat.Rect.H,
stat.Rect.Z));
_TimeRects.Add(trect);
}
_TimeRects.Add(trect);
}
}
break;
+1 -1
View File
@@ -310,7 +310,7 @@ namespace VocaluxeLib.Menu
public interface IPlaylist
{
string GetPlaylistName(int playlistID);
string[] GetPlaylistNames();
List<string> GetPlaylistNames();
void SetPlaylistName(int playlistID, string name);
void DeletePlaylist(int playlistID);
+30 -39
View File
@@ -25,73 +25,73 @@ namespace VocaluxeLib.Menu.SingNotes
{
public class CNotes
{
private readonly List<CLines> _Lines = new List<CLines>();
private readonly List<CVoice> _Voices = new List<CVoice>();
public CLines[] Lines
public CVoice[] Voices
{
get { return _Lines.ToArray(); }
get { return _Voices.ToArray(); }
}
public CNotes() {}
public int LinesCount
{
get { return _Lines.Count; }
get { return _Voices.Count; }
}
public CNotes(CNotes notes)
{
foreach (CLines lines in notes._Lines)
_Lines.Add(new CLines(lines));
foreach (CVoice voice in notes._Voices)
_Voices.Add(new CVoice(voice));
}
public CLines GetLines(int index)
public CVoice GetVoice(int index)
{
while (index >= _Lines.Count)
_Lines.Add(new CLines());
while (index >= _Voices.Count)
_Voices.Add(new CVoice());
return _Lines[index];
return _Voices[index];
}
public int GetPoints(int index)
{
if (index >= _Lines.Count)
if (index >= _Voices.Count)
return 0;
return _Lines[index].Points;
return _Voices[index].Points;
}
public int GetNumLinesWithPoints(int index)
{
if (index >= _Lines.Count)
if (index >= _Voices.Count)
return 0;
return _Lines[index].NumLinesWithPoints;
return _Voices[index].NumLinesWithPoints;
}
public void AddLines(CLines lines)
public void AddVoice(CVoice voice)
{
_Lines.Add(lines);
_Voices.Add(voice);
}
public bool ReplaceLinesAt(int index, CLines lines)
public bool ReplaceVoiceAt(int index, CVoice voice)
{
if (index >= _Lines.Count)
if (index >= _Voices.Count)
return false;
_Lines[index] = lines;
_Voices[index] = voice;
return true;
}
public void Reset()
{
_Lines.Clear();
_Voices.Clear();
}
public void SetMedley(int startBeat, int endBeat)
{
foreach (CLines lines in _Lines)
lines.SetMedley(startBeat, endBeat);
foreach (CVoice voice in _Voices)
voice.SetMedley(startBeat, endBeat);
}
}
@@ -542,23 +542,23 @@ namespace VocaluxeLib.Menu.SingNotes
#endregion Methods
}
public class CLines
public class CVoice
{
private readonly List<CLine> _Lines = new List<CLine>();
public CLines() {}
public CVoice() {}
public CLines(CLines lines)
public CVoice(CVoice voice)
{
foreach (CLine line in lines._Lines)
foreach (CLine line in voice._Lines)
_Lines.Add(new CLine(line));
}
public CLine[] Line
public CLine[] Lines
{
get { return _Lines.ToArray(); }
}
public int LineCount
public int NumLines
{
get { return _Lines.Count; }
}
@@ -577,22 +577,13 @@ namespace VocaluxeLib.Menu.SingNotes
int endbeat = _Lines.Min(line => line.LastNoteBeat);
int result = endbeat - startbeat;
if (result > 0)
return result;
return 0;
return result > 0 ? result : 0;
}
}
public int Points
{
get
{
int points = 0;
foreach (CLine line in _Lines)
points += line.Points;
return points;
}
get { return _Lines.Sum(line => line.Points); }
}
public int NumLinesWithPoints
+12 -12
View File
@@ -224,24 +224,24 @@ namespace VocaluxeLib.Menu.SingNotes
return notes.ID;
}
public void AddLine(int id, CLine[] line, int lineNr)
public void SetLines(int id, CLine[] lines, int lineNr)
{
if (line == null)
if (lines == null)
return;
int n = _FindPlayerLine(id);
int n = _FindPlayerNotes(id);
if (n == -1)
return;
if (lineNr == _PlayerNotes[n].LineNr)
return;
if (line.Length <= lineNr)
if (lines.Length <= lineNr)
return;
SPlayerNotes notes = _PlayerNotes[n];
notes.Lines = line;
notes.Lines = lines;
notes.LineNr = lineNr;
notes.GoldenStars.Clear();
notes.Flares.Clear();
@@ -253,7 +253,7 @@ namespace VocaluxeLib.Menu.SingNotes
public void SetAlpha(int id, float alpha)
{
int n = _FindPlayerLine(id);
int n = _FindPlayerNotes(id);
if (n == -1)
return;
@@ -264,7 +264,7 @@ namespace VocaluxeLib.Menu.SingNotes
public float GetAlpha(int id)
{
int n = _FindPlayerLine(id);
int n = _FindPlayerNotes(id);
if (n == -1)
return 0f;
@@ -276,9 +276,9 @@ namespace VocaluxeLib.Menu.SingNotes
Draw(id, null, player);
}
public void Draw(int id, List<CLine> singLine, int player)
public void Draw(int id, List<CLine> singLines, int player)
{
int n = _FindPlayerLine(id);
int n = _FindPlayerNotes(id);
if (n == -1)
return;
@@ -357,7 +357,7 @@ namespace VocaluxeLib.Menu.SingNotes
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
perfline.Draw();
if (singLine == null || singLine.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || singLine.Count <= CBase.Game.GetPlayers()[player].CurrentLine)
if (singLines == null || singLines.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || singLines.Count <= CBase.Game.GetPlayers()[player].CurrentLine)
{
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{
@@ -367,7 +367,7 @@ namespace VocaluxeLib.Menu.SingNotes
return;
}
foreach (CNote note in singLine[CBase.Game.GetPlayers()[player].CurrentLine].Notes)
foreach (CNote note in singLines[CBase.Game.GetPlayers()[player].CurrentLine].Notes)
{
if (note.StartBeat >= line.FirstNoteBeat && note.EndBeat <= line.LastNoteBeat)
{
@@ -456,7 +456,7 @@ namespace VocaluxeLib.Menu.SingNotes
LoadTextures();
}
private int _FindPlayerLine(int id)
private int _FindPlayerNotes(int id)
{
for (int i = 0; i < _PlayerNotes.Count; i++)
{
+29 -29
View File
@@ -209,7 +209,7 @@ namespace VocaluxeLib.Menu.SongMenu
private readonly bool _Selected;
public bool IsDuet
{
get { return Notes.Lines.Length > 1; }
get { return Notes.Voices.Length > 1; }
}
public readonly List<string> Edition = new List<string>();
@@ -769,8 +769,8 @@ namespace VocaluxeLib.Menu.SongMenu
fileLineNo++;
} while (!sr.EndOfStream && (tempC != 'E'));
foreach (CLines lines in Notes.Lines)
lines.UpdateTimings();
foreach (CVoice voice in Notes.Voices)
voice.UpdateTimings();
}
catch (Exception e)
{
@@ -799,15 +799,15 @@ namespace VocaluxeLib.Menu.SongMenu
private bool _ParseNote(int player, ENoteType noteType, int start, int length, int tone, string text)
{
CNote note = new CNote(start, length, tone, text, noteType);
CLines lines = Notes.GetLines(player);
return lines.AddNote(note);
CVoice voice = Notes.GetVoice(player);
return voice.AddNote(note);
}
private void _NewSentence(int player, int start)
{
CLines lines = Notes.GetLines(player);
CVoice voice = Notes.GetVoice(player);
CLine line = new CLine {StartBeat = start};
lines.AddLine(line);
voice.AddLine(line);
}
public void LoadSmallCover()
@@ -875,29 +875,29 @@ namespace VocaluxeLib.Menu.SongMenu
private List<SSeries> _GetSeries()
{
CLines lines = Notes.GetLines(0);
CVoice voice = Notes.GetVoice(0);
if (lines.LineCount == 0)
if (voice.NumLines == 0)
return null;
// build sentences list
List<string> sentences = new List<string>();
foreach (CLine line in lines.Line)
foreach (CLine line in voice.Lines)
sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty);
// find equal sentences series
List<SSeries> series = new List<SSeries>();
for (int i = 0; i < lines.LineCount - 1; i++)
for (int i = 0; i < voice.NumLines - 1; i++)
{
for (int j = i + 1; j < lines.LineCount; j++)
for (int j = i + 1; j < voice.NumLines; j++)
{
if (sentences[i] != sentences[j] || sentences[i] == "")
continue;
SSeries tempSeries = new SSeries {Start = i, End = i};
int max;
if (j + j - i > lines.LineCount)
max = lines.LineCount - 1 - j;
if (j + j - i > voice.NumLines)
max = voice.NumLines - 1 - j;
else
max = j - i - 1;
@@ -942,13 +942,13 @@ namespace VocaluxeLib.Menu.SongMenu
longest = i;
}
CLines lines = Notes.GetLines(0);
CVoice voice = Notes.GetVoice(0);
// set medley vars
if (series.Count > 0 && series[longest].Length > CBase.Settings.GetMedleyMinSeriesLength())
{
Medley.StartBeat = lines.Line[series[longest].Start].FirstNoteBeat;
Medley.EndBeat = lines.Line[series[longest].End].LastNoteBeat;
Medley.StartBeat = voice.Lines[series[longest].Start].FirstNoteBeat;
Medley.EndBeat = voice.Lines[series[longest].End].LastNoteBeat;
bool foundEnd = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM);
@@ -957,13 +957,13 @@ namespace VocaluxeLib.Menu.SongMenu
if (!foundEnd)
{
for (int i = series[longest].Start + 1; i < lines.LineCount - 1; i++)
for (int i = series[longest].Start + 1; i < voice.NumLines - 1; i++)
{
if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, BPM))
CBase.Game.GetTimeFromBeats(voice.Lines[i].LastNoteBeat, BPM))
{
foundEnd = true;
Medley.EndBeat = lines.Line[i].LastNoteBeat;
Medley.EndBeat = voice.Lines[i].LastNoteBeat;
}
}
}
@@ -989,32 +989,32 @@ namespace VocaluxeLib.Menu.SongMenu
if (series == null)
return;
CLines lines = Notes.GetLines(0);
CVoice voice = Notes.GetVoice(0);
//Calculate length of singing
int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNote.StartBeat) / 2 + lines.Line[0].FirstNote.StartBeat;
int stop = (voice.Lines[voice.Lines.Length - 1].LastNoteBeat - voice.Lines[0].FirstNote.StartBeat) / 2 + voice.Lines[0].FirstNote.StartBeat;
//Check if stop is in series
for (int i = 0; i < series.Count; i++)
{
if (lines.Line[series[i].Start].FirstNoteBeat < stop && lines.Line[series[i].End].LastNoteBeat > stop)
if (voice.Lines[series[i].Start].FirstNoteBeat < stop && voice.Lines[series[i].End].LastNoteBeat > stop)
{
if (stop < (lines.Line[series[i].Start].FirstNoteBeat + ((lines.Line[series[i].End].LastNoteBeat - lines.Line[series[i].Start].FirstNoteBeat) / 2)))
if (stop < (voice.Lines[series[i].Start].FirstNoteBeat + ((voice.Lines[series[i].End].LastNoteBeat - voice.Lines[series[i].Start].FirstNoteBeat) / 2)))
{
ShortEnd = lines.Line[series[i].Start - 1].LastNote.EndBeat;
ShortEnd = voice.Lines[series[i].Start - 1].LastNote.EndBeat;
return;
}
ShortEnd = lines.Line[series[i].End].LastNote.EndBeat;
ShortEnd = voice.Lines[series[i].End].LastNote.EndBeat;
return;
}
}
//Check if stop is in line
for (int i = 0; i < lines.Line.Length; i++)
foreach (CLine line in voice.Lines)
{
if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop)
if (line.FirstNoteBeat < stop && line.LastNoteBeat > stop)
{
ShortEnd = lines.Line[i].LastNoteBeat;
ShortEnd = line.LastNoteBeat;
return;
}
}