moved CSong to SongMenu/CSong.cs

This commit is contained in:
Alexander Eckart committed 2012-12-14 16:12:58 +01:00
1 parent 06f6ca0d40
commit 0c636929a2
26 files changed
+399 -137

No files matched your search

+3 -2
View File
@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.IO;
using Vocaluxe.Base;
using System.Diagnostics;
using Vocaluxe.Lib.Song;
using Vocaluxe.Lib.Draw;
using System.Drawing;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Base
{
+1 -1
View File
@@ -20,8 +20,8 @@ using SQLiteDataReader = Mono.Data.Sqlite.SqliteDataReader;
using Community.CsharpSqlite;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Base
{
+1 -1
View File
@@ -6,9 +6,9 @@ using System.Text;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SingNotes;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Base
{
+192 -1
View File
@@ -4,6 +4,7 @@ using System.Drawing;
using System.Text;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Base
{
@@ -22,8 +23,15 @@ namespace Vocaluxe.Base
public static IGame Game = new BGame();
public static IProfiles Profiles = new BProfiles();
public static IRecording Record = new BRecord();
public static ISongs Songs = new BSongs();
public static IVideo Video = new BVideo();
public static ISound Sound = new BSound();
public static ICover Cover = new BCover();
public static IDataBase DataBase = new BDataBase();
public static Menu.Base Base = new Menu.Base(Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles, Record);
public static Menu.Base Base = new Menu.Base(
Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase);
}
class BConfig : IConfig
@@ -45,6 +53,11 @@ namespace Vocaluxe.Base
return CConfig.BackgroundMusicVolume;
}
public int GetPreviewMusicVolume()
{
return CConfig.PreviewMusicVolume;
}
public ESongMenu GetSongMenuType()
{
return CConfig.SongMenu;
@@ -60,6 +73,11 @@ namespace Vocaluxe.Base
return CConfig.VideoBackgrounds;
}
public EOffOn GetVideoPreview()
{
return CConfig.VideoPreview;
}
public EOffOn GetDrawNoteLines()
{
return CConfig.DrawNoteLines;
@@ -69,6 +87,16 @@ namespace Vocaluxe.Base
{
return CConfig.DrawToneHelper;
}
public int GetCoverSize()
{
return CConfig.CoverSize;
}
public List<string> GetSongFolder()
{
return CConfig.SongFolder;
}
}
class BSettings : ISettings
@@ -122,6 +150,26 @@ namespace Vocaluxe.Base
{
return CSettings.MaxNumPlayer;
}
public float GetDefaultMedleyFadeInTime()
{
return CSettings.DefaultMedleyFadeInTime;
}
public float GetDefaultMedleyFadeOutTime()
{
return CSettings.DefaultMedleyFadeOutTime;
}
public int GetMedleyMinSeriesLength()
{
return CSettings.MedleyMinSeriesLength;
}
public float GetMedleyMinDuration()
{
return CSettings.MedleyMinDuration;
}
}
class BTheme : ITheme
@@ -279,6 +327,11 @@ namespace Vocaluxe.Base
CDraw.DrawTextureReflection(Texture, Rect, Color, Bounds, ReflectionSpace, ReflectionHeight);
}
public void RemoveTexture(ref STexture Texture)
{
CDraw.RemoveTexture(ref Texture);
}
public void DrawColor(SColorF Color, SRectF Rect)
{
CDraw.DrawColor(Color, Rect);
@@ -383,6 +436,11 @@ namespace Vocaluxe.Base
{
return CGame.Rand.NextDouble();
}
public float GetTimeFromBeats(float Beat, float BPM)
{
return CGame.GetTimeFromBeats(Beat, BPM);
}
}
class BProfiles : IProfiles
@@ -400,4 +458,137 @@ namespace Vocaluxe.Base
return CSound.RecordGetToneAbs(PlayerNr);
}
}
class BSongs : ISongs
{
public int GetNumVisibleSongs()
{
return CSongs.NumVisibleSongs;
}
public int GetNumCategories()
{
return CSongs.NumCategories;
}
public int GetCurrentCategoryIndex()
{
return CSongs.Category;
}
public void SetCategory(int CategoryIndex)
{
CSongs.Category = CategoryIndex;
}
public CSong GetVisibleSong(int VisibleIndex)
{
if (VisibleIndex >= CSongs.NumVisibleSongs)
return null;
CSong song = CSongs.VisibleSongs[VisibleIndex];
if (song == null)
return null;
return new CSong(song);
}
}
class BVideo : IVideo
{
public int Load(string VideoFileName)
{
return CVideo.VdLoad(VideoFileName);
}
public bool Skip(int VideoStream, float StartPosition, float VideoGap)
{
return CVideo.VdSkip(VideoStream, StartPosition, VideoGap);
}
public bool GetFrame(int VideoStream, ref STexture VideoTexture, float Time, ref float VideoTime)
{
return CVideo.VdGetFrame(VideoStream, ref VideoTexture, Time, ref VideoTime);
}
public bool IsFinished(int VideoStream)
{
return CVideo.VdFinished(VideoStream);
}
public bool Close(int VideoStream)
{
return CVideo.VdClose(VideoStream);
}
}
class BSound : ISound
{
public int Load(string SoundFile, bool Prescan)
{
return CSound.Load(SoundFile, Prescan);
}
public void SetPosition(int SoundStream, float NewPosition)
{
CSound.SetPosition(SoundStream, NewPosition);
}
public void Play(int SoundStream)
{
CSound.Play(SoundStream);
}
public void Fade(int SoundStream, float TargetVolume, float Duration)
{
CSound.Fade(SoundStream, TargetVolume, Duration);
}
public bool IsFinished(int SoundStream)
{
return CSound.IsFinished(SoundStream);
}
public float GetPosition(int SoundStream)
{
return CSound.GetPosition(SoundStream);
}
public float GetLength(int SoundStream)
{
return CSound.GetLength(SoundStream);
}
public void FadeAndStop(int SoundStream, float TargetVolume, float Duration)
{
CSound.FadeAndStop(SoundStream, TargetVolume, Duration);
}
public void SetStreamVolume(int SoundStream, float Volume)
{
CSound.SetStreamVolume(SoundStream, Volume);
}
public void SetStreamVolumeMax(int SoundStream, float MaxVolume)
{
CSound.SetStreamVolumeMax(SoundStream, MaxVolume);
}
}
class BCover : ICover
{
public STexture GetNoCover()
{
return CCover.NoCover;
}
}
class BDataBase : IDataBase
{
public bool GetCover(string FileName, ref STexture Texture, int CoverSize)
{
return CDataBase.GetCover(FileName, ref Texture, CoverSize);
}
}
}
-1
View File
@@ -5,7 +5,6 @@ using System.Text;
using System.Xml;
using System.Xml.XPath;
using Vocaluxe.Lib.Song;
using Vocaluxe.Lib.Playlist;
using Vocaluxe.Menu;
+3 -2
View File
@@ -8,8 +8,9 @@ using System.Text.RegularExpressions;
using System.Threading;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Base
{
@@ -958,7 +959,7 @@ namespace Vocaluxe.Base
CLog.StartBenchmark(2, "Read TXTs");
foreach (string file in files)
{
CSong Song = new CSong();
CSong Song = new CSong(CMain.Base);
if (Song.ReadTXTSong(file))
{
Song.ID = _Songs.Count;
-35
View File
@@ -348,39 +348,4 @@ namespace Vocaluxe.Base
}
}
static class CEncoding
{
public static Encoding GetEncoding(string EncodingName)
{
switch (EncodingName)
{
case "AUTO":
return Encoding.Default;
case "CP1250":
return Encoding.GetEncoding(1250);
case "CP1252":
return Encoding.GetEncoding(1252);
case "LOCALE":
return Encoding.Default;
case "UTF8":
return Encoding.UTF8;
default:
return Encoding.UTF8;
}
}
public static string GetEncodingName(Encoding Enc)
{
string Result = "UTF8";
if (Enc.CodePage == 1250)
Result = "CP1250";
if (Enc.CodePage == 1252)
Result = "CP1252";
return Result;
}
}
}
-1
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
+1 -1
View File
@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.GameModes
{
+1 -1
View File
@@ -7,8 +7,8 @@ using System.Xml.XPath;
using Vocaluxe.Base;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Lib.Playlist
+35
View File
@@ -310,4 +310,39 @@ namespace Vocaluxe.Menu
return ((bounds.X <= x) && (bounds.X + bounds.W >= x) && (bounds.Y <= y) && (bounds.Y + bounds.H >= y));
}
}
static class CEncoding
{
public static Encoding GetEncoding(string EncodingName)
{
switch (EncodingName)
{
case "AUTO":
return Encoding.Default;
case "CP1250":
return Encoding.GetEncoding(1250);
case "CP1252":
return Encoding.GetEncoding(1252);
case "LOCALE":
return Encoding.Default;
case "UTF8":
return Encoding.UTF8;
default:
return Encoding.UTF8;
}
}
public static string GetEncodingName(Encoding Enc)
{
string Result = "UTF8";
if (Enc.CodePage == 1250)
Result = "CP1250";
if (Enc.CodePage == 1252)
Result = "CP1252";
return Result;
}
}
}
+12 -1
View File
@@ -2337,9 +2337,15 @@ namespace Vocaluxe.Menu
public IGame Game;
public IProfiles Profiles;
public IRecording Record;
public ISongs Songs;
public IVideo Video;
public ISound Sound;
public ICover Cover;
public IDataBase DataBase;
public Base(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic,
IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles, IRecording Record)
IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles, IRecording Record,
ISongs Songs, IVideo Video, ISound Sound, ICover Cover, IDataBase DataBase)
{
this.Config = Config;
this.Settings = Settings;
@@ -2354,6 +2360,11 @@ namespace Vocaluxe.Menu
this.Game = Game;
this.Profiles = Profiles;
this.Record = Record;
this.Songs = Songs;
this.Video = Video;
this.Sound = Sound;
this.Cover = Cover;
this.DataBase = DataBase;
}
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu.SongMenu;
using Vocaluxe.GameModes;
namespace Vocaluxe.Menu
+64 -1
View File
@@ -5,6 +5,7 @@ using System.Text;
using System.Windows.Forms;
using Vocaluxe.Menu.SingNotes;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Menu
{
@@ -47,13 +48,20 @@ namespace Vocaluxe.Menu
void SetBackgroundMusicVolume(int NewVolume);
int GetBackgroundMusicVolume();
int GetPreviewMusicVolume();
EOffOn GetVideosToBackground();
EOffOn GetVideoBackgrounds();
EOffOn GetVideoPreview();
ESongMenu GetSongMenuType();
EOffOn GetDrawNoteLines();
EOffOn GetDrawToneHelper();
int GetCoverSize();
List<string> GetSongFolder();
}
public interface ISettings
@@ -72,6 +80,11 @@ namespace Vocaluxe.Menu
int GetNumNoteLines();
int GetMaxNumPlayer();
float GetDefaultMedleyFadeInTime();
float GetDefaultMedleyFadeOutTime();
int GetMedleyMinSeriesLength();
float GetMedleyMinDuration();
}
public interface ITheme
@@ -124,6 +137,8 @@ namespace Vocaluxe.Menu
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds);
void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight);
void RemoveTexture(ref STexture Texture);
void DrawColor(SColorF Color, SRectF Rect);
void DrawColorReflection(SColorF Color, SRectF Rect, float Space, float Height);
}
@@ -165,6 +180,8 @@ namespace Vocaluxe.Menu
int GetRandom(int Max);
double GetRandomDouble();
float GetTimeFromBeats(float Beat, float BPM);
}
public interface IRecording
@@ -177,6 +194,52 @@ namespace Vocaluxe.Menu
SProfile[] GetProfiles();
}
public interface ISongs
{
int GetNumVisibleSongs();
int GetNumCategories();
int GetCurrentCategoryIndex();
void SetCategory(int CategoryIndex);
CSong GetVisibleSong(int VisibleIndex);
}
public interface IVideo
{
int Load(string VideoFileName);
bool Skip(int VideoStream, float StartPosition, float VideoGap);
bool GetFrame(int VideoStream, ref STexture VideoTexture, float Time, ref float VideoTime);
bool IsFinished(int VideoStream);
bool Close(int VideoStream);
}
public interface ISound
{
int Load(string SoundFile, bool Prescan);
void SetPosition(int SoundStream, float NewPosition);
void Play(int SoundStream);
void Fade(int SoundStream, float TargetVolume, float Duration);
bool IsFinished(int SoundStream);
float GetPosition(int SoundStream);
float GetLength(int SoundStream);
void FadeAndStop(int SoundStream, float TargetVolume, float Duration);
void SetStreamVolume(int SoundStream, float Volume);
void SetStreamVolumeMax(int SoundStream, float MaxVolume);
}
public interface ICover
{
STexture GetNoCover();
}
public interface IDataBase
{
bool GetCover(string FileName, ref STexture Texture, int CoverSize);
}
[Flags]
public enum EModifier
{
@@ -305,7 +368,7 @@ namespace Vocaluxe.Menu
EditTheme
}
enum EAspect
public enum EAspect
{
Crop,
LetterBox,
+1 -1
View File
@@ -6,7 +6,7 @@ using Vocaluxe.Menu;
namespace Vocaluxe.Menu.SingNotes
{
class CNotes
public class CNotes
{
private List<CLines> _Lines = new List<CLines>();
@@ -4,13 +4,11 @@ using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SingNotes;
using Vocaluxe.GameModes;
namespace Vocaluxe.Lib.Song
namespace Vocaluxe.Menu.SongMenu
{
[Flags]
enum EHeaderFlags
@@ -24,14 +22,14 @@ namespace Vocaluxe.Lib.Song
MedleyEndBeat = 64
}
enum EMedleySource
public enum EMedleySource
{
None,
Calculated,
Tag
}
struct SMedley
public struct SMedley
{
public EMedleySource Source;
public int StartBeat;
@@ -49,8 +47,9 @@ namespace Vocaluxe.Lib.Song
}
}
class CSong
public class CSong
{
private Base _Base;
private bool _CoverLoaded = false;
private bool _NotesLoaded = false;
private STexture _CoverTextureSmall = new STexture(-1);
@@ -98,11 +97,11 @@ namespace Vocaluxe.Lib.Song
if (this.CoverFileName != String.Empty)
{
if (!CDataBase.GetCover(Path.Combine(this.Folder, this.CoverFileName), ref _CoverTextureSmall, CConfig.CoverSize))
_CoverTextureSmall = CCover.NoCover;
if (!_Base.DataBase.GetCover(Path.Combine(this.Folder, this.CoverFileName), ref _CoverTextureSmall, _Base.Config.GetCoverSize()))
_CoverTextureSmall = _Base.Cover.GetNoCover();
}
else
_CoverTextureSmall = CCover.NoCover;
_CoverTextureSmall = _Base.Cover.GetNoCover();
_CoverLoaded = true;
}
@@ -175,12 +174,14 @@ namespace Vocaluxe.Lib.Song
}
}
public CSong()
public CSong(Base Base)
{
_Base = Base;
}
public CSong(CSong song)
{
this._Base = song._Base;
this._CoverTextureSmall = song._CoverTextureSmall;
this._CoverTextureBig = song._CoverTextureBig;
@@ -284,7 +285,7 @@ namespace Vocaluxe.Lib.Song
this.Folder = Path.GetDirectoryName(FilePath);
foreach (string folder in CConfig.SongFolder)
foreach (string folder in _Base.Config.GetSongFolder())
{
if (this.Folder.Contains(folder))
{
@@ -411,7 +412,7 @@ namespace Vocaluxe.Lib.Song
}
else
{
CLog.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value));
_Base.Log.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value));
return false;
}
break;
@@ -461,7 +462,7 @@ namespace Vocaluxe.Lib.Song
if (File.Exists(Path.Combine(this.Folder, Value)))
this.VideoFileName = Value;
else
CLog.LogError("Can't find video file: " + Path.Combine(this.Folder, Value));
_Base.Log.LogError("Can't find video file: " + Path.Combine(this.Folder, Value));
break;
case "VIDEOGAP":
@@ -517,31 +518,31 @@ namespace Vocaluxe.Lib.Song
if ((HeaderFlags & EHeaderFlags.Title) == 0)
{
CLog.LogError("Title tag missing: " + FilePath);
_Base.Log.LogError("Title tag missing: " + FilePath);
return false;
}
if ((HeaderFlags & EHeaderFlags.Artist) == 0)
{
CLog.LogError("Artist tag missing: " + FilePath);
_Base.Log.LogError("Artist tag missing: " + FilePath);
return false;
}
if ((HeaderFlags & EHeaderFlags.MP3) == 0)
{
CLog.LogError("MP3 tag missing: " + FilePath);
_Base.Log.LogError("MP3 tag missing: " + FilePath);
return false;
}
if ((HeaderFlags & EHeaderFlags.BPM) == 0)
{
CLog.LogError("BPM tag missing: " + FilePath);
_Base.Log.LogError("BPM tag missing: " + FilePath);
return false;
}
if (this.Relative == EOffOn.TR_CONFIG_ON)
{
CLog.LogError("Relative songs are not supported by Vocaluxe (perhaps later)! (" + FilePath + ")");
_Base.Log.LogError("Relative songs are not supported by Vocaluxe (perhaps later)! (" + FilePath + ")");
return false;
}
@@ -550,7 +551,7 @@ namespace Vocaluxe.Lib.Song
{
if (this.Medley.StartBeat > this.Medley.EndBeat)
{
CLog.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath);
_Base.Log.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath);
HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat;
}
}
@@ -560,7 +561,7 @@ namespace Vocaluxe.Lib.Song
//PreviewStart is not set or <=0
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0)
//fallback to MedleyStart
this.PreviewStart = CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
this.PreviewStart = _Base.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
else
//else set to 0, it will be set in FindRefrainStart
this.PreviewStart = 0f;
@@ -569,8 +570,8 @@ namespace Vocaluxe.Lib.Song
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0)
{
this.Medley.Source = EMedleySource.Tag;
this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime;
this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime;
this.Medley.FadeInTime = _Base.Settings.GetDefaultMedleyFadeInTime();
this.Medley.FadeOutTime = _Base.Settings.GetDefaultMedleyFadeOutTime();
}
#endregion check medley tags
@@ -578,7 +579,7 @@ namespace Vocaluxe.Lib.Song
}
catch (Exception e)
{
CLog.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message);
_Base.Log.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message);
return false;
}
@@ -606,7 +607,7 @@ namespace Vocaluxe.Lib.Song
{
if (!File.Exists(FilePath))
{
CLog.LogError("Error loading song. The file does not exist: " + FilePath);
_Base.Log.LogError("Error loading song. The file does not exist: " + FilePath);
return false;
}
@@ -637,7 +638,7 @@ namespace Vocaluxe.Lib.Song
if (sr.EndOfStream || (line.Length == 0))
{
CLog.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". The file is empty or it starts with an empty line: " + FilePath);
_Base.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". The file is empty or it starts with an empty line: " + FilePath);
return false;
}
@@ -661,7 +662,7 @@ namespace Vocaluxe.Lib.Song
Player = 2;
else
{
CLog.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". Wrong or missing number after \"P\": " + FilePath);
_Base.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". Wrong or missing number after \"P\": " + FilePath);
return false;
}
}
@@ -705,7 +706,7 @@ namespace Vocaluxe.Lib.Song
{
if (isNewSentence)
{
CLog.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". Double sentence break: " + FilePath);
_Base.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". Double sentence break: " + FilePath);
return false;
}
@@ -731,7 +732,7 @@ namespace Vocaluxe.Lib.Song
}
catch (Exception e)
{
CLog.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
_Base.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
return false;
}
FindRefrain();
@@ -744,7 +745,7 @@ namespace Vocaluxe.Lib.Song
private void ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text)
{
CNote note = new CNote(CMain.Base, Start, Length, Tone, Text, NoteType);
CNote note = new CNote(_Base, Start, Length, Tone, Text, NoteType);
CLines lines = this.Notes.GetLines(Player);
if (lines.LineCount == 0)
@@ -810,12 +811,12 @@ namespace Vocaluxe.Lib.Song
if (DuetPart1 == String.Empty)
{
DuetPart1 = "Part 1";
CLog.LogError("Warning: Can't find #P1-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
_Base.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
}
if (DuetPart2 == String.Empty)
{
DuetPart2 = "Part 2";
CLog.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
_Base.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
}
}
@@ -896,7 +897,7 @@ namespace Vocaluxe.Lib.Song
}
// set medley vars
if (series.Count > 0 && series[longest].length > CSettings.MedleyMinSeriesLength)
if (series.Count > 0 && series[longest].length > _Base.Settings.GetMedleyMinSeriesLength())
{
this.Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat;
this.Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat;
@@ -904,16 +905,16 @@ namespace Vocaluxe.Lib.Song
bool foundEnd = false;
// set end if duration > MedleyMinDuration
if (CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CSettings.MedleyMinDuration >
CGame.GetTimeFromBeats(this.Medley.EndBeat, this.BPM))
if (_Base.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + _Base.Settings.GetMedleyMinDuration() >
_Base.Game.GetTimeFromBeats(this.Medley.EndBeat, this.BPM))
foundEnd = true;
if (!foundEnd)
{
for (int i = series[longest].start + 1; i < lines.LineCount - 1; i++)
{
if (CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CSettings.MedleyMinDuration >
CGame.GetTimeFromBeats(lines.Line[i].LastNoteBeat, this.BPM))
if (_Base.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + _Base.Settings.GetMedleyMinDuration() >
_Base.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, this.BPM))
{
foundEnd = true;
this.Medley.EndBeat = lines.Line[i].LastNoteBeat;
@@ -924,15 +925,15 @@ namespace Vocaluxe.Lib.Song
if (foundEnd)
{
this.Medley.Source = EMedleySource.Calculated;
this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime;
this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime;
this.Medley.FadeInTime = _Base.Settings.GetDefaultMedleyFadeInTime();
this.Medley.FadeOutTime = _Base.Settings.GetDefaultMedleyFadeOutTime();
}
}
if (this.PreviewStart == 0f)
{
if (this.Medley.Source == EMedleySource.Calculated)
this.PreviewStart = CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
this.PreviewStart = _Base.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
}
}
+35 -37
View File
@@ -6,8 +6,6 @@ using System.Text;
using System.Xml;
using System.Xml.XPath;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.PartyModes;
namespace Vocaluxe.Menu.SongMenu
@@ -273,7 +271,7 @@ namespace Vocaluxe.Menu.SongMenu
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CTheme.GetColor(_Theme.ColorName, SkinIndex, ref _Color);
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref _Color);
}
else
{
@@ -444,17 +442,17 @@ namespace Vocaluxe.Menu.SongMenu
if (_streams.Count > 0 && _video != -1)
{
if (CVideo.VdFinished(_video) || CSound.IsFinished(_actsongstream))
if (_Base.Video.IsFinished(_video) || _Base.Sound.IsFinished(_actsongstream))
{
CVideo.VdClose(_video);
_Base.Video.Close(_video);
_video = -1;
return;
}
float time = CSound.GetPosition(_actsongstream);
float time = _Base.Sound.GetPosition(_actsongstream);
float vtime = 0f;
CVideo.VdGetFrame(_video, ref _vidtex, time, ref vtime);
_Base.Video.GetFrame(_video, ref _vidtex, time, ref vtime);
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
{
_vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f);
@@ -477,14 +475,14 @@ namespace Vocaluxe.Menu.SongMenu
{
foreach (int stream in _streams)
{
CSound.FadeAndStop(stream, 0f, 0.75f);
_Base.Sound.FadeAndStop(stream, 0f, 0.75f);
}
_streams.Clear();
CVideo.VdClose(_video);
_Base.Video.Close(_video);
_video = -1;
CDraw.RemoveTexture(ref _vidtex);
_Base.Drawing.RemoveTexture(ref _vidtex);
_timer.Stop();
_timer.Reset();
@@ -510,7 +508,7 @@ namespace Vocaluxe.Menu.SongMenu
if (_video != -1)
{
CDraw.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0));
_Base.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0));
}
}
@@ -521,7 +519,7 @@ namespace Vocaluxe.Menu.SongMenu
foreach (int stream in _streams)
{
CSound.SetStreamVolumeMax(stream, _MaxVolume);
_Base.Sound.SetStreamVolumeMax(stream, _MaxVolume);
}
}
@@ -582,7 +580,7 @@ namespace Vocaluxe.Menu.SongMenu
Init();
if (_Theme.ColorName != String.Empty)
_Color = CTheme.GetColor(_Theme.ColorName);
_Color = _Base.Theme.GetColor(_Theme.ColorName);
}
public void ReloadTextures()
@@ -596,10 +594,10 @@ namespace Vocaluxe.Menu.SongMenu
if (!_Initialized)
return;
if (Category >= CSongs.NumCategories)
if (Category >= _Base.Songs.GetNumCategories())
return;
CSongs.Category = Category;
_Base.Songs.SetCategory(Category);
}
protected virtual void ShowCategories()
@@ -607,58 +605,58 @@ namespace Vocaluxe.Menu.SongMenu
if (!_Initialized)
return;
if (CSongs.Category != -1)
if (_Base.Songs.GetCurrentCategoryIndex() != -1)
Reset();
CSongs.Category = -1;
_Base.Songs.SetCategory(-1);
}
public void ApplyVolume()
{
CSound.SetStreamVolume(_actsongstream, CConfig.PreviewMusicVolume);
_Base.Sound.SetStreamVolume(_actsongstream, _Base.Config.GetPreviewMusicVolume());
}
protected void SelectSong(int nr)
{
if (CSongs.Category >= 0 && (CSongs.NumVisibleSongs > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
if (_Base.Songs.GetCurrentCategoryIndex() >= 0 && (_Base.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
{
foreach (int stream in _streams)
{
CSound.FadeAndStop(stream, 0f, 1f);
_Base.Sound.FadeAndStop(stream, 0f, 1f);
}
_streams.Clear();
CVideo.VdClose(_video);
_Base.Video.Close(_video);
_video = -1;
CDraw.RemoveTexture(ref _vidtex);
_Base.Drawing.RemoveTexture(ref _vidtex);
_actsong = nr;
if (_actsong >= CSongs.NumVisibleSongs)
if (_actsong >= _Base.Songs.GetNumVisibleSongs())
_actsong = 0;
int _stream = CSound.Load(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].MP3FileName), true);
CSound.SetStreamVolumeMax(_stream, _MaxVolume);
CSound.SetStreamVolume(_stream, 0f);
int _stream = _Base.Sound.Load(Path.Combine(_Base.Songs.GetVisibleSong(_actsong).Folder, _Base.Songs.GetVisibleSong(_actsong).MP3FileName), true);
_Base.Sound.SetStreamVolumeMax(_stream, _MaxVolume);
_Base.Sound.SetStreamVolume(_stream, 0f);
float startposition = CSongs.VisibleSongs[_actsong].PreviewStart;
float startposition = _Base.Songs.GetVisibleSong(_actsong).PreviewStart;
if (startposition == 0f)
startposition = CSound.GetLength(_stream) / 4f;
startposition = _Base.Sound.GetLength(_stream) / 4f;
CSound.SetPosition(_stream, startposition);
CSound.Play(_stream);
CSound.Fade(_stream, 100f, 3f);
_Base.Sound.SetPosition(_stream, startposition);
_Base.Sound.Play(_stream);
_Base.Sound.Fade(_stream, 100f, 3f);
_streams.Add(_stream);
_actsongstream = _stream;
if (CSongs.VisibleSongs[_actsong].VideoFileName != String.Empty && CConfig.VideoPreview == EOffOn.TR_CONFIG_ON)
if (_Base.Songs.GetVisibleSong(_actsong).VideoFileName != String.Empty && _Base.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
{
_video = CVideo.VdLoad(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].VideoFileName));
_video = _Base.Video.Load(Path.Combine(_Base.Songs.GetVisibleSong(_actsong).Folder, _Base.Songs.GetVisibleSong(_actsong).VideoFileName));
if (_video == -1)
return;
CVideo.VdSkip(_video, startposition, CSongs.VisibleSongs[_actsong].VideoGap);
_Base.Video.Skip(_video, startposition, _Base.Songs.GetVisibleSong(_actsong).VideoGap);
_VideoFadeTimer.Stop();
_VideoFadeTimer.Reset();
_VideoFadeTimer.Start();
@@ -670,14 +668,14 @@ namespace Vocaluxe.Menu.SongMenu
{
foreach (int stream in _streams)
{
CSound.FadeAndStop(stream, 0f, 0.75f);
_Base.Sound.FadeAndStop(stream, 0f, 0.75f);
}
_streams.Clear();
CVideo.VdClose(_video);
_Base.Video.Close(_video);
_video = -1;
CDraw.RemoveTexture(ref _vidtex);
_Base.Drawing.RemoveTexture(ref _vidtex);
_timer.Stop();
_timer.Reset();
+1 -1
View File
@@ -6,7 +6,7 @@ using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu.SongMenu;
using Vocaluxe.PartyModes;
namespace Vocaluxe.Menu.SongMenu
@@ -8,7 +8,7 @@ using Vocaluxe.Base;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Screens
{
@@ -8,7 +8,7 @@ using Vocaluxe.Base;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Screens
{
+1 -1
View File
@@ -5,8 +5,8 @@ using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Screens
{
+1 -1
View File
@@ -9,8 +9,8 @@ using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Screens
{
+1 -1
View File
@@ -8,7 +8,7 @@ using Vocaluxe.Base;
using Vocaluxe.Menu;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Screens
{
+1 -2
View File
@@ -10,8 +10,7 @@ using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SingNotes;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.Screens
{
+1 -2
View File
@@ -9,7 +9,6 @@ using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
using Vocaluxe.PartyModes;
@@ -814,7 +813,7 @@ namespace Vocaluxe.Screens
id = CSongs.VisibleSongs[song].ID;
}
int visibleID = Array.FindIndex<Vocaluxe.Lib.Song.CSong>(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
int visibleID = Array.FindIndex<CSong>(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1)
{
id = visibleID;
+1 -1
View File
@@ -210,7 +210,7 @@
<Compile Include="Lib\Playlist\CPlaylistFile.cs" />
<Compile Include="Menu\CParticle.cs" />
<Compile Include="Menu\SingNotes\CNotes.cs" />
<Compile Include="Lib\Song\CSong.cs" />
<Compile Include="Menu\SongMenu\CSong.cs" />
<Compile Include="Lib\Sound\CDirectSoundRecord.cs" />
<Compile Include="Lib\Sound\COpenALPlay.cs" />
<Compile Include="Lib\Sound\COpenALRecord.cs" />