推荐到一个人的百度空间里去看,
里面有DirectSound的教程
还有DirectInput、DirectDraw的教程
但是DirectSound只能播放wav
给你个 很简单的
Public Class Form1
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
' 声明函数 mciexcute 加入库 winmm.all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call mciExecute("play E:\music\music\单身情歌.wma ")
'在 formload过程中 调用函数 mciexcute 里面 是 文件 路径
End Sub
End Class
''''''''''' WAV/wma背景音乐
Dim a As New Media.SoundPlayer
a.SoundLocation = "c:\windows.wav"
a.PlayLooping()
下面以C#为工具,把开发过程写出来.
{
public string identify;//TAG,三个字节
public char reserved1;//保留位,一个字节
}
///
/// 文件名
/// 返回字节数组
FileStream fs = new FileStream(FileName,FileMode.Open,FileAccess.Read);
Stream stream = fs;
int rl = 0;
byte[] Info = new byte[seekPos];
rl = stream.Read(Info,0,seekPos);
fs.Close();
stream.Close();
return Info;
string str = null;
int i;
int position = 0;//循环的起始值
int currentIndex = 0;//Info的当前索引值
//获取TAG标识
for(i = currentIndex;i
str = str+(char)Info[i];
position++;
currentIndex = position;
//获取歌名
str = null;
int j = 0;
bytTitle[j] = Info[i];
j++;
//获取歌手名
j = 0;
bytArtist[j] = Info[i];
//获取唱片名
bytAlbum[j] = Info[i];
//获取年
bytYear[j] = Info[i];
//获取注释
bytComment[j] = Info[i];
//以下获取保留位
上面程序用到下面的方法:
/// 将字节数组转换成字符串
/// 字节数组
/// 返回转换后的字符串
private string byteToString(byte[] b)
string str = enc.GetString(b);
str = str.Substring(0,str.IndexOf('\0') = 0 ? str.IndexOf('\0') : str.Length);//去掉无用字符
return str;
改名怎么办呢?我们按(演唱者)歌名 的格式对歌曲进行改名,程序如下:
/// 更改文件名
private bool ReName(string filePath)
if(File.Exists(filePath))
try
//更名
return true;
catch(Exception)
return false;
else
以上就是土嘎嘎小编为大家整理的vb.net歌曲信息相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!