fixing up stuff

This commit is contained in:
Brett Sanderson 2016-03-01 01:33:48 -05:00
parent 0d09a3bcb6
commit dd5a85b220
27 changed files with 383 additions and 941 deletions

View File

@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>

View File

@ -28,7 +28,6 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.tbFileName = new System.Windows.Forms.TextBox();
this.btBrowseCDG = new System.Windows.Forms.Button();
this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
@ -51,15 +50,15 @@
this.pbAVI = new System.Windows.Forms.ProgressBar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.Panel2 = new System.Windows.Forms.Panel();
this.vlcVideo = new AxAXVLC.AxVLCPlugin2();
this.SaveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.vlcControl1 = new Vlc.DotNet.Forms.VlcControl();
this.Panel1.SuspendLayout();
this.GroupBox3.SuspendLayout();
this.GroupBox2.SuspendLayout();
this.GroupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.Panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.vlcVideo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).BeginInit();
this.SuspendLayout();
//
// tbFileName
@ -272,8 +271,8 @@
//
// Panel2
//
this.Panel2.Controls.Add(this.vlcControl1);
this.Panel2.Controls.Add(this.pictureBox1);
this.Panel2.Controls.Add(this.vlcVideo);
this.Panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.Panel2.Location = new System.Drawing.Point(0, 255);
this.Panel2.Name = "Panel2";
@ -281,14 +280,19 @@
this.Panel2.TabIndex = 4;
this.Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.Panel2_Paint);
//
// vlcVideo
// vlcControl1
//
this.vlcVideo.Enabled = true;
this.vlcVideo.Location = new System.Drawing.Point(317, 47);
this.vlcVideo.Name = "vlcVideo";
this.vlcVideo.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("vlcVideo.OcxState")));
this.vlcVideo.Size = new System.Drawing.Size(320, 175);
this.vlcVideo.TabIndex = 25;
this.vlcControl1.BackColor = System.Drawing.Color.Black;
this.vlcControl1.Location = new System.Drawing.Point(411, 18);
this.vlcControl1.Name = "vlcControl1";
this.vlcControl1.Size = new System.Drawing.Size(75, 23);
this.vlcControl1.Spu = -1;
this.vlcControl1.TabIndex = 25;
this.vlcControl1.Text = "vlcControl1";
this.vlcControl1.VlcLibDirectory = null;
this.vlcControl1.VlcMediaplayerOptions = new string[] {
"--projectm-preset-path=\"C:\\Program Files\\VideoLAN\\VLC\\visualizations\\presets_milk" +
"drop\""};
//
// Form1
//
@ -308,7 +312,7 @@
this.GroupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.vlcVideo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).EndInit();
this.ResumeLayout(false);
}
@ -346,7 +350,7 @@
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private AxAXVLC.AxVLCPlugin2 vlcVideo;
private Vlc.DotNet.Forms.VlcControl vlcControl1;
}
}

View File

@ -232,11 +232,6 @@ namespace KaraokeConverter
var file = new Uri(@"D:\HDMovies\28 Weeks Later (2007)\28.Weeks.Later.2007.720p.BrRip.264.YIFY.mp4");
vlcVideo.playlist.add(file.AbsoluteUri);
vlcVideo.playlist.play();
}
}
}

View File

@ -120,20 +120,6 @@
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="vlcVideo.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAgwEAAAIB
AAAAAQAAAAAAAAAAAAAAAG4BAAAHAAAAKABDAG8AdQBuAHQAKQADAA0AAAAIAAAAQQB1AHQAbwBMAG8A
bwBwAAsAAAAIAAAAQQB1AHQAbwBQAGwAYQB5AAsA//8JAAAAQgBhAGMAawBDAG8AbABvAHIAAwAAAAAA
BwAAAEIAYQBzAGUAVQBSAEwACAAAAAAACAAAAEIAcgBhAG4AZABpAG4AZwALAP//DAAAAEUAeAB0AGUA
bgB0AEgAZQBpAGcAaAB0AAMAFhIAAAsAAABFAHgAdABlAG4AdABXAGkAZAB0AGgAAwATIQAAEQAAAEYA
dQBsAGwAcwBjAHIAZQBlAG4ARQBuAGEAYgBsAGUAZAALAP//AwAAAE0AUgBMAAgAAAAAAAkAAABTAHQA
YQByAHQAVABpAG0AZQADAAAAAAAHAAAAVABvAG8AbABiAGEAcgALAP//BwAAAFYAaQBzAGkAYgBsAGUA
CwD//wYAAABWAG8AbAB1AG0AZQADADIAAAAL
</value>
</data>
<metadata name="SaveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>159, 17</value>
</metadata>

View File

@ -162,25 +162,6 @@
<Content Include="lib\NReco.VideoInfo.XML" />
<None Include="Resources\Google.png" />
</ItemGroup>
<ItemGroup>
<COMReference Include="AxAXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="AXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CdgLib\CdgLib.csproj">
<Project>{3203dfd2-da5b-47b3-b009-18dd9c401fc3}</Project>

