diff --git a/CdgLib/CdgLib.csproj b/CdgLib/CdgLib.csproj index bba14ac..a516b92 100644 --- a/CdgLib/CdgLib.csproj +++ b/CdgLib/CdgLib.csproj @@ -20,6 +20,7 @@ DEBUG;TRACE prompt 4 + AnyCPU pdbonly diff --git a/KaraokeConverter/Form1.Designer.cs b/KaraokeConverter/Form1.Designer.cs index fdf61ea..4d33ba1 100644 --- a/KaraokeConverter/Form1.Designer.cs +++ b/KaraokeConverter/Form1.Designer.cs @@ -28,7 +28,6 @@ /// 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; } } diff --git a/KaraokeConverter/Form1.cs b/KaraokeConverter/Form1.cs index 7c19e3b..ee52b1f 100644 --- a/KaraokeConverter/Form1.cs +++ b/KaraokeConverter/Form1.cs @@ -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(); - - } } } \ No newline at end of file diff --git a/KaraokeConverter/Form1.resx b/KaraokeConverter/Form1.resx index ff828c2..fdfe6a4 100644 --- a/KaraokeConverter/Form1.resx +++ b/KaraokeConverter/Form1.resx @@ -120,20 +120,6 @@ 17, 17 - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAgwEAAAIB - AAAAAQAAAAAAAAAAAAAAAG4BAAAHAAAAKABDAG8AdQBuAHQAKQADAA0AAAAIAAAAQQB1AHQAbwBMAG8A - bwBwAAsAAAAIAAAAQQB1AHQAbwBQAGwAYQB5AAsA//8JAAAAQgBhAGMAawBDAG8AbABvAHIAAwAAAAAA - BwAAAEIAYQBzAGUAVQBSAEwACAAAAAAACAAAAEIAcgBhAG4AZABpAG4AZwALAP//DAAAAEUAeAB0AGUA - bgB0AEgAZQBpAGcAaAB0AAMAFhIAAAsAAABFAHgAdABlAG4AdABXAGkAZAB0AGgAAwATIQAAEQAAAEYA - dQBsAGwAcwBjAHIAZQBlAG4ARQBuAGEAYgBsAGUAZAALAP//AwAAAE0AUgBMAAgAAAAAAAkAAABTAHQA - YQByAHQAVABpAG0AZQADAAAAAAAHAAAAVABvAG8AbABiAGEAcgALAP//BwAAAFYAaQBzAGkAYgBsAGUA - CwD//wYAAABWAG8AbAB1AG0AZQADADIAAAAL - - 159, 17 diff --git a/KaraokeConverter/KaraokeConverter.csproj b/KaraokeConverter/KaraokeConverter.csproj index 8f21fb1..c4aebfb 100644 --- a/KaraokeConverter/KaraokeConverter.csproj +++ b/KaraokeConverter/KaraokeConverter.csproj @@ -162,25 +162,6 @@ - - - {DF2BBE39-40A8-433B-A279-073F48DA94B6} - 1 - 0 - 0 - aximp - False - - - {DF2BBE39-40A8-433B-A279-073F48DA94B6} - 1 - 0 - 0 - tlbimp - False - True - - {3203dfd2-da5b-47b3-b009-18dd9c401fc3} diff --git a/KaraokePlayer/CDGWindow.Designer.cs b/KaraokePlayer/CDGWindow.Designer.cs deleted file mode 100644 index 1ed195b..0000000 --- a/KaraokePlayer/CDGWindow.Designer.cs +++ /dev/null @@ -1,105 +0,0 @@ -namespace KaraokePlayer -{ - partial class CDGWindow - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} \ No newline at end of file diff --git a/KaraokePlayer/CDGWindow.cs b/KaraokePlayer/CDGWindow.cs deleted file mode 100644 index 0871f43..0000000 --- a/KaraokePlayer/CDGWindow.cs +++ /dev/null @@ -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; - } - - } - } -} \ No newline at end of file diff --git a/KaraokePlayer/Form1.Designer.cs b/KaraokePlayer/Form1.Designer.cs deleted file mode 100644 index 4f36bf1..0000000 --- a/KaraokePlayer/Form1.Designer.cs +++ /dev/null @@ -1,235 +0,0 @@ -namespace KaraokePlayer -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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 - } -} - diff --git a/KaraokePlayer/Form1.cs b/KaraokePlayer/Form1.cs deleted file mode 100644 index 7978966..0000000 --- a/KaraokePlayer/Form1.cs +++ /dev/null @@ -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 - } -} \ No newline at end of file diff --git a/KaraokePlayer/KaraokePlayer.csproj b/KaraokePlayer/KaraokePlayer.csproj index 16bf6c8..c288e1e 100644 --- a/KaraokePlayer/KaraokePlayer.csproj +++ b/KaraokePlayer/KaraokePlayer.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + true AnyCPU @@ -33,13 +34,14 @@ 4 - - lib\Bass.Net.dll - ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll True + + False + lib\MaterialSkin.dll + @@ -52,43 +54,42 @@ - + + False ..\packages\Vlc.DotNet.Core.2.1.115\lib\net45\x86\Vlc.DotNet.Core.dll - True - + + False ..\packages\Vlc.DotNet.Core.Interops.2.1.115\lib\net45\x86\Vlc.DotNet.Core.Interops.dll - True - + + False ..\packages\Vlc.DotNet.Forms.2.1.115\lib\net45\x86\Vlc.DotNet.Forms.dll - True - + + UserControl + + + KaraokeVideoPlayer.cs + + Form - - CDGWindow.cs + + MainForm.cs - - Form - - - Form1.cs - - + Form - - - CDGWindow.cs + + KaraokeVideoPlayer.cs - - Form1.cs + + MainForm.cs ResXFileCodeGenerator @@ -114,41 +115,19 @@ - - - - - - - - - {DF2BBE39-40A8-433B-A279-073F48DA94B6} - 1 - 0 - 0 - aximp - False - - - {DF2BBE39-40A8-433B-A279-073F48DA94B6} - 1 - 0 - 0 - tlbimp - False - True - - {3203dfd2-da5b-47b3-b009-18dd9c401fc3} CdgLib + + + - copy "$(ProjectDir)lib\bass.dll" "$(TargetDir)" -copy "$(ProjectDir)lib\bass_fx.dll" "$(TargetDir)" + +