bug fixes

This commit is contained in:
chudov
2010-04-16 04:30:51 +00:00
parent a866b79341
commit 08722c0255
46 changed files with 1990 additions and 420 deletions

View File

@@ -84,6 +84,18 @@
<Compile Include="frmCUEPlayer.Designer.cs">
<DependentUpon>frmCUEPlayer.cs</DependentUpon>
</Compile>
<Compile Include="Icecast.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Icecast.Designer.cs">
<DependentUpon>Icecast.cs</DependentUpon>
</Compile>
<Compile Include="IcecastSettings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="IcecastSettings.Designer.cs">
<DependentUpon>IcecastSettings.cs</DependentUpon>
</Compile>
<Compile Include="Output.cs">
<SubType>Form</SubType>
</Compile>
@@ -107,6 +119,12 @@
<EmbeddedResource Include="frmCUEPlayer.resx">
<DependentUpon>frmCUEPlayer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Icecast.resx">
<DependentUpon>Icecast.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="IcecastSettings.resx">
<DependentUpon>IcecastSettings.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Output.resx">
<DependentUpon>Output.cs</DependentUpon>
</EmbeddedResource>
@@ -132,6 +150,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Settings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CUEControls\CUEControls.csproj">
@@ -146,6 +165,10 @@
<Project>{FAD09EE2-D6B2-4A8E-9F1C-2A9FB293661A}</Project>
<Name>CUETools.Codecs.CoreAudio</Name>
</ProjectReference>
<ProjectReference Include="..\CUETools.Codecs.Icecast\CUETools.Codecs.Icecast.csproj">
<Project>{8FC5DA7C-F6AC-4D04-85BC-1233DDF569E7}</Project>
<Name>CUETools.Codecs.Icecast</Name>
</ProjectReference>
<ProjectReference Include="..\CUETools.Codecs\CUETools.Codecs.csproj">
<Project>{6458A13A-30EF-45A9-9D58-E5031B17BEE2}</Project>
<Name>CUETools.Codecs</Name>
@@ -248,6 +271,13 @@
<ItemGroup>
<Content Include="CUEPlayer.sdf">
</Content>
<None Include="Properties\DataSources\CUETools.Codecs.Icecast.IcecastSettingsData.datasource" />
<None Include="Resources\transmit.ico" />
<None Include="Resources\cog.png" />
<None Include="Properties\DataSources\Output.datasource" />
<None Include="Resources\sound_mute.png" />
<None Include="Resources\sound.png" />
<None Include="Resources\transmit_blue.png" />
<None Include="Resources\ctdb.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Binary file not shown.

View File

