AGermanUser
Anmeldedatum: 25.10.2005 Beiträge: 169
|
Verfasst am: Di Dez 26, 2006 5:27 am Titel: Funktion GetMP3Len |
|
|
Thalon war so freundlich, in diesem Thread die Arbeit zu Ende zu bringen.
Hab mir den Code nochmal vorgenommen, und daraus eine Funktion gebastelt. Damit sollte man sie leichter in seine Scripts einbauen können.
| Code: | GetMP3Len(In_PathFile)
{
; In_PathFile: Absolute path to your mp3 file - e.g. C:\Music\test.mp3
; Set variable capacities for dllcalls
VarSetCapacity(ShortName, 255)
VarSetCapacity(Length , 255)
; Transforms FilePath into it's 8.3-Value
RetValue := DllCall("kernel32.dll\GetShortPathNameA"
, "Str", In_PathFile
, "Str", ShortName
, "UInt", 255)
; Open MP3
RetValue := DllCall("winmm.dll\mciSendStringA"
, "Str", "open " . ShortName . " type MPEGVideo alias mp3audio"
, "Str", 0
, "UInt", 0
, "UInt", 0)
; Read Length
RetValue := DllCall("winmm.dll\mciSendStringA"
, "Str", "status mp3audio length"
, "Str", Length
, "UInt", 255
, "UInt", 0)
; Close MP3
RetValue := DllCall("winmm.dll\mciSendStringA"
, "Str", "close mp3audio"
, "Str", 0
, "UInt", 0
, "UInt", 0)
; Trim milliseconds -> just seconds needed
StringTrimRight, Length, Length, 3
; Convert the specified number of seconds to hh:mm:ss format.
time = 19990101 ; *Midnight* of an arbitrary date.
time += %Length%, seconds
FormatTime, mmss, %time%, mm:ss
Return mmss ; This method is used to support more than 24 hours worth of sections.
} |
_________________ Gruß
AGermanUser a.k.a. AGU
Moderator |
|