View File

@ -1,105 +0,0 @@
namespace KaraokePlayer
{
partial class CDGWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CDGWindow));
this.pbLyrics = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
this.vlcPlayer = new Vlc.DotNet.Forms.VlcControl();
((System.ComponentModel.ISupportInitialize)(this.pbLyrics)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).BeginInit();
this.SuspendLayout();
//
// pbLyrics
//
this.pbLyrics.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pbLyrics.Dock = System.Windows.Forms.DockStyle.Fill;
this.pbLyrics.Image = global::KaraokePlayer.Properties.Resources.Google;
this.pbLyrics.Location = new System.Drawing.Point(0, 0);
this.pbLyrics.Name = "pbLyrics";
this.pbLyrics.Size = new System.Drawing.Size(553, 414);
this.pbLyrics.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pbLyrics.TabIndex = 0;
this.pbLyrics.TabStop = false;
//
// panel1
//
this.panel1.Controls.Add(this.vlcPlayer);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Enabled = false;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(553, 414);
this.panel1.TabIndex = 2;
//
// vlcPlayer
//
this.vlcPlayer.BackColor = System.Drawing.Color.Black;
this.vlcPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
this.vlcPlayer.Location = new System.Drawing.Point(0, 0);
this.vlcPlayer.Name = "vlcPlayer";
this.vlcPlayer.Size = new System.Drawing.Size(553, 414);
this.vlcPlayer.Spu = -1;
this.vlcPlayer.TabIndex = 2;
this.vlcPlayer.Text = "vlcControl1";
this.vlcPlayer.VlcLibDirectory = ((System.IO.DirectoryInfo)(resources.GetObject("vlcPlayer.VlcLibDirectory")));
this.vlcPlayer.VlcMediaplayerOptions = new string[] {
"--audio-visual=visual",
"--effect-list=scope",
"--no-video"};
//
// CDGWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(553, 414);
this.Controls.Add(this.pbLyrics);
this.Controls.Add(this.panel1);
this.KeyPreview = true;
this.Name = "CDGWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Karaoke";
this.Load += new System.EventHandler(this.CDGWindow_Load);
this.DoubleClick += new System.EventHandler(this.CDGWindow_DoubleClick_1);
((System.ComponentModel.ISupportInitialize)(this.pbLyrics)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).EndInit();
this.ResumeLayout(false);
}
public System.Windows.Forms.PictureBox pbLyrics;
#endregion
private System.Windows.Forms.Panel panel1;
private Vlc.DotNet.Forms.VlcControl vlcPlayer;
}
}

View File

@ -1,47 +0,0 @@
using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
namespace KaraokePlayer
{
public partial class CDGWindow : Form
{
public CDGWindow()
{
InitializeComponent();
}
private void CDGWindow_Load(object sender, EventArgs e)
{
var plexiGlass =new Plexiglass(this);
plexiGlass.Controls.Add(pbLyrics);
var file = new Uri(@"D:\Karaoke\SF001 - SF339 Sunfly Hits Karaoke Complete\SF339\SF339-01 - Kiesza - Hideaway.mp3");
vlcPlayer.SetMedia(file);
vlcPlayer.Play();
}
private void CDGWindow_DoubleClick_1(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Maximized)
{
FormBorderStyle = FormBorderStyle.Sizable;
this.WindowState = FormWindowState.Normal;
}
else
{
FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}
}
}
}

View File

