我正试图从.mp3文件中的C#中检索音频播放器的详细信息。
代码片段:
[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,因为我知道它们的可靠性。
发布于 2014-03-28 11:09:41
设置卷:
string command = "setaudio MediaFile volume to " + volume.ToString();
error = mciSendString(Pcommand, null, 0, IntPtr.Zero);其中卷是介于0到1000之间的int。
在msdn上的多媒体引用中有一个完整的mci命令字符串列表:
set命令
在CodeProject上也有一个很好的示例项目,它完成了您试图在:简易MCI播放器上执行的大部分内容。
HTH
保罗
https://stackoverflow.com/questions/22710770
复制相似问题