C#实现wmp播放歌曲淡入淡出
想要实现淡入淡出功能,有个listview里有歌曲和需要淡入淡出,切入切出的时间。然后实现淡入淡出,还有切入切出,一开始播放就播放歌曲的副歌部分,副歌放完立即停止播放。
private void timer1_Tick(object sender, EventArgs e)
{
string t = DateTime.Now.ToLongTimeString().ToString();
this.textBox1.Text = t.ToString();
for (int i = 0; i < listView1.Items.Count; i++)
if (this.textBox1.Text == this.listView1.Items.SubItems.Text)
{
axWindowsMediaPlayer1.URL = listView1.Items.SubItems.Text;
axWindowsMediaPlayer1.Ctlcontrols.play();
//this.timer1.Enabled = false;
timer2.Enabled = true;
}
}
}
//下面想实现淡入淡出,根本不行啊
private void timer2_Tick_1(object sender, EventArgs e)
{
for (int x = 0; x < listView1.Items.Count; x++)
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
{
if (axWindowsMediaPlayer1.settings.volume > 70)
axWindowsMediaPlayer1.settings.volume = axWindowsMediaPlayer1.settings.volume - 1;
if (axWindowsMediaPlayer1.settings.volume < 0)
axWindowsMediaPlayer1.settings.volume = axWindowsMediaPlayer1.settings.volume + 1;
timer2.Enabled =false ;
}
}
//下面想实现切入
private void timer3_Tick(object sender, EventArgs e)
{
for (int y= 0; y< listView1.Items.Count; y++)
if (listView1.Items.SubItems.Text != null)
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
{
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = Convert.ToDouble(listView1.Items.SubItems.Text);
timer3.Enabled = false;
timer4.Enabled = true;
}
}
private double ToDouble(string p)
{
throw new NotImplementedException();
}
//下面想实现切出
private void timer4_Tick(object sender, EventArgs e)
{
for (int z = 0; z < listView1.Items.Count; z++)
if (listView1.Items.SubItems.Text != null)
if (axWindowsMediaPlayer1.Ctlcontrols.currentPosition ==Convert .ToDouble ( listView1.Items.SubItems.Text))
{
axWindowsMediaPlayer1.Ctlcontrols.stop();
timer4.Enabled = false;
}
淡入淡出 设置他的opacity就行了 0-100 ibcadmin 发表于 2014-5-7 00:43
淡入淡出 设置他的opacity就行了 0-100
是歌曲播放淡入淡出不是窗口啊 2712 发表于 2014-5-7 02:03
是歌曲播放淡入淡出不是窗口啊
你的歌曲 指的是字幕? ibcadmin 发表于 2014-5-7 22:33
你的歌曲 指的是字幕?
就是歌曲声音逐渐增大 2712 发表于 2014-5-8 11:39
就是歌曲声音逐渐增大
这没研究过..
页:
[1]