找回密码
 加入
搜索
查看: 2446|回复: 3

[AU3基础] au3如何播放.m4a格式音频

[复制链接]
发表于 2018-7-5 20:09:37 | 显示全部楼层 |阅读模式
悬赏100金钱已解决
win10系统自带录音机voice recorder, 录制的音频默认格式是.m4a
Au3有办法播放这种格式的音频文件吗?

Soundplay()和_Soundplay()均不能用.

最佳答案

查看完整内容

代码你自己将就看吧,测试可以用,你不想写GUI也可以 [AU3]#include Global $wmp = ObjCreate("WMPlayer.OCX") GUICreate("庆祝论坛上线", 320, 300) $GUIActiveX = GUICtrlCreateObj($wmp, 0, 0, 320, 300) $wmp.uimode = "full" $wmp.url = @DesktopDir & "\b.m4a" $wmp.Controls.play GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd [/AU3] ...
发表于 2018-7-5 20:09:38 | 显示全部楼层

代码你自己将就看吧,测试可以用,你不想写GUI也可以
#include <GUIConstants.au3>

Global $wmp = ObjCreate("WMPlayer.OCX")



GUICreate("庆祝论坛上线", 320, 300)
$GUIActiveX = GUICtrlCreateObj($wmp, 0, 0, 320, 300)
$wmp.uimode = "full"
$wmp.url = @DesktopDir & "\b.m4a"
$wmp.Controls.play


GUISetState()
While 1
        $msg = GUIGetMsg()

        Select
                Case $msg = $GUI_EVENT_CLOSE
                        ExitLoop
        EndSelect
WEnd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2018-7-18 11:35:13 | 显示全部楼层
cfanpc 发表于 2018-7-5 20:09
代码你自己将就看吧,测试可以用,你不想写GUI也可以

感谢兄弟, 果然是可以播放了. 但还有一些问题.

比如不知道什么时候播放结束. 如何循环播放...

有相关OCX的学校资料吗?
 楼主| 发表于 2018-7-18 16:09:47 | 显示全部楼层
URL:String; 指定媒体位置,本机或网络地搜索址
uiMode:String; 播放器界面模式,可为Full, Mini, None, Invisible
playState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪
enableContextMenu:Boolean; 启用/禁用右键菜单
fullScreen:boolean; 是否全屏显示
[controls] wmp.controls //播放器基本控制
controls.play; 播放
controls.pause; 暂停
controls.stop; 停止
controls.currentPosition:double; 当前进度
controls.currentPositionString:string; 当前进度,字符串格式。如“00:23”
controls.fastForward; 快进
controls.fastReverse; 快退
controls.next; 下一曲
controls.previous; 上一曲
[settings] wmp.settings //播放器基本设置
settings.volume:integer; 音量,0-100
settings.autoStart:Boolean; 是否自动播放
settings.mute:Boolean; 是否静音
settings.playCount:integer; 播放次数
[currentMedia] wmp.currentMedia //当前媒体属性
currentMedia.duration:double; 媒体总长度
currentMedia.durationString:string; 媒体总长度,字符串格式。如“03:24”
currentMedia.getItemInfo(const string); 获取当前媒体信息"Title"=媒体标题,"Author"=艺术家,"Copyright"=版权信息,"Description"=媒体内容描述, "Duration"=持续时间(秒),"FileSize"=文件大小,"FileType"=文件类型,"sourceURL"=原始地址
currentMedia.setItemInfo(const string); 通过属性名设置媒体信息
currentMedia.name:string; 同 currentMedia.getItemInfo("Title")
[currentPlaylist] wmp.currentPlaylist //当前播放列表属性
currentPlaylist.count:integer; 当前播放列表所包含媒体数
currentPlaylist.Item[integer]; 获取或设置指定项目媒体信息,其子属性同wmp.currentMedia

playState:integer; 播放状态。这个属性改变时同时引发PlayStateChange事件与StateChange事件。取值范围为枚举型:WMPLib.WMPPlayState,它的成员如下:
  wmppsUndefined = 0;   //未知状态
  wmppsStopped = 1;    //播放停止
  wmppsPaused = 2;     //播放暂停
  wmppsPlaying = 3;     //正在播放
  wmppsScanForward = 4;   //向前搜索
  wmppsScanReverse = 5;   //向后搜索
  wmppsBuffering = 6;     //正在缓冲
  wmppsWaiting = 7;      //正在等待流开始
  wmppsMediaEnded = 8;    //播放流已结束
  wmppsTransitioning = 9;    //准备新的媒体文件
  wmppsReady = 10;      //播放准备就绪
  wmppsReconnecting = 11;   //尝试重新连接流媒体数据
  wmppsLast = 12;       //上一次状态,状态没有改变
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 01:47 , Processed in 0.070544 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表