
nobbe
Active Members-
Posts
427 -
Joined
-
Last visited
Everything posted by nobbe
-
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
"this page 9" , somewhere in the middle is my complete source for the player sample http://www.autoitscript.com/forum/index.php?showtopic=83481&st=160 @Brettf: maybe you could integrate it in your Code sample archive of the Bass module? -
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
i created a media player sample code for this - see previous scripts of me -
How to get a screen shot of an entire page?
nobbe replied to Herb191's topic in AutoIt General Help and Support
if you want to have the picture without frames etc (just the html content) you will need to position IE window (maximise), and setup your screen coord to something like this (need some tries here to get the positions right) local $xstart = 190; local $ystart = 170; Opt("PixelCoordMode", 0); Screen coordinates relative to active screen _ScreenCapture_Capture(@ScriptDir & "\ie.jpg", $xstart, $ystart, $xstart+320, $ystart+330, False) -
How to get a screen shot of an entire page?
nobbe replied to Herb191's topic in AutoIt General Help and Support
i did something like this - close all IE windows before running it or it will get wrong screen results ; ; do screenshots of websites, save in scriptdir ; ; - please close all "internet explorer" sessions before snapshot ; - after new IE window starts, move IE to position where it is not overlapped by another window ; - press GO button ; author nobbe 2008 ; ; #include <GUIConstants.au3> #include <IE.au3> #include <String.au3> #include <ScreenCapture.au3> ; ------------------------------------------------------------------- Global $oIE ; ------------------------------------------------------------------- $Form1 = GUICreate("screenshot demo", 200, 100, 0, 0) $btn_go = GUICtrlCreateButton("go", 10, 10, 75, 20) GUISetState(@SW_SHOW) ; --------------------------------------------------------------------------------- $oIE = _IECreate("about:blank", 0) ; --------------------------------------------------------------------------------- While 1 $nMsg = GUIGetMsg() Switch $nMsg ; start Case $btn_go doit() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; --------------------------------------------------------------------------------- ; ; do some screenshots ; Func doit() do_screen_shot_url("http://www.autoitscript.com") do_screen_shot_url("http://www.google.com") do_screen_shot_url("http://www.cnn.com") ;; or load from setup file etc.. EndFunc ;==>doit ; ; move to url, then take snapshot of IE window ; Func do_screen_shot_url($url) local $Hwnd, $Winlist, $list Local $tmp = StringReplace($url, "http://", ""); Local $outfile = @ScriptDir & "\" & $tmp & "_1.jpg"; _IENavigate($oIE, $url) _IELoadWait($oIE) $Winlist = WinList() For $list = 1 To $Winlist[0][0] $WinTitle = $Winlist[$list][0] If StringInStr($WinTitle, "Internet explorer") > 0 Then $Hwnd = $Winlist[$list][1] EndIf Next _ScreenCapture_CaptureWnd($outfile, $Hwnd) sleep(500) EndFunc ;==>do_screen_shot_url -
; sample volume meter display ; ; author nobbe 2009 #include <GUIConstantsEx.au3> #include <GUIConstants.au3> Global $vol_left[51], $vol_right[51]; ;Create GUI and controls $GUI = GUICreate("Sample", 380, 190, 193, 115); $btn_start = GUICtrlCreateButton("Start", 216, 160, 75, 25, 0) ;Show GUI GUISetState(@SW_SHOW) _setup_volume() ;; loop While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $btn_start ; up for $i = 1 to 100 _show_volume($i, $i); left , right sleep(100) next ; down for $i = 100 to 1 step -1 _show_volume($i, $i); left , right sleep(100) next ; random for $i = 1 to 100 $l = int(Random(1,100)) $r = int(Random(1,100)) _show_volume($l, $r); left , right sleep(100) next EndSwitch Sleep(20) WEnd ; ; setup a bunch of controls as array to display the volume ; Func _setup_volume() Local $color_red = 0xff0000 Local $color_grey = 0xcccccc $left = 10 $top = 180 $height = 3 $width = 10 For $m = 0 To 25 $vol_left[$m] = GUICtrlCreateLabel("", $left, $top, $width, $height) GUICtrlSetBkColor($vol_left[$m], $color_grey) $top = $top - $height - 1 ; Next $left = $left + $width + 3 $top = 180 ;right slider For $m = 0 To 25 $vol_right[$m] = GUICtrlCreateLabel("", $left, $top, $width, $height) GUICtrlSetBkColor($vol_right[$m], $color_grey) $top = $top - $height - 1 ; Next EndFunc ;==>_setup_volume ; ; set the volume "display" to .... ; Func _show_volume($l, $r) Local $color_red = 0xff0000 Local $color_grey = 0xcccccc For $m = 0 To 50 If ($l / 4) >= $m Then GUICtrlSetBkColor($vol_left[$m], $color_red) Else GUICtrlSetBkColor($vol_left[$m], $color_grey) EndIf If ($r / 4) >= $m Then GUICtrlSetBkColor($vol_right[$m], $color_red) Else GUICtrlSetBkColor($vol_right[$m], $color_grey) EndIf Next EndFunc ;==>_show_volume
-
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
a bug with 64 bit when i run it from the 64 bit version "AutoIt3_x64.exe" it fails on the function "Could not initialize audio" from the routine ;Initalize bass. Required for most functions. _BASS_Init(0, -1, 44100, 0, "") If @error Then MsgBox(0, "Error", "Could not initialize audio") Exit EndIf when i use the 32 bit "AutoIt3.exe" it works fine -
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
yes thats very nice ! meanwhile i wrote a gui interface to the web radio station player i also added another "selfmade" volume display just for fun ;;;; ADDITIONAL STUFF FOR CALLBACK ; #FUNCTION# ==================================================================================================================== ; Name...........: __BASS_LoadLibrary ; Author ........: Paul Campbell (PaulIA) ; =============================================================================================================================== Func __BASS_LoadLibrary($sFileName) Local $aResult = DllCall("Kernel32.dll", "hwnd", "LoadLibraryA", "str", $sFileName) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ;==>__BASS_LoadLibrary ; #FUNCTION# ==================================================================================================================== ; Name...........: __BASS_LoadLibrary ; Author ........: Prog@ndy ; =============================================================================================================================== Func __BASS_GetProcAddress($hModule, $sFunctionName) Local $aResult = DllCall("Kernel32.dll", "hwnd", "GetProcAddress", "hwnd", $hModule, "str", $sFunctionName) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ;==>__BASS_GetProcAddress ; #FUNCTION# ==================================================================================================================== ; Name...........: __BASS_LoadLibrary ; Author ........: Prog@ndy ; =============================================================================================================================== Func __BASS_GetModuleHandle($sFileName) Local $aResult = DllCall("Kernel32.dll", "hwnd", "GetModuleHandleA", "str", $sFileName) If @error Then Return SetError(1, 0, HWnd(0)) Return $aResult[0] EndFunc ;==>__BASS_GetModuleHandle ; #FUNCTION# ==================================================================================================================== ; Name...........: __BASS_DLLSLOADED ; Author ........: Prog@ndy ; Return Values: Bass.dll loaded: return 1 ; Bassvb.dll loaded return 2 ; both loaded: return 3 ; none loaded: return 0 ; =============================================================================================================================== Func __BASS_DLLSLOADED() Local $bass = Number(__BASS_GetModuleHandle("BASS")) > 0 Local $basscb = Number(__BASS_GetModuleHandle("BASSCB")) > 0 Return $bass + ($basscb * 2) EndFunc ;==>__BASS_DLLSLOADED Global Const $hLibBassCB = __BASS_LoadLibrary("BassCB.dll") Global Const $DownloadProc = __BASS_GetProcAddress($hLibBassCB, "DownloadProc@12") Global Const $StreamProc = __BASS_GetProcAddress($hLibBassCB, "StreamProc@16") Global Const $StreamProcWriteFile = __BASS_GetProcAddress($hLibBassCB, "StreamProcWriteFile@16") ; =============================================================================================================================== ; =============================================================================================================================== ; =============================================================================================================================== ; ; Bass Radio Station Player GUI ; code based on Example_3 and bass_ext.au3 ; ; author Nobbe 2009 ; swr3.de ; http://edge.live.mp3.mdn.newmedia.nacamar.net/swr3live/livestream.mp3 ; dasding.de ; http://62.27.44.15/swrdasdinglive/livestream.mp3 ; trance ; http://scfire-ntc-aa03.stream.aol.com/stream/1065 ; ; 977 hitz ; http://scfire-mtc-aa02.stream.aol.com:80/stream/1074 ; top 100 station.de ; http://188.72.209.66:80 #include <Bass.au3> #include <BassConstants.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> Global $playing_state = -1 Global $MusicHandle = -1 Global $file Global $vol_left[51], $vol_right[51]; global $glob_update_display ;Open Bass.DLL. Required for all function calls. _BASS_STARTUP("BASS.dll") ;Initalize bass. Required for most functions. _BASS_Init(0, -1, 44100, 0, "") If @error Then MsgBox(0, "Error", "Could not initialize audio") Exit EndIf ;Create GUI and controls $GUI = GUICreate("Radio Station Player", 380, 190, 193, 115); ;$lblFileName = GUICtrlCreateLabel($file, 8, 8, 379, 17) $lblFileName = GUICtrlCreateLabel("", 8, 8, 379, 17) $lbl_title = GUICtrlCreateLabel("", 10, 80, 200, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $lbl_artist = GUICtrlCreateLabel("", 10, 105, 200, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ; set vertical now for volume $progress_leftVol = GUICtrlCreateProgress(330, 80, 12, 100, $PBS_VERTICAL) GUICtrlSetLimit(-1, 100, 0) $progress_rightVol = GUICtrlCreateProgress(343, 80, 12, 100, $PBS_VERTICAL) GUICtrlSetLimit(-1, 100, 0) $edit_input = GUICtrlCreateInput("http://scfire-ntc-aa03.stream.aol.com/stream/1065", 10, 40, 350, 20) $btn_tune_in = GUICtrlCreateButton("tune in", 216, 70, 75, 25, 0) ; $Play_pause = GUICtrlCreateButton("Play/Pause", 216, 160, 75, 25, 0) ;Show GUI GUISetState(@SW_SHOW) GUICtrlSetData($progress_rightVol, 0) GUICtrlSetData($progress_leftVol, 0) _setup_volume() ;; loop While 1 If $playing_state = 1 Then ;Get Channel levels. $levels = _BASS_ChannelGetLevel($MusicHandle) ;Get Right and calculate percentage $rightChLvl = _LoWord($levels) $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0) ;Get Left and calculate percentage $LeftChLvl = _HiWord($levels) $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0) ;Set the levels on GUI. GUICtrlSetData($progress_rightVol, $rightChLvlper) GUICtrlSetData($progress_leftVol, $leftChLvlper) _show_volume($leftChLvlper, $rightChLvlper); EndIf ;Get GUI Message $nMsg = GUIGetMsg() Switch $nMsg ;If Close button or red x, then exit. Alway remember to free resources Case $GUI_EVENT_CLOSE ; , $Close Exit Case $btn_tune_in $st = GUICtrlRead($edit_input) ;MsgBox(0, '', "Stream is: " & $st) init_station($st); Case $Play_pause ;Check if playing or paused, then take appropriate action Switch $playing_state Case 0; Song Paused, Resume. ;Resume Song _BASS_Start() ; was bug $playing_state = 1 Case - 1 ; Song stopped, start from begining. ;Play Song _BASS_ChannelPlay($MusicHandle, 1) $playing_state = 1 Case 1 ; Song Playing, Pause ;Pause song _BASS_Pause() $playing_state = 0 GUICtrlSetData($progress_rightVol, 0) GUICtrlSetData($progress_leftVol, 0) _show_volume(0, 0) EndSwitch EndSwitch Sleep(20) WEnd Func OnAutoItExit() ;Free Resources _BASS_Free() EndFunc ;==>OnAutoItExit ; open station and reset values Func init_station($station) _BASS_StreamFree($MusicHandle) ;Create a stream from that URL. $MusicHandle = _BASS_StreamCreateURL($station, 0, 0, $DownloadProc, 0) GUICtrlSetData($lblFileName, $file); GUICtrlSetData($progress_rightVol, 0) GUICtrlSetData($progress_leftVol, 0) _show_volume(0, 0) ; start playback _BASS_ChannelPlay($MusicHandle, 1) $playing_state = 1 EndFunc ;==>init_station ; ; setup a bunch of controls as array to display the volume ; Func _setup_volume() Local $color_red = 0xff0000 Local $color_grey = 0xcccccc $left = 10 $top = 180 $height = 3 $width = 10 For $m = 0 To 25 $vol_left[$m] = GUICtrlCreateLabel("", $left, $top, $width, $height) GUICtrlSetBkColor($vol_left[$m], $color_grey) $top = $top - $height - 1 ; Next $left = $left + $width + 3 $top = 180 ;right slider For $m = 0 To 25 $vol_right[$m] = GUICtrlCreateLabel("", $left, $top, $width, $height) GUICtrlSetBkColor($vol_right[$m], $color_grey) $top = $top - $height - 1 ; Next EndFunc ;==>_setup_volume ; ; set the volume "display" to .... ; ; his takes o LOT of cpu cycles :-( ; Func _show_volume($l, $r) Local $color_red = 0xff0000 Local $color_grey = 0xcccccc if $glob_update_display = 4 then ; every 4th For $m = 0 To 50 If ($l / 4) > $m Then GUICtrlSetBkColor($vol_left[$m], $color_red) Else GUICtrlSetBkColor($vol_left[$m], $color_grey) EndIf If ($r / 4) > $m Then GUICtrlSetBkColor($vol_right[$m], $color_red) Else GUICtrlSetBkColor($vol_right[$m], $color_grey) EndIf Next $glob_update_display =0 endif $glob_update_display = $glob_update_display +1 ; EndFunc ;==>_show_volume -
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
of course its easy to integrate the id3.au3 udf or any other library - but i was loooking for a way to do it with bass functions i started with id3 v1 tags (which wasnt working as expected), im looking into the v2 now which is more complicated ; Name...........: _BASS_ChannelGetTags $BASS_TAG_ID3 ID3v1 tags. A pointer to a 128 byte block is returned. See http://www.id3.org/ID3v1 for details $BASS_TAG_ID3V2 ID3v2 tags. A pointer to a variable length block is returned. ID3v2 tags are supported at both the start and end of the file. See http://www.id3.org/ for details of the block's structure. -
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
updated my sample: now releases filehandles and retrieves mp3 tags ; ; sample BASS player - based on example_3 ; ; added / changed: ; - time display ; - slider working to set / get position ; - volume display vertical ; - added drag / drop from explorer ; - display title / artist from bass mp3 tag ; ; ; author nobbe 2009 ; #include <Bass.au3> #include <BassConstants.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> Global $WM_DROPFILES = 0x233 Global $gaDropFiles[1], $str = "" GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC") Global $playing_state = -1 Global $MusicHandle = -1 Global $file Global $song_length_sec ;Open Bass.DLL. Required for all function calls. _BASS_STARTUP("BASS.dll") ;Initalize bass. Required for most functions. _BASS_Init(0, -1, 44100, 0, "") ;Check if bass iniated. If not, we cannot continue. If @error Then MsgBox(0, "Error", "Could not initialize audio") Exit EndIf ;Prompt the user to select a MP3 file #cs $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)") ;Create a stream from that file. $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, $BASS_MUSIC_PRESCAN) ;Check if we opened the file correctly. If @error Then MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error) Exit EndIf #ce ;Create GUI and controls $GUI = GUICreate("Player", 380, 190, 193, 115, $GUI_SS_DEFAULT_GUI, $WS_EX_ACCEPTFILES); ;$lblFileName = GUICtrlCreateLabel($file, 8, 8, 379, 17) $lblFileName = GUICtrlCreateLabel("", 8, 8, 379, 17) $progress_slider = GUICtrlCreateSlider(8, 32, 370, 25) GUICtrlSetLimit(-1, 100, 0) $lbl_title = GUICtrlCreateLabel("", 10, 80, 200, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $lbl_artist = GUICtrlCreateLabel("", 10, 105, 200, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ; set vertical now for volume $progress_leftVol = GUICtrlCreateProgress(330, 80, 12, 100, $PBS_VERTICAL) GUICtrlSetLimit(-1, 100, 0) $progress_rightVol = GUICtrlCreateProgress(350, 80, 12, 100, $PBS_VERTICAL) GUICtrlSetLimit(-1, 100, 0) ;GUICtrlCreateLabel("Right Channel Volume Level", 8, 64, 150, 17) ;GUICtrlCreateLabel("Left Channel Volume Level", 8, 112, 150, 17) ; $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0) $Play_pause = GUICtrlCreateButton("Play/Pause", 216, 160, 75, 25, 0) $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0) $lbl_time_info = GUICtrlCreateLabel("00:00:00 / 00:00:00", 10, 165, 115, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;Show GUI GUISetState(@SW_SHOW) GUICtrlSetData($progress_rightVol, 0) GUICtrlSetData($progress_leftVol, 0) ;Get the length of the song in bytes. $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) $song_length_sec = _BASS_ChannelBytes2Seconds($MusicHandle, $song_length) ConsoleWrite("MAX : " & format_time_hr_min_sec_from_sec($song_length_sec) & @CRLF); While 1 ;Only do this if a song is playing. If $playing_state = 1 Then ;Get cursor information for the GUI. We use this to know if the user is using the slider or no. $GGCI = GUIGetCursorInfo($GUI) ;Can't be using the slider, so update. If IsArray($GGCI) And Not $GGCI[2] Then ;Get Current playback position $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) ;Calculate the percentage $percent = Round(($current / $song_length) * 100, 0) EndIf ;User has clicked the slider, so we must not update the song position. If IsArray($GGCI) And $GGCI[4] = $progress_slider And $GGCI[2] Then ;While the slider is being moved While $GGCI[2] ;Get updated cursor info $GGCI = GUIGetCursorInfo($GUI) ;Get position $gpos = Round(GUICtrlRead($progress_slider) / 100 * $song_length, 0) WEnd ;Slider is no longer clicked, so we now can set the pos. _BASS_ChannelSetPosition($MusicHandle, $gpos, $BASS_POS_BYTE + $BASS_MUSIC_POSRESET) Else ; ;Set the slider to show percent GUICtrlSetData($progress_slider, $percent) ; set sliders here or it will cause some funny effect ? ;Get Channel levels. $levels = _BASS_ChannelGetLevel($MusicHandle) ;Get Right and calculate percentage $rightChLvl = _LoWord($levels) $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0) ;Get Left and calculate percentage $LeftChLvl = _HiWord($levels) $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0) ;Set the levels on GUI. GUICtrlSetData($progress_rightVol, $rightChLvlper) GUICtrlSetData($progress_leftVol, $leftChLvlper) EndIf EndIf ;Get GUI Message $nMsg = GUIGetMsg() Switch $nMsg ;If Close button or red x, then exit. Alway remember to free resources Case $GUI_EVENT_CLOSE ; , $Close Exit Case $Play_pause ;Check if playing or paused, then take appropriate action Switch $playing_state Case 0; Song Paused, Resume. ;Resume Song ;_BASS_Pause () _BASS_Start() ; was bug $playing_state = 1 AdlibEnable("_my_timer_adlib", 1000) ; every 1 sec Case -1 ; Song stopped, start from begining. ;Play Song _BASS_ChannelPlay($MusicHandle, 1) $playing_state = 1 AdlibDisable() Case 1 ; Song Playing, Pause ;Pause song _BASS_Pause() $playing_state = 0 GUICtrlSetData($progress_rightVol, 0) GUICtrlSetData($progress_leftVol, 0) EndSwitch Case $Stop ;Stop Song _BASS_ChannelStop($MusicHandle) $playing_state = -1 GUICtrlSetData($progress_rightVol, 0) GUICtrlSetData($progress_leftVol, 0) EndSwitch WEnd Func OnAutoItExit() ;Free Resources _BASS_Free() EndFunc ;==>OnAutoItExit ;=============================================================================== ; ; ; format time string to hr:min:sec ; ; ;=============================================================================== Func format_time_hr_min_sec_from_sec($t_in) Local $l_std Local $l_min Local $l_sec Local $t_str $l_std = Int($t_in / 3600); $l_min = Int(($t_in - ($l_std * 3600)) / 60) ; $l_sec = Int(($t_in - ($l_std * 3600) - ($l_min * 60))) ; $t_str = StringFormat("%02i:%02i:%02i", $l_std, $l_min, $l_sec) Return $t_str EndFunc ;==>format_time_hr_min_sec_from_sec ; ; drop my files here ; Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i + 1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next ; files are 0....x but only 0 is used for now init_file($gaDropFiles[0]) EndFunc ;==>WM_DROPFILES_FUNC ; open file and reset values Func init_file($file) Local $struct ; open & play first song ;Stop Song _BASS_Start() ; in case PAUSE was pressed it wont work _BASS_ChannelStop($MusicHandle) $playing_state = -1 ; here _BASS_StreamFree() should be used to release filehandle _BASS_StreamFree($MusicHandle) $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, $BASS_MUSIC_PRESCAN) GUICtrlSetData($lblFileName, $file); GUICtrlSetData($progress_rightVol, 0) GUICtrlSetData($progress_leftVol, 0) ;Get the length of the song in bytes. $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) $song_length_sec = _BASS_ChannelBytes2Seconds($MusicHandle, $song_length) ConsoleWrite("MAX : " & format_time_hr_min_sec_from_sec($song_length_sec) & @CRLF); ; get ID3 tags now drectyl $id3_ptr = _BASS_ChannelGetTags($MusicHandle, $BASS_TAG_ID3) If $id3_ptr <> 0 Then ; no data ? $struct = DllStructCreate("char v0[3]; char v1[30];char v2[30];char v3[30];char v4[4];char v5[30];char v6[1]", $id3_ptr) $id3_ptr_text = DllStructGetData($struct, 1) $id3_title = DllStructGetData($struct, 2) $id3_artist = DllStructGetData($struct, 3) $id3_album = DllStructGetData($struct, 4) ;$id3_ptr_text = DllStructGetData($struct, 5) ; ConsoleWrite("mp3 5 = " & $id3_ptr_text & @CRLF); ; $id3_ptr_text = DllStructGetData($struct, 6) ; ConsoleWrite("mp3 6 = " & $id3_ptr_text & @CRLF); GUICtrlSetData($lbl_title, $id3_title); GUICtrlSetData($lbl_artist, $id3_artist); Else GUICtrlSetData($lbl_title, "--unknown--"); GUICtrlSetData($lbl_artist, "--unknown--"); EndIf ; start playback _BASS_ChannelPlay($MusicHandle, 1) $playing_state = 1 AdlibEnable("_my_timer_adlib", 1000) ; every 1 sec EndFunc ;==>init_file ; update time every sec in timer adlib to avoid flicker Func _my_timer_adlib() ;Get Current playback position $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) $current_sec = _BASS_ChannelBytes2Seconds($MusicHandle, $current) GUICtrlSetData($lbl_time_info, format_time_hr_min_sec_from_sec($current_sec) & " / " & format_time_hr_min_sec_from_sec($song_length_sec)); EndFunc ;==>_my_timer_adlib -
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
i figured it out the function $id3_ptr = _BASS_ChannelGetTags($MusicHandle, $BASS_TAG_ID3) $id3_ptr_text = _BASS_PtrStringRead($id3_ptr, False, -1) ; gives wrong Number of data, only 1st tag is detected i changed it now to $id3_ptr = _BASS_ChannelGetTags($MusicHandle, $BASS_TAG_ID3) Local $struct = DllStructCreate("char v0[3]; char v1[30];char v2[30];char v3[30];char v4[4];char v5[30];char v6[1]", $id3_ptr) $id3_ptr_text = DllStructGetData($struct, 1) ConsoleWrite("mp3 1 = " & $id3_ptr_text & @CRLF); $id3_ptr_text = DllStructGetData($struct, 2) ConsoleWrite("mp3 2 = " & $id3_ptr_text & @CRLF); $id3_ptr_text = DllStructGetData($struct, 3) ConsoleWrite("mp3 3 = " & $id3_ptr_text & @CRLF); $id3_ptr_text = DllStructGetData($struct, 4) ConsoleWrite("mp3 4 = " & $id3_ptr_text & @CRLF); $id3_ptr_text = DllStructGetData($struct, 5) ConsoleWrite("mp3 5 = " & $id3_ptr_text & @CRLF); $id3_ptr_text = DllStructGetData($struct, 6) ConsoleWrite("mp3 6 = " & $id3_ptr_text & @CRLF); which results in correct tag description like mp3 1 = TAG mp3 2 = I See You [Theme from Avatar] mp3 3 = Leona Lewis mp3 4 = AVATAR Music From The Motion P mp3 5 = mp3 6 = -
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
i tried so far $id3_ptr = _BASS_ChannelGetTags($MusicHandle, $BASS_TAG_ID3) $id3_ptr_text=_BASS_PtrStringRead($id3_ptr, FALSE, -1) ; substitute "TAG" in beginning $id3_ptr_text = StringReplace($id3_ptr_text, "TAG", "", 0, 1); ConsoleWrite("mp3 = " & $id3_ptr_text & @CRLF); which only gives my the FIRST Tag Entry corresponding to title like "TAGOwner of a lonely Heart" all others are omitted ? it should return a 128 byte structure, but only returns the length of the first tag? -
BASS Function Library (Sound and Music Functions)
nobbe replied to BrettF's topic in AutoIt Example Scripts
hi nice work one thing i couldnt yet figure out is how to extract the ID3 info from the returned pointer info from ? $id3 = _BASS_ChannelGetTags($MusicHandle, $BASS_TAG_ID3) ConsoleWrite($id3 & @crlf); -
not a really fancy script, but it works for me ; ; ; Backup firefox and thunderbird user profile with 7zip = http://www.7-zip.org/ ; ; author nobbe ; december 2009 ; ;%APPDATA%\Mozilla\Profiles\[profile name]\[random string].slt\ #include <GUIConstants.au3> ; get full path to firefox profiles $ff_dir = @AppDataDir & "\Mozilla\Firefox\*.*" ; get full path to thunderbird $th_dir = @AppDataDir & "\Thunderbird\*.*" ; change these to your need $7z_dir="c:\Program Files\7-Zip\"; $7z_dir="c:\Program Files (x86)\7-Zip\"; $backup_to_dir="c:\temp\" #Region ### START Koda GUI section ### $FFBACK = GUICreate("Backup Firefox&Thunderbird Profile", 200, 150, 193, 115) $btn_backup = GUICtrlCreateButton("Backup", 30, 20, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $btn_backup ; do firefox $c= '"' & $7z_dir & "7z.exe " & '"' & " a -r " & $backup_to_dir & "backup_firefox_" & @YEAR & "_" & @MON & "_" & @MDAY & ".7z " & $ff_dir & " -x!*.sqlite"; ConsoleWrite($c & @crlf) runwait($c); ; do thunderbird $c= '"' & $7z_dir & "7z.exe " & '"' & " a -r " & $backup_to_dir & "backup_thunderbird_" & @YEAR & "_" & @MON & "_" & @MDAY & ".7z " & $th_dir & " -x!*.sqlite"; ConsoleWrite($c & @crlf) runwait($c); Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
-
do you have some explanation on what the program does ?
-
hi for an exact crc match you could use this $crc32 = _ChecksumGetInfo($file) ; ;; ---- new fast CRC 32 code.!! ------ ; Func _ChecksumGetInfo($sFile) Local $nBufSize = 16384 * 8 Local $crc32 = 0 If $sFile = "" Then Return SetError(1, 0, -1) Local $hFile = FileOpen($sFile, 16) For $I = 1 To Ceiling(FileGetSize($sFile) / $nBufSize) $crc32 = _FastCRC32(FileRead($hFile, $nBufSize), BitNOT($crc32)) Next FileClose($hFile) Return Hex($crc32, 8) EndFunc ;==>_ChecksumGetInfo Func _FastCRC32($vBuffer, $nCRC32 = 0xFFFFFFFF) Local $nLen, $vTemp If DllStructGetSize($vBuffer) = 0 Then ; String passed If IsBinary($vBuffer) Then $nLen = BinaryLen($vBuffer) Else $nLen = StringLen($vBuffer) EndIf $vTemp = DllStructCreate("byte[" & $nLen & "]") DllStructSetData($vTemp, 1, $vBuffer) $vBuffer = $vTemp EndIf ; Machine code hex strings (created by Laszlo) Local $CRC32Init = "0x33C06A088BC85AF6C101740AD1E981F12083B8EDEB02D1E94A75EC8B542404890C82403D0001000072D8C3" Local $CRC32Exec = "0x558BEC33C039450C7627568B4D080FB60C08334D108B55108B751481E1FF000000C1EA0833148E403B450C89551072DB5E8B4510F7D05DC3" ; Create machine code stubs Local $CRC32InitCode = DllStructCreate("byte[" & BinaryLen($CRC32Init) & "]") DllStructSetData($CRC32InitCode, 1, $CRC32Init) Local $CRC32ExecCode = DllStructCreate("byte[" & BinaryLen($CRC32Exec) & "]") DllStructSetData($CRC32ExecCode, 1, $CRC32Exec) ; Structure for CRC32 Lookup table Local $CRC32LookupTable = DllStructCreate("int[" & 256 & "]") ; CallWindowProc under WinXP can have 0 or 4 parameters only, so pad remain params with zeros ; Execute stub for fill lookup table DllCall("user32.dll", "int", "CallWindowProc", "ptr", DllStructGetPtr($CRC32InitCode), _ "ptr", DllStructGetPtr($CRC32LookupTable), _ "int", 0, _ "int", 0, _ "int", 0) ; Execute main stub Local $ret = DllCall("user32.dll", "uint", "CallWindowProc", "ptr", DllStructGetPtr($CRC32ExecCode), _ "ptr", DllStructGetPtr($vBuffer), _ "uint", DllStructGetSize($vBuffer), _ "uint", $nCRC32, _ "ptr", DllStructGetPtr($CRC32LookupTable)) Return $ret[0] EndFunc ;==>_FastCRC32
-
Record sounds from another software without microphone
nobbe replied to Chris86's topic in AutoIt General Help and Support
not with autoit but here is freeware http://www.no23.de -
#include <GUIConstants.au3> #include <IE.au3> Global $oIE1 = _IECreateEmbedded() Global $oIE2 = _IECreateEmbedded() #Region ### START Koda GUI section ### Form= $Browser = GUICreate("Browser", 650, 450, 185, 145) $First_Group = GUICtrlCreateGroup("First Surf Page", 8, 10, 633, 210) $GUIActiveX1 = GUICtrlCreateObj($oIE1, 25, 50, 600, 160) $GUIActiveX2 = GUICtrlCreateObj($oIE2, 25, 270, 600, 160) $First_Link_Label = GUICtrlCreateLabel("Link", 16, 26, 24, 17) $First_Link_Input = GUICtrlCreateInput("", 48, 24, 225, 21) $Surf1_Button = GUICtrlCreateButton("Surf", 538, 24, 80, 21, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $Second_Group = GUICtrlCreateGroup("Second Surf Page", 8, 230, 633, 210) $Second_Link_Label = GUICtrlCreateLabel("Link", 16, 246, 24, 17) $Second_Link_Input = GUICtrlCreateInput("", 48, 244, 225, 21) $Surf2_Button = GUICtrlCreateButton("Surf", 538, 244, 80, 21, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Surf1_Button $GUICtrlReadFirstLink = GUICtrlRead($First_Link_Input) _IENavigate($oIE1, $GUICtrlReadFirstLink) Case $msg = $Surf2_Button $GUICtrlReadSecondLink = GUICtrlRead($Second_Link_Input) _IENavigate($oIE2, $GUICtrlReadSecondLink) EndSelect WEnd GUIDelete() Exit
-
v 0.0.4 - it crashes with subscript error when i add a directory with files - Menu flashes - When I choose a radio station it crashes - volume slider is set wrong (left side = zero ) but then to 100 % initially - volume is set to 100% each new file - it will play the files nicely but the right volume (wave display?) display is really useless ? apart from this is has potential for a good player :-)
-
it doesnt seem like he continues development on the program. also he has been away from the forum for a long time now
-
i dont think anyone understands WHAT you are trying to do? maybe you can explain more what you really want in the program?
-
thanks zedna i put it in to the code (updated first post)
-
updates first post i added a litte chart for temperatures (google.chart.api)
-
i suspect the ms xml parser is rather picky .. the same happens to me here when i use the .com server with "&hl=de" ; http://www.google.com/ig/api?weather=Berlin&hl=de -> this is buggy here?? its shows the same error "An invalid character was found in text content" ; http://www.google.com/ig/api?weather=Berlin -> this works??