找回密码
 加入
搜索
查看: 2217|回复: 9

[系统综合] 关于函数_SoundLength 的问题

  [复制链接]
发表于 2010-12-7 23:06:42 | 显示全部楼层 |阅读模式
_SoundLength
--------------------------------------------------------------------------------

返回声音文件的长度.


#include <Sound.au3>
_SoundLength ( $aSnd_id [, $iMode ] )


该函数好像返回数值不准确,不知大家是否也有该问题?
发表于 2010-12-8 02:07:37 | 显示全部楼层
回复 1# thealert

我这里正常,但是长度不到1秒的文件就当不存在.

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
    MsgBox(0, "Error", "The file does not exist")
    Exit
ElseIf @extended <> 0 Then
    $extended = @extended ;assign because @extended will be set after DllCall
    $stText = DllStructCreate("char[128]")
    $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
    MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
    MsgBox(0, "Success", "The file opened successfully")
EndIf
MsgBox(0, "Sound Length", "The Sound has a length of:" & @CRLF & "hh:mm:ss - " & _
        _SoundLength($sound, 1) & @CRLF & "Milliseconds - " & _SoundLength($sound, 2))
 楼主| 发表于 2010-12-8 09:03:34 | 显示全部楼层
回复 2# lixiaolong

举个例子:

    autoit显示的时间:

    千千静听显示时间

本帖子中包含更多资源

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

×
 楼主| 发表于 2010-12-8 09:04:19 | 显示全部楼层
差距很大,不知是什么原因
 楼主| 发表于 2010-12-8 11:25:07 | 显示全部楼层
希望大家帮下忙 谢了
发表于 2010-12-8 21:10:41 | 显示全部楼层
5:33和4:04 那个是真正的时间?
 楼主| 发表于 2010-12-8 21:38:15 | 显示全部楼层
回复 6# lixiaolong


    感觉千千静听的准点
 楼主| 发表于 2010-12-8 21:40:27 | 显示全部楼层
media player 也是4:04
发表于 2010-12-9 14:15:35 | 显示全部楼层
我返回的都正常啊
发表于 2010-12-9 16:08:01 | 显示全部楼层
回复 7# thealert

我想应该是声音文件有问题.
看看其它文件怎么样.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 16:40 , Processed in 0.094844 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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