@ -1,235 +0,0 @@
namespace KaraokePlayer
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tbFileName = new System.Windows.Forms.TextBox();
this.btBrowse = new System.Windows.Forms.Button();
this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.Timer1 = new System.Windows.Forms.Timer(this.components);
this.Panel1 = new System.Windows.Forms.Panel();
this.Label2 = new System.Windows.Forms.Label();
this.nudKey = new System.Windows.Forms.NumericUpDown();
this.Label1 = new System.Windows.Forms.Label();
this.ToolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsbPlay = new System.Windows.Forms.ToolStripButton();
this.tsbStop = new System.Windows.Forms.ToolStripButton();
this.tsbPause = new System.Windows.Forms.ToolStripButton();
this.trbVolume = new System.Windows.Forms.TrackBar();
this.Panel2 = new System.Windows.Forms.Panel();
this.Panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudKey)).BeginInit();
this.ToolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trbVolume)).BeginInit();
this.SuspendLayout();
//
// tbFileName
//
this.tbFileName.Location = new System.Drawing.Point(3, 5);
this.tbFileName.Name = "tbFileName";
this.tbFileName.ReadOnly = true;
this.tbFileName.Size = new System.Drawing.Size(309, 20);
this.tbFileName.TabIndex = 0;
this.tbFileName.Text = "D:\\Karaoke\\SF001 - SF339 Sunfly Hits Karaoke Complete\\SF339\\SF339-01 - Kiesza - H" +
"ideaway.cdg";
//
// btBrowse
//
this.btBrowse.Location = new System.Drawing.Point(318, 6);
this.btBrowse.Name = "btBrowse";
this.btBrowse.Size = new System.Drawing.Size(75, 23);
this.btBrowse.TabIndex = 1;
this.btBrowse.Text = "Browse...";
this.btBrowse.UseVisualStyleBackColor = true;
this.btBrowse.Click += new System.EventHandler(this.Button1_Click);
//
// OpenFileDialog1
//
this.OpenFileDialog1.FileName = "OpenFileDialog1";
//
// Timer1
//
this.Timer1.Interval = 50;
//
// Panel1
//
this.Panel1.Controls.Add(this.Label2);
this.Panel1.Controls.Add(this.nudKey);
this.Panel1.Controls.Add(this.Label1);
this.Panel1.Controls.Add(this.ToolStrip1);
this.Panel1.Controls.Add(this.tbFileName);
this.Panel1.Controls.Add(this.btBrowse);
this.Panel1.Controls.Add(this.trbVolume);
this.Panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.Panel1.Location = new System.Drawing.Point(0, 0);
this.Panel1.Name = "Panel1";
this.Panel1.Size = new System.Drawing.Size(397, 61);
this.Panel1.TabIndex = 3;
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.Location = new System.Drawing.Point(230, 37);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(25, 13);
this.Label2.TabIndex = 9;
this.Label2.Text = "Key";
//
// nudKey
//
this.nudKey.Location = new System.Drawing.Point(261, 35);
this.nudKey.Maximum = new decimal(new int[] {
12,
0,
0,
0});
this.nudKey.Minimum = new decimal(new int[] {
12,
0,
0,
-2147483648});
this.nudKey.Name = "nudKey";
this.nudKey.Size = new System.Drawing.Size(50, 20);
this.nudKey.TabIndex = 8;
this.nudKey.ValueChanged += new System.EventHandler(this.nudKey_ValueChanged);
//
// Label1
//
this.Label1.AutoSize = true;
this.Label1.Location = new System.Drawing.Point(90, 35);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(42, 13);
this.Label1.TabIndex = 7;
this.Label1.Text = "Volume";
//
// ToolStrip1
//
this.ToolStrip1.Dock = System.Windows.Forms.DockStyle.None;
this.ToolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbPlay,
this.tsbStop,
this.tsbPause});
this.ToolStrip1.Location = new System.Drawing.Point(3, 29);
this.ToolStrip1.Name = "ToolStrip1";
this.ToolStrip1.Size = new System.Drawing.Size(81, 25);
this.ToolStrip1.TabIndex = 2;
this.ToolStrip1.Text = "ToolStrip1";
//
// tsbPlay
//
this.tsbPlay.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.tsbPlay.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbPlay.Name = "tsbPlay";
this.tsbPlay.Size = new System.Drawing.Size(23, 22);
this.tsbPlay.Text = "Play";
this.tsbPlay.Click += new System.EventHandler(this.tsbPlay_Click);
//
// tsbStop
//
this.tsbStop.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.tsbStop.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbStop.Name = "tsbStop";
this.tsbStop.Size = new System.Drawing.Size(23, 22);
this.tsbStop.Text = "Stop";
this.tsbStop.Click += new System.EventHandler(this.tsbStop_Click);
//
// tsbPause
//
this.tsbPause.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.tsbPause.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbPause.Name = "tsbPause";
this.tsbPause.Size = new System.Drawing.Size(23, 22);
this.tsbPause.Text = "Pause";
this.tsbPause.Click += new System.EventHandler(this.tsbPause_Click);
//
// trbVolume
//
this.trbVolume.Location = new System.Drawing.Point(131, 34);
this.trbVolume.Maximum = 100;
this.trbVolume.Name = "trbVolume";
this.trbVolume.Size = new System.Drawing.Size(101, 45);
this.trbVolume.TabIndex = 6;
this.trbVolume.TickFrequency = 5;
this.trbVolume.TickStyle = System.Windows.Forms.TickStyle.None;
this.trbVolume.Value = 100;
this.trbVolume.Scroll += new System.EventHandler(this.TrackBar1_Scroll);
//
// Panel2
//
this.Panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.Panel2.Location = new System.Drawing.Point(0, 61);
this.Panel2.Name = "Panel2";
this.Panel2.Size = new System.Drawing.Size(397, 0);
this.Panel2.TabIndex = 4;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(397, 61);
this.Controls.Add(this.Panel2);
this.Controls.Add(this.Panel1);
this.Name = "Form1";
this.Text = "MP3+CDG Player";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.Panel1.ResumeLayout(false);
this.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudKey)).EndInit();
this.ToolStrip1.ResumeLayout(false);
this.ToolStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trbVolume)).EndInit();
this.ResumeLayout(false);
}
private System.Windows.Forms.TextBox tbFileName;
private System.Windows.Forms.Button btBrowse;
private System.Windows.Forms.OpenFileDialog OpenFileDialog1;
private System.Windows.Forms.Timer Timer1;
private System.Windows.Forms.Panel Panel1;
private System.Windows.Forms.Panel Panel2;
private System.Windows.Forms.ToolStrip ToolStrip1;
private System.Windows.Forms.ToolStripButton tsbPlay;
private System.Windows.Forms.ToolStripButton tsbStop;
private System.Windows.Forms.ToolStripButton tsbPause;
private System.Windows.Forms.Label Label1;
private System.Windows.Forms.TrackBar trbVolume;
private System.Windows.Forms.Label Label2;
private System.Windows.Forms.NumericUpDown nudKey;
#endregion
}
}