@@ -458,10 +458,10 @@ namespace CUEPlayer {
this.columnid.ReadOnly = true;
this.columnid.Unique = true;
this.columnpath.AllowDBNull = false;
this.columnpath.MaxLength = 100;
this.columnartist.MaxLength = 100;
this.columntitle.MaxLength = 100;
this.columnalbum.MaxLength = 100;
this.columnpath.MaxLength = 255;
this.columnartist.MaxLength = 255;
this.columntitle.MaxLength = 255;
this.columnalbum.MaxLength = 255;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -616,11 +616,11 @@ namespace CUEPlayer {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public string artist {
get {
try {
return ((string)(this[this.tablePlaylist.artistColumn]));
if (this.IsartistNull()) {
return string.Empty;
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'artist\' in table \'Playlist\' is DBNull.", e);
else {
return ((string)(this[this.tablePlaylist.artistColumn]));
}
}
set {
@@ -631,11 +631,11 @@ namespace CUEPlayer {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public string title {
get {
try {
return ((string)(this[this.tablePlaylist.titleColumn]));
if (this.IstitleNull()) {
return string.Empty;
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'title\' in table \'Playlist\' is DBNull.", e);
else {
return ((string)(this[this.tablePlaylist.titleColumn]));
}
}
set {
@@ -646,11 +646,11 @@ namespace CUEPlayer {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public string album {
get {
try {
return ((string)(this[this.tablePlaylist.albumColumn]));
if (this.IsalbumNull()) {
return string.Empty;
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'album\' in table \'Playlist\' is DBNull.", e);
else {
return ((string)(this[this.tablePlaylist.albumColumn]));
}
}
set {

View File

@@ -32,7 +32,7 @@
</DbCommand>
</InsertCommand>
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT [id], [path], [artist], [title], [album], [length], [track] FROM [Playlist]</CommandText>
<Parameters />
</DbCommand>
@@ -69,43 +69,43 @@
</DataSource>
</xs:appinfo>
</xs:annotation>
<xs:element name="DataSet1" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_DataSetName="DataSet1" msprop:Generator_UserDSName="DataSet1" msprop:EnableTableAdapterManager="true">
<xs:element name="DataSet1" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="DataSet1" msprop:Generator_DataSetName="DataSet1" msprop:EnableTableAdapterManager="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Playlist" msprop:Generator_UserTableName="Playlist" msprop:Generator_RowDeletedName="PlaylistRowDeleted" msprop:Generator_TableClassName="PlaylistDataTable" msprop:Generator_RowChangedName="PlaylistRowChanged" msprop:Generator_RowClassName="PlaylistRow" msprop:Generator_RowChangingName="PlaylistRowChanging" msprop:Generator_RowEvArgName="PlaylistRowChangeEvent" msprop:Generator_RowEvHandlerName="PlaylistRowChangeEventHandler" msprop:Generator_TablePropName="Playlist" msprop:Generator_TableVarName="tablePlaylist" msprop:Generator_RowDeletingName="PlaylistRowDeleting">
<xs:element name="Playlist" msprop:Generator_UserTableName="Playlist" msprop:Generator_RowDeletedName="PlaylistRowDeleted" msprop:Generator_RowChangedName="PlaylistRowChanged" msprop:Generator_RowClassName="PlaylistRow" msprop:Generator_RowChangingName="PlaylistRowChanging" msprop:Generator_RowEvArgName="PlaylistRowChangeEvent" msprop:Generator_RowEvHandlerName="PlaylistRowChangeEventHandler" msprop:Generator_TableClassName="PlaylistDataTable" msprop:Generator_TableVarName="tablePlaylist" msprop:Generator_RowDeletingName="PlaylistRowDeleting" msprop:Generator_TablePropName="Playlist">
<xs:complexType>
<xs:sequence>
<xs:element name="id" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="id" msprop:Generator_ColumnPropNameInRow="id" msprop:Generator_ColumnVarNameInTable="columnid" msprop:Generator_ColumnPropNameInTable="idColumn" type="xs:int" />
<xs:element name="path" msprop:Generator_UserColumnName="path" msprop:Generator_ColumnPropNameInRow="path" msprop:Generator_ColumnVarNameInTable="columnpath" msprop:Generator_ColumnPropNameInTable="pathColumn">
<xs:element name="id" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="id" msprop:Generator_ColumnVarNameInTable="columnid" msprop:Generator_ColumnPropNameInRow="id" msprop:Generator_ColumnPropNameInTable="idColumn" type="xs:int" />
<xs:element name="path" msprop:Generator_UserColumnName="path" msprop:Generator_ColumnVarNameInTable="columnpath" msprop:Generator_ColumnPropNameInRow="path" msprop:Generator_ColumnPropNameInTable="pathColumn">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="artist" msprop:Generator_UserColumnName="artist" msprop:Generator_ColumnPropNameInRow="artist" msprop:Generator_ColumnVarNameInTable="columnartist" msprop:Generator_ColumnPropNameInTable="artistColumn" minOccurs="0">
<xs:element name="artist" msprop:Generator_UserColumnName="artist" msprop:Generator_ColumnVarNameInTable="columnartist" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="artist" msprop:Generator_ColumnPropNameInTable="artistColumn" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="title" msprop:Generator_UserColumnName="title" msprop:Generator_ColumnPropNameInRow="title" msprop:Generator_ColumnVarNameInTable="columntitle" msprop:Generator_ColumnPropNameInTable="titleColumn" minOccurs="0">
<xs:element name="title" msprop:Generator_UserColumnName="title" msprop:Generator_ColumnVarNameInTable="columntitle" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="title" msprop:Generator_ColumnPropNameInTable="titleColumn" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="album" msprop:Generator_UserColumnName="album" msprop:Generator_ColumnPropNameInRow="album" msprop:Generator_ColumnVarNameInTable="columnalbum" msprop:Generator_ColumnPropNameInTable="albumColumn" minOccurs="0">
<xs:element name="album" msprop:Generator_UserColumnName="album" msprop:Generator_ColumnVarNameInTable="columnalbum" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="album" msprop:Generator_ColumnPropNameInTable="albumColumn" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="length" msprop:Generator_UserColumnName="length" msprop:Generator_ColumnPropNameInRow="length" msprop:Generator_ColumnVarNameInTable="columnlength" msprop:Generator_ColumnPropNameInTable="lengthColumn" type="xs:int" minOccurs="0" />
<xs:element name="track" msprop:Generator_UserColumnName="track" msprop:Generator_ColumnPropNameInRow="track" msprop:Generator_ColumnVarNameInTable="columntrack" msprop:Generator_ColumnPropNameInTable="trackColumn" type="xs:int" minOccurs="0" />
<xs:element name="length" msprop:Generator_UserColumnName="length" msprop:Generator_ColumnVarNameInTable="columnlength" msprop:Generator_ColumnPropNameInRow="length" msprop:Generator_ColumnPropNameInTable="lengthColumn" type="xs:int" minOccurs="0" />
<xs:element name="track" msprop:Generator_UserColumnName="track" msprop:Generator_ColumnVarNameInTable="columntrack" msprop:Generator_ColumnPropNameInRow="track" msprop:Generator_ColumnPropNameInTable="trackColumn" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@@ -1 +1,12 @@

<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool to store the dataset designer's layout information.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="18" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:Playlist" ZOrder="1" X="70" Y="70" Height="210" Width="186" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
</Shapes>
<Connectors />
</DiagramLayout>

View File

@@ -134,7 +134,7 @@
this.mediaSlider.ButtonStyle = MediaSlider.MediaSlider.ButtonType.GlassOverlap;
this.mediaSlider.ContextMenuStrip = null;
this.mediaSlider.LargeChange = 2;
this.mediaSlider.Location = new System.Drawing.Point(0, 115);
this.mediaSlider.Location = new System.Drawing.Point(0, 112);
this.mediaSlider.Margin = new System.Windows.Forms.Padding(0);
this.mediaSlider.Maximum = 1;
this.mediaSlider.Minimum = 0;
@@ -242,7 +242,7 @@
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(361, 145);
this.ClientSize = new System.Drawing.Size(361, 136);
this.ControlBox = false;
this.Controls.Add(this.buttonNext);
this.Controls.Add(this.buttonRewind);
@@ -262,6 +262,7 @@
this.Name = "Deck";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Deck";
this.Load += new System.EventHandler(this.Deck_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Deck_DragDrop);
this.DragOver += new System.Windows.Forms.DragEventHandler(this.Deck_DragOver);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();

View File

@@ -21,6 +21,7 @@ namespace CUEPlayer
long playingFinish = 0;
Thread playThread;
int iSource;
AudioBuffer buff;
MixingSource mixer;
MixingWriter writer;
Deck nextDeck;
@@ -72,12 +73,15 @@ namespace CUEPlayer
textBoxAlbum.Text = playingRow < 0 ? "" : dataSet.Playlist[playingRow].album;
textBoxTitle.Text = playingRow < 0 ? "" : dataSet.Playlist[playingRow].title;
textBoxDuration.Text = "";
pictureBox.Image = playingCue != null ? playingCue.Cover : pictureBox.InitialImage;
pictureBox.Image = playingCue != null && playingCue.Cover != null ? playingCue.Cover : pictureBox.InitialImage;
if (nextDeck != null && nextDeck.playingSource == null && playingRow >= 0 && playingRow < dataSet.Playlist.Rows.Count - 1)
{
nextDeck.LoadDeck(playingRow + 1);
}
if (playThread != null)
(MdiParent as frmCUEPlayer).UpdateMetadata(textBoxArtist.Text, textBoxTitle.Text);
}
mediaSlider.Enabled = playingSource != null;
if (playingSource != null)
@@ -101,8 +105,6 @@ namespace CUEPlayer
private void PlayThread()
{
AudioBuffer buff = new AudioBuffer(playingSource.PCM, 0x2000);
try
{
do
@@ -151,6 +153,8 @@ namespace CUEPlayer
nextDeck.playingRow = -1;
nextDeck.needUpdate = true;
}
if (buff == null || buff.PCM.SampleRate != playingSource.PCM.SampleRate || buff.PCM.ChannelCount != playingSource.PCM.ChannelCount || buff.PCM.BitsPerSample != playingSource.PCM.BitsPerSample)
buff = new AudioBuffer(playingSource.PCM, 0x2000);
playingSource.Read(buff, Math.Min(buff.Size, (int)(playingFinish - playingSource.Position)));
writer.Write(buff);
}
@@ -205,12 +209,6 @@ namespace CUEPlayer
private void buttonPlay_Click(object sender, EventArgs e)
{
if (playingSource == null)
{
Playlist playlist = (MdiParent as frmCUEPlayer).wndPlaylist;
LoadDeck(playlist.List.SelectedIndices[0]);
}
mixer.BufferPlaying(iSource, true);
if (playThread == null)
{
playThread = new Thread(PlayThread);
@@ -219,6 +217,12 @@ namespace CUEPlayer
playThread.Name = Text;
playThread.Start();
}
if (playingSource == null)
{
Playlist playlist = (MdiParent as frmCUEPlayer).wndPlaylist;
LoadDeck(playlist.List.SelectedIndices[0]);
}
mixer.BufferPlaying(iSource, true);
}
private void buttonStop_Click(object sender, EventArgs e)
@@ -313,5 +317,10 @@ namespace CUEPlayer
playingSource.Position = playingStart;
}
}
private void Deck_Load(object sender, EventArgs e)
{
}
}
}

119
CUEPlayer/Icecast.Designer.cs generated Normal file
View File

@@ -0,0 +1,119 @@
namespace CUEPlayer
{
partial class Icecast
{
/// <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.timer1 = new System.Windows.Forms.Timer(this.components);
this.textBoxBytes = new System.Windows.Forms.TextBox();
this.checkBoxTransmit = new System.Windows.Forms.CheckBox();
this.buttonSettings = new System.Windows.Forms.Button();
this.textBoxLatency = new System.Windows.Forms.TextBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.SuspendLayout();
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// textBoxBytes
//
this.textBoxBytes.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBoxBytes.Enabled = false;
this.textBoxBytes.Location = new System.Drawing.Point(2, 87);
this.textBoxBytes.Name = "textBoxBytes";
this.textBoxBytes.ReadOnly = true;
this.textBoxBytes.Size = new System.Drawing.Size(70, 13);
this.textBoxBytes.TabIndex = 14;
this.textBoxBytes.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// checkBoxTransmit
//
this.checkBoxTransmit.Appearance = System.Windows.Forms.Appearance.Button;
this.checkBoxTransmit.AutoSize = true;
this.checkBoxTransmit.Image = global::CUEPlayer.Properties.Resources.transmit_blue;
this.checkBoxTransmit.Location = new System.Drawing.Point(14, 106);
this.checkBoxTransmit.Name = "checkBoxTransmit";
this.checkBoxTransmit.Size = new System.Drawing.Size(22, 22);
this.checkBoxTransmit.TabIndex = 15;
this.checkBoxTransmit.UseVisualStyleBackColor = true;
this.checkBoxTransmit.CheckedChanged += new System.EventHandler(this.checkBoxTransmit_CheckedChanged);
//
// buttonSettings
//
this.buttonSettings.AutoSize = true;
this.buttonSettings.Image = global::CUEPlayer.Properties.Resources.cog;
this.buttonSettings.Location = new System.Drawing.Point(42, 106);
this.buttonSettings.Name = "buttonSettings";
this.buttonSettings.Size = new System.Drawing.Size(22, 22);
this.buttonSettings.TabIndex = 16;
this.buttonSettings.UseVisualStyleBackColor = true;
this.buttonSettings.Click += new System.EventHandler(this.buttonSettings_Click);
//
// textBoxLatency
//
this.textBoxLatency.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBoxLatency.Enabled = false;
this.textBoxLatency.Location = new System.Drawing.Point(2, 62);
this.textBoxLatency.Name = "textBoxLatency";
this.textBoxLatency.ReadOnly = true;
this.textBoxLatency.Size = new System.Drawing.Size(70, 13);
this.textBoxLatency.TabIndex = 17;
this.textBoxLatency.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// Icecast
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(74, 136);
this.Controls.Add(this.textBoxLatency);
this.Controls.Add(this.buttonSettings);
this.Controls.Add(this.checkBoxTransmit);
this.Controls.Add(this.textBoxBytes);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Icecast";
this.Text = "Icecast";
this.Load += new System.EventHandler(this.Icecast_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.TextBox textBoxBytes;
private System.Windows.Forms.CheckBox checkBoxTransmit;
private System.Windows.Forms.Button buttonSettings;
private System.Windows.Forms.TextBox textBoxLatency;
private System.Windows.Forms.ToolTip toolTip1;
}
}

142
CUEPlayer/Icecast.cs Normal file
View File

@@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;
using System.Net;
using CUETools.Codecs;
using CUETools.Codecs.Icecast;
namespace CUEPlayer
{
public partial class Icecast : Form
{
private IcecastWriter _icecastWriter;
private IcecastSettingsData _icecastSettings;
private CUETools.DSP.Mixer.MixingSource _mixer;
private Thread flushThread;
private AudioPipe buffer;
private bool close = false;
private int latency = 0;
public Icecast()
{
InitializeComponent();
}
private void Icecast_Load(object sender, EventArgs e)
{
if (Properties.Settings.Default.IcecastSettings == null)
Properties.Settings.Default.IcecastSettings = new IcecastSettingsData();
_icecastSettings = Properties.Settings.Default.IcecastSettings;
}
public void Init(frmCUEPlayer parent)
{
MdiParent = parent;
Show();
_mixer = parent.Mixer;
buffer = new AudioPipe(_mixer.PCM, _mixer.PCM.SampleRate * 10); // 10 secs
_mixer.AudioRead += new EventHandler<CUETools.DSP.Mixer.AudioReadEventArgs>(Mixer_AudioRead);
parent.updateMetadata += new EventHandler<UpdateMetadataEvent>(parent_updateMetadata);
flushThread = new Thread(FlushThread);
flushThread.Priority = ThreadPriority.AboveNormal;
flushThread.IsBackground = true;
flushThread.Name = "Icecast";
flushThread.Start();
}
void parent_updateMetadata(object sender, UpdateMetadataEvent e)
{
if (_icecastWriter != null)
_icecastWriter.UpdateMetadata(e.artist, e.title);
}
private void FlushThread()
{
AudioBuffer result = new AudioBuffer(_mixer.PCM, _mixer.BufferSize);
while (true)
{
buffer.Read(result, -1);
if (_icecastWriter != null && !close)
{
try
{
_icecastWriter.Write(result);
}
catch (Exception ex)
{
close = true;
}
}
if (_icecastWriter != null && close)
{
_icecastWriter.Delete();
_icecastWriter = null;
}
}
}
void Mixer_AudioRead(object sender, CUETools.DSP.Mixer.AudioReadEventArgs e)
{
latency = buffer.Write(e.buffer);
//int bs = buffer.Write(e.buffer);
//if (bs > 0)
//{
// Trace.WriteLine(string.Format("buffer size {0}", bs));
//}
}
private void timer1_Tick(object sender, EventArgs e)
{
textBoxBytes.Text = _icecastWriter == null ? "" : string.Format("{0}K", _icecastWriter.BytesWritten/1024);
textBoxLatency.Text = (_icecastWriter == null || latency == 0 ) ? "" : string.Format("{0}", 1.0 * latency / buffer.PCM.SampleRate);
}
private void checkBoxTransmit_CheckedChanged(object sender, EventArgs e)
{
close = !checkBoxTransmit.Checked;
this.toolTip1.SetToolTip(this.checkBoxTransmit, "");
if (!close && _icecastWriter == null)
{
IcecastWriter icecastWriter = new IcecastWriter(_mixer.PCM, _icecastSettings);
try
{
icecastWriter.Connect();
if (icecastWriter.Response.StatusCode == HttpStatusCode.OK)
_icecastWriter = icecastWriter;
else
{
toolTip1.ToolTipIcon = ToolTipIcon.Error;
toolTip1.ToolTipTitle = icecastWriter.Response.StatusCode.ToString();
toolTip1.IsBalloon = true;
//toolTip1.Show(resp.StatusDescription, checkBoxTransmit, 0, 0, 2000);
toolTip1.SetToolTip(checkBoxTransmit, icecastWriter.Response.StatusDescription);
}
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
icecastWriter.Close();
toolTip1.ToolTipIcon = ToolTipIcon.Error;
toolTip1.ToolTipTitle = "Exception";
toolTip1.IsBalloon = true;
//toolTip1.Show(ex.Message, checkBoxTransmit, 0, 0, 2000);
toolTip1.SetToolTip(checkBoxTransmit, ex.Message);
}
}
}
private void buttonSettings_Click(object sender, EventArgs e)
{
IcecastSettings frm = new IcecastSettings(_icecastSettings);
if (frm.ShowDialog(this) == DialogResult.OK)
Properties.Settings.Default.Save();
}
}
}

126
CUEPlayer/Icecast.resx Normal file
View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 17</value>
</metadata>
</root>

301
CUEPlayer/IcecastSettings.Designer.cs generated Normal file
View File

@@ -0,0 +1,301 @@
namespace CUEPlayer
{
partial class IcecastSettings
{
/// <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();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(IcecastSettings));
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOk = new System.Windows.Forms.Button();
this.textBoxServer = new System.Windows.Forms.TextBox();
this.textBoxPort = new System.Windows.Forms.TextBox();
this.textBoxPassword = new System.Windows.Forms.TextBox();
this.textBoxMount = new System.Windows.Forms.TextBox();
this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxDesctiption = new System.Windows.Forms.TextBox();
this.textBoxWeb = new System.Windows.Forms.TextBox();
this.comboBoxGenre = new System.Windows.Forms.ComboBox();
this.labelServer = new System.Windows.Forms.Label();
this.labelPort = new System.Windows.Forms.Label();
this.labelPassword = new System.Windows.Forms.Label();
this.labelMount = new System.Windows.Forms.Label();
this.labelStationName = new System.Windows.Forms.Label();
this.labelStationDescription = new System.Windows.Forms.Label();
this.labelWeb = new System.Windows.Forms.Label();
this.labelGenre = new System.Windows.Forms.Label();
this.textBoxMP3Options = new System.Windows.Forms.TextBox();
this.labelMP3Options = new System.Windows.Forms.Label();
this.icecastSettingsDataBindingSource = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.icecastSettingsDataBindingSource)).BeginInit();
this.SuspendLayout();
//
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(197, 272);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 0;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// buttonOk
//
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOk.Location = new System.Drawing.Point(116, 272);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(75, 23);
this.buttonOk.TabIndex = 1;
this.buttonOk.Text = "OK";
this.buttonOk.UseVisualStyleBackColor = true;
//
// textBoxServer
//
this.textBoxServer.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Server", true));
this.textBoxServer.Location = new System.Drawing.Point(91, 12);
this.textBoxServer.Name = "textBoxServer";
this.textBoxServer.Size = new System.Drawing.Size(181, 20);
this.textBoxServer.TabIndex = 2;
//
// textBoxPort
//
this.textBoxPort.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Port", true));
this.textBoxPort.Location = new System.Drawing.Point(91, 38);
this.textBoxPort.Name = "textBoxPort";
this.textBoxPort.Size = new System.Drawing.Size(181, 20);
this.textBoxPort.TabIndex = 3;
//
// textBoxPassword
//
this.textBoxPassword.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Password", true));
this.textBoxPassword.Location = new System.Drawing.Point(91, 64);
this.textBoxPassword.Name = "textBoxPassword";
this.textBoxPassword.Size = new System.Drawing.Size(181, 20);
this.textBoxPassword.TabIndex = 4;
this.textBoxPassword.UseSystemPasswordChar = true;
//
// textBoxMount
//
this.textBoxMount.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Mount", true));
this.textBoxMount.Location = new System.Drawing.Point(91, 90);
this.textBoxMount.Name = "textBoxMount";
this.textBoxMount.Size = new System.Drawing.Size(181, 20);
this.textBoxMount.TabIndex = 5;
//
// textBoxName
//
this.textBoxName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Name", true));
this.textBoxName.Location = new System.Drawing.Point(91, 116);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(181, 20);
this.textBoxName.TabIndex = 6;
//
// textBoxDesctiption
//
this.textBoxDesctiption.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Desctiption", true));
this.textBoxDesctiption.Location = new System.Drawing.Point(91, 142);
this.textBoxDesctiption.Name = "textBoxDesctiption";
this.textBoxDesctiption.Size = new System.Drawing.Size(181, 20);
this.textBoxDesctiption.TabIndex = 7;
//
// textBoxWeb
//
this.textBoxWeb.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Url", true));
this.textBoxWeb.Location = new System.Drawing.Point(91, 168);
this.textBoxWeb.Name = "textBoxWeb";
this.textBoxWeb.Size = new System.Drawing.Size(181, 20);
this.textBoxWeb.TabIndex = 8;
//
// comboBoxGenre
//
this.comboBoxGenre.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "Genre", true));
this.comboBoxGenre.FormattingEnabled = true;
this.comboBoxGenre.Location = new System.Drawing.Point(91, 194);
this.comboBoxGenre.Name = "comboBoxGenre";
this.comboBoxGenre.Size = new System.Drawing.Size(181, 21);
this.comboBoxGenre.TabIndex = 9;
//
// labelServer
//
this.labelServer.AutoSize = true;
this.labelServer.Location = new System.Drawing.Point(12, 15);
this.labelServer.Name = "labelServer";
this.labelServer.Size = new System.Drawing.Size(38, 13);
this.labelServer.TabIndex = 10;
this.labelServer.Text = "Server";
//
// labelPort
//
this.labelPort.AutoSize = true;
this.labelPort.Location = new System.Drawing.Point(12, 41);
this.labelPort.Name = "labelPort";
this.labelPort.Size = new System.Drawing.Size(26, 13);
this.labelPort.TabIndex = 11;
this.labelPort.Text = "Port";
//
// labelPassword
//
this.labelPassword.AutoSize = true;
this.labelPassword.Location = new System.Drawing.Point(12, 67);
this.labelPassword.Name = "labelPassword";
this.labelPassword.Size = new System.Drawing.Size(53, 13);
this.labelPassword.TabIndex = 12;
this.labelPassword.Text = "Password";
//
// labelMount
//
this.labelMount.AutoSize = true;
this.labelMount.Location = new System.Drawing.Point(12, 93);
this.labelMount.Name = "labelMount";
this.labelMount.Size = new System.Drawing.Size(37, 13);
this.labelMount.TabIndex = 13;
this.labelMount.Text = "Mount";
//
// labelStationName
//
this.labelStationName.AutoSize = true;
this.labelStationName.Location = new System.Drawing.Point(12, 119);
this.labelStationName.Name = "labelStationName";
this.labelStationName.Size = new System.Drawing.Size(35, 13);
this.labelStationName.TabIndex = 14;
this.labelStationName.Text = "Name";
//
// labelStationDescription
//
this.labelStationDescription.AutoSize = true;
this.labelStationDescription.Location = new System.Drawing.Point(12, 145);
this.labelStationDescription.Name = "labelStationDescription";
this.labelStationDescription.Size = new System.Drawing.Size(60, 13);
this.labelStationDescription.TabIndex = 15;
this.labelStationDescription.Text = "Description";
//
// labelWeb
//
this.labelWeb.AutoSize = true;
this.labelWeb.Location = new System.Drawing.Point(12, 171);
this.labelWeb.Name = "labelWeb";
this.labelWeb.Size = new System.Drawing.Size(30, 13);
this.labelWeb.TabIndex = 16;
this.labelWeb.Text = "Web";
//
// labelGenre
//
this.labelGenre.AutoSize = true;
this.labelGenre.Location = new System.Drawing.Point(12, 197);
this.labelGenre.Name = "labelGenre";
this.labelGenre.Size = new System.Drawing.Size(36, 13);
this.labelGenre.TabIndex = 17;
this.labelGenre.Text = "Genre";
//
// textBoxMP3Options
//
this.textBoxMP3Options.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.icecastSettingsDataBindingSource, "MP3Options", true));
this.textBoxMP3Options.Location = new System.Drawing.Point(91, 221);
this.textBoxMP3Options.Name = "textBoxMP3Options";
this.textBoxMP3Options.Size = new System.Drawing.Size(181, 20);
this.textBoxMP3Options.TabIndex = 18;
//
// labelMP3Options
//
this.labelMP3Options.AutoSize = true;
this.labelMP3Options.Location = new System.Drawing.Point(12, 224);
this.labelMP3Options.Name = "labelMP3Options";
this.labelMP3Options.Size = new System.Drawing.Size(68, 13);
this.labelMP3Options.TabIndex = 19;
this.labelMP3Options.Text = "MP3 Options";
//
// icecastSettingsDataBindingSource
//
this.icecastSettingsDataBindingSource.DataSource = typeof(CUETools.Codecs.Icecast.IcecastSettingsData);
//
// IcecastSettings
//
this.AcceptButton = this.buttonOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(284, 307);
this.Controls.Add(this.labelMP3Options);
this.Controls.Add(this.textBoxMP3Options);
this.Controls.Add(this.labelGenre);
this.Controls.Add(this.labelWeb);
this.Controls.Add(this.labelStationDescription);
this.Controls.Add(this.labelStationName);
this.Controls.Add(this.labelMount);
this.Controls.Add(this.labelPassword);
this.Controls.Add(this.labelPort);
this.Controls.Add(this.labelServer);
this.Controls.Add(this.comboBoxGenre);
this.Controls.Add(this.textBoxWeb);
this.Controls.Add(this.textBoxDesctiption);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.textBoxMount);
this.Controls.Add(this.textBoxPassword);
this.Controls.Add(this.textBoxPort);
this.Controls.Add(this.textBoxServer);
this.Controls.Add(this.buttonOk);
this.Controls.Add(this.buttonCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "IcecastSettings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Icecast Settings";
this.Load += new System.EventHandler(this.IcecastSettings_Load);
((System.ComponentModel.ISupportInitialize)(this.icecastSettingsDataBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Button buttonOk;
private System.Windows.Forms.TextBox textBoxServer;
private System.Windows.Forms.TextBox textBoxPort;
private System.Windows.Forms.TextBox textBoxPassword;
private System.Windows.Forms.TextBox textBoxMount;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.TextBox textBoxDesctiption;
private System.Windows.Forms.TextBox textBoxWeb;
private System.Windows.Forms.ComboBox comboBoxGenre;
private System.Windows.Forms.Label labelServer;
private System.Windows.Forms.Label labelPort;
private System.Windows.Forms.Label labelPassword;
private System.Windows.Forms.Label labelMount;
private System.Windows.Forms.Label labelStationName;
private System.Windows.Forms.Label labelStationDescription;
private System.Windows.Forms.Label labelWeb;
private System.Windows.Forms.Label labelGenre;
private System.Windows.Forms.BindingSource icecastSettingsDataBindingSource;
private System.Windows.Forms.TextBox textBoxMP3Options;
private System.Windows.Forms.Label labelMP3Options;
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CUETools.Codecs.Icecast;
namespace CUEPlayer
{
public partial class IcecastSettings : Form
{
public IcecastSettings(IcecastSettingsData data)
{
InitializeComponent();
icecastSettingsDataBindingSource.DataSource = data;
}
private void IcecastSettings_Load(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="icecastSettingsDataBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACjo6OampqaTgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF9fX01aWlpKWlpaAwAA
AAAAAAAAAAAAAAAAAAAAAAAAra2tS6Ojo+Sampp8AAAAAAAAAAAAAAAAAAAAAGxsbIBlZWXAX19fRQAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACtra28o6Oj95qampwAAAAAAAAAAH19faN0dHTzbGxsrgAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtra2MK2trf2jo6P+mpqaxJCQkMSGhob+fX199HR0
dCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC2traWra2t/Ofk4//l4uH/kJCQ/IaG
hocAAAAAAAAAAAAAAAAAAAAAAAAAAOCfam/emmZm3ZdfDwAAAAAAAAAAv7+/Era2tvOtra3+o6Oj/pqa
muWQkJAMAAAAAAAAAAAAAAAA1Xs4P9V7OFXipXXb5K6E/96davbdmWMG3ZZcPgAAAAC/v7+j2tnY/9vZ
2P+jo6OiAAAAANV+PCzVfTkF1Xs45NmGSf/VezjV5auA+e3Fp//ipHX/4J9tCd+daP/dl2Pq0q2PPL+/
v/u2trb6vZ+ISNiGR+HXhEP/1YI9CdV/PP/jp3r/1Xs48+ayifnuyq3/5ap+/+OneAPionL246d3/96a
Zj/Hx8dOv7+/KtuPUz/dlV3/2IlK9teFRAPVgkD/46p9/9V9OfDotpHY7suu/+Wxif/lrYIJ46h7q+e1
jv/goXCq3p1qP92ZYz/dllyq4qV2/9qOU6vaiU0J2YlI/+Knev/Vgj/V6byZkOzHqf/qvZv/5rOLQuWu
hRvlq4De6LWP/+Srf//jp3r/5KyA/92XY97dlFsb25FWQt2XX//goG7/2IZHjevBny3rvpz87syw/+i4
lPzmto4f5rKJDOWug4Tlqn7G46d4xuKicoTgn2oM3ppmH92XX/zlrID/249T/NqLTioAAAAA7MOikO7J
rv/vyq3/6buX/Oi2kULmtYwJAAAAAAAAAADjqHsJ4qV1QuChcPzlsIb/4qh6/92WXI0AAAAAAAAAAOzE
pQbsxKS37squ//DNtP/rwqL/6LqV/+i2kf/ms4v/5a+G/+ezi//qu5n/5rGI/+CfbbfenGcGAAAAAAAA
AAAAAAAAAAAAAOzEpXLsw6L2782x//HQuP/x07v/8NC5/+3Lrv/rwKD/5a6D9uWqfnIAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA7MSlJ+zEpY3sw6LM67+f/Ou+mvzpu5fM6LaRjea1jCcAAAAAAAAAAAAA
AAAAAAAA5+MAAOPHAADxjwAA8A8AAPgfAAAYHAAABCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYEAAIAB
AADgBwAA8A8AAA==
</value>
</data>
</root>

View File

@@ -29,12 +29,14 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Output));
this.mediaSliderVolume = new MediaSlider.MediaSlider();
this.peakMeterCtrl1 = new Ernzo.WinForms.Controls.PeakMeterCtrl();
this.buttonPause = new System.Windows.Forms.Button();
this.buttonPlay = new System.Windows.Forms.Button();
this.buttonStop = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.checkBoxMute = new System.Windows.Forms.CheckBox();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.outputBindingSource = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.outputBindingSource)).BeginInit();
this.SuspendLayout();
//
// mediaSliderVolume
@@ -61,7 +63,7 @@
this.mediaSliderVolume.Name = "mediaSliderVolume";
this.mediaSliderVolume.Orientation = System.Windows.Forms.Orientation.Vertical;
this.mediaSliderVolume.ShowButtonOnHover = false;
this.mediaSliderVolume.Size = new System.Drawing.Size(37, 114);
this.mediaSliderVolume.Size = new System.Drawing.Size(37, 101);
this.mediaSliderVolume.SliderFlyOut = MediaSlider.MediaSlider.FlyOutStyle.None;
this.mediaSliderVolume.SmallChange = 1;
this.mediaSliderVolume.SmoothScrolling = true;
@@ -91,63 +93,61 @@
this.peakMeterCtrl1.FalloffColor = System.Drawing.Color.Blue;
this.peakMeterCtrl1.GridColor = System.Drawing.Color.Gainsboro;
this.peakMeterCtrl1.LEDCount = 25;
this.peakMeterCtrl1.Location = new System.Drawing.Point(60, 9);
this.peakMeterCtrl1.Location = new System.Drawing.Point(46, 9);
this.peakMeterCtrl1.Margin = new System.Windows.Forms.Padding(0);
this.peakMeterCtrl1.Name = "peakMeterCtrl1";
this.peakMeterCtrl1.Size = new System.Drawing.Size(15, 109);
this.peakMeterCtrl1.Size = new System.Drawing.Size(15, 101);
this.peakMeterCtrl1.TabIndex = 13;
this.peakMeterCtrl1.Text = "peakMeterCtrl1";
//
// buttonPause
//
this.buttonPause.Image = global::CUEPlayer.Properties.Resources.control_pause_blue;
this.buttonPause.Location = new System.Drawing.Point(59, 130);
this.buttonPause.Name = "buttonPause";
this.buttonPause.Size = new System.Drawing.Size(25, 25);
this.buttonPause.TabIndex = 12;
this.buttonPause.UseVisualStyleBackColor = true;
this.buttonPause.Click += new System.EventHandler(this.buttonPause_Click);
//
// buttonPlay
//
this.buttonPlay.BackColor = System.Drawing.Color.Transparent;
this.buttonPlay.BackgroundImage = global::CUEPlayer.Properties.Resources.control_play_blue;
this.buttonPlay.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.buttonPlay.FlatAppearance.BorderSize = 0;
this.buttonPlay.Location = new System.Drawing.Point(9, 130);
this.buttonPlay.Name = "buttonPlay";
this.buttonPlay.Size = new System.Drawing.Size(25, 25);
this.buttonPlay.TabIndex = 10;
this.buttonPlay.UseVisualStyleBackColor = false;
this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click);
//
// buttonStop
//
this.buttonStop.Image = global::CUEPlayer.Properties.Resources.control_stop_blue;
this.buttonStop.Location = new System.Drawing.Point(34, 130);
this.buttonStop.Name = "buttonStop";
this.buttonStop.Size = new System.Drawing.Size(25, 25);
this.buttonStop.TabIndex = 11;
this.buttonStop.UseVisualStyleBackColor = true;
this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 50;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// checkBoxMute
//
this.checkBoxMute.Appearance = System.Windows.Forms.Appearance.Button;
this.checkBoxMute.Checked = true;
this.checkBoxMute.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxMute.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.outputBindingSource, "Muted", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.checkBoxMute.DataBindings.Add(new System.Windows.Forms.Binding("ImageIndex", this.outputBindingSource, "VolumeIcon", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.checkBoxMute.FlatAppearance.BorderSize = 0;
this.checkBoxMute.FlatAppearance.CheckedBackColor = System.Drawing.Color.Transparent;
this.checkBoxMute.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
this.checkBoxMute.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
this.checkBoxMute.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.checkBoxMute.ImageIndex = 0;
this.checkBoxMute.ImageList = this.imageList1;
this.checkBoxMute.Location = new System.Drawing.Point(16, 110);
this.checkBoxMute.Name = "checkBoxMute";
this.checkBoxMute.Size = new System.Drawing.Size(22, 22);
this.checkBoxMute.TabIndex = 15;
this.checkBoxMute.UseVisualStyleBackColor = true;
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "sound_mute.png");
this.imageList1.Images.SetKeyName(1, "sound_none.png");
this.imageList1.Images.SetKeyName(2, "sound_low.png");
this.imageList1.Images.SetKeyName(3, "sound.png");
//
// outputBindingSource
//
this.outputBindingSource.DataSource = typeof(CUEPlayer.Output);
//
// Output
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(96, 168);
this.ClientSize = new System.Drawing.Size(74, 136);
this.ControlBox = false;
this.Controls.Add(this.checkBoxMute);
this.Controls.Add(this.mediaSliderVolume);
this.Controls.Add(this.peakMeterCtrl1);
this.Controls.Add(this.buttonPause);
this.Controls.Add(this.buttonPlay);
this.Controls.Add(this.buttonStop);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
@@ -155,6 +155,7 @@
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Output";
this.Load += new System.EventHandler(this.Output_Load);
((System.ComponentModel.ISupportInitialize)(this.outputBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -163,9 +164,9 @@
private MediaSlider.MediaSlider mediaSliderVolume;
private Ernzo.WinForms.Controls.PeakMeterCtrl peakMeterCtrl1;
private System.Windows.Forms.Button buttonPause;
private System.Windows.Forms.Button buttonPlay;
private System.Windows.Forms.Button buttonStop;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.CheckBox checkBoxMute;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.BindingSource outputBindingSource;
}
}

View File

@@ -9,24 +9,39 @@ using System.Diagnostics;
using NAudio.CoreAudioApi;
using CUETools.Codecs;
using CUETools.Codecs.CoreAudio;
using CUETools.DSP.Resampler;
using CUETools.DSP.Mixer;
using CUETools.Processor;
namespace CUEPlayer
{
public partial class Output : Form
{
private IWavePlayer _player;
private AudioBuffer resampled;
private SOXResampler _resampler;
private MMDevice _device;
private DateTime _pauseTill;
private bool _muted;
internal MMDevice Device
public int VolumeIcon
{
get
{
return _device;
return _muted ? 0 : mediaSliderVolume.Value < 10 ? 1 : mediaSliderVolume.Value < 50 ? 2 : 3;
}
}
public bool Muted
{
get
{
return _muted;
}
set
{
_device = value;
_muted = value;
_pauseTill = DateTime.Now;
}
}
@@ -35,13 +50,73 @@ namespace CUEPlayer
InitializeComponent();
}
private void Output_Load(object sender, EventArgs e)
{
peakMeterCtrl1.Start(50);
outputBindingSource.DataSource = this;
}
public void Init(frmCUEPlayer parent)
{
MdiParent = parent;
_device = WasapiOut.GetDefaultAudioEndpoint();
_device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
mediaSliderVolume.Value = (int)(_device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
//mediaSliderVolume.Maximum = (int)(_device.AudioEndpointVolume.VolumeRange);
Show();
int delay = 100;
try
{
_player = new WasapiOut(_device, NAudio.CoreAudioApi.AudioClientShareMode.Shared, true, delay, new AudioPCMConfig(32, 2, 44100));
}
catch
{
_player = null;
}
if (_player == null)
{
try
{
_player = new WasapiOut(_device, NAudio.CoreAudioApi.AudioClientShareMode.Shared, true, delay, new AudioPCMConfig(32, 2, 48000));
SOXResamplerConfig cfg;
cfg.quality = SOXResamplerQuality.Very;
cfg.phase = 50;
cfg.allow_aliasing = false;
cfg.bandwidth = 0;
_resampler = new SOXResampler(parent.Mixer.PCM, _player.PCM, cfg);
resampled = new AudioBuffer(_player.PCM, parent.Mixer.BufferSize * 2 * parent.Mixer.PCM.SampleRate / _player.PCM.SampleRate);
}
catch (Exception ex)
{
_player = null;
Trace.WriteLine(ex.Message);
}
}
parent.Mixer.AudioRead += new EventHandler<AudioReadEventArgs>(Mixer_AudioRead);
if (_player != null)
_player.Play();
}
void Mixer_AudioRead(object sender, AudioReadEventArgs e)
{
if (_muted || _player == null)
{
double tosleep = (_pauseTill - DateTime.Now).TotalMilliseconds;
if (tosleep > 0) System.Threading.Thread.Sleep((int)tosleep);
_pauseTill = DateTime.Now.AddMilliseconds(1000 * e.buffer.Length / e.buffer.PCM.SampleRate);
return;
}
if (_resampler == null)
_player.Write(e.buffer);
else
{
//Trace.WriteLine(string.Format("Flow: {0}", result.Length));
_resampler.Flow(e.buffer, resampled);
//Trace.WriteLine(string.Format("Play: {0}", resampled.Length));
if (resampled.Length != 0)
_player.Write(resampled);
}
}
void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
@@ -51,13 +126,17 @@ namespace CUEPlayer
if (this.InvokeRequired)
this.Invoke((MethodInvoker)delegate() { AudioEndpointVolume_OnVolumeNotification(data); });
else
{
mediaSliderVolume.Value = (int)(data.MasterVolume * 100);
outputBindingSource.ResetBindings(false);
}
}
private void mediaSliderVolume_Scrolled(object sender, EventArgs e)
{
try
{
outputBindingSource.ResetBindings(false);
_device.AudioEndpointVolume.MasterVolumeLevelScalar = mediaSliderVolume.Value / 100.0f;
}
catch (Exception ex)
@@ -82,25 +161,5 @@ namespace CUEPlayer
//peakValues[0] = (int)(_device.AudioMeterInformation.MasterPeakValue * 100);
peakMeterCtrl1.SetData(peakValues, 0, peakValues.Length);
}
private void buttonPlay_Click(object sender, EventArgs e)
{
(MdiParent as frmCUEPlayer).buttonPlay_Click(sender, e);
}
private void buttonStop_Click(object sender, EventArgs e)
{
(MdiParent as frmCUEPlayer).buttonStop_Click(sender, e);
}
private void buttonPause_Click(object sender, EventArgs e)
{
(MdiParent as frmCUEPlayer).buttonPause_Click(sender, e);
}
private void Output_Load(object sender, EventArgs e)
{
peakMeterCtrl1.Start(50);
}
}
}

View File

@@ -120,4 +120,63 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="outputBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>214, 17</value>
</metadata>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 17</value>
</metadata>
<data name="imageList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC0
CgAAAk1TRnQBSQFMAgEBBAEAAQwBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AiQAB9AH/
BAAB8gHsCgAB8gH4DgAB8gH4DgAB8gHsCwAB/wHjAZQB/wEAAf8BvAJtCAAB/wG8Am0MAAH/AbwCbQwA
Af8BvAJtBQABvQH/BQABBwHjARYB8wHsAW0B6wFtBAAD9AHzAewBbQHrAW0IAAP0AfMB7AFtAesBbQQA
Af8DAAP0AfMB7AFtAesBbQQAAb0BRwFvBQAB6wFvARcBbwHrARIB6gFtBAAC6wNtARIB6gFtCAAC6wNt
ARIB6gFtAwABGgH/AwAC6wNtARIB6gFtAwABGgH/AUYBRwEaBAAB7AGSAW8BFwFGARQB6gFtBAAB+AGS
AesBbQESARUB6gFtCAAB+AGSAesBbQESARUB6gFtAgABGgEXARoB/wIAAewBkgHrAW0BEgEVAeoBbQIA
ARoBFwIaAUcBbwQAAewBkgFtAW4BFwFGAm0EAAHsAZIBbQHqARIBEwJtCAAB7AGSAW0B6gESARMCbQEA
AeMB9AIXAwAB7AGSAW0B6gESARMCbQEAAeMB9AIXAQACRgQAAewB9wLsAW8BFwFvAesEAAHsAfcC7AH4
AesB7AFtCAAB7AH3AuwB+AHrAewBbQEAARYB9AHjARcDAAHsAfcD7AHrAewBbQEAARYB9AHjARcBAAEX
AUYEAAHsAwcBkgFvARcBbwH/AwAB7AMHAZIB7AHtAesIAAHsAwcBkgHsAe0B6wIAARsB4wEaAf8CAAHs
AwcBkgHsAe0B6wIAARsB4wIaARcBFgQAAewD7QH3Ae8BbwEXAZQDAAHsA+0B9wHvAfcB6wgAAewD7QH3
Ae8B9wHrAwABGwH/AwAB7APtAfcB7wH3AesDAAEbAf8BbwHjARoEAAT0AfcBkgHvAW8BFgH/AgAE9AH3
AZIB7wH4CAAE9AH3AZIB7wH4BAAB/wMABPQB9wGSAe8B7AQAARoB4wGTCQAB/wHwAuwBGgH/BgAB/wHw
AuwMAAH/AfAC7AwAAf8B8ALsBQABGwH/CwAB8gGSCgAB8gGSDgAB8gGSDgAB8gGSiAABQgFNAT4HAAE+
AwABKAMAAUADAAEgAwABAQEAAQEGAAEBFgAD/4EAEP8B8wHPAfwB/wH8Af8B/AH/AeEBDwHwAf8B8AH/
AfAB+QHwAQ8BAAH/AQAB9wEAAfEB8AEPAQAB/wEAAecBAAHgAfABDwEAAf8BAAHDAQABwAHwAQ8BAAH/
AQABhwEAAYQB8AEPAQAB/wEAAYcBAAGEAfABBwEAAf8BAAHDAQABwAHwAQcBAAH/AQAB5wEAAeAB8AED
AQAB/wEAAfcBAAHxAf8BAwHwAf8B8AH/AfAB+QH/Ac8B/AH/AfwB/wH8Ef8L
</value>
</data>
</root>

View File

@@ -104,6 +104,7 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "Playlist";
this.Text = "Playlist";
this.Load += new System.EventHandler(this.Playlist_Load);
this.contextMenuStripPlaylist.ResumeLayout(false);
this.ResumeLayout(false);

View File

@@ -33,7 +33,16 @@ namespace CUEPlayer
_icon_mgr = parent.IconMgr;
listViewTracks.SmallImageList = _icon_mgr.ImageList;
foreach (DataSet1.PlaylistRow row in dataSet.Playlist)
listViewTracks.Items.Add(ToItem(row));
{
try
{
listViewTracks.Items.Add(ToItem(row));
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
}
public ListView List
@@ -161,5 +170,10 @@ namespace CUEPlayer
return;
}
}
private void Playlist_Load(object sender, EventArgs e)
{
}
}
}

View File

@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CUEPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyCompany("CUETools")]
[assembly: AssemblyProduct("CUEPlayer")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyCopyright("Copyright © Gregory S. Chudov 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.0.7.0")]
[assembly: AssemblyFileVersion("2.0.7.0")]

View File

@@ -6,5 +6,5 @@
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="frmCUEPlayer" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>CUEPlayer.frmCUEPlayer, CUEPlayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
<TypeInfo>CUEPlayer.frmCUEPlayer, CUEPlayer, Version=2.0.7.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -60,6 +60,13 @@ namespace CUEPlayer.Properties {
}
}
internal static System.Drawing.Bitmap cog {
get {
object obj = ResourceManager.GetObject("cog", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap control_eject {
get {
object obj = ResourceManager.GetObject("control_eject", resourceCulture);
@@ -143,5 +150,26 @@ namespace CUEPlayer.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap sound {
get {
object obj = ResourceManager.GetObject("sound", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap sound_mute {
get {
object obj = ResourceManager.GetObject("sound_mute", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap transmit_blue {
get {
object obj = ResourceManager.GetObject("transmit_blue", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -118,8 +118,8 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="control_eject_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_eject_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="ctdb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ctdb.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_fastforward_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_fastforward_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -130,20 +130,32 @@
<data name="control_eject" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_eject.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_end_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_end_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="control_eject_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_eject_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_stop_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_stop_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="sound_mute" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sound_mute.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_repeat_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_repeat_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="sound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sound.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_rewind_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_rewind_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="transmit_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\transmit_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_pause_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_pause_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_stop_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_stop_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="control_end_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_end_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_play_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_play_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -151,7 +163,7 @@
<data name="control_equalizer_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_equalizer_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ctdb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ctdb.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="cog" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cog.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -32,5 +32,27 @@ namespace CUEPlayer.Properties {
return ((string)(this["CUEPlayerConnectionString"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::CUETools.Codecs.Icecast.IcecastSettingsData IcecastSettings {
get {
return ((global::CUETools.Codecs.Icecast.IcecastSettingsData)(this["IcecastSettings"]));
}
set {
this["IcecastSettings"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::CUEPlayer.CUEPlayerSettings AppSettings {
get {
return ((global::CUEPlayer.CUEPlayerSettings)(this["AppSettings"]));
}
set {
this["AppSettings"] = value;
}
}
}
}

View File

@@ -10,5 +10,11 @@
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=|DataDirectory|\CUEPlayer.sdf</Value>
</Setting>
<Setting Name="IcecastSettings" Type="CUETools.Codecs.Icecast.IcecastSettingsData" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AppSettings" Type="CUEPlayer.CUEPlayerSettings" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

BIN
CUEPlayer/Resources/cog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

28
CUEPlayer/Settings.cs Normal file
View File

@@ -0,0 +1,28 @@
namespace CUEPlayer.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}

View File

@@ -7,4 +7,9 @@
connectionString="Data Source=|DataDirectory|\CUEPlayer.sdf"
providerName="Microsoft.SqlServerCe.Client.3.5" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="plugins (x64)"/>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -28,24 +28,62 @@
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.windowsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.icecastToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.windowsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1200, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
// windowsToolStripMenuItem
//
this.windowsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.icecastToolStripMenuItem});
this.windowsToolStripMenuItem.Name = "windowsToolStripMenuItem";
this.windowsToolStripMenuItem.Size = new System.Drawing.Size(68, 20);
this.windowsToolStripMenuItem.Text = "Windows";
//
// icecastToolStripMenuItem
//
this.icecastToolStripMenuItem.Name = "icecastToolStripMenuItem";
this.icecastToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.icecastToolStripMenuItem.Text = "Icecast";
this.icecastToolStripMenuItem.Click += new System.EventHandler(this.icecastToolStripMenuItem_Click);
//
// frmCUEPlayer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1200, 477);
this.ClientSize = new System.Drawing.Size(1200, 474);
this.Controls.Add(this.menuStrip1);
this.IsMdiContainer = true;
this.MainMenuStrip = this.menuStrip1;
this.Name = "frmCUEPlayer";
this.Text = "CUEPlayer 2.0.7";
this.Load += new System.EventHandler(this.frmCUEPlayer_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmCUEPlayer_FormClosing);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem windowsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem icecastToolStripMenuItem;
}
}

View File

@@ -8,12 +8,9 @@ using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Diagnostics;
using NAudio.CoreAudioApi;
using CUEControls;
using CUETools.Codecs;
using CUETools.Codecs.CoreAudio;
using CUETools.DSP.Mixer;
using CUETools.DSP.Resampler;
using CUETools.Processor;
namespace CUEPlayer
@@ -22,12 +19,10 @@ namespace CUEPlayer
{
private ShellIconMgr _icon_mgr;
private CUEConfig _config;
private IWavePlayer _player;
DataSet1TableAdapters.PlaylistTableAdapter adapterPlayList = new DataSet1TableAdapters.PlaylistTableAdapter();
private DataSet1 dataSet = new DataSet1();
private Thread mixThread;
private MixingSource _mixer;
private SOXResampler _resampler;
internal Playlist wndPlaylist
{
@@ -85,236 +80,42 @@ namespace CUEPlayer
private void frmCUEPlayer_Load(object sender, EventArgs e)
{
int delay = 100;
AudioPCMConfig mixerPCM = AudioPCMConfig.RedBook;
if (Properties.Settings.Default.AppSettings == null)
{
Properties.Settings.Default.AppSettings = new CUEPlayerSettings();
Properties.Settings.Default.AppSettings.IcecastServers.Add(new CUETools.Codecs.Icecast.IcecastSettingsData());
}
//System.Data.SqlServerCe.SqlCeDataAdapter ad = new System.Data.SqlServerCe.SqlCeDataAdapter();
//ad.SelectCommand = new System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM Playlist WHERE track=1", adapterPlayList.Connection);
//ad.Fill(dataSet.Playlist);
adapterPlayList.Fill(dataSet.Playlist);
_mixer = new MixingSource(mixerPCM, delay, 2);
_mixer = new MixingSource(new AudioPCMConfig(32, 2, 44100), 100, 2);
outputA.Init(this);
browser.Init(this);
playlist.Init(this);
deckB.Init(this, null);
deckA.Init(this, deckB);
Icecast icecast = new Icecast();
icecast.Init(this);
//LayoutMdi(MdiLayout.TileHorizontal);
browser.Location = new Point(0, 0);
browser.Height = ClientRectangle.Height - 5;
browser.Height = ClientRectangle.Height - 5 - menuStrip1.Height;
playlist.Location = new Point(browser.Location.X + browser.Width, 0);
playlist.Height = ClientRectangle.Height - 5;
playlist.Height = ClientRectangle.Height - 5 - menuStrip1.Height;
deckA.Location = new Point(playlist.Location.X + playlist.Width, 0);
deckB.Location = new Point(playlist.Location.X + playlist.Width, deckA.Height);
outputA.Location = new Point(deckA.Location.X + deckA.Width, 0);
icecast.Location = new Point(deckA.Location.X + deckA.Width, outputA.Height);
try
{
_player = new WasapiOut(outputA.Device, NAudio.CoreAudioApi.AudioClientShareMode.Shared, true, delay, new AudioPCMConfig(32, 2, 44100));
}
catch
{
_player = null;
}
if (_player == null)
{
try
{
_player = new WasapiOut(outputA.Device, NAudio.CoreAudioApi.AudioClientShareMode.Shared, true, delay, new AudioPCMConfig(32, 2, 48000));
SOXResamplerConfig cfg;
cfg.quality = SOXResamplerQuality.Very;
cfg.phase = 50;
cfg.allow_aliasing = false;
cfg.bandwidth = 0;
_resampler = new SOXResampler(mixerPCM, _player.PCM, cfg);
}
catch(Exception ex)
{
_player = null;
Trace.WriteLine(ex.Message);
}
}
if (_player != null)
{
_player.Play();
mixThread = new Thread(MixThread);
mixThread.Priority = ThreadPriority.AboveNormal;
mixThread.IsBackground = true;
mixThread.Name = "Mixer";
mixThread.Start();
}
}
Thread playThread;
int playingRow;
private void PlayThread()
{
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0x2000);
IAudioSource playingSource = null;
CUESheet playingCue = null;
long playingOffs = 0;
long playingFin = 0;
try
{
do
{
// End of playlist entry or source file
if (playingSource != null && (playingOffs == playingFin || playingSource.Remaining == 0))
{
this.Invoke((MethodInvoker)delegate()
{
playlist.List.Items[playingRow].BackColor = Color.White;
});
playingRow++;
playingOffs = 0;
if (playingRow >= dataSet.Playlist.Rows.Count)
break;
string path = dataSet.Playlist[playingRow].path;
int track = dataSet.Playlist[playingRow].track;
if (playingCue == null ||
playingSource == null ||
playingCue.InputPath != path ||
playingSource.Position != (long)playingCue.TOC[track].Start * 588)
{
if (playingSource != null)
{
playingSource.Close();
playingSource = null;
}
if (playingCue != null)
{
playingCue.Close();
playingCue = null;
}
}
else
{
playingFin = (long)playingCue.TOC[track].Length * 588;
this.Invoke((MethodInvoker)delegate()
{
playlist.List.Items[playingRow].BackColor = Color.AliceBlue;
//deckA.UpdateDeck(dataSet, playingRow, playingCue, playingFin);
});
}
}
// Open it
if (playingSource == null)
{
string path = dataSet.Playlist[playingRow].path;
int track = dataSet.Playlist[playingRow].track;
try
{
playingCue = new CUESheet(_config);
playingCue.Open(path);
playingSource = new CUESheetAudio(playingCue);
playingSource.Position = (long)playingCue.TOC[track].Start * 588 + playingOffs;
playingSource = new AudioPipe(playingSource, 0x2000);
playingFin = (long)playingCue.TOC[track].Length * 588;
this.Invoke((MethodInvoker)delegate()
{
playlist.List.Items[playingRow].BackColor = Color.AliceBlue;
//deckA.UpdateDeck(dataSet, playingRow, playingCue, playingFin);
});
}
catch (Exception ex)
{
// skip it
playingOffs = playingFin = 0;
continue;
}
}
playingSource.Read(buff, (int)(playingFin - playingOffs));
this.Invoke((MethodInvoker)delegate()
{
deckA.PlayingOffset = (int)playingOffs;
});
_player.Write(buff);
playingOffs += buff.Length;
} while (_player.PlaybackState != PlaybackState.Stopped);
}
catch (Exception ex)
{
// Can't invoke while joining
//if (playingRow < dataSet.Playlist.Rows.Count)
// this.Invoke((MethodInvoker)delegate()
// {
// listViewTracks.Items[playingRow].BackColor = Color.White;
// });
}
if (playingCue != null)
{
playingCue.Close();
playingCue = null;
}
if (playingSource != null)
{
playingSource.Close();
playingSource = null;
}
}
internal void buttonPlay_Click(object sender, EventArgs e)
{
try
{
_player.Stop();
if (playThread != null)
{
playThread.Join();
playThread = null;
}
if (playlist.List.SelectedIndices.Count < 0)
return;
playingRow = playlist.List.SelectedIndices[0];
playlist.List.Items[playingRow].BackColor = Color.AliceBlue;
_player.Play();
playThread = new Thread(new ThreadStart(PlayThread));
playThread.Priority = ThreadPriority.AboveNormal;
playThread.IsBackground = true;
playThread.Start();
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
internal void buttonStop_Click(object sender, EventArgs e)
{
try
{
_player.Stop();
if (playThread != null)
{
playThread.Join();
playThread = null;
}
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
internal void buttonPause_Click(object sender, EventArgs e)
{
_player.Pause();
mixThread = new Thread(MixThread);
mixThread.Priority = ThreadPriority.AboveNormal;
mixThread.IsBackground = true;
mixThread.Name = "Mixer";
mixThread.Start();
}
private void frmCUEPlayer_FormClosing(object sender, FormClosingEventArgs e)
@@ -331,23 +132,55 @@ namespace CUEPlayer
private void MixThread()
{
AudioBuffer result = new AudioBuffer(
new AudioPCMConfig(_player.PCM.BitsPerSample, _player.PCM.ChannelCount, _mixer.PCM.SampleRate), _mixer.BufferSize);
AudioBuffer resampled = _resampler == null ? null : new AudioBuffer(_player.PCM, _mixer.BufferSize * 2 * _mixer.PCM.SampleRate / _player.PCM.SampleRate);
AudioBuffer result = new AudioBuffer(_mixer.PCM, _mixer.BufferSize);
while (true)
{
//Trace.WriteLine(string.Format("Read"));
_mixer.Read(result, -1);
if (_resampler == null)
_player.Write(result);
else
{
//Trace.WriteLine(string.Format("Flow: {0}", result.Length));
_resampler.Flow(result, resampled);
//Trace.WriteLine(string.Format("Play: {0}", resampled.Length));
if (resampled.Length != 0)
_player.Write(resampled);
}
}
}
public event EventHandler<UpdateMetadataEvent> updateMetadata;
public void UpdateMetadata(string artist, string title)
{
UpdateMetadataEvent e = new UpdateMetadataEvent();
e.artist = artist;
e.title = title;
if (updateMetadata != null)
updateMetadata(this, e);
}
private void icecastToolStripMenuItem_Click(object sender, EventArgs e)
{
Icecast icecast = new Icecast();
icecast.Init(this);
}
}
public class UpdateMetadataEvent: EventArgs
{
public string artist;
public string title;
}
public class CUEPlayerSettings
{
private BindingList<CUETools.Codecs.Icecast.IcecastSettingsData> icecastServers;
public CUEPlayerSettings()
{
icecastServers = new BindingList<CUETools.Codecs.Icecast.IcecastSettingsData>();
}
public BindingList<CUETools.Codecs.Icecast.IcecastSettingsData> IcecastServers
{
get
{
return icecastServers;
}
set
{
icecastServers = value;
}
}
}

View File

@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>39</value>
</metadata>