Here you go:
Code: Select all
loadAG3 := DllCall( "LoadLibrary", Str,"AudioGenie3.dll" ) ; dll should be in the script directory
path := "GhostRiders.mp3" ; obvly put here the path to your soundfile
ATOU(PathUni, path) ; Path from Ansi to Unicode
MsgBox % DllCall("AudioGenie3\AUDIOAnalyzeFileW", Str, PathUni) ; don't leave out! reads and analyzes sound file, returns 1 for mp3 , 5 for wav, etc
MsgBox % "Artist: " UTOA( DllCall("AudioGenie3\AUDIOGetArtistW") ) ; returns artist (Unicode to Ansi)
msgbox % "Duration: " DllCall("AudioGenie3\AUDIOGetDurationW", Float) ; returns duration in seconds
DllCall("FreeLibrary", UInt, loadAG3)
ExitApp
; Useful functions by SKAN
ATOU( ByRef Unicode, Ansi ) ; Ansi to Unicode
{
VarSetCapacity( Unicode, (Len:=StrLen(Ansi))*2+1, 0 )
Return DllCall( "MultiByteToWideChar", Int,0,Int,0,Str,Ansi,Int,Len, Str,Unicode, Int,Len )
}
UTOA( pUnicode ) ; Unicode to Ansi
{
VarSetCapacity( Ansi,(nSz:=DllCall( "lstrlenW", UInt,pUnicode )+1) )
DllCall( "WideCharToMultiByte", Int,0, Int,0, UInt,pUnicode, Int,nSz
, Str,Ansi, Int,nSz+1, Int,0, Int,0 )
Return Ansi
}
It's a bit longer, but since AudioGenie3 uses Unicode anyway, you have to use the two functions ATOU() and UTOA() as a workaround (made by SKAN, I think) for ANSI, if the DllCalls are using strings (like paths or names). The 'Duration'-DllCall uses floating numbers, that's why it can stay unchanged (related stuff:
http://l.autohotkey.net/docs/commands/DllCall.htm#types and
http://l.autohotkey.net/docs/Compat.htm#DllCall).
Somewhere, a wrapper for the most used functions might still float around, but I think the links in the old forum are dead. But if you want to use other functions of AG3, you can look up the data types in the Audiogenie documentation (
http://sourceforge.net/projects/audioge ... 0.4.0/doc/) and use them similarly.
Disclaimer: Note that I have no clue what I am doing, when DllCalls are concerned... but that should work...