View File

@ -1,328 +0,0 @@
using System;
using System.Drawing;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using CdgLib;
using Un4seen.Bass;
using Un4seen.Bass.AddOn.Fx;
namespace KaraokePlayer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#region "Private Declarations"
private CdgFile mCDGFile;
private CdgFileIoStream mCDGStream;
private int mSemitones = 0;
private bool mPaused;
private long mFrameCount;
private bool mStop;
private string mCDGFileName;
private string mMP3FileName;
private string mTempDir;
private int mMP3Stream;
private CDGWindow withEventsField_mCDGWindow = new CDGWindow();
private CDGWindow mCDGWindow
{
get { return withEventsField_mCDGWindow; }
set
{
if (withEventsField_mCDGWindow != null)
{
withEventsField_mCDGWindow.FormClosing -= mCDGWindow_FormClosing;
}
withEventsField_mCDGWindow = value;
if (withEventsField_mCDGWindow != null)
{
withEventsField_mCDGWindow.FormClosing += mCDGWindow_FormClosing;
}
}
}
private bool mBassInitalized;
#endregion
#region "Control Events"
private void Form1_Load(object sender, EventArgs e)
{
//Add registration key here if you have a license
//BassNet.Registration("email@domain.com", "0000000000000000")
try
{
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Handle);
mBassInitalized = true;
}
catch (Exception ex)
{
MessageBox.Show("Unable to initialize the audio playback system.");
}
}
private void Button1_Click(object sender, EventArgs e)
{
BrowseCDGZip();
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
StopPlayback();
}
private void tsbPlay_Click(object sender, EventArgs e)
{
Play();
}
private void tsbStop_Click(object sender, EventArgs e)
{
try
{
StopPlayback();
}
catch (Exception ex)
{
//Do nothing for now
}
}
private void tsbPause_Click(object sender, EventArgs e)
{
Pause();
}
private void TrackBar1_Scroll(object sender, EventArgs e)
{
AdjustVolume();
}
private void nudKey_ValueChanged(object sender, EventArgs e)
{
AdjustPitch();
}
private void mCDGWindow_FormClosing(object sender, FormClosingEventArgs e)
{
StopPlayback();
mCDGWindow.Hide();
e.Cancel = true;
}
#endregion
#region "CDG + MP3 Playback Operations"
private void Pause()
{
mPaused = !mPaused;
if (mMP3Stream != 0)
{
if (Bass.BASS_ChannelIsActive(mMP3Stream) != BASSActive.BASS_ACTIVE_PLAYING)
{
Bass.BASS_ChannelPlay(mMP3Stream, false);
tsbPause.Text = "Pause";
}
else
{
Bass.BASS_ChannelPause(mMP3Stream);
tsbPause.Text = "Resume";
}
}
}
private void PlayMP3Bass(string mp3FileName)
{
if (mBassInitalized || Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Handle))
{
mMP3Stream = 0;
mMP3Stream = Bass.BASS_StreamCreateFile(mp3FileName, 0, 0,
BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN);
mMP3Stream = BassFx.BASS_FX_TempoCreate(mMP3Stream,
BASSFlag.BASS_FX_FREESOURCE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_SAMPLE_LOOP);
if (mMP3Stream != 0)
{
AdjustPitch();
AdjustVolume();
ShowCDGWindow();
Bass.BASS_ChannelPlay(mMP3Stream, false);
}
else
{
throw new Exception(string.Format("Stream error: {0}", Bass.BASS_ErrorGetCode()));
}
}
}
private void StopPlaybackBass()
{
Bass.BASS_Stop();
Bass.BASS_StreamFree(mMP3Stream);
Bass.BASS_Free();
mMP3Stream = 0;
mBassInitalized = false;
}
private void StopPlayback()
{
mStop = true;
HideCDGWindow();
StopPlaybackBass();
mCDGFile.Dispose();
CleanUp();
}
private void PausePlayback()
{
Bass.BASS_Pause();
}
private void ResumePlayback()
{
Bass.BASS_Pause();
}
private void Play()
{
try
{
if (mMP3Stream != 0 && Bass.BASS_ChannelIsActive(mMP3Stream) == BASSActive.BASS_ACTIVE_PLAYING)
{
StopPlayback();
}
PreProcessFiles();
if (string.IsNullOrEmpty(mCDGFileName) | string.IsNullOrEmpty(mMP3FileName))
{
MessageBox.Show("Cannot find a CDG and MP3 file to play together.");
StopPlayback();
return;
}
mPaused = false;
mStop = false;
mFrameCount = 0;
mCDGFile = new CdgFile(mCDGFileName);
var cdgLength = mCDGFile.GetTotalDuration();
PlayMP3Bass(mMP3FileName);
var startTime = DateTime.Now;
var endTime = startTime.AddMilliseconds(mCDGFile.GetTotalDuration());
var millisecondsRemaining = cdgLength;
while (millisecondsRemaining > 0)
{
if (mStop)
{
break; // TODO: might not be correct. Was : Exit While
}
millisecondsRemaining = (long) endTime.Subtract(DateTime.Now).TotalMilliseconds;
var pos = cdgLength - millisecondsRemaining;
while (mPaused)
{
endTime = DateTime.Now.AddMilliseconds(millisecondsRemaining);
Application.DoEvents();
}
mCDGFile.RenderAtPosition(pos);
mFrameCount += 1;
mCDGWindow.pbLyrics.Image = mCDGFile.RgbImage;
mCDGWindow.pbLyrics.BackColor = ((Bitmap) mCDGFile.RgbImage).GetPixel(1, 1);
mCDGWindow.pbLyrics.Refresh();
Application.DoEvents();
}
StopPlayback();
}
catch (Exception ex)
{
}
}
private void AdjustPitch()
{
if (mMP3Stream != 0)
{
Bass.BASS_ChannelSetAttribute(mMP3Stream, BASSAttribute.BASS_ATTRIB_TEMPO_PITCH, (float) nudKey.Value);
}
}
private void AdjustVolume()
{
if (mMP3Stream != 0)
{
Bass.BASS_ChannelSetAttribute(mMP3Stream, BASSAttribute.BASS_ATTRIB_VOL,
trbVolume.Value == 0 ? 0 : trbVolume.Value/100);
}
}
#endregion
#region "File Access"
private void BrowseCDGZip()
{
OpenFileDialog1.Filter = "CDG or Zip Files (*.zip, *.cdg)|*.zip;*.cdg";
OpenFileDialog1.ShowDialog();
tbFileName.Text = OpenFileDialog1.FileName;
}
private void PreProcessFiles()
{
var myCDGFileName = "";
if (Regex.IsMatch(tbFileName.Text, "\\.zip$"))
{
var myTempDir = Path.GetTempPath() + Path.GetRandomFileName();
Directory.CreateDirectory(myTempDir);
mTempDir = myTempDir;
myCDGFileName = Unzip.UnzipMP3GFiles(tbFileName.Text, myTempDir);
}
else if (Regex.IsMatch(tbFileName.Text, "\\.cdg$"))
{
myCDGFileName = tbFileName.Text;
var myMP3FileName = Regex.Replace(myCDGFileName, "\\.cdg$", ".mp3");
if (File.Exists(myMP3FileName))
{
mMP3FileName = myMP3FileName;
mCDGFileName = myCDGFileName;
mTempDir = "";
}
}
}
private void CleanUp()
{
if (!string.IsNullOrEmpty(mTempDir))
{
try
{
Directory.Delete(mTempDir, true);
}
catch (Exception ex)
{
}
}
mTempDir = "";
}
#endregion
#region "CDG Graphics Window"
private void ShowCDGWindow()
{
mCDGWindow.Show();
}
private void HideCDGWindow()
{
mCDGWindow.pbLyrics.Image = null;
mCDGWindow.Hide();
}
#endregion
}
}

