Sign in to follow this  
Followers 0
burners

Analog Meter from UEZ & GDI+ HELP

4 posts in this topic

I have been working on my analog gauge project when I have time, if you don't know check out this thread

Now that one sucks, it was more so proof of concept but the code itself is crap.

I had been reading up on GDI+ and fixing things like flicker and generally just making analog gauges, I found this thread which mentions pushing the background image into memory and calling it from there as the gauge refreshes.

http://www.fsdeveloper.com/forum/showthread.php?t=22024

"You need to store the static background image in a memory area in its native pixel format (which, regardless of the source format used, it's *always* 16 bit 1555 or 32 bit 8888) then, at every frame during the _DRAW cycle, restore the background, then draw with GDI+ on top of it."

Then I found this project from UEZ

http://www.autoit.de/index.php?page=Thread&threadID=10534

So I was looking through his code (GREAT JOB BTW) and I seen some brilliant ideas that I think would really set the analog gauge project off, Most important would be pushing the BMP into Memory.

It looks like this is done towards the bottom with the VU_Image() function, I think that is the image converted into HEX? But I tried to convert an image to HEX and use something else to see if it would work and it did not, maybe I didn't convert correctly. If it is indeed HEX couldn't you run an IN SCRIPT convert on the BMP instead of converting externally and then pasting in the code?

;code by UEZ 2009
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
#AutoIt3Wrapper_Run_After=del /f /q "Visualizer_Analog Meter_Obfuscated.au3"
#include <GUIConstantsEx.au3>
#include <GDIplus.au3>
#include <Memory.au3>
#include <Misc.au3>
#include <WindowsConstants.au3>
#include "Bass.au3" ;thanks to BrettF and ProgAndy
Opt("GUIOnEventMode", 1)

#Region load image files
Global $dll = DllOpen("user32.dll")
_GDIPlus_Startup()
Global $bitmap_from_file
$bitmap_from_file = Load_BMP_From_Mem(VU_Image()) ;thanks to AIMP2 player ;-)

Global $bitmap_from_file2
$bitmap_from_file2 = Load_BMP_From_Mem(VU_Fragement_Image())

Global Const $iX = _GDIPlus_ImageGetWidth($bitmap_from_file)
Global Const $iY = _GDIPlus_ImageGetHeight($bitmap_from_file)
Global Const $width = $iX * 2
Global Const $height = $iY
#EndRegion

#Region initialize sound and load MP3
Global $levels, $LeftChLvl, $RightChLvl, $l_x2, $l_y2, $r_x2, $r_y2, $r, $current
Global $ChLevel = 0x1000
Global $volume_error = 0
Global $ve
Global $volume_boost_level = 2
Global $needle_decrease_speed = 0.0275
Global $no_load = 0
Global Const $bass_dll = _BASS_Startup(@ScriptDir & "\BASS.dll")
If @error = -1 Then
    MsgBox(16, "ERROR!", "Could not load BASS.dll" & @CR & "Terminating... ")
    Exit
EndIf
Global $file = FileOpenDialog("Select MP3...", "", "MP3 Files (*.mp3)");
If @error Then
     $no_load = 1
    MsgBox(16, "Error", "Could not load audio file!" & @CRLF & @CRLF & "At main screen you can press O to open file open dialog window" & @CRLF & "or you can drag'n'drop a mp3 file to window!", 20)
EndIf
Global $filename = StringMid($file, StringInStr($file, "\", 0, -1) + 1, StringLen($file) - StringInStr($file, "\", 0, -1) - 4) ;get the filename only
Global $file_suffix
_BASS_Init($BASS_DEVICE_CPSPEAKERS)
Global $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
Global $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
#EndRegion

#Region GUI
Global Const $WM_DROPFILES = 0x0233
Global $hwnd = GUICreate("", $width, $height, -1, -1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES))
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Move") ;move main window when lmb pressed and hold on main window
GUISetState()
#EndRegion

#Region initialize GDI+
Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)
Global Const $pen_size = 2
Global $pen = _GDIPlus_PenCreate(0, $pen_size)
Global $brush_l = _GDIPlus_BrushCreateSolid()
Global $brush_r = _GDIPlus_BrushCreateSolid()
_GDIPlus_GraphicsDrawImage($backbuffer, $bitmap_from_file, 0, 0)
_GDIPlus_GraphicsDrawImage($backbuffer, $bitmap_from_file, $iX, 0)
#EndRegion

#Region constants
Global Const $pi = 4 * ATan(1)
Global Const $pi_div_180 = $pi / 180
Global Const $max_amplitude = 450
Global Const $min_x = 25
Global Const $max_x = 160
Global Const $pointer_ini_point_y = 80 ;less is longer
Global Const $pointer_start_y = 93
Global Const $pointer_length = 65
Global Const $ellipse_size = 8
Global Const $ellipse_size_half = $ellipse_size / 2
Global Const $width_div_4 = $width / 4
Global Const $width_div_2 = $width / 2
Global Const $sleep = 30
#EndRegion

#Region play audio
_BASS_ChannelPlay($MusicHandle, 1)
$volume = _BASS_GetVolume()
If @error Or $volume = 1 Then ;check whether _BASS_GetVolume() returns 1
    $volume_error = 1
    $ve = "YES! Volume controlled peak disabled!"
Else
    $ve = "NO!"
EndIf
#EndRegion

