; Load Libraries fMod := DllCall("LoadLibrary", Str,"FMOD.DLL") RMC := DllCall("LoadLibrary", Str,"rmchart.dll") ; Set Variables AudioFile = %A_WorkingDir%\02 Grace.mp3 DataL := DataR := "0*0*0*0*0*0*0*0*0*0" VisActive := !1 ; Build Menu Menu, FileMenu, Add, Visualization, ToggleVis Menu, MainMenu, Add, &File, :FileMenu ; Build GUI Gui, Margin, 5, 5 Gui, Add, GroupBox, x6 y5 w360 h312 Gui, Add, Text, +0x4 x8 y13 w355 h301 hwndVisOverlay Gui, Add, Text, x130 y145 +BackgroundTrans, Visualization Disabled Gui, Add, GroupBox, x6 y317 w475 h80 Gui, Add, ListBox, x366 y27 w115 h290 vNowPlaying Gui, Add, Text, x366 y10 w115 r1 center, Now Playing Gui, Add, Slider, x16 y347 w455 h20, 0 Gui, Add, Text, x16 y368 w40 r1 left, -0:00 Gui, Add, Text, x431 y368 w40 r1 right, 0:00 Gui, Add, Text, x16 y330 w455 r1, Song Name... Gui, Menu, MainMenu Gui, +LastFound hwnd := WinExist() Gui, Show,, New GUI Window GoSub, PopulateListBox GoSub, ToggleVis ; Sound Analysis "Magicks" DllCall( "FMOD.DLL\_FSOUND_SetHWND@4", UInt,hWnd ) DllCall( "FMOD.DLL\_FSOUND_Init@12", UInt,44100, UInt,32, UInt,( FSOUND_INIT_GLOBALFOCUS := 0x2)) Flags := ( FSOUND_MPEGACCURATE := 0x20000 ) ; Open/Play Music fStream := DllCall("FMOD.DLL\_FSOUND_Stream_Open@16", Str,AudioFile, UInt,Flags, UInt,0, UInt,0 ) Channel := DllCall("FMOD.DLL\_FSOUND_Stream_Play@8", UInt,-1, UInt, fStream ) ; Update Graph Loop { ; Get Info From Playing Music ms := DllCall("FMOD.DLL\_FSOUND_Stream_GetTime@4", UInt,fStream ) DllCall( "FMOD.DLL\_FSOUND_GetCurrentLevels@12", UInt,Channel, FloatP,LCh, FloatP,RCh ) ; Update Data Arrays If (VisActive) { DataL := RegExReplace(DataL,"^[^\*]+\*","") . "*" . lCh DataR := RegExReplace(DataR,"^[^\*]+\*","") . "*" . rCh IfWinActive, ahk_id %hwnd% UpdateChart( DataL, DataR, 1000 ) Sleep 0 } Else Sleep 100 ; If Song is done - break If !DllCall( "FMOD.DLL\_FSOUND_IsPlaying@4", UInt,Channel ) Break } ; Close Audio DllCall( "FMOD.DLL\_FSOUND_Stream_Stop@4", UInt,fStream ) DllCall( "FMOD.DLL\_FSOUND_Stream_Close@4", UInt,fStream ) Return GuiClose: ExitApp PopulateListBox: SongList = Violet Hill|Burn it to the Ground GuiControl,,NowPlaying,%SongList% Return ToggleVis: VisActive ? DelChart(1000) : MakeChart(hwnd, VisOverlay, DataL, DataR) Menu, FileMenu, % (VisActive ? "" : "Un") "check", Visualization Return ; Get Data String BuildChart( DataL, DataR ) { Str = 00003355|00004301|000051|000061|00008-16777216|00009412|00011Tahoma|100011|1000910|100101|100111|100181|100200|100211|100222|100238|100331|100341|1003525|100378|100482|10051-16777216|10052-16777216|10053-16777216|100541|100558|10056-16777216|10057-16777216|100586|10063-1|100652|110011|1100221|1100421|110065|11019-65536|1102115|110221|1102325|110261|11053%DataL%|11055C:\Documents and Settings\Administrator\Desktop\rmchart_dll\SOUND.csv|110562|110571,25|11058,|120011|1200221|1200421|120065|120131|12019-14774017|1202115|120221|1202325|120261|12053%DataR%|12055C:\Documents and Settings\Administrator\Desktop\rmchart_dll\SOUND.csv|120563|120571,25|12058, Return Str } ; Update Chart UpdateChart( L, R, ID ) { X := 0 Loop, Parse, L, * DllCall("rmchart.dll\RMC_SETSERIESSINGLEDATA" ,Int,ID ,Int,1 ,Int,2 ,Double,A_LoopField ,Int,++X) X := 0 Loop, Parse, R, * DllCall("rmchart.dll\RMC_SETSERIESSINGLEDATA" ,Int,ID ,Int,1 ,Int,1 ,Double,A_LoopField ,Int,++X) DllCall("rmchart.dll\RMC_DRAW",UInt,ID ) } ; Delete Chart DelChart( ID ) { Global VisActive If (!VisActive) Return 0 result := DllCall("rmchart.dll\RMC_DELETECHART",UInt,ID ) VisActive := 0 } ; Make Chart MakeChart(hwnd, VisOverlay, L, R) { Global VisActive Static Chart := 0 Chart++ If (VisActive) Return 0 ControlGetPos, X, Y, W, H,, ahk_id %VisOverlay% AddChart( hwnd, BuildChart( L, R ), 1000 ) ControlMove, RMC%Chart%, % X, % Y, % W, % H, ahk_id %hwnd% VisActive := 1 } ; Create New Chart ; engunneer ; http://www.autohotkey.com/forum/viewtopic.php?t=18292 AddChart( GuiID, DesignFile, ID ) { result := DllCall("rmchart.dll\RMC_CREATECHARTFROMFILE" ,UInt,GuiID ,UInt,ID ,UInt,50 ,UInt,45 ,UInt,0 ,Str,DesignFile ) ; Draw the chart result := DllCall("rmchart.dll\RMC_DRAW",UInt,ID ) }