View File

@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -33,13 +34,14 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Bass.Net">
<HintPath>lib\Bass.Net.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MaterialSkin, Version=0.0.3.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\MaterialSkin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Design" />
@ -52,43 +54,42 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Vlc.DotNet.Core, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<Reference Include="Vlc.DotNet.Core, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Vlc.DotNet.Core.2.1.115\lib\net45\x86\Vlc.DotNet.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Vlc.DotNet.Core.Interops, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<Reference Include="Vlc.DotNet.Core.Interops, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Vlc.DotNet.Core.Interops.2.1.115\lib\net45\x86\Vlc.DotNet.Core.Interops.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Vlc.DotNet.Forms, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<Reference Include="Vlc.DotNet.Forms, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Vlc.DotNet.Forms.2.1.115\lib\net45\x86\Vlc.DotNet.Forms.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CDGWindow.cs">
<Compile Include="KaraokeVideoPlayer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="KaraokeVideoPlayer.Designer.cs">
<DependentUpon>KaraokeVideoPlayer.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CDGWindow.Designer.cs">
<DependentUpon>CDGWindow.cs</DependentUpon>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="PlexiGlass.cs">
<Compile Include="OverlayForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Unzip.cs" />
<EmbeddedResource Include="CDGWindow.resx">
<DependentUpon>CDGWindow.cs</DependentUpon>
<EmbeddedResource Include="KaraokeVideoPlayer.resx">
<DependentUpon>KaraokeVideoPlayer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
@ -114,41 +115,19 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="lib\bass.dll" />
<Content Include="lib\Bass.Net.dll" />
<Content Include="lib\bass_fx.dll" />
<None Include="Resources\Google.png" />
</ItemGroup>
<ItemGroup>
<COMReference Include="AxAXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="AXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CdgLib\CdgLib.csproj">
<Project>{3203dfd2-da5b-47b3-b009-18dd9c401fc3}</Project>
<Name>CdgLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="lib\MaterialSkin.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(ProjectDir)lib\bass.dll" "$(TargetDir)"
copy "$(ProjectDir)lib\bass_fx.dll" "$(TargetDir)"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -0,0 +1,77 @@
namespace KaraokePlayer
{
partial class KaraokeVideoPlayer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KaraokeVideoPlayer));
this.vlcPlayer = new Vlc.DotNet.Forms.VlcControl();
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).BeginInit();
this.SuspendLayout();
//
// vlcPlayer
//
this.vlcPlayer.BackColor = System.Drawing.Color.Black;
this.vlcPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
this.vlcPlayer.Location = new System.Drawing.Point(0, 0);
this.vlcPlayer.Name = "vlcPlayer";
this.vlcPlayer.Size = new System.Drawing.Size(428, 330);
this.vlcPlayer.Spu = -1;
this.vlcPlayer.TabIndex = 0;
this.vlcPlayer.Text = "vlcControl1";
this.vlcPlayer.VlcLibDirectory = ((System.IO.DirectoryInfo)(resources.GetObject("vlcPlayer.VlcLibDirectory")));
this.vlcPlayer.VlcMediaplayerOptions = new string[] {
"--projectm-preset-path=Presets",
"--projectm-width=1680",
"--projectm-height=1050",
"--audio-visual=projectm",
"--effect-list=scope",
"--no-video",
"--extraintf=logger",
"--verbose=2"};
this.vlcPlayer.Playing += new System.EventHandler<Vlc.DotNet.Core.VlcMediaPlayerPlayingEventArgs>(this.vlcPlayer_Playing);
this.vlcPlayer.TimeChanged += new System.EventHandler<Vlc.DotNet.Core.VlcMediaPlayerTimeChangedEventArgs>(this.vlcPlayer_TimeChanged);
this.vlcPlayer.Stopped += new System.EventHandler<Vlc.DotNet.Core.VlcMediaPlayerStoppedEventArgs>(this.vlcPlayer_Stopped);
//
// KaraokeVideoPlayer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.vlcPlayer);
this.Name = "KaraokeVideoPlayer";
this.Size = new System.Drawing.Size(428, 330);
this.ParentChanged += new System.EventHandler(this.KaraokeVideoPlayer_ParentChanged);
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Vlc.DotNet.Forms.VlcControl vlcPlayer;
}
}

