Jump to content

addition to sound.au3


nobbe
 Share

Recommended Posts

hi all

as i needed 2 more functions in sound.au3 i wanted to share them

CODE
;===============================================================================

;

; Function Name: _SoundSeek- Millisec now

; Description:: Seeks the sound to a specified time in millisec

; Parameter(s): $sSnd_id - Sound ID returned by _SoundOpen (must NOT be a file), $iMs

; Requirement(s): AutoIt 3.2 ++

; Return Value(s): 1 - Success, 0 and @error = 1 - Failure,

; Author(s): Nobbe

;

;===============================================================================

;

Func _SoundSeek_MS($sSnd_id, $iMs)

Local $iRet

;prepare mci to recieve time in milliseconds

mciSendString("set time format miliseconds")

$iRet = mciSendString("seek " & $sSnd_id & " to " & $iMs)

;return

If $iRet = 0 Then

Return 1

Else

Return SetError(1, 0, 0)

EndIf

EndFunc ;==>_SoundSeek

;===============================================================================

;

;

; format time string to hr:min:sec

;

; input time in millisec

;

; returns time formatted string like "12.59.59"

;

; Author Nobbe

;

;===============================================================================

Func format_time_hr_min_sec_from_millisec($t)

Local $l_std

Local $l_min

Local $l_sec

Local $t_str

$t /= 1000; time is in millisec

$l_std = Int($t / 3600);

$l_min = Int(($t - ($l_std * 3600)) / 60) ;

$l_sec = Int(($t - ($l_std * 3600) - ($l_min * 60))) ;

$t_str = StringFormat("%02i:%02i:%02i", $l_std, $l_min, $l_sec)

Return $t_str

EndFunc ;==>format_time_hr_min_sec_from_millisec

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...