#Region initialize title in window
Dim $title[25] = ["º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`", _
        " GDI+ Visualization:   Analog Meter", _
        " Playing:  " & $filename, _
        " Get volume error:   " & $ve, _
        " Press P to pause current song", _
        " Press C to continue after P was pressed", _
        " Press O to open another song", _
        " Press ESC to exit program", _
        " Credits:", _
        " Main coding by:   UEZ 2009", _
        " Bass UDF:   BrettF (modified by ProgAndy)", _
        " Bass DLL:   www.un4seen.com", _
        " Image:   AIMP Player", _
        " And of course", _
        " AutoIt developers ;-)", _
        "•*´¯`*•.¸ .. ¥ .. ¸.•*´¯`*•*´¯`*•.¸ .. ¥ .. ¸.•*´¯`*•*´¯`*•.¸ .. ¥ .. ¸.•*´¯`*.¸ .. ¥ .. ¸.•*´¯", _
        " Greetings to: ", _
        " All members from", _
        " www.autoitscript.com  /  www.autoit.de", _
        " Richie for the good ideas to improve Analog Meter", _
        " Christos", _
        " and", _
        " DrSchulz (http://www.drschulz-music.de/) ;-)", _
        "                                                                                                      ", _
        " Restarting text..."]
Global $c = 0 ;counter for sleep
Global $i = 1 ;for character
Global $j = 0 ;for array
Global $k = UBound($title) - 1
Global $s = 150 ;sleep time
Global $in = True
Global $effect = Random(1, 2, 1)
Global $g = 0x00
Global $b = 0x00
Global $pause = 0
#EndRegion

#Region additional GUI functions
GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") ;enable drag'n'drop
GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113
DllCall("User32.dll", "int", "SetTimer", "hwnd", $hwnd, "int", 0, "int", $sleep, "int", 0) ;set GUIRegisterMsg($WM_TIMER, "Draw") timer
#EndRegion

Do
Until False * Not Sleep(100000) ;do nothing, just sleep