View File

@ -0,0 +1,85 @@
using System;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using CdgLib;
using Vlc.DotNet.Core;
namespace KaraokePlayer
{
public partial class KaraokeVideoPlayer : UserControl
{
private readonly PictureBox _lyrics = new PictureBox {Dock = DockStyle.Fill};
private CdgFile _cdgFile;
private Image _lyricImage;
private OverlayForm _overlayForm;
private DateTime _startTime;
private readonly System.Timers.Timer _lyricTimer = new System.Timers.Timer();
public KaraokeVideoPlayer()
{
InitializeComponent();
_lyricTimer.Interval = 30;
_lyricTimer.Elapsed += LyricTimerOnElapsed;
}
private async void LyricTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
{
System.Diagnostics.Debug.Print(DateTime.Now.Millisecond.ToString());
if (vlcPlayer.IsPlaying)
{
await Task.Run(() =>
{
_cdgFile.RenderAtPosition(
(long)(DateTime.Now - _startTime).TotalMilliseconds);
});
Invoke((MethodInvoker)(() =>
{
_lyrics.Image = _cdgFile.RgbImage;
_lyrics.BackColor = ((Bitmap)_cdgFile.RgbImage).GetPixel(1, 1);
}));
}
else
{
this.Enabled = false;
}
}
public void Play(Uri file)
{
vlcPlayer.SetMedia(file);
_cdgFile = new CdgFile(Path.ChangeExtension(file.LocalPath, "cdg"));
vlcPlayer.Play();
}
private void vlcPlayer_Playing(object sender, VlcMediaPlayerPlayingEventArgs e)
{
_startTime = DateTime.Now;
_lyricTimer.Start();
}
private void vlcPlayer_TimeChanged(object sender, VlcMediaPlayerTimeChangedEventArgs e)
{
_startTime = DateTime.Now.AddMilliseconds(-e.NewTime);
}
private void vlcPlayer_Stopped(object sender, VlcMediaPlayerStoppedEventArgs e)
{
_overlayForm.Hide();
}
private void KaraokeVideoPlayer_ParentChanged(object sender, EventArgs e)
{
if (ParentForm != null)
{
_overlayForm = new OverlayForm(this);
_overlayForm.Controls.Add(_lyrics);
}
}
}
}

