Refactoring
Refactoring
This commit is contained in:
parent
deade2f47d
commit
1d6a879e34
@ -23,7 +23,7 @@ namespace CdgLib
|
|||||||
|
|
||||||
private readonly int[] _colourTable = new int[ColourTableSize];
|
private readonly int[] _colourTable = new int[ColourTableSize];
|
||||||
private readonly byte[,] _pixelColours = new byte[FullHeight, FullWidth];
|
private readonly byte[,] _pixelColours = new byte[FullHeight, FullWidth];
|
||||||
private int[,] _graphicData = new int[FullHeight, FullWidth];
|
private readonly int[,] _graphicData = new int[FullHeight, FullWidth];
|
||||||
|
|
||||||
public Graphic(IEnumerable<Packet> packets)
|
public Graphic(IEnumerable<Packet> packets)
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ namespace CdgLib
|
|||||||
_pixelColours[rowIndex, columnIndex] = (byte)colour;
|
_pixelColours[rowIndex, columnIndex] = (byte)colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (rowIndex = _pixelColours.GetLength(1) - 12; rowIndex < _pixelColours.GetLength(1); rowIndex++)
|
for (rowIndex = _pixelColours.GetLength(0) - 12; rowIndex < _pixelColours.GetLength(0); rowIndex++)
|
||||||
{
|
{
|
||||||
_pixelColours[rowIndex, columnIndex] = (byte)colour;
|
_pixelColours[rowIndex, columnIndex] = (byte)colour;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CdgLib", "CdgLib\CdgLib.csp
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KaraokePlayer", "KaraokePlayer\KaraokePlayer.csproj", "{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KaraokePlayer", "KaraokePlayer\KaraokePlayer.csproj", "{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KaraokeConverter", "KaraokeConverter\KaraokeConverter.csproj", "{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -23,10 +21,6 @@ Global
|
|||||||
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -26,41 +26,33 @@ namespace KaraokePlayer
|
|||||||
public KaraokeVideoPlayer()
|
public KaraokeVideoPlayer()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_lyricTimer.Interval = 500;
|
_lyricTimer.Interval = 30;
|
||||||
_lyricTimer.Elapsed += LyricTimerOnElapsed;
|
_lyricTimer.Elapsed += LyricTimerOnElapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void LyricTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
|
private void LyricTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
|
||||||
{
|
{
|
||||||
|
var picture = _cdgFile.RenderAtTime((long)(DateTime.Now - _startTime).TotalMilliseconds);
|
||||||
|
_lyrics.Image = picture;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Play(Uri file)
|
public async void Play(Uri file)
|
||||||
{
|
{
|
||||||
vlcPlayer.SetMedia(file);
|
vlcPlayer.SetMedia(file);
|
||||||
_cdgFile = await GraphicsFile.LoadAsync(Path.ChangeExtension(file.LocalPath, "cdg"));
|
_cdgFile = await GraphicsFile.LoadAsync(Path.ChangeExtension(file.LocalPath, "cdg"));
|
||||||
vlcPlayer.Play();
|
vlcPlayer.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void vlcPlayer_Playing(object sender, VlcMediaPlayerPlayingEventArgs e)
|
private void vlcPlayer_Playing(object sender, VlcMediaPlayerPlayingEventArgs e)
|
||||||
{
|
{
|
||||||
_startTime = DateTime.Now;
|
_startTime = DateTime.Now;
|
||||||
_lyricTimer.Start();
|
_lyricTimer.Start();
|
||||||
|
|
||||||
while (vlcPlayer.IsPlaying)
|
|
||||||
{
|
|
||||||
var stopwatch = new Stopwatch();
|
|
||||||
stopwatch.Start();
|
|
||||||
var picture = _cdgFile.RenderAtTime((long) (DateTime.Now - _startTime).TotalMilliseconds);
|
|
||||||
stopwatch.Reset();
|
|
||||||
Debug.Print(stopwatch.ElapsedMilliseconds.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
_lyrics.Image = picture;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void vlcPlayer_TimeChanged(object sender, VlcMediaPlayerTimeChangedEventArgs e)
|
private void vlcPlayer_TimeChanged(object sender, VlcMediaPlayerTimeChangedEventArgs e)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user