1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. UEZ

Beiträge von UEZ

  • Rekursive Dateisuche

    • UEZ
    • 28. Januar 2010 um 16:26
    Zitat von Silverlight

    Da öffnet sich dann aber noch eine GUI *heul* geht es auch ohne :)?
    Ansonsten perfekt werde es testen.

    Einfach die Zeile 11 auskommentieren -> ;_ArrayDisplay($ergebnis)

    Gruß,
    UEZ

  • Rekursive Dateisuche

    • UEZ
    • 28. Januar 2010 um 15:37
    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    Dim $ergebnis[1]

    [/autoit] [autoit][/autoit] [autoit]

    $path = "c:\"
    $file = ".mp3" ;suche nach *.mp3

    [/autoit] [autoit][/autoit] [autoit]

    $ergebnis = File_Seeker($path, $file, $ergebnis, True)

    [/autoit] [autoit][/autoit] [autoit]

    If Not @error Then
    ;~ _ArraySort($ergebnis)
    _ArrayDisplay($ergebnis)
    Local $log
    For $i = 1 To UBound($ergebnis) - 1
    $log &= $ergebnis[$i] & @CRLF
    Next
    $file = FileOpen(@ScriptDir & "\Ergebnis.log", 1)
    FileWrite($file, $log) ;schreibe das Ergebnis in die "Ergebnis.log" Datei
    FileClose($file)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit] [autoit][/autoit] [autoit]

    ;==================================================================================================
    ; Function Name: File_Seeker($path, $file, $array)
    ; Description: searchs for a file recursively on given drive
    ; Parameter(s): $path path where to search
    ; $file filename to search for
    ; $array to save the search results
    ; $ext search for file extension, e.g. .mp3
    ; $exact to search for exact file name (not case sensitive)
    ; Return Value(s): an array with the full path of the files, $array[0] = amount of found files
    ; Version: v0.75 Build 2010-01-18 Beta
    ; Author(s): UEZ
    ;==================================================================================================
    Func File_Seeker($path, $file, ByRef $aResults, $ext = False, $exact = False)
    If $file <> "" And IsArray($aResults) Then
    If StringRegExp(StringLeft($path, 1), "[a-zA-Z]") And StringMid($path, 2, 1) = ":" Then
    If StringRight($path, 1) <> "\" Then $path &= "\"
    Local $seek, $suffix = ""
    Local $search = FileFindFirstFile($path & "*")
    If $search = -1 Then
    SetError(2)
    Return
    EndIf
    While 1
    $seek = FileFindNextFile($search)
    If @error Then ExitLoop
    If @extended Then File_Seeker($path & $seek & "\", $file, $aResults, $ext, $exact)
    If $exact Then
    If $seek = $file Then _ArrayAdd($aResults, $path & $seek)
    Else
    If $ext Then $suffix = "$"
    If StringRegExp($seek, "(?i:\" & $file & $suffix & "\b)") Then _ArrayAdd($aResults, $path & $seek)
    EndIf
    WEnd
    FileClose($search)
    $aResults[0] = UBound($aResults) - 1
    SetError(0)
    Return $aResults
    Else
    SetError(1)
    Return
    EndIf
    Else
    SetError(1)
    Return
    EndIf
    EndFunc

    [/autoit]


    Gruß,
    UEZ

  • Rekursive Dateisuche

    • UEZ
    • 28. Januar 2010 um 15:17
    Zitat von Silverlight

    Ok aber wo gibt er das Ergebnis aus?

    Das Ergebnis wird in ein Array gespeichert und nur angezeigt.

    Das Schreiben des Ergebnisses in eine Datei ist nicht implementiert, da ich nicht weiß, was die Leute mit dem Ergebniss machen wollen!

    Gruß,
    UEZ

  • Play Chip Sound from Memory

    • UEZ
    • 28. Januar 2010 um 15:07
    Zitat von progandy


    MemoryDLL selbst sollte auch unter x64 laufen. Nur die FMOD.dll nicht. Was passiert denn, wenn du als AutoIt x86 ausführst?

    Die compilierte x86 exe unter Win7 x64 läuft, aber nicht, wenn du es native x64 laufen lässt. Ob das jetzt and der FMOD.DLL oder and MemoryDLL.au3 liegt, habe ich nicht direkt getestet, sondern nur vermutet, da die FMOD.DLL ja nicht x64 Code enthält, aber von dem AutoIt Code im x64 Mode ausgeführt wird.
    Die compilierte x64 läuft auch nicht!

    Gruß,
    UEZ

  • Rekursive Dateisuche

    • UEZ
    • 28. Januar 2010 um 14:58
    Zitat von Silverlight

    Oscar wie lasse ich mir den die gefunden Pfade + Dateien in einer txt Datei wieder geben?
    Ich denke mal mit

    [autoit]

    _ArrayDisplay($aReturn, 'Alle Dateien mit der Erweiterung ".au3"')

    [/autoit]

    aber wo werden sie gespeichert?

    UEZ dein Programm sucht aber nur nach einer Datei?

    Nein, nach den Dateien, die ins Suchmuster passen. Im Beispiel nach *.log Dateien.

    Gruß,
    UEZ

  • Rekursive Dateisuche

    • UEZ
    • 28. Januar 2010 um 14:09

    Auch eins von mir -> File_Seeker v0.75 Build 2010-01-18 Beta (Schleichwerbung).

    Kannst ja mal testen und Feedback geben, ob das Proggy richtig läuft!

    Gruß,
    UEZ

  • Play Chip Sound from Memory

    • UEZ
    • 28. Januar 2010 um 00:08

    MemoryDLL.au3 läuft anscheinend nur unter x32! :(

    Gruß,
    UEZ

  • Play Chip Sound from Memory

    • UEZ
    • 27. Januar 2010 um 23:56

    Hier eine Demo, wie man ein Chip Sound (FastTracker Mods) direkt vom Speicher abspielt!

    Da der Source Code recht groß ist, nur als Anhang! :huh:

    Benutzt wurden

    • FMOD.au3 in einer von mir modifizierten Version
    • FMOD.DLL
    • MemoryDLL.au3
    • 3 Sounds :rock:

    Gruß,
    UEZ

    PS: Source Code scheint nur als x86 zu laufen!

    Dateien

    Play MP3 from mem using FMOD.au3 1,85 MB – 1.534 Downloads FMod Memory Play Example.au3 1,13 MB – 1.067 Downloads
  • gdi plus

    • UEZ
    • 27. Januar 2010 um 22:34

    Nun ja, da habe ich fast dein Skript geschrieben...

    Spoiler anzeigen
    [autoit]


    ;===================================================================================================
    ; INRadio-Localtuner by JuraX
    ;===================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    #NoTrayIcon
    #include "Bass.au3"
    ;~ #include <BassConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #Include <Misc.au3>
    #include <Sound.au3>
    #include <WindowsConstants.au3>
    #include <GDIplus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0)
    #Region StartUp
    Local $progress_slider, $slots, $hwnd
    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233
    Global $playing_state = -1
    Global $aItem[2]

    [/autoit] [autoit][/autoit] [autoit]

    ;First Start
    ;~ $firststart = IniRead("INRadio.ini", "Start", "firststart", "")
    ;~ If $firststart = "" Then
    ;~ MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    ;~ Exit
    ;~ ElseIf ProcessExists("Radiotuner.exe") Then
    ;~ Else
    ;~ MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    ;~ Exit
    ;~ EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;Bass StartUp
    _BASS_STARTUP(@ScriptDir & "\BASS.dll")
    _BASS_Init(0, -1, 44100, 0, "")
    If @error Then
    MsgBox(0, "Error", "Sound konnte nicht Initialisiert werden!")
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;File Open
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    If @error Then
    MsgBox(0, "Error", "Konnte Audiodatei nicht laden!" & @CR & "Error = " & @error)
    Exit
    EndIf
    $fftstruct = DllStructCreate("float[128]")
    _BASS_ChannelPlay($MusicHandle, 0)
    $playing_state = 1
    #EndRegion StartUp

    [/autoit] [autoit][/autoit] [autoit]

    #Region GUI
    $width = 380
    $height = 650
    $hwnd = GUICreate("INRadio-Localtuner", $width, $height, -1, -1, Default, $WS_EX_ACCEPTFILES)
    $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
    $Play = GUICtrlCreateButton("Play", 216, 160, 75, 25, 0)
    $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
    $newfile = GUICtrlCreateButton("Andere Datei", 36, 160, 75, 25, 0)
    $progress_slider = GUICtrlCreateProgress(8, 32, 236, 20)
    $slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider) & "%", 8, 8, 150, 17)
    ;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Lautstärke", 8, 190, 80, 20)
    $Volume_slider1 = GUICtrlCreateSlider(8, 210, 366, 80)
    GUICtrlSetData($Volume_slider1, 50)
    GUICtrlSetLimit(-1, 100, 0)
    $Volume_slider2 = GUICtrlCreateSlider(8, 292, 366, 80)
    GUICtrlSetData($Volume_slider2, 50)
    GUICtrlSetLimit(-1, 100, 0)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hListView = GUICtrlCreateListView('Dateiname|Pfad', 10, 375, 350, 200)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($hwnd, '', 1)

    [/autoit] [autoit][/autoit] [autoit]

    $rightVol = GUICtrlCreateProgress(8, 88, 236, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
    $LeftVol = GUICtrlCreateProgress(8, 136, 236, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion GUI

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateListViewItem(StringRegExpReplace($file, '.*\\(.*)\..*', '$1')& "|" & $file, $hListView)
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $iX = 120
    $iY = 145
    $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsClear($backbuffer)
    $pen1_size = 4
    $pen1 = _GDIPlus_PenCreate(0, $pen1_size)
    $pen2_size = 4
    $pen2 = _GDIPlus_PenCreate(0, $pen2_size)
    $pen3_size = 3
    $pen3 = _GDIPlus_PenCreate(0, $pen3_size)

    [/autoit] [autoit][/autoit] [autoit]

    $fall_speed_l_threshold = 0
    $fall_speed_r_threshold = 0
    $equalizer_width = 24
    $max_l = 0
    $max_r = 0
    $fall_speed = 5
    $fire_up = 15

    [/autoit] [autoit][/autoit] [autoit]

    $fft_start = 7
    $fft_end = 127
    $fft_boost = 750
    $dy = Int($iY / ($fft_end - $fft_start)) + $pen3_size
    $dyy = Int($iY / $dy / 2)
    $eq = -1
    Dim $mpos[2]
    ;Sonstiges
    AdlibRegister("Aktualisieren", 100)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #Region Loop
    While 1 * Sleep(20)
    If $playing_state = 1 Then
    $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    $percent = Round(($current / $song_length) * 100, 0)
    GUICtrlSetData($progress_slider, $percent)
    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $rightChLvl = _LoWord($levels)
    $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
    $LeftChLvl = _HiWord($levels)
    $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
    Else
    $rightChLvlper = 0
    $leftChLvlper = 0
    EndIf
    GUICtrlSetData($rightVol, $rightChLvlper)
    GUICtrlSetData($LeftVol, $leftChLvlper)
    Display_Vis($eq)
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE, $Close
    _BASS_Stop()
    _BASS_Free()
    ProcessClose("Radiotuner.exe")
    AdlibUnRegister("Aktualisieren")
    _GDIPlus_PenDispose($pen1)
    _GDIPlus_PenDispose($pen2)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    $fftstruct = 0
    Exit
    Case $Play
    _BASS_ChannelPlay($MusicHandle, 1)
    $playing_state = 1
    Case $newfile
    _BASS_ChannelStop($MusicHandle)
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 0)
    Case $Volume_slider1
    _BASS_SetVolume(GUICtrlRead($Volume_slider1) / 100)
    Case $Volume_slider2
    SoundSetWaveVolume(GUICtrlRead($Volume_slider2))
    Case $Stop
    _BASS_ChannelStop($MusicHandle)
    $playing_state = -1
    EndSwitch
    $mpos = MouseGetPos()
    If $mpos[0]>= $width - $iX - 10 And $mpos[0] <= $width - 10 And $mpos[1] > 8 And $mpos[1] <= $iY + 8 And _IsPressed("01", "user32.dll") And WinActive($hwnd) Then
    $eq *= -1
    EndIf
    WEnd
    #EndRegion Loop

    [/autoit] [autoit][/autoit] [autoit]

    #Region Func's
    Func OnAutoItExit()
    ; _BASS_Free()
    EndFunc ;==>OnAutoItExit

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
    Local $nSize, $pFileName ; Original von UEZ http://www.autoit.de/index.php?page…4119#post134119
    Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $nAmt[0]
    $nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
    $nSize = $nSize[0] + 1
    $pFileName = DllStructCreate('wchar[' & $nSize & ']')
    DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
    $filename = DllStructGetData($pFileName, 1) ;Dateinamen holen
    ConsoleWrite($filename & @CRLF)
    ReDim $gaDropFiles[$i + 1]
    $gaDropFiles[$i] = $filename
    $pFileName = 0
    Next
    ;_ArrayDisplay($gaDropFiles)
    For $i = 0 To UBound($gaDropFiles) - 2 ;kommt derzeit immer noch ein leerer Eintrag am schluss
    GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1')& "|" & $gaDropFiles[$i], $hListView)
    Next
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE) ;erst wenn alle eigefügt sind
    EndFunc ;==>WM_DROPFILES_FUNC

    [/autoit] [autoit][/autoit] [autoit]

    Func Aktualisieren()
    $Sliderstatus = GUICtrlRead($progress_slider)
    GUICtrlSetData($slots, $Sliderstatus)
    EndFunc ;==>Aktualisieren

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam);<================== Benachrichtigung Doppelklick from Chaoskeks (in ChaosExecution)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $hListView And $code = -3 And _GUICtrlListView_GetSelectedCount($hListView) > 0 Then
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView)
    IF _GUICtrlListView_GetItemSelected($hListView, $i) Then
    $aItem = _GUICtrlListView_GetItemTextArray($hlistview, $i)
    ;~ In aItem[1] steht der Dateiname und in $aItem[2] der Pfad zincl. Dateinamen
    _LeftDblClick()
    EndIf
    Next
    Endif
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIF

    [/autoit] [autoit][/autoit] [autoit]

    Func _LeftDblClick()
    _BASS_ChannelStop($MusicHandle)
    $File = $aItem[2]
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Display_Vis($eq = 1)
    _GDIPlus_GraphicsClear($backbuffer, 0x80F0F0F0)
    If $eq > 0 Then
    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $LeftChLvl = $leftChLvlper ;Round(_HiWord($levels) / $iY, 0)
    $RightChLvl = $rightChLvlper ;Round(_LoWord($levels) / $iY, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $max_l <= $LeftChLvl Then ;fire up higest line
    $max_l = $LeftChLvl + $fire_up
    $fall_speed_l_threshold = 20
    Else
    If $fall_speed_l_threshold <= 0 Then ;increase fall speed of highest line faster until threshold is <= 0 (second fall part)
    If $max_l > $LeftChLvl + $pen2_size * 2 Then $max_l -= $fall_speed
    Else
    $fall_speed_l_threshold -= 1 ;increase fall speed of highest line by slower until threshold is <= 0 (first fall part)
    If $max_l > $LeftChLvl + $pen2_size * 2 Then $max_l -= $fall_speed / 3
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $max_r <= $RightChLvl Then
    $max_r = $RightChLvl + $fire_up
    $fall_speed_r_threshold = 20
    Else
    If $fall_speed_r_threshold <= 0 Then
    If $max_r > $RightChLvl + $pen2_size * 2 Then $max_r -= $fall_speed
    Else
    $fall_speed_r_threshold -= 1
    If $max_r > $RightChLvl + $pen2_size * 2 Then $max_r -= $fall_speed / 3
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_PenSetColor($pen2, 0xFF505050)
    For $l = -$pen1_size - 2 To $leftChLvl Step $pen1_size * 2
    $r = $l / ($iY) * 224
    $g = 224 - $r
    $b = 0
    _GDIPlus_PenSetColor($pen1, "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsDrawLine($backbuffer, $iX / 5, $iY - $l, $iX / 5 + $equalizer_width, $iY - $l, $pen1)
    Next
    For $l = 0 To $RightChLvl
    $r = (-(Cos(1.7 * $l / 128) + 1) / 2) * 224
    $g = ((Cos(4 * $l / 256) + 1) / 2) * 224
    $b = 0
    _GDIPlus_PenSetColor($pen1, "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsDrawLine($backbuffer, 3 * $iX / 5, $iY - $l, 3 * $iX / 5 + $equalizer_width, $iY - $l, $pen1)
    Next
    _GDIPlus_GraphicsDrawLine($backbuffer, $iX / 5, $iY - $max_l, $iX / 5 + $equalizer_width, $iY - $max_l, $pen2)
    _GDIPlus_GraphicsDrawLine($backbuffer, 3 * $iX / 5, $iY - $max_r, 3 * $iX / 5 + $equalizer_width, $iY - $max_r, $pen2)
    Else
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = $fft_start To $fft_end Step $dy
    $fft = Round(DllStructGetData($fftstruct, 1, $i + 1) * $fft_boost)
    $r = (-(Cos(1.7 * $fft / 256) + 1) * 0.5) * 256
    $g = ((Cos(4 * $fft / 256) + 1) * 0.5) * 256
    $b = 0
    _GDIPlus_PenSetColor($pen3, "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsDrawLine($backbuffer, $iX / 5, $i + $dyy, $iX / 5 + $fft, $i + $dyy, $pen3)
    Next
    EndIf
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, $width - $iX - 10, 8, $iX, $iY)
    EndFunc
    #EndRegion Func's

    [/autoit]

    Ist nur eine simple Implementierung!

    Gruß,
    UEZ

  • StringSplit und @CRLF Leerzeilen entfernen

    • UEZ
    • 26. Januar 2010 um 19:39

    Oder du kannst auch StringStripWS() benutzen (siehe Hilfe)!

    Gruß,
    UEZ

  • GDIPlus Digitaluhr

    • UEZ
    • 26. Januar 2010 um 19:37
    Zitat von xp_fan

    Sry, dass ich erst jetzt antworte!
    UEZ & Andy:Jetzt funtioniert's super :thumbup: !!!!!
    Noch eine Frage:
    Kann man die inaktiven Segmente auch ganz transparent machen, sodass man bei transparentem Hintergrund nur die Ziffern sieht?

    Ja, in dem du einfach das Zeichnen des Hintergrundes abschaltest!

    Gruß,
    UEZ

  • Zufalls Wert generieren ---> Ordner erstellen

    • UEZ
    • 26. Januar 2010 um 19:33

    Wenn nicht mehrmals in einer Sekunden Ordner erstellet werden sollen, würde ich anstelle von Zufallszahlen eher ein Datum-Zeit-Format wählen, wie z.B. 2010-01-26_193320.

    [autoit]


    $foldername = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & @SEC

    [/autoit]

    Ansonsten kann man ja noch eine Zufallszahl dran hängen!

    Gruß,
    UEZ

  • Stadion-Uhr

    • UEZ
    • 26. Januar 2010 um 19:25

    Schick, schick Oscar :thumbup:

    Ich plane auch sowas, aber mit GDI+ :rolleyes:

    Ich muss mir nur noch das Design der GUI mir überlegen und dann kann es losgehen!

    Gruß,
    UEZ

  • Rekursionseinstieg: Fakultät - Logikproblem!?

    • UEZ
    • 26. Januar 2010 um 14:27

    Ich benutze HIEW um die Hex Codes in die Datei und W32Dasm um den ASM Code angezeigt zu bekommen!

    Ich habe auch das Bespiel von RAPTOR-ONE versucht in ASM zu bekommen, aber irgendwie will es nicht so richtig! Deins geht ja wunderbar.

    Ich würde gerne wissen, woran das liegt.

    Ich habe dein Beispiel mit der Demo3 (mein Versuch) erweitert:

    Spoiler anzeigen
    [autoit]


    Func Demo3($n)
    Func Demo3($n)
    ; Initial an asm object
    AsmReset($Asm) ;Zeilennummer Kommentar
    AsmAdd($Asm, " push ebp" ) ;00
    AsmAdd($Asm, " mov ebp, esp" ) ;01
    AsmAdd($Asm, " mov ecx, [ebp + 08]") ;03
    AsmAdd($Asm, " mov eax, 1" ) ;09
    AsmAdd($Asm, " mov ebx, 1" ) ;0F
    AsmAdd($Asm, " cmp ecx, 2" ) ;15
    AsmAdd($Asm, " jbe $+1E" ) ;1B jbe @endek2
    AsmAdd($Asm, " sub ecx, 2" ) ;1D
    AsmAdd($Asm, "start:" )
    AsmAdd($Asm, " add eax, ebx" ) ;23 fn2(ax) = fn1(ax) + fn(bx)
    AsmAdd($Asm, " mov edx, eax" ) ;25 fn2(cx) = fn2(ax)
    AsmAdd($Asm, " sub edx, ebx" ) ;27 fn1(dx) = fn2(dx) - fn(bx)
    AsmAdd($Asm, " loop $+5" ) ;29 loop @start2
    AsmAdd($Asm, " jmp $+F" ) ;2C jmp @ende"
    AsmAdd($Asm, "start2:" )
    AsmAdd($Asm, " add eax, edx" ) ;2E fn2(ax) = fn1(ax) + fn(dx)
    AsmAdd($Asm, " mov ebx, eax" ) ;30 fn2(bx) = fn2(ax)
    AsmAdd($Asm, " sub ebx, edx" ) ;32 fn1(bx) = fn2(bx) - fn(dx)
    AsmAdd($Asm, " loop @start" ) ;34 loop @start
    AsmAdd($Asm, " jmp $+4" ) ;37 jmp @ende"
    AsmAdd($Asm, "endek2:" )
    AsmAdd($Asm, " mov eax, ecx" ) ;39
    AsmAdd($Asm, "ende: " )
    AsmAdd($Asm, " pop ebp" ) ;3B
    AsmAdd($Asm, " ret" ) ;3C

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite(String(AsmGetBinary($Asm)) & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    $Ret = MemoryFuncCall("int", AsmGetPtr($Asm), "int", $n)

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0, "Demo 0: Fibonacci via Inline ASM", "Fibonacci (" & $n & ") = " & $Ret[0])

    [/autoit] [autoit][/autoit] [autoit]

    ; Release the asm object
    AsmExit($Asm)
    EndFunc

    [/autoit]

    Hier der Disassembler Code:

    Spoiler anzeigen
    Code
    :00000000 55                  push ebp
    :00000001 8BEC                mov ebp, esp
    :00000003 8B8D08000000        mov ecx, dword ptr [ebp+00000008]
    :00000009 C7C001000000        mov eax, 00000001
    :0000000F C7C301000000        mov ebx, 00000001
    :00000015 81F902000000        cmp ecx, 00000002
    :0000001B 761C                jbe 00000039
    :0000001D 81E902000000        sub ecx, 00000002
    :00000023 03C3                add eax, ebx
    :00000025 8BD0                mov edx, eax
    :00000027 2BD3                sub edx, ebx
    :00000029 67E202              loop 0000002E
    :0000002C EB0D                jmp 0000003B
    :0000002E 03C2                add eax, edx
    :00000030 8BD8                mov ebx, eax
    :00000032 2BDA                sub ebx, edx
    :00000034 67E2EC              loop 00000023
    :00000037 EB02                jmp 0000003B
    :00000039 8BC1                mov eax, ecx
    :0000003B 5D                  pop ebp
    :0000003C C3                  ret
    Alles anzeigen

    Weiß du, warum meins nicht funktioniert?

    Danke,
    UEZ

  • Rekursionseinstieg: Fakultät - Logikproblem!?

    • UEZ
    • 25. Januar 2010 um 23:34

    Andy:

    das hatte ich auch gestern Abend noch probiert, aber ich weiß nicht, wie ich den Code sauber umwandeln kann.

    Hier mein Versuch:

    [autoit]


    #include <ASM.au3>

    [/autoit][autoit][/autoit][autoit]

    ; Initial an asm object
    Global $Asm = AsmInit()
    $n = 30
    AsmReset($Asm) ;Zeilennummer Kommentar
    AsmAdd($Asm, " mov ecx, " & $n ) ;0E
    AsmAdd($Asm, " mov eax, 1" ) ;13
    AsmAdd($Asm, " mov ebx, 1" ) ;19
    AsmAdd($Asm, " cmp ecx, 2" ) ;1E
    AsmAdd($Asm, " jbe $+19" ) ;21 jbe @endek2
    AsmAdd($Asm, " sub ecx, 2" ) ;23
    AsmAdd($Asm, "start: ")
    AsmAdd($Asm, " add eax, ebx" ) ;26 fn2(ax) = fn1(ax) + fn(bx)
    AsmAdd($Asm, " mov edx, eax" ) ;28 fn2(cx) = fn2(ax)
    AsmAdd($Asm, " sub edx, ebx" ) ;2A fn1(dx) = fn2(dx) - fn(bx)
    AsmAdd($Asm, " loop $+4" ) ;2C loop @start2
    AsmAdd($Asm, " jmp $+E" ) ;2E jmp @ende"
    AsmAdd($Asm, "start2: ")
    AsmAdd($Asm, " add eax, edx" ) ;30 fn2(ax) = fn1(ax) + fn(dx)
    AsmAdd($Asm, " mov ebx, eax" ) ;32 fn2(bx) = fn2(ax)
    AsmAdd($Asm, " sub ebx, edx" ) ;34 fn1(bx) = fn2(bx) - fn(dx)
    AsmAdd($Asm, " loop @start" ) ;36 loop @start
    AsmAdd($Asm, " jmp $+4" ) ;38 jmp @ende"
    AsmAdd($Asm, "endek2: ")
    AsmAdd($Asm, " mov eax, ecx" ) ;3A
    AsmAdd($Asm, "ende: ")
    AsmAdd($Asm, " ret ") ;3C

    [/autoit][autoit][/autoit][autoit]

    ConsoleWrite(String(AsmGetBinary($Asm)) & @CRLF)

    [/autoit][autoit][/autoit][autoit]

    $Ret = MemoryFuncCall("int", AsmGetPtr($Asm))

    [/autoit][autoit][/autoit][autoit]

    MsgBox(0, "Demo 0: Fibonacci via Inline ASM", "Fibonacci (" & $n & ") = " & $Ret[0])

    [/autoit][autoit][/autoit][autoit]

    ; Release the asm object
    AsmExit($Asm)
    Exit

    [/autoit]

    Ich hatte trancexx gefragt, aber sie konnte / wollte mir nicht helfen!

    Kannst du mir den Weg erklären, wie du das gemacht hast?

    Danke,
    UEZ

  • gdi plus

    • UEZ
    • 25. Januar 2010 um 22:21

    Hier mit dem GDI+ Visualizer:

    Spoiler anzeigen
    [autoit]


    ;===================================================================================================
    ; INRadio-Localtuner by JuraX
    ;===================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    #NoTrayIcon
    #include <Bass.au3>
    #include <BassConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #include <sound.au3>
    #include <WindowsConstants.au3>
    #include <GDIplus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region StartUp
    Local $progress_slider, $slots, $hwnd
    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233
    Global $playing_state = -1
    Global $aItem[2]

    [/autoit] [autoit][/autoit] [autoit]

    ;First Start
    ;~ $firststart = IniRead("INRadio.ini", "Start", "firststart", "")
    ;~ If $firststart = "" Then
    ;~ MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    ;~ Exit
    ;~ ElseIf ProcessExists("Radiotuner.exe") Then
    ;~ Else
    ;~ MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    ;~ Exit
    ;~ EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;Bass StartUp
    _BASS_STARTUP("BASS.dll")
    _BASS_Init(0, -1, 44100, 0, "")
    If @error Then
    MsgBox(0, "Error", "Sound konnte nicht Initialisiert werden!")
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;File Open
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    If @error Then
    MsgBox(0, "Error", "Konnte Audiodatei nicht laden!" & @CR & "Error = " & @error)
    Exit
    EndIf
    _BASS_ChannelPlay($MusicHandle, 0)
    $playing_state = 1
    #EndRegion StartUp

    [/autoit] [autoit][/autoit] [autoit]

    #Region GUI
    $width = 380
    $height = 650
    $hwnd = GUICreate("INRadio-Localtuner", $width, $height, -1, -1, Default, $WS_EX_ACCEPTFILES)
    $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
    $Play = GUICtrlCreateButton("Play", 216, 160, 75, 25, 0)
    $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
    $newfile = GUICtrlCreateButton("Andere Datei", 36, 160, 75, 25, 0)
    $progress_slider = GUICtrlCreateProgress(8, 32, 236, 20)
    $slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider) & "%", 8, 8, 150, 17)
    ;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Lautstärke", 8, 190, 80, 20)
    $Volume_slider1 = GUICtrlCreateSlider(8, 210, 366, 80)
    GUICtrlSetData($Volume_slider1, 50)
    GUICtrlSetLimit(-1, 100, 0)
    $Volume_slider2 = GUICtrlCreateSlider(8, 292, 366, 80)
    GUICtrlSetData($Volume_slider2, 50)
    GUICtrlSetLimit(-1, 100, 0)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hListView = GUICtrlCreateListView('Dateiname|Pfad', 10, 375, 350, 200)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($hwnd, '', 1)

    [/autoit] [autoit][/autoit] [autoit]

    $rightVol = GUICtrlCreateProgress(8, 88, 236, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
    $LeftVol = GUICtrlCreateProgress(8, 136, 236, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion GUI

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateListViewItem(StringRegExpReplace($file, '.*\\(.*)\..*', '$1')& "|" & $file, $hListView)
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $iX = 120
    $iY = 145
    $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsClear($backbuffer)
    $pen1_size = 4
    $pen1 = _GDIPlus_PenCreate(0, $pen1_size)
    $pen2_size = 4
    $pen2 = _GDIPlus_PenCreate(0, $pen2_size)

    [/autoit] [autoit][/autoit] [autoit]

    $fall_speed_l_threshold = 0
    $fall_speed_r_threshold = 0
    $c = 1
    $equalizer_width = 24
    $max_l = 0
    $max_r = 0
    $fall_speed = 5
    $fire_up = 15

    [/autoit] [autoit][/autoit] [autoit]

    ;Sonstiges
    AdlibRegister("Aktualisieren", 100)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #Region Loop
    While 1 * Sleep(20)
    If $playing_state = 1 Then
    $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    $percent = Round(($current / $song_length) * 100, 0)
    GUICtrlSetData($progress_slider, $percent)
    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $rightChLvl = _LoWord($levels)
    $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
    $LeftChLvl = _HiWord($levels)
    $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
    Else
    $rightChLvlper = 0
    $leftChLvlper = 0
    EndIf
    GUICtrlSetData($rightVol, $rightChLvlper)
    GUICtrlSetData($LeftVol, $leftChLvlper)
    Display_Vis()
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE, $Close
    _BASS_Stop()
    _BASS_Free()
    ProcessClose("Radiotuner.exe")
    AdlibUnRegister("Aktualisieren")
    _GDIPlus_PenDispose($pen1)
    _GDIPlus_PenDispose($pen2)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Play
    _BASS_ChannelPlay($MusicHandle, 1)
    $playing_state = 1
    Case $newfile
    _BASS_ChannelStop($MusicHandle)
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 0)
    Case $Volume_slider1
    _BASS_ChannelSetVolume($MusicHandle, GUICtrlRead($Volume_slider1) / 100)
    Case $Volume_slider2
    SoundSetWaveVolume(GUICtrlRead($Volume_slider2))
    Case $Stop
    _BASS_ChannelStop($MusicHandle)
    $playing_state = -1
    EndSwitch
    WEnd
    #EndRegion Loop

    [/autoit] [autoit][/autoit] [autoit]

    #Region Func's
    Func OnAutoItExit()
    ; _BASS_Free()
    EndFunc ;==>OnAutoItExit

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
    Local $nSize, $pFileName ; Original von UEZ http://www.autoit.de/index.php?page…4119#post134119
    Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $nAmt[0]
    $nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
    $nSize = $nSize[0] + 1
    $pFileName = DllStructCreate('wchar[' & $nSize & ']')
    DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
    $filename = DllStructGetData($pFileName, 1) ;Dateinamen holen
    ConsoleWrite($filename & @CRLF)
    ReDim $gaDropFiles[$i + 1]
    $gaDropFiles[$i] = $filename
    $pFileName = 0
    Next
    ;_ArrayDisplay($gaDropFiles)
    For $i = 0 To UBound($gaDropFiles) - 2 ;kommt derzeit immer noch ein leerer Eintrag am schluss
    GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1')& "|" & $gaDropFiles[$i], $hListView)
    Next
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE) ;erst wenn alle eigefügt sind
    EndFunc ;==>WM_DROPFILES_FUNC

    [/autoit] [autoit][/autoit] [autoit]

    Func Aktualisieren()
    $Sliderstatus = GUICtrlRead($progress_slider)
    GUICtrlSetData($slots, $Sliderstatus)
    EndFunc ;==>Aktualisieren

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam);<================== Benachrichtigung Doppelklick from Chaoskeks (in ChaosExecution)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $hListView And $code = -3 And _GUICtrlListView_GetSelectedCount($hListView) > 0 Then
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView)
    IF _GUICtrlListView_GetItemSelected($hListView, $i) Then
    $aItem = _GUICtrlListView_GetItemTextArray($hlistview, $i)
    ;~ In aItem[1] steht der Dateiname und in $aItem[2] der Pfad zincl. Dateinamen
    _LeftDblClick()
    EndIf
    Next
    Endif
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIF

    [/autoit] [autoit][/autoit] [autoit]

    Func _LeftDblClick()
    _BASS_ChannelStop($MusicHandle)
    $File = $aItem[2]
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Display_Vis()
    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $LeftChLvl = $leftChLvlper ;Round(_HiWord($levels) / $iY, 0)
    $RightChLvl = $rightChLvlper ;Round(_LoWord($levels) / $iY, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $max_l <= $LeftChLvl Then ;fire up higest line
    $max_l = $LeftChLvl + $fire_up
    $fall_speed_l_threshold = 20
    Else
    If $fall_speed_l_threshold <= 0 Then ;increase fall speed of highest line faster until threshold is <= 0 (second fall part)
    If $max_l > $LeftChLvl + $pen2_size * 2 Then $max_l -= $fall_speed
    Else
    $fall_speed_l_threshold -= 1 ;increase fall speed of highest line by slower until threshold is <= 0 (first fall part)
    If $max_l > $LeftChLvl + $pen2_size * 2 Then $max_l -= $fall_speed / 3
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $max_r <= $RightChLvl Then
    $max_r = $RightChLvl + $fire_up
    $fall_speed_r_threshold = 20
    Else
    If $fall_speed_r_threshold <= 0 Then
    If $max_r > $RightChLvl + $pen2_size * 2 Then $max_r -= $fall_speed
    Else
    $fall_speed_r_threshold -= 1
    If $max_r > $RightChLvl + $pen2_size * 2 Then $max_r -= $fall_speed / 3
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsClear($backbuffer, 0xD0F0F0F0)
    _GDIPlus_PenSetColor($pen2, 0xFF505050)
    For $l = -$pen1_size - 2 To $leftChLvl Step $pen1_size * 2
    $r = $l / ($iY) * 224
    $g = 224 - $r
    $b = 0
    _GDIPlus_PenSetColor($pen1, "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsDrawLine($backbuffer, $iX / 5, $iY - $l, $iX / 5 + $equalizer_width, $iY - $l, $pen1)
    Next
    For $l = 0 To $RightChLvl
    $r = (-(Cos(1.7 * $l / 128) + 1) / 2) * 224
    $g = ((Cos(4 * $l / 256) + 1) / 2) * 224
    $b = 0
    _GDIPlus_PenSetColor($pen1, "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsDrawLine($backbuffer, 3 * $iX / 5, $iY - $l, 3 * $iX / 5 + $equalizer_width, $iY - $l, $pen1)
    Next
    _GDIPlus_GraphicsDrawLine($backbuffer, $iX / 5, $iY - $max_l, $iX / 5 + $equalizer_width, $iY - $max_l, $pen2)
    _GDIPlus_GraphicsDrawLine($backbuffer, 3 * $iX / 5, $iY - $max_r, 3 * $iX / 5 + $equalizer_width, $iY - $max_r, $pen2)
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, $width - $iX - 10, 8, $iX, $iY)
    $c += 1
    EndFunc
    #EndRegion Func's

    [/autoit]

    Gruß,
    UEZ :D

  • eq

    • UEZ
    • 25. Januar 2010 um 16:59

    Ich hatte mal vor langer Zeit ein Visualizer gebastelt, allerding nur für die 2 Kanäle (links/rechts)!

    Schau' mal rein, vielleicht kannst du das noch erweitern!

    Spoiler anzeigen
    [autoit]


    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
    #AutoIt3Wrapper_Run_After=del /f /q "Visualizer_Obfuscated.au3"

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <GDIplus.au3>
    #include <WindowsConstants.au3>
    #include "Bass.au3"

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $bass_dll = _BASS_STARTUP(@ScriptDir & "\BASS.dll")
    Global Const $width = 200
    Global Const $height = 230
    Global $title = "GDI+ Visualization by UEZ"
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)");
    If @error Then
    MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
    Exit
    EndIf
    _BASS_Init($BASS_DEVICE_CPSPEAKERS)
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    $hwnd = GUICreate($title, $width, $height, -1, -1, Default, $WS_EX_TOOLWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsClear($backbuffer)
    $pen1_size = 4
    $pen1 = _GDIPlus_PenCreate(0, $pen1_size)
    $pen2_size = 4
    $pen2 = _GDIPlus_PenCreate(0, $pen2_size)

    [/autoit] [autoit][/autoit] [autoit]

    $c = 1
    $equalizer_width = 30
    $max_l = 0
    $max_r = 0
    $fall_speed = 5
    $fire_up = 15
    Do
    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $LeftChLvl = Round(_HiWord($levels) / $height * 1.5, 0)
    $RightChLvl = Round(_LoWord($levels) / $height * 1.5, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $max_l <= $LeftChLvl Then ;fire up higest line
    $max_l = $LeftChLvl + $fire_up
    $fall_speed_l_threshold = 20
    Else
    If $fall_speed_l_threshold <= 0 Then ;increase fall speed of highest line faster until threshold is <= 0 (second fall part)
    If $max_l > $LeftChLvl + $pen2_size * 2 Then $max_l -= $fall_speed
    Else
    $fall_speed_l_threshold -= 1 ;increase fall speed of highest line by slower until threshold is <= 0 (first fall part)
    If $max_l > $LeftChLvl + $pen2_size * 2 Then $max_l -= $fall_speed / 3
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $max_r <= $RightChLvl Then
    $max_r = $RightChLvl + $fire_up
    $fall_speed_r_threshold = 20
    Else
    If $fall_speed_r_threshold <= 0 Then
    If $max_r > $RightChLvl + $pen2_size * 2 Then $max_r -= $fall_speed
    Else
    $fall_speed_r_threshold -= 1
    If $max_r > $RightChLvl + $pen2_size * 2 Then $max_r -= $fall_speed / 3
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsClear($backbuffer, 0x9F000000)
    _GDIPlus_PenSetColor($pen2, 0xFF7F7F7F)
    For $l = -$pen1_size - 2 To $leftChLvl Step $pen1_size * 2
    $r = $l / ($height) * 256
    $g = 256 - $r
    $b = 0
    _GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $l, $width / 5 + $equalizer_width, $height - $l, $pen1)
    Next
    For $l = 0 To $RightChLvl
    $r = (-(Cos(1.7 * $l / 2^7) + 1) / 2) * 256
    $g = ((Cos(4 * $l / 2^8) + 1) / 2) * 256
    $b = 0
    _GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    _GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $l, 3 * $width / 5 + $equalizer_width, $height - $l, $pen1)
    Next
    _GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $max_l, $width / 5 + $equalizer_width, $height - $max_l, $pen2)
    _GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $max_r, 3 * $width / 5 + $equalizer_width, $height - $max_r, $pen2)
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    $c += 1
    Sleep(15)
    Until False

    [/autoit] [autoit][/autoit] [autoit]

    Func close()
    _BASS_Stop()
    _BASS_Free()
    DllClose(@ScriptDir & "\BASS.dll")
    _GDIPlus_PenDispose($pen1)
    _GDIPlus_PenDispose($pen2)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>close

    [/autoit]

    Im Anhang sind die benötigten Dateien!

    Gruß,
    UEZ

    Dateien

    Visualizer.7z 129,95 kB – 304 Downloads
  • Rekursionseinstieg: Fakultät - Logikproblem!?

    • UEZ
    • 24. Januar 2010 um 18:54

    Ich habe die #05 - L-System Fraktale auch rekusriv programmiert! Ich weiß gar nicht, wie man das als Iteration coden kann!

    Wer mal eine Idee hat, kann sich ja bei mir melden! :thumbup:

    Gruß,
    UEZ

  • Rekursionseinstieg: Fakultät - Logikproblem!?

    • UEZ
    • 24. Januar 2010 um 18:12

    Irgendwie kommt mir deine optimierte Variante bekannt vor - vielleicht noch aus dem Studium...


    Zitat

    Die Iterative Variante hat auch noch einen Fehler bei kleinen Fib. Zahlen (0, 1)

    Da ist die Abfrage für n < 2 nicht implementiert ;)

    [autoit]


    Func Fibonacci_i($f)
    If $f = 0 Then
    Return 0
    ElseIf $f = 1 Then
    Return 1
    Else
    $arr_fib_n0 = 0
    $arr_fib_n1 = 1

    [/autoit][autoit][/autoit][autoit]

    For $i = 2 To $f
    $arr_fib = $arr_fib_n1 + $arr_fib_n0
    $arr_fib_n0 = $arr_fib_n1
    $arr_fib_n1 = $arr_fib
    Next

    [/autoit][autoit][/autoit][autoit]

    Return $arr_fib
    EndIf
    EndFunc

    [/autoit]

    So ab n = 10 wird die Iteration schneller..

    Gruß,
    UEZ

  • Rekursionseinstieg: Fakultät - Logikproblem!?

    • UEZ
    • 24. Januar 2010 um 17:43

    Coole Optimierung der Rekusion! 8o

    Wobei bei mir die Iteration immer noch schneller ist:

    Iterative : 0.454 ms
    Recursive : 0.0036 ms -> hab's auskommentiert, damit ich nicht lange warten muss für n=50
    Recursive2: 1.9964 ms

    n=2500:

    Iterative : 9.8585 ms
    Recursive2: 29.6587 ms

    Gruß,
    UEZ

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™