View File

@ -120,8 +120,8 @@
<data name="vlcPlayer.VlcLibDirectory" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAEAQAAABdTeXN0ZW0uSU8uRGlyZWN0b3J5SW5mbwIAAAAMT3JpZ2luYWxQ
YXRoCEZ1bGxQYXRoAQEGAgAAACNDOlxQcm9ncmFtIEZpbGVzICh4ODYpXFZpZGVvTEFOXFZMQwkCAAAA
Cw==
YXRoCEZ1bGxQYXRoAQEGAgAAAEBDOlxVc2Vyc1xsLWJyZVxEZXNrdG9wXEthcmFva2VQbGF5ZXJcS2Fy
YW9rZVBsYXllclxiaW5cRGVidWdcVkxDCQIAAAAL
</value>
</data>
</root>

72
KaraokePlayer/MainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,72 @@
namespace KaraokePlayer
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.materialRaisedButton1 = new MaterialSkin.Controls.MaterialRaisedButton();
this.karaokeVideoPlayer1 = new KaraokePlayer.KaraokeVideoPlayer();
this.SuspendLayout();
//
// materialRaisedButton1
//
this.materialRaisedButton1.Depth = 0;
this.materialRaisedButton1.Location = new System.Drawing.Point(385, 358);
this.materialRaisedButton1.MouseState = MaterialSkin.MouseState.HOVER;
this.materialRaisedButton1.Name = "materialRaisedButton1";
this.materialRaisedButton1.Size = new System.Drawing.Size(81, 37);
this.materialRaisedButton1.TabIndex = 1;
this.materialRaisedButton1.Text = "Play";
this.materialRaisedButton1.UseVisualStyleBackColor = true;
this.materialRaisedButton1.Click += new System.EventHandler(this.materialRaisedButton1_Click);
//
// karaokeVideoPlayer1
//
this.karaokeVideoPlayer1.Location = new System.Drawing.Point(100, 140);
this.karaokeVideoPlayer1.Name = "karaokeVideoPlayer1";
this.karaokeVideoPlayer1.Size = new System.Drawing.Size(249, 146);
this.karaokeVideoPlayer1.TabIndex = 0;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(478, 407);
this.Controls.Add(this.materialRaisedButton1);
this.Controls.Add(this.karaokeVideoPlayer1);
this.Name = "MainForm";
this.Text = "Karaoke Player";
this.ResumeLayout(false);
}
#endregion
private KaraokeVideoPlayer karaokeVideoPlayer1;
private MaterialSkin.Controls.MaterialRaisedButton materialRaisedButton1;
}
}

25
KaraokePlayer/MainForm.cs Normal file
View File

@ -0,0 +1,25 @@
using System;
using MaterialSkin;
using MaterialSkin.Controls;
namespace KaraokePlayer
{
public partial class MainForm : MaterialForm
{
private readonly MaterialSkinManager _materialSkinManager;
public MainForm()
{
InitializeComponent();
// Initialize MaterialSkinManager
_materialSkinManager = MaterialSkinManager.Instance;
_materialSkinManager.AddFormToManage(this);
_materialSkinManager.Theme = new DarkTheme();
_materialSkinManager.ColorScheme = new ColorScheme(Primary.Green600, Primary.Green700, Primary.Green200, Accent.Red100, TextShade.WHITE);
}
private void materialRaisedButton1_Click(object sender, System.EventArgs e)
{
karaokeVideoPlayer1.Play(new Uri(@"D:\Karaoke\SF360 February 2016\SF360-01 - Charlie Puth - One Call Away\SF360-01 - Charlie Puth - One Call Away.mp3"));
}
}
}

View File