Func Draw()
    If WinGetState($hwnd) = 15 Then ;only activate keys when window is active
        If _IsPressed("50", $dll) Then ;P pressed (pause)
            _BASS_Pause()
            $pause = 1
        ElseIf _IsPressed("43", $dll) Then ;C pressed (continue after pause)
            _BASS_Start()
            $pause = 0
        ElseIf _IsPressed("4F", $dll) Then ;O pressed (open file dialoge)
            $file = FileOpenDialog("Select MP3...", "", "MP3 Files (*.mp3)")
            If Not @error Then
                $file_suffix = StringRight($file, 3)
                If StringLower($file_suffix) = "mp3" Then
                    $filename = StringMid($file, StringInStr($file, "\", 0, -1) + 1, StringLen($file) - StringInStr($file, "\", 0, -1) - 4) ;get the filename only
                    $title[2] = "Music:   " & $filename
                    _BASS_ChannelStop($MusicHandle)
                    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
                    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
                    _BASS_ChannelStop($MusicHandle)
                    _BASS_ChannelPlay($MusicHandle, 1)
                EndIf
            EndIf
        EndIf
    EndIf
    $levels = _BASS_ChannelGetLevel($MusicHandle) ;get 16-bit level for l/r
    If $no_load Then $levels = 0x00000000
    $l_w = _HiWord($levels) ;get volume level from left (15-8 bit)
    $r_w = _LoWord($levels) ;get volume level from right (7-0 bit)
    If $l_w < 0 Then $l_w = ($l_w + 1) * - 1 ;invert value to positive value (a bug in bass.dll?)
    If $r_w < 0 Then $r_w = ($r_w + 1) * - 1
    If $volume_error = 1 And $pause = 0 Then
        $volume = 0.33333
    Else
        If $pause = 0 Then $volume = _BASS_GetVolume() * $volume_boost_level
    EndIf
    If $pause = 1 Then ;if pause then move needle to position 0
        If $volume >= 0 Then $volume -= $needle_decrease_speed
    EndIf
    $LeftChLvl = 1 + Round($l_w * 135 / $ChLevel * $volume, 0) ; 135 = $max_x - $min_x
    $RightChLvl = 1 + Round($r_w * 135 / $ChLevel * $volume, 0)
    $l_x2 = $min_x + $max_x * ($LeftChLvl / $max_amplitude) ;set x/y coordinate of needle
    If $l_x2 >= $max_x Then $l_x2 = $max_x ;avoid exceeding right limit of needle
    If $l_x2 < $min_x Then $l_x2 = $min_x ;avoid exceeding left limit  of needle
    $l_y2 = $pointer_ini_point_y - Sin($l_x2 * $pi_div_180) * $pointer_length ;calculate length of left needle (radius) depending and new x/y coordinate
    $r_x2 = $min_x + $max_x * ($RightChLvl / $max_amplitude)
    If $r_x2 >= $max_x Then $r_x2 = $max_x
    If $r_x2 < $min_x Then $r_x2 = $min_x
    $r_y2 = $pointer_ini_point_y - Sin($r_x2 * $pi_div_180) * $pointer_length
    _GDIPlus_PenSetColor($pen, 0xCF111111)
    _GDIPlus_GraphicsDrawLine($backbuffer, $width_div_4 - 1, $pointer_start_y, $l_x2, $l_y2, $pen) ;draw left needle
    _GDIPlus_GraphicsDrawLine($backbuffer, $width - $width_div_4 - 1, $pointer_start_y, $width_div_2 + $r_x2, $r_y2, $pen) ;draw right needle
    _GDIPlus_GraphicsDrawImageRect($backbuffer, $bitmap_from_file2, 68, 76, 53, 30)
    _GDIPlus_GraphicsDrawImageRect($backbuffer, $bitmap_from_file2, $iX + 68, 76, 53, 30)
    $r = $LeftChLvl * ($LeftChLvl / 0xFF)
    _GDIPlus_BrushSetSolidColor($brush_l, "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsFillEllipse($backbuffer, $width_div_4 - $ellipse_size_half - 1, $pointer_start_y - $ellipse_size_half, $ellipse_size, $ellipse_size, $brush_l)
    $r = $RightChLvl * ($RightChLvl / 0xFF)
    _GDIPlus_BrushSetSolidColor($brush_r, "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsFillEllipse($backbuffer, $width - $width_div_4 - $ellipse_size_half - 1, $pointer_start_y - $ellipse_size_half, $ellipse_size, $ellipse_size, $brush_r)
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    _GDIPlus_GraphicsDrawImage($backbuffer, $bitmap_from_file, 0, 0) ;clear screen by overwritting screen with bmp (left)
    _GDIPlus_GraphicsDrawImage($backbuffer, $bitmap_from_file, $iX, 0) ;clear screen by overwritting screen with bmp (right)
    $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) ;get current song position
    If $current >= $song_length Then _BASS_ChannelPlay($MusicHandle, 1) ;replay song when it is finished
    Display_Info() ;display win title info
EndFunc   ;==>Draw

Func Move() ;move whole window when pressed lmb and hold continuing drawing of window content
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", 0x00A1, "int", 2, "int", 0) ;$WM_NCLBUTTONDOWN = 0x00A1
EndFunc   ;==>Move

Func WM_DROPFILES($hwnd, $msg, $wParam, $lParam) ;drag'n'drop function - I don't know who made this
    Local $tBuffer = DllStructCreate("char[256]")
    Local $iString
    ;Get dropped items count
    Local $aRet = DllCall("shell32.dll", "int", "DragQueryFile", "int", $wParam, "int", -1, "ptr", 0, "int", 0)
    ;Getting name only from 1st dropped item
    DllCall("shell32.dll", "int", "DragQueryFile", "int", $wParam, "int", 0, "ptr", DllStructGetPtr($tBuffer), "int", DllStructGetSize($tBuffer))
    $iString = DllStructGetData($tBuffer, 1)
    DllCall("shell32.dll", "none", "DragFinish", "int", $wParam)
    $file = $iString
    $filename = StringMid($file, StringInStr($file, "\", 0, -1) + 1, StringLen($file) - StringInStr($file, "\", 0, -1) - 4) ;get the filename only
    $file_suffix = StringRight($file, 3)
    If StringLower($file_suffix) = "mp3" Then
        _BASS_ChannelStop($MusicHandle)
        $title[2] = "Music:   " & $filename
        $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
        $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
        _BASS_ChannelStop($MusicHandle)
        _BASS_ChannelPlay($MusicHandle, 1)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_DROPFILES

Func Display_Info()
    If $in Then
        If $i <> StringLen($title[$j]) + 1 Then
            If $effect = 1 Then
                WinSetTitle($hwnd, "", StringLeft($title[$j], $i)) ;effect 1a, 1 by 1
            Else
                WinSetTitle($hwnd, "", StringRight($title[$j], $i)) ;effect 2a, scroll to right
            EndIf
            $i += 1
        Else
            If $c = $s Then
                $i = 1
                $in = False
                $c = 0
                $effect = Random(1, 2, 1)
            Else
                $c += 1
            EndIf
        EndIf
    Else
        If $i <> StringLen($title[$j]) + 1 Then
            If $effect = 1 Then
                WinSetTitle($hwnd, "", StringLeft($title[$j], StringLen($title[$j]) - $i)) ;effect 1b, 1 by 1
            Else
                WinSetTitle($hwnd, "", StringRight($title[$j], StringLen($title[$j]) - $i)) ;effect 2b, scroll to left
            EndIf
            $i += 1
        Else
            $i = 1
            $in = True
            $effect = Random(1, 2, 1)
            If $j = $k Then
                $j = 0
            Else
                $j += 1
            EndIf
        EndIf
    EndIf
EndFunc   ;==>Display_Info

Func Close()
    _BASS_Stop()
    _BASS_Free()
    DllClose(@ScriptDir & "\BASS.dll")
    GUIRegisterMsg($WM_DROPFILES, "")
    GUIRegisterMsg($WM_TIMER, "")
    DllClose($dll)
    _GDIPlus_PenDispose($pen)
    _GDIPlus_BrushDispose($brush_l)
    _GDIPlus_BrushDispose($brush_r)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    GUIDelete($hwnd)
    Exit
EndFunc   ;==>Close

Func Load_BMP_From_Mem($pic) ;coded by UEZ. Thanks to ProgAndy for mem allocation lines
    Local $memBitmap, $len, $tMem, $hImage, $hData, $pData, $hStream, $hBitmapFromStream
    $memBitmap = Binary($pic) ;load image  saved in variable (memory) and convert it to binary
    $len =  BinaryLen($memBitmap) ;get length of image

    $hData  = _MemGlobalAlloc($len, 0x0002) ;allocates movable memory  ($GMEM_MOVEABLE = 0x0002)
    $pData = _MemGlobalLock($hData)  ;translate the handle into a pointer
    $tMem =  DllStructCreate("byte[" & $len & "]", $pData) ;create struct
     DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
    _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE

    $hStream = _WinAPI_CreateStreamOnHGlobal($pData) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents
    $hBitmapFromStream = _GDIPlus_BitmapCreateFromStream($hStream) ;Creates a Bitmap object based on an IStream COM interface
    $tMem = ""
    Return $hBitmapFromStream
EndFunc

Func _WinAPI_CreateStreamOnHGlobal($hGlobal = 0, $fDeleteOnRelease = True)
    Local $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "hwnd", $hGlobal, "int", $fDeleteOnRelease, "ptr*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[3]
EndFunc   ;==>_WinAPI_CreateStreamOnHGlobal

Func _GDIPlus_BitmapCreateFromStream($pStream)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $pStream, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[2]
EndFunc   ;==>_GDIPlus_BitmapCreateFromStream

Func VU_Image()
Local $VU = '0x89504E470D0A1A0A0000000D49484452000000BE0000006B0803000000FE59C833000002A6504C5445000000FFFFFF282828707070B8B8B8484848D8D8D8F8F8F8808080A0A0A0181818E0E8E0F0F0'
    $VU &= 'E8E8F0E8C8D0D0E8F0F0F0F8F0D8E0D8809088586868909898E0E8E8F0F8F8607068707878B0B8B8F8F8F098A0A0D0D8D880888898A8A0D8E0E0C0C8C8C0C0C0687070C0C8C0C0C0B8E0E0D8788080B8'
    $VU &= 'C0C0D0D0D0585858787878888888D0D8D0B0B8B0F8F0F0606060909090A8B0B0A0A8A850605868686860686898A098808880708078A8B0A8485858889090A0A8A0F0F0F8989898707880788078788888'
    $VU &= '7078709898A0788880506860D0D0D8F8F0F8808890687878909890B8C0B8A0A098806040A08080D04838D0C8C888908890A098808078B84030D04038C03828C86050E0C0A0B8B8B0C8C8D0C03830C840'
    $VU &= '30C83830C04840505858B8C8C0C84038E08080889898D03830A08060888880B06058E8E0D8586860F0E8E8687068F8F0E8384840789088907068C8D0C8C83828986858C83028202020C83020D8D8D098'
    $VU &= '7870B0B0B8708080586060485050B0B0A8606860687870B06860C02020787070806060A87060404020787870806868A8A8A03838380404042C2C2C4C4C4CDCDCDCFCFCFC8484840C0C0CA4A4A4B4B4B4'
    $VU &= '1C1C1CF4F4F4F8FCF8C4C4C4FCFCF8D4D4D4CCCCCC7C7C7C8C8C8C545454F8FCFC6464645C5C5CFCF8F8FCF8FC6C6C6C9C9C9CF8F8FCFCE0E084807CBCC4C07C88848C7C7CB06458A4ACA87884809C6C'
    $VU &= '60D0D0CC808C88A47C7C8C94949C808098A09C90746CC44038D4D4D0807C7CA04C4074807C787C7CBC4838CCD0CCB8BCB8A46C58C8CCC8E4E8E0F0FCF8E4E8E4B0B4B0ACB4AC748080B05044BCC0BCC0'
    $VU &= 'C4C0F4F8F4808C8CAC5848DCE0DCB4B8B4E0E4E0909C98D0D4D0D4D8D4ECECEC080808F0F0F0E0E0E0C8C8C8303030BCBCBC343434747474ACACAC404040A8A8A8505050101010E8E8E8E4E4E4B0B0B0'
    $VU &= '3C24B1380000138849444154785ED4CE091180400C03C0F87797F4BBE3C70903A8E82A58BC7474849F726E773FCBD0B75FCB78B29FD80520CBDCAF861803D0E443ADB930B7719D67386F84D997A82060'
    $VU &= '652F69620196209902AC094004AAD0A201B156DA38159D984E2A516A493111CBDED354AEABA497B4EEC56D33196D860A964B8E02696123AD5BB95737BD5A7553A9357BA1EBB0D80DC71C3687FC27DD3D'
    $VU &= '806C6A466401096CC9678667170B70F6392FBFF3EDC10C9D1A0D1C380CA736F45F1FF8CE86A8E140521357BFFA81EFCCD70C1C488C5AE0173DFD927130FD8D52E040A75F6AA48FB6E31CC6DEB357FA22'
    $VU &= '14728E8450E748588908F8080121F6505F2E02431E1E663D1C518F3EF2A8D6D9059F4EEDB1EEA80A494844F040348CA4DE5EA71FD2118DC57B34C227FEDD22DADD0B807A88899EB0B977E9F7AD01A50D'
    $VU &= '6761CDC0421F9A4357750BDBA06532A422D11F40973310F8D0F7805A52585043AA8ADE4753780F9D6CD6735D0194AD55EFC02D07C67DF50D6CDD58C5D2D7C45007E0FD34533FA44EA66320F4BB524A2A'
    $VU &= 'E366E1F6C748E1284A08D1FE30542015CD887832FEBE3C84D394BF01BE7B0DB8F678ED6B6BA8DDE8DB517FF55800C31D181A028687D0042455DF3452D675BC87A0A320D7EF200B8FFCF7A5CA5D001871'
    $VU &= '10EDE9B47097D4F10FE755B329FFABD76BA5EB7DF4D46BD777D28781A1AFF0F8163AEAFABB87AF53922502FD230901E23D4CA49F489E182565ED3FF664774E9E9188152296BC4C20FCE14C6F320AB009'
    $VU &= '7D71C31D3C56ABFD6FFA7DC7D78F8BBBE9EFE84F50272801A114F3C998BAFD5DC089C6EB5E3C12118A68E8331FA54D13365861ACA08A421ECDF1956BC3D7BCE258D85DBF74E8C63030FFF26AE9DDE19D'
    $VU &= 'D3274DA88E0EB24267204D22DC93C6364894554AE76D156E9327BB4C0B0D0A39A4BBB74F7AB7F8176E78EAA543631CFCDEC19DF46120F8DF2EB0F9EEF5EB87941DF4E913C93DF9FD11E8603CA550A4C3'
    $VU &= '85C23DD5439B03B948432B11149010423969120D466227B5A7EAD77D5801B9A37EEDE543252070ECF8B1E1D28EFA40CD316080CA620D3BCBC32968A74E45EA45444BCD7CC4B76705EF41B845D1388B6A'
    $VU &= '114854247E60DB2C7B7FF0A38FF40220558064D689606736053CC4E215DF6FF7C79621871DED492190D3BAC04A850DBABA68DB3621314984F375531BB9BBEB8288E655E8044CF94A3D2A7D093DE924C9'
    $VU &= 'D050E1E1F73CF2FCFE2D9F55BB629A204174697992B0E9A1EB48F8B224984F80F223F13147EA5B9E3EC146E3C9D1A2457F3B6143282C37AEC73F12054432B6FBB6418EC6036DD958A75CB56942B821B5'
    $VU &= '90A387D437758487D2204DBFA0E5822694B1A7C10A6095F3BE3E818F21A20560EBE8D504BAC0BC1629AB000826A3C948249F74F66AC749CB22510F9E69D781D3110525302D1D915886202DA40A521570'
    $VU &= 'F2E1C6C76377D387A3C96BD11FAAB20BCE232964650400A943391100F746DFAE5A047B3BCBA46DA942B72052BDB2724CAABA45223712814EA2B7A0420D09E5E94CFFA9DC482C56D062FDA7F3F95C34E5'
    $VU &= 'C6D54041E61BCB43253ED4A180A00DD3247572645CBD579F6D4CDF632C291337CD323D0027206B2097024FC22D2800184AF7C7A2C1582C968FA61289703C1E5794DEDE703811CDE563B16477F019D771'
    $VU &= '4E2920F9F14F3C3BF15CD6A2C8DA242D1E15F00F68C036EAD3041249D5E9C8F9FEB42AB009F1C91448331A3B821022B154281D0D6ADAA772036941DC0F5528CF8C7E4A3BF1643E1D81F8E1336727CF9C'
    $VU &= '3BFF231B02A4CD4E15A4499F0AC0066D4A5FA4B23F7A8A08271DE866D52ED326311013C8C2D1126059F4F4C7F2195789C0476ADC7F3F4CA124F29A96FFE427A62626A62FCC7833C85A3A5CAD57CE8226'
    $VU &= 'A9FA7D1440B94DFA44E2D31A92792FE3005456099A20C4480A24735A3CA515728DCCEBC38E7FFABA917AF833E3E3E3335317272626CE5E3C37FBF5C88FE5A47DC53449FA7DD419D204DAA4AFB2B33FEA'
    $VU &= 'F41773DD0A74BB6C9BA64D12294D806AFEA33DB9B0DA48AB19480B80353EFEFB2FCE5C9C3B3B71616AF6C77FE20828A990F0FBA813CD6B026D4A9F88F73FAD16C7C22069B2EC8F1FAB44F21925373E7A'
    $VU &= 'D404CA680D822C0FBC7AFA0FFFE8E2F4D9B3D39333B33FC5B2CE3A2AE1913971B43DFA10AE8354FF610032A00A65F7815AF8692D2500130F46B5BA7AF3B527FEF8CCE4F4C4D9A999D99F0149DBAC10A1'
    $VU &= 'B49BEFF8D9F6741E42A41412AE83CE9C03B242593AA194968F13241E0276FDC99F9EFE337F15CC5D3877FEB3A00FC4899F2BA69C87D4679D0A850049942DE6345297F26AB49077F0F090D6DB7F7EFA2F'
    $VU &= '6626A7CF5E983A77DE2E93EC82F8DCE7BA2AF0301F589FA41C6D0296491F44623950273850C81F0688366093B5D86B7FF90DAF0D5DF09600988513E9FA8C83874A9F84C86404C8B269DB264DD324E1F8'
    $VU &= 'CFAAEA252DE8A07D50D7F5D74F3FFB8DE727262ECE9CCFE2E9EEF4FBB9930FA24FA2735CD39E4883B42C5AA6E51F88818288C4B430DA0D3B0BA77FE1F939AF82669F4BA6409D2024BBE97F7517FD4041'
    $VU &= '20DA110749D3F2C3B74D12D17ECD55B117FC55CF5FFFCDF4C4DCF499675966B5AE4FAAA4BE5BFA1BF7D3A74D284303508341153449D3362D9270C63501624FE0CADFFEFC0B73D35E0FCD8255D3040824'
    $VU &= '334901ABB5E2D121B47191EA4E9C8C8D8440DB96954F0B033DA9965A258956587DE4EFFEFEC2D90B93E7BE5EF66F4AEA0825C723B8F4CC11E84DA62FED0BB958B2F352F244410169D9F4ED11098E09E8'
    $VU &= '2D1895DE192CA115AA6BAFFDC3E485B9CBE73E0FFA37B5993C9C1418481655B4A0AF0C29C20B5AA443A054B76DC2D146D50A4DAB697FBEB9B47489065AE11F4F7F61F2F9B91766CE83FC266DD2AE300B'
    $VU &= 'E5291746B3FA34D5742892FFA5A80BD8A44E1FB88530C88A65A3490C717BD3B92D5AD387FECF43FFE2F94F9DB7A99BD411D714B5E7576291E6D3A76E9AB432BF9A14A12F5E828C9E88161C90AC12CD52'
    $VU &= '5A1E14627099688D7FFDB79E7F7F61EEF2D4AC6D67AB44FCB18CF36B79902D148FEA3A883EA58099A40BFAE462219036596D3A7CE796B3BAEAAC6C1A680DFEE7AB3F7979FAF9C9D9ACAD1348FCFAA7B5'
    $VU &= '93660BB56FAAA930784485AE23D19D4296EA5891205931D134A59545E1F1CEAD125A83E5FC6B9EFFE5C9D9CF96F99C4BA11064F3FA74D2042D929E7FF8A91C446194F56F8855340BBFB5EC080FE7AD2B'
    $VU &= '2DC66F92B95F7EF1F2DC0BBF316BE77ED32D1326C9E6FB3E6952A243B8914B3DB142942069A3798CDAA8227C36176F975AF3376DF2D68917A7E6E6667ECB2B6055A507764ABF761FFD063A39F2443CFF'
    $VU &= '6800244DA205F8C682B32971FEE01DA225E89138FDDB53675EFA9D23C8D29655D0D2A6017568E95FECE8CF116415AD60883B8AA72FF9D6E86A6BF1DB0079E9D5DF7DE9F7AAD469FBFE6821FDED58F028'
    $VU &= '93680D2E2FF9F61267E04DB65AFDE8FAE6958F3F53A66ED307BBEAB71BC3787B4571DE43B9D3F4B3CBB2D0802C83ACCF053BE87FF01E7D03BB0336AB5F5A59BA5237F7872BEE328D66F56D34A8EE94FA'
    $VU &= 'DEA7AFDCAA7B2FAE2CCA49DC7EBB597DC084846017EA34917EFB904D7349B9E2B1B8B2BCE29F28EE4AA9F5BB10FF3FFA7CE32D69AF2CBFB99A7115390FA54D77D97B7D63757450DABB999AE1DC5EF4CE'
    $VU &= '14F74ECD300E84BEC1E5BE45C563E9CEDB86FF6270707069616B900742DF30366F0FFAF683B73C6303B595A24730B87240F44B2B0B8B3ECB8DAD6669B5E653327020F4959525DF7EB0CF91D6F7D2CE59'
    $VU &= 'B4BFEFCBA6B93028F503C5E03DBCFEFAC848B0F816DB9AFE77ADB7579F6FDC1A6CE02EF479ACADC9211008DC2EDE743789F6E9AF79FAED4DDF58BDB920DD975C692FF1DC57EE146F29B5120DB453BFDD'
    $VU &= 'E91B1C58715D571A37B8BA75F5F6CDD137376B256F0D1BD8BFFAB269DEDC0A5CBDBAE5E31FD6D7B746FDD8595B5596B78A77560D633FEB9756E6D7EFB2B1B1BE5E1C75FFA944C360A6589C9FDF985FE3'
    $VU &= 'BED6BF321F9CDFD8D898F71ACDC64631A0D4287D0D2E8FCC7B048BFF61ECDBA56B18A59BAF78E2AF8C0537FC26E3C7FE5E3B9DF7DF098E8D960C639FA66F70F095316D2C381F5C91B11BDB67B6383236'
    $VU &= 'F6CAD8D8C81BDCB7FAA53B63C1EDB16FD72FDD1996AC97DAA7DFD7567DD46E66646F6FC8DFEB2FAE06D63C166A86B15F97AE54DFB1B4EA18D8AFE963D7FF9C37EA603FE9B7CEC1D037600077D3360E98'
    $VU &= 'BE0189D4971807465FAAD694BEE1C70FBDEC71E8F1E13EA5262FFFDFEA1BA55A8D0F225F5A1A3EFEA56F7FF9830DBEFCED2F1DBBE6961E6402945F321F40DF40EDCAC2FAD6924318ADC9AFFE0FE756B4'
    $VU &= '9CAA0E451B0C89F8DC1FC81BC5077CE099AFF223A88285320CA8A333FA4734092844217F7283B6A770CFB9BDED592A387BEFC9ACACBDB3639C41EE3C45F974F2DE713AA9A978B668C00F87C26D262BE2'
    $VU &= 'D3BF519FA6EE78B359877EFCA3277CB0DC2F34C5FDC6FE763B75E892B1AD6817F16DC4BEB036B3F1CCA43FA5AF683077255C578CC336F88168E85C2CEEDCEBA57D50C53F72F67A7D9FC862E1643FE95C'
    $VU &= '8D1C2B06E166E36310FC507D9A8C67B6BD77662B137F3FDBF052D41D3CDDB6D68AF9656B3BE7B565D7DECD5CE8F2FB8D02A3A93BDADBF66C55D29FFD685029A672B5BD6CB74B7B45E877E9C7E272D93F'
    $VU &= 'EDB7B53EB20E975ABBBEBCBDBD5DE7F565B43EE8F593725D9647FADD64C6C96AB7DC2AACC59F8B2E268BFFA00F024AB6A75AE16467F49BECA9B01D6B3CB67567BDAF4FDAF57ADA1F0EF669729D9FF4DD'
    $VU &= '5A99C7E3B563BBF91F98F41FD6FBD82BE26CE779B74C7614DF5FBD384007F48788D176A12AD6D30E2CFE865C41C77EEF8CA7D6E562ED54B1CF5F74C1681C53269F147FAF76ACE576BD1A1F9EDCFC7BFA'
    $VU &= 'E3C6D2BA55B4D0BBB5FBFFEA078332CEA5A71585B62479F02DED71B577A6B391EE5875A1D84FC68CD25881D276367FF5BC6269D9FA79361DED8DDFD2C97C9A6293509A99D8375384EF7AF0AD62B03819'
    $VU &= '79B7741B1FA828EA339435C0CFF0803E2B4D24A1292346A20C71151E53E8E8CB11A7F8361DC263D8CA469A304A7104E3DF562DB1157B5BB7EC42B1D726B3B6C9E91D4D7B7C55FA178573D69DD9D4D947'
    $VU &= 'C34E1200689023811C9A5102AB2811F71325A699B5D46D99E37B0C95CC4D8E5042112722EB174F208F50D06CC65925431395DDF01853C628C6F74419A2A9D80CBABCAA2066B21D663308D0C1DECC2EDB'
    $VU &= '753DEFB6A9898358F30B0C9D275D3B9D2FD797A7D9C676CC000C90B8C72A444026666CC8924777F79D418E6FEC73C335210B8F4722650628CC07EABBC7B26A1237415292368D62FC71C008EEFA64EE91'
    $VU &= '54CC758D44701A10180CE50BE8E66935D577A3422B14B44594B24FB4293CCD6F76CFDA2F67D3A771D32FFF001021A5292547426611E161692A639F41009228A92225AE2C230C7068B41DFDE2437D9EF9'
    $VU &= '4C121F96392F3306617B5FE41F00BC61256F13D34C4D00A82CF3BEFA2AA0DC9F2D7D64CFB562B15814AF76827CE4BF0321C40FAF3787A61D0EFAD47A92C346D82D119033809B1C505575AD1A7E70FA09'
    $VU &= '020A00A53856A04110E44D7C57FFF58B8DE4071BA465DB97F572A2DD50BC8E93B40733E59B7971F74D9EACE5C839B04E9D1FE1F778A5FE07FD28C349D4B028C13C0E383139565E96519E129E91848280'
    $VU &= 'F332C10043642698247858F972BF7CB28A8936BF61319F1233EBC1248F0BEDEED4AEF5FAB2DD8741BF78D2927342987AA3D2447E9A22546256129F93B4F33765C21100698609E50941CAC500A0BFE807'
    $VU &= '3E521643B491297320A06B6060CECCF298F26329239182401866C90197A282992958BF76036AD53B4BBBCEDF51CC57900F006785F6E19D14EBBD3E6AFAE5534A3FEA3A4AC488E0A812A1846E6A4A1855'
    $VU &= 'D2ECEA0755709A005C1938314A215126A3B2AF7E809BC8C4C710101EE581806685B198C15619248255B76BCBB0C94A40122138427050F940D62367727D9DBC2AA86BA15932213D2472AC151FEEF9757E'
    $VU &= '3E7812F4F813E9C34AF8823724EA9A4F65548F9257A12F09BAD137D47000B98F6960E41561A608D9A078046CA22A35AB889651023188202C194424C8222E1AAE3480308214E48240C9C22807BDCD4EE8'
    $VU &= 'D6F67A9D7CE05A68F611963D40C3D18AC967C075775E42F079904C18200D2F21411C26314C9128591931A406C97010048803BF22D24C212E6954A61CA181FA00DF3FF4D6AD06CFFD759DEBCE15BF5FB0'
    $VU &= '0A093E0B379E2EC7F5DBB5074DAB570246BF00ABA9AE69FD88B7E55A7F049F12BC1FEC3106EF8DF2C33858220A7D6AB46B9C77FAACEB9C7E0310F35BD098AC6D6966A6A8F1E9FF7503D3B6ADC5F3B58F'
    $VU &= '89A7EDA6B2AA6487EEBE71346F320879F6C6DB03FBE2F8759F448B529421C69A386D1105BE99372CE54C997D1074F40B49BB6956D3A31186110E8D48C67C631C1FB399EB0A1E31107C79B872F5F3EEE5'
    $VU &= 'F96580B745713A4C8508C51D9B9157146F6F839887D7D161293A79BF1227095DE91A86A8905B4559136EB898B91B28852131A0C47BA85D8AD5182D6A106369DCE48C05D467CCCFD5451963107CA10FDF'
    $VU &= '6DC7FAC3F3DB10CF2FF5C2B32D5709628486BBDED55A7DFD77D0C3F3657D19A12FFF97034DAB94677E9BB64DE3D3B84554D1F4D5F79BFA86FE503BE8AFF7ADD45A9E47AF0F7FC0B52E4E17FBBC9A4E57'
    $VU &= '67FBE22DEAC99FA2E6D66139F5C15F82B2D1E5A1D8594DFC4F2B75B0E2200C840178BAD968C95BECB173E9250F995457E9D18ABE532D4A24CC40DFA4B1746F6D6060BFF39F7F0602534AFDA6D73FA887'
    $VU &= '2EC27B1CC357889A4847770AD1C07B5577ACF673B9DD0BB16B333AF076B4DF452D34DF9B03D9AE6FE1933644B79C364E07864F78DC0F74BC9CE7A29652A3F200AC5435588994A6CAAEA8197278894F4B'
    $VU &= '3E660857AB69AB156E81E6F583889D00A6B8A205003CE4B1310C597EAB08B43E4B45B06FFFE6FB49C6C3BFF39314240FFB2BE73850E508D20000000049454E44AE426082'
    Return $VU
EndFunc

Func VU_Fragement_Image()
Local $VU_Fragment = '0x89504E470D0A1A0A0000000D49484452000000350000001E0803000000BB53A6B7000000AE504C54450000003030302828281010104040404848485050507878786060606868683838381818182C2C'
    $VU_Fragment &= '2C343434202020080808A8A8A88888889090907070705858588080807474744C4C4C7C7C7C5C5C5C6C6C6CB8B8B8B0B0B0646464D8D8D8F0F0F0E0E0E0ACACACC0C0C08484840C0C0CA4A4A41C1C1C8C'
    $VU_Fragment &= '8C8C545454040404A0A0A0E8E8E8E4E4E4D4D4D4C4C4C4D0D0D0C8C8C8B4B4B49898989C9C9CBCBCBCDCDCDCF4F4F4CCCCCCECECEC909898AA04C38C0000000174524E530040E6D8660000025D494441'
    $VU_Fragment &= '54785EC5D2D772DB381480611EF4CEDE49F52E773BC9EEFBBF58204AB1A954E52ADF053183C37F301C30F8E716094F1B2FE5C9E2C624910A0CBA30A0C4F68F49D72B64C05A75612D18A444F4DBA636C8'
    $VU_Fragment &= '2743342CF644F97037FF6554803927A4148DFFB054D6949C7B63E4CF9B9601395154F0CA076C2764517141143901FAB32862ACCEEA1DA1296F1841781586217684A5554349E647AC7CFD311292E7B9A0'
    $VU_Fragment &= 'B2AA894518DBBA6984D5D859DA577E3BCF2B295EBE8F6A99C79C31DE13A5DC8A46B3E9E7CFD35997F94C11C9CB5DB5CC9BEC3A9BD7324E522A39011FE97C36F591CFA67789DB28052517B448E2B43E8C'
    $VU_Fragment &= 'A285F091A05C808F904EEE8EFF4DCF8E77AF1B6715802CA84C62593F7F548DD8266C5711A7AC052D27B3E3BBD9A4D0A7FB7065C5B2642BE47BB4CD9631ED5340E021F37C3FFB7077DF5A37EC2B5E9749'
    $VU_Fragment &= '9CE597E8AD2E384D8543608C818D78987C9A7CBA984C264FCD661820D43434E65977AEB810AC2A351AC0267FB81F79BC7FDA3A40039DF13295CDE5E72B330E1AB98171F1E2F1CBC8E3E27F83CE438449'
    $VU_Fragment &= 'C576F57A388AF41C6177016ED93E5D691340EE424355D3F4E88F22A9D478A3379E7F02E2DDC362E4A1CB117C1B3BEC8A46754144F90E63FD0D06245EDBB791F62011E87718F74519943909F108426419'
    $VU_Fragment &= 'B5CFEFDA794C11C223615905DCECF19856A88FBBF9BC1BF8752B91D2786CAF82D57E752534609B388AD6D1D936550061B81A0B827D786DBF224609FE7258AF0FEBC34BD51344F0F72F053FC2042C13C5'
    $VU_Fragment &= '328E978560CA101DDC02138B2CA18C51A28CF5D16D56962830278A5A1CDC0C0319000EFE0ED6FA97C957E7B64B82E69A2ACC0000000049454E44AE426082'
    Return $VU_Fragment
EndFunc

I just feel there has to be a better way and a way where you could use different images.

Any help on this is greatly appreciated, if you dont know a better way but know if that is the image and if it is HEX or why there are 2 functions for the image (VU_Image() & VU_Fragement_Image()) please let me know.

I plan to post my complete code up once I get this all sorted out to give back to the community, my goal is to make a set of gauges that is user customizable and can report data read on a serial port through an external controller like an arduino and do it all in AutoIT.

I think will be great for things like Speedometer, Tachometer, Water Level, or any other type of sensor that looks good as an analog gauge.

I have noticed the explosion in EE with the Arduino and many of those users are looking for compatible software which is just as simple and easy to learn. I think the marriage of Arduino and AutoIT is perfect because they are both very similar in their nature. My primary focus withing AIT currently is to come up with creative ways to bring these 2 communities together for the mutual benefit of both.


~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Share this post


Link to post
Share on other sites



Don't everyone answer at once, Do I need more information or does my thread not make sense. Please anything you need from me to help get this topic rolling just let me know. I'd love to get this thing going because I believe this will be a hot item once its working and people can use and modify it easily.


~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Share this post


Link to post
Share on other sites

Hi,

The person that can probably answer your post most effectively would be UEZ.

But UEZ is on holidays atm.

So hang in there and bump your thread once a day so it doesn't get lost.

I'm sure once UEZ is back from holidays he'll try and answer your question.

Cheers

Share this post


Link to post
Share on other sites

Hi,

you can use this code to convert any file to a binary string: http://autoitscript.com/forum/topic/123293-how-to-play-sound-directly-not-from-file/page__view__findpost__p__856302

İt will create a function within the binary string which will be put to the clipboard (it is a modıfied version from Ward's code!)

To use this binary string you can use the Load_BMP_From_Mem function (latest version here: http://pastebin.com/mt1NkG5e)

Check out eukalyptus' Audio Visualization Collection: http://www.autoit.de/index.php?page=Thread&threadID=23204

Greeting from west coast of Turkey :)

Br,

UEZ

PS: wrote from an internet cafe


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
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
Sign in to follow this  
Followers 0