0
我想从C#中的.mp3文件中为音频播放器检索详细信息。歌曲信息检索
代码剪断:
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
public static void Close()
{
_command = "close MediaFile";
mciSendString(_command, null, 0, IntPtr.Zero);
isOpen = false;
}
public static void Open(string sFileName)
{
_command = "open \"" + sFileName + "\" type mpegvideo alias MediaFile";
mciSendString(_command, null, 0, IntPtr.Zero);
isOpen = true;
}
public static void Play(bool loop)
{
if (isOpen)
{
_command = "play MediaFile";
if (loop)
_command += " REPEAT";
mciSendString(_command, null, 0, IntPtr.Zero);
}
}
我的问题是:
- 我将如何设定歌曲的音量?
- 我该如何获得歌曲的比特率/采样率?
我更喜欢使用MCI或NAudio,因为我知道它们的可靠性。