@ -117,13 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>159, 17</value>
</metadata>
<metadata name="ToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>248, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,73 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace KaraokePlayer
{
internal class OverlayForm : Form
{
private const int DwmwaTransitionsForcedisabled = 3;
public OverlayForm(ContainerControl parent)
{
BackColor = Color.FromArgb(1, 1, 1);
TransparencyKey = Color.FromArgb(1, 1, 1);
FormBorderStyle = FormBorderStyle.None;
ControlBox = false;
ShowInTaskbar = false;
StartPosition = FormStartPosition.Manual;
AutoScaleMode = AutoScaleMode.None;
Location = parent.PointToScreen(Point.Empty);
ClientSize = parent.ClientSize;
parent.ParentForm.LocationChanged += Cover_LocationChanged;
parent.ParentForm.ClientSizeChanged += Cover_ClientSizeChanged;
Show(parent.ParentForm);
parent.ParentForm.Focus();
// Disable Aero transitions, the plexiglass gets too visible
if (Environment.OSVersion.Version.Major >= 6)
{
var value = 1;
DwmSetWindowAttribute(parent.ParentForm.Handle, DwmwaTransitionsForcedisabled, ref value, 4);
}
}
public sealed override Color BackColor
{
get { return base.BackColor; }
set { base.BackColor = value; }
}
private void Cover_LocationChanged(object sender, EventArgs e)
{
// Location = Owner.PointToScreen(Point.Empty);
}
private void Cover_ClientSizeChanged(object sender, EventArgs e)
{
//ClientSize = Owner.ClientSize;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
// Restore owner
Owner.LocationChanged -= Cover_LocationChanged;
Owner.ClientSizeChanged -= Cover_ClientSizeChanged;
if (!Owner.IsDisposed && Environment.OSVersion.Version.Major >= 6)
{
var value = 1;
DwmSetWindowAttribute(Owner.Handle, DwmwaTransitionsForcedisabled, ref value, 4);
}
base.OnFormClosing(e);
}
protected override void OnActivated(EventArgs e)
{
// Always keep the owner activated instead
BeginInvoke(new Action(() => Owner.Activate()));
}
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int value, int attrLen);
}
}

View File

@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KaraokePlayer
{
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
class Plexiglass : Form
{
public Plexiglass(Form tocover)
{
this.BackColor = Color.FromArgb(1,1,1);
TransparencyKey = Color.FromArgb(1, 1, 1);
this.FormBorderStyle = FormBorderStyle.None;
this.ControlBox = false;
this.ShowInTaskbar = false;
this.StartPosition = FormStartPosition.Manual;
this.AutoScaleMode = AutoScaleMode.None;
this.Location = tocover.PointToScreen(Point.Empty);
this.ClientSize = tocover.ClientSize;
tocover.LocationChanged += Cover_LocationChanged;
tocover.ClientSizeChanged += Cover_ClientSizeChanged;
this.Show(tocover);
tocover.Focus();
// Disable Aero transitions, the plexiglass gets too visible
if (Environment.OSVersion.Version.Major >= 6)
{
int value = 1;
DwmSetWindowAttribute(tocover.Handle, DWMWA_TRANSITIONS_FORCEDISABLED, ref value, 4);
}
}
private void Cover_LocationChanged(object sender, EventArgs e)
{
// Ensure the plexiglass follows the owner
this.Location = this.Owner.PointToScreen(Point.Empty);
}
private void Cover_ClientSizeChanged(object sender, EventArgs e)
{
// Ensure the plexiglass keeps the owner covered
this.ClientSize = this.Owner.ClientSize;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
// Restore owner
this.Owner.LocationChanged -= Cover_LocationChanged;
this.Owner.ClientSizeChanged -= Cover_ClientSizeChanged;
if (!this.Owner.IsDisposed && Environment.OSVersion.Version.Major >= 6)
{
int value = 1;
DwmSetWindowAttribute(this.Owner.Handle, DWMWA_TRANSITIONS_FORCEDISABLED, ref value, 4);
}
base.OnFormClosing(e);
}
protected override void OnActivated(EventArgs e)
{
// Always keep the owner activated instead
this.BeginInvoke(new Action(() => this.Owner.Activate()));
}
private const int DWMWA_TRANSITIONS_FORCEDISABLED = 3;
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int value, int attrLen);
}
}

View File

@ -13,7 +13,7 @@ namespace KaraokePlayer
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new MainForm());
}
}
}

View File

@ -59,15 +59,5 @@ namespace KaraokePlayer.Properties {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Google {
get {
object obj = ResourceManager.GetObject("Google", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -118,7 +118,4 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Google" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Google.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,30 +0,0 @@
using System;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
namespace KaraokePlayer
{
internal class Unzip
{
public static string UnzipMP3GFiles(string zipFilename, string outputPath)
{
string functionReturnValue = null;
functionReturnValue = "";
try
{
var myZip = new FastZip();
myZip.ExtractZip(zipFilename, outputPath, "");
var myDirInfo = new DirectoryInfo(outputPath);
var myFileInfo = myDirInfo.GetFiles("*.cdg", SearchOption.AllDirectories);
if (myFileInfo.Length > 0)
{
functionReturnValue = myFileInfo[0].FullName;
}
}
catch (Exception ex)
{
}
return functionReturnValue;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.