Player erstellen!

  • Hey zusammem.
    also ich hab bis jetzt einen eigenen kleinen player gemacht (test-version)

    Spoiler anzeigen

    include <GUIConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Sound.au3>


    FileInstall('mussik.jpg', @TempDir&"\mussik.jpg")
    opt("guioneventmode",1)

    $Form1 = GUICreate("doPe's Player", 596, 469, 317, 144)
    GUISetBkColor(0x000000)
    $Pic1 = GUICtrlCreatePic(@TempDir&"\mussik.jpg", 0, 56, 572, 244, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Button1 = GUICtrlCreateButton("Song beenden",16, 328, 131, 41)
    GUICtrlSetOnEvent(-1,"stop")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Button2 = GUICtrlCreateButton("Play", 16, 392, 131, 41)
    GUICtrlSetOnEvent(-1,"Play")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Button3 = GUICtrlCreateButton("Pause", 160, 360, 131, 41)
    GUICtrlSetOnEvent(-1,"Pause")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Button4 = GUICtrlCreateButton("Weiter", 368, 360, 131, 41)
    GUICtrlSetOnEvent(-1,"Resume")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Label1 = GUICtrlCreateLabel("Player by dope³", 8, 8, 388, 33)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    GUICtrlSetColor(-1, 0xFF0000)
    guisetonevent($GUI_EVENT_CLOSE,"_exit")
    GUICtrlSetState($Button1, $GUI_DISABLE)
    GUICtrlSetState($Button3, $GUI_DISABLE)
    GUICtrlSetState($Button4, $GUI_DISABLE)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
    WEnd

    func play()
    $choosefile=fileopendialog("Choose a sound","C:\Users\" & @username & "\Music","Musik(*.mp3)",1+4)
    global $sound=_soundopen($choosefile)
    global $play=_SoundPlay($sound)
    GUICtrlSetState($Button3, $GUI_Enable)
    GUICtrlSetState($Button1, $GUI_Enable)


    endfunc

    func stop()
    _soundstop($sound)
    GUICtrlSetState($Button3, $GUI_DISABLE)
    GUICtrlSetState($Button4, $GUI_DISABLE)
    GUICtrlSetState($Button1, $GUI_DISABLE)

    EndFunc

    func _exit()
    _soundclose($sound)
    exit
    endfunc

    func resume()
    _soundresume($sound)
    GUICtrlSetState($Button3, $GUI_enable)
    GUICtrlSetState($Button4, $GUI_DISABLE)

    EndFunc

    func pause()
    _SoundPause($sound)
    GUICtrlSetState($Button4, $GUI_Enable)
    GUICtrlSetState($Button3, $GUI_DISABLE)

    endfunc


    so und darin wollte ich nun so eine visulation dirn haben .
    so wie diese visulation

    Spoiler anzeigen

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

    $bass_dll = DllOpen(@ScriptDir & "\BASS.dll")
    Global Const $width = 200
    Global Const $height = 230
    Global $title = "doPs's Player"
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)");
    _BASS_Init($bass_dll, 0, -1, 44100, 0, "")
    $MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)
    If @error Then
    MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
    Exit
    EndIf
    Opt("GUIOnEventMode", 1)
    $hwnd = GUICreate($title, $width, $height, -1, -1, Default, $WS_EX_TOOLWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "close")
    GUISetState()

    _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)

    $song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)
    _BASS_ChannelPlay($bass_dll, $MusicHandle, 1)
    ;~ $current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)
    ;~ $percent = Round(($current / $song_length) * 100, 0)
    $c = 1
    $equalizer_width = 30
    $max_l = 0
    $max_r = 0
    $fall_speed = 5
    $fire_up = 15
    Do
    $levels = _BASS_ChannelGetLevel($bass_dll, $MusicHandle)
    $LeftChLvl = Round(_HiWord($levels) / $height * 1.5, 0)
    $RightChLvl = Round(_LoWord($levels) / $height * 1.5, 0)

    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

    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

    _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

    Func close()
    _BASS_Free($bass_dll)
    DllClose($bass_dll)
    _GDIPlus_PenDispose($pen1)
    _GDIPlus_PenDispose($pen2)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>close


    nun wollte ich wissen wie man diese beiden sachen am besten zusammenfügt also das diese visulation in mein player drin ist...
    freue mich auf eure antworten danke ...
    daas ganze packed zum die visulaizer_analog gib es hier:
    https://autoit.de/index.php?page…80495#post80495

    MFG doPe

    3 Mal editiert, zuletzt von doPe (28. Juli 2009 um 14:14)

  • so so deinen player soweit ich mich erinnere sieht das genauso aus wie das das ich mal zum bespiel gepostet habe naja egal ........

    Zauberei :)
    Wenn es doch ein beispiel ist , ist es doch gut , dass man aus beispielen lernt :)
    Mann muss war nicht alles genau gleich Kopieren aber lernen ist immer gut.
    Mache ich auch so

  • na und ich habs ja ein bischen anders gemacht ^^
    naja wisst ihr den wie man das nun kombeniert?

  • ja ich hab schon so viel probiert aber immer kommt " can't open #include "bass".au3 oda so was ähnliches .....

    daran verzweifle ich langsam ^^

  • Du hast auch ein Fehler :D


    Versuche ihn zu finden.

    [autoit]


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

    [/autoit]

    Ich habe ihn gefunden.

    Spoiler anzeigen

    [Auflösung]

    [autoit]


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

    [/autoit]

    Frage:Wie kann man Spoilers umbennen , dass die nicht Spoiler heißen ? :) Mfg

  • ich hab heute eh nichts besseres zu tun...

    hier bitte:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <sound.au3>
    #include <Bass.au3>
    #include <GDIplus.au3>

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

    Global Const $width = 200
    Global Const $height = 230

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

    FileInstall('mussik.jpg', @TempDir&"\mussik.jpg")
    opt("guioneventmode",1)
    $bass_dll = DllOpen(@ScriptDir & "\BASS.dll")
    $Form1 = GUICreate("doPe's Player", 596, 469, 317, 144)
    GUISetBkColor(0x000000)
    $Pic1 = GUICtrlCreatePic(@TempDir&"\mussik.jpg", 0, 56, 572, 244, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Button1 = GUICtrlCreateButton("Song beenden",16, 328, 131, 41)
    GUICtrlSetOnEvent(-1,"stop")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Button2 = GUICtrlCreateButton("Play", 16, 392, 131, 41)
    GUICtrlSetOnEvent(-1,"Play")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Button3 = GUICtrlCreateButton("Pause", 160, 360, 131, 41)
    GUICtrlSetOnEvent(-1,"Pause")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Button4 = GUICtrlCreateButton("Weiter", 368, 360, 131, 41)
    GUICtrlSetOnEvent(-1,"Resume")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    $Label1 = GUICtrlCreateLabel("Player by dope³", 8, 8, 388, 33)
    GUICtrlSetFont(-1, 14, 400, 0, "Rage Italic")
    GUICtrlSetColor(-1, 0xFF0000)
    guisetonevent($GUI_EVENT_CLOSE,"_exit")
    GUICtrlSetState($Button1, $GUI_DISABLE)
    GUICtrlSetState($Button3, $GUI_DISABLE)
    GUICtrlSetState($Button4, $GUI_DISABLE)
    GUISetState(@SW_SHOW)
    $file=fileopendialog("Choose a sound","C:\Users\" & @username & "\Music","Musik(*.mp3)",1+4)
    _BASS_Init($bass_dll, 0, -1, 44100, 0, "")
    $MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)
    ;~ global $play=_SoundPlay($sound)
    GUICtrlSetState($Button3, $GUI_Enable)
    GUICtrlSetState($Button1, $GUI_Enable)

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

    _GDIPlus_Startup()
    $graphics = _GDIPlus_GraphicsCreateFromHWND($Form1)
    $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]

    $song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)
    _BASS_ChannelPlay($bass_dll, $MusicHandle, 0)
    ;~ $current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)
    ;~ $percent = Round(($current / $song_length) * 100, 0)
    $c = 1
    $equalizer_width = 30
    $max_l = 0
    $max_r = 0
    $fall_speed = 0
    $fire_up = 0
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $levels = _BASS_ChannelGetLevel($bass_dll, $MusicHandle)
    $LeftChLvl = Round(_HiWord($levels) / $height * 1.5, 0)
    $RightChLvl = Round(_LoWord($levels) / $height * 1.5, 0)
    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
    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 _GDIPlus_GraphicsClear($backbuffer, 0x9F000000)
    _GDIPlus_PenSetColor($pen2, 0x000000)
    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)
    WEnd

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

    func play()
    $file=fileopendialog("Choose a sound","C:\Users\" & @username & "\Music","Musik(*.mp3)",1+4)
    _BASS_Init($bass_dll, 0, -1, 44100, 0, "")
    $MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)
    ;~ global $play=_SoundPlay($sound)
    GUICtrlSetState($Button3, $GUI_Enable)
    GUICtrlSetState($Button1, $GUI_Enable)
    _GDIPlus_Startup()
    $graphics = _GDIPlus_GraphicsCreateFromHWND($Form1)
    $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)
    $song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)
    _BASS_Start($bass_dll)
    _BASS_ChannelPlay($bass_dll, $MusicHandle, 0)
    ;~ $current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)
    ;~ $percent = Round(($current / $song_length) * 100, 0)

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

    $c = 1
    $equalizer_width = 30
    $max_l = 0
    $max_r = 0
    $fall_speed = 0
    $fire_up = 0
    endfunc

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

    func stop()
    _BASS_Stop($bass_dll)
    GUICtrlSetState($Button3, $GUI_DISABLE)
    GUICtrlSetState($Button4, $GUI_DISABLE)
    GUICtrlSetState($Button1, $GUI_DISABLE)

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

    EndFunc

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

    func _exit()
    _BASS_Free($bass_dll)
    DllClose($bass_dll)
    _GDIPlus_PenDispose($pen1)
    _GDIPlus_PenDispose($pen2)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit
    endfunc

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

    func resume()
    _BASS_Start($bass_dll)
    GUICtrlSetState($Button3, $GUI_enable)
    GUICtrlSetState($Button4, $GUI_DISABLE)

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

    EndFunc

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

    func pause()
    _BASS_Pause($bass_dll)
    GUICtrlSetState($Button4, $GUI_Enable)
    GUICtrlSetState($Button3, $GUI_DISABLE)

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

    endfunc

    [/autoit]
  • ja also ich muss den script dann in den ordner rein tun wo auch die bass constans ist oda?hab ich gemacht udn dann ist da noch ein fehler:
    [Blockierte Grafik: http://www.bilder-hochladen.net/files/awgl-1q.jpg]
    was nun?
    ich weiß es ^^ ähh du hast ein fehler gemacht unzwa:
    [Blockierte Grafik: http://www.bilder-hochladen.net/files/awgl-1r.jpg]
    du hast ein "enter" vergessen ....
    und ich mach das noch ein bischen anders den die visulation ist zu weit links finde ich ...
    und ess soll erst ein lied anfordern wenn man auf play drück oda ich mach da noch ein andern button hin "song auswählen oda so"
    aber danke an dich hat mir sehr wieter geholfen ...