C# winform 如何播放amr音频文件

a12321321321312321 2012-02-16 08:42:16
目前2种思路。
一个是用Windows media play 播放,需要装一个20M的解码包才可以播放。
二是调用第三方程序(以前用过ffmpeg 不知道支不支持amr 到mp3?求推荐) 把amr转mp3,然后在用wmp播放。

还有什么最简单的方法没?求解。万分感谢。
...全文
562 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
a12321321321312321 2013-02-01
  • 打赏
  • 举报
回复
Test Post
a12321321321312321 2013-02-01
  • 打赏
  • 举报
回复
Test Post
a12321321321312321 2013-02-01
  • 打赏
  • 举报
回复
Test Post
laboy00 2012-09-25
  • 打赏
  • 举报
回复
继续啊!求答案啊!
段传涛 2012-02-17
  • 打赏
  • 举报
回复
是不是可以调用API的方式 异步播放。
好像可以 你找找资料。
EnForGrass 2012-02-17
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 f800051235 的回复:]

win7装个win7codecs这个Windows media play就可以播放amr了。
XP还没去试,应该可以找到对应的解码器。
[/Quote]

http://www.haogongju.net/art/649899
a12321321321312321 2012-02-17
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 linxi729778865 的回复:]

使用MCI Command String多媒体设备程序接口播放mp3,avi等。
这种方法很好用。
下面的类传入音乐名(路径)可以完成音乐播放,循环播放和停止。
C# code

using System.Runtime.InteropServices;

class Music
{
[DllImport("winmm.dll")]
public static exter……
[/Quote]
你这个我试过了,不支持amr
tanghuawei 2012-02-17
  • 打赏
  • 举报
回复
还有这个实例:http://www.cnblogs.com/freeliver54/archive/2008/09/17/1292717.html
tanghuawei 2012-02-17
  • 打赏
  • 举报
回复
看看这个:http://blog.csdn.net/lxiongh/article/details/5350329
使用DirectShow
linxi729778865 2012-02-16
  • 打赏
  • 举报
回复
使用MCI Command String多媒体设备程序接口播放mp3,avi等。
这种方法很好用。
下面的类传入音乐名(路径)可以完成音乐播放,循环播放和停止。

using System.Runtime.InteropServices;

class Music
{
[DllImport("winmm.dll")]
public static extern int mciSendString(string m_strCmd, string m_strReceive, int m_v1, int m_v2);

[DllImport("Kernel32", CharSet = CharSet.Auto)]
static extern Int32 GetShortPathName(String path, StringBuilder shortPath, Int32 shortPathLength);

private void playMusic(string name)
{
try
{
StringBuilder shortpath = new StringBuilder(80);
int result = GetShortPathName(name, shortpath, shortpath.Capacity);
name = shortpath.ToString();
string buf = string.Empty;

mciSendString("play " + name, buf, buf.Length, 0); //播放
}
catch (Exception ex)
{
throw ex;
}
}

private void playMusicRepeatly(string name)
{
try
{
StringBuilder shortpath = new StringBuilder(80);
int result = GetShortPathName(name, shortpath, shortpath.Capacity);
name = shortpath.ToString();
string buf = string.Empty;

mciSendString("play " + name+" repeat", buf, buf.Length, 0); //播放
}
catch (Exception ex)
{
throw ex;
}
}

public void stopMusic(string name)
{
StringBuilder shortpath = new StringBuilder(80);
int result = GetShortPathName(name, shortpath, shortpath.Capacity);
name = shortpath.ToString();
string buf = string.Empty;

mciSendString(@"stop "+name, buf, buf.Length, 0);
mciSendString(@"close "+name, buf, buf.Length, 0); //停止播放
}
}
a12321321321312321 2012-02-16
  • 打赏
  • 举报
回复
win7装个win7codecs这个Windows media play就可以播放amr了。
XP还没去试,应该可以找到对应的解码器。
孟子E章 2012-02-16
  • 打赏
  • 举报
回复
如果有免费的解压包,使用解压包的方法不错,安装一次即可,也不用再次转换了

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