Hat keiner ne idee?
Noch mal die source
Spoiler anzeigen
;===================================================================================================
; INRadio-Localtuner by JuraX
;===================================================================================================
#NoTrayIcon
#include <Bass.au3>
#include <BassConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <sound.au3>
#include <WindowsConstants.au3>
#Region StartUp
Local $progress_slider, $slots, $Form1
Global $gaDropFiles[1]
Global Const $WM_DROPFILES = 0x0233
Global $playing_state = -1
;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
;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
;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
;Sonstiges
AdlibRegister("Aktualisieren", 100)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
#EndRegion StartUp
[/autoit] [autoit][/autoit] [autoit]#Region GUI
$Form1 = GUICreate("INRadio-Localtuner", 380, 650, 193, 115, 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, 366, 20)
$slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider) & "%", 8, 8, 150, 17)
;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)
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)
$hListView = GUICtrlCreateListView('Dateiname', 10, 375, 350, 200)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
WinSetOnTop($Form1, '', 1)
$rightVol = GUICtrlCreateProgress(8, 88, 366, 17)
GUICtrlSetLimit(-1, 100, 0)
GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
$LeftVol = GUICtrlCreateProgress(8, 136, 366, 17)
GUICtrlSetLimit(-1, 100, 0)
GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)
GUISetState(@SW_SHOW)
#EndRegion GUI
#Region Loop
While 1
$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)
GUICtrlSetData($rightVol, $rightChLvlper)
GUICtrlSetData($LeftVol, $leftChLvlper)
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE, $Close
ProcessClose("Radiotuner.exe")
AdlibUnRegister("Aktualisieren")
Exit
Case $Play
Switch $playing_state
Case -1
_BASS_ChannelPlay($MusicHandle, 1)
$playing_state = 1
EndSwitch
Case $newfile
_BASS_ChannelStop($MusicHandle)
$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
$MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
_BASS_ChannelStop($MusicHandle)
Case $Volume_slider1
_BASS_ChannelSetVolume($MusicHandle, GUICtrlRead($Volume_slider1) / 100)
Case $Volume_slider2
SoundSetWaveVolume(GUICtrlRead($Volume_slider2))
Case $GUI_EVENT_DROPPED
For $i = 0 To UBound($gaDropFiles) - 1
GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1'), $hListView)
_GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
Next
Case $Stop
_BASS_ChannelStop($MusicHandle)
$playing_state = -1
EndSwitch
WEnd
#EndRegion Loop
#Region Func's
Func OnAutoItExit()
_BASS_Free()
EndFunc ;==>OnAutoItExit
Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
Local $nSize, $pFileName
Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)
For $i = 0 To $nAmt[0] - 1
$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)
ReDim $gaDropFiles[$i + 1]
$gaDropFiles[$i] = DllStructGetData($pFileName, 1)
$pFileName = 0
Next
EndFunc ;==>WM_DROPFILES_FUNC
Func Aktualisieren()
$Sliderstatus = GUICtrlRead($progress_slider)
GUICtrlSetData($slots, $Sliderstatus)
EndFunc ;==>Aktualisieren
Func _BASS_ChannelSetVolume($hChannel, $nVol)
Local $ret = _BASS_ChannelSetAttribute($hChannel, $BASS_ATTRIB_VOL, $nVol)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_BASS_ChannelSetVolume
Func _BASS_ChannelGetVolume($hChannel)
Local $ret = _BASS_ChannelGetAttribute($hChannel, $BASS_ATTRIB_VOL)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_BASS_ChannelGetVolume
Func _LeftDblClick($aInfo)
Local $sMsg = 'Doppelklick auf:' & @LF & 'ZeilenIndex: ' & $aInfo[3] & @LF & _
'Spaltenindex: ' & $aInfo[4] & @LF & _
'Zellen Text: ' & _GUICtrlListView_GetItemText($hListView, $aInfo[3], $aInfo[4])
MsgBox(0, 'Doppelklick', $sMsg)
EndFunc
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
Local $aInfo[12] = [$hWndFrom, _
$iIDFrom, _
$iCode, _
DllStructGetData($tInfo, "Index"), _
DllStructGetData($tInfo, "SubItem"), _
DllStructGetData($tInfo, "NewState"), _
DllStructGetData($tInfo, "OldState"), _
DllStructGetData($tInfo, "Changed"), _
DllStructGetData($tInfo, "ActionX"), _
DllStructGetData($tInfo, "ActionY"), _
DllStructGetData($tInfo, "lParam"), _
DllStructGetData($tInfo, "KeyFlags")]
_LeftDblClick($aInfo)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
#EndRegion Func's