Darth
Active Members-
Posts
61 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Darth's Achievements
Wayfarer (2/7)
0
Reputation
-
For my first project using Bass.Dll I made a simple music player with visualization. The visualization I was going for was a scrolling set of colors rather than an oscilloscope. The first version is the scrolling one #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Bass.au3> #Include <BassConstants.au3> Global $File Global $Stream Global $Length Global $Controls[5] Global $Labels[100][2] _BASS_Startup("Bass.dll") _BASS_Init($BASS_DEVICE_NOSPEAKER,1,44100,"NULL") $Parent = GUICreate("Bass Test",200,100) Opt("GUIOnEventMode", 1) $Controls[0] = GUICtrlCreateButton("Open",10,40) GUICtrlSetOnEvent($Controls[0],"_Open") $Controls[1] = GUICtrlCreateButton(">",50,40) GUICtrlSetOnEvent($Controls[1],"_Play") $Controls[2] = GUICtrlCreateButton("| |",65,40) GUICtrlSetOnEvent($Controls[2],"_Pause") $Controls[3] = GUICtrlCreateButton("[]",80,40) GUICtrlSetOnEvent($Controls[3],"_Stop") $Controls[4] = GUICtrlCreateSlider(10,70,80) GUICtrlSetData($Controls[4],50) GUICtrlSetOnEvent($Controls[4],"_Vol") For $i = 0 to 99 $Labels[$i][0] = GUICtrlCreateLabel("",100+$i,0,1,100) GUICtrlSetBkColor($Labels[$i][0],0xFFFFFF) Next GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") Func _Open() $File = FileOpenDialog('Music', '', 'MP3 (*.mp3;*.wav)') If $Stream <> "" Then _BASS_StreamFree($Stream) AdlibUnRegister() EndIf $Stream = _BASS_StreamCreateFile(False,$File,0,0,$BASS_SAMPLE_FLOAT) $Length = _BASS_ChannelBytes2Seconds($Stream, _BASS_ChannelGetLength($Stream,$BASS_POS_BYTE)) _Vol() EndFunc Func _Play() _BASS_ChannelPlay($Stream,0) AdlibRegister("_Pos",1) EndFunc Func _Pause() _BASS_ChannelPause($Stream) AdlibUnRegister() EndFunc Func _Stop() _BASS_ChannelStop($Stream) AdlibUnRegister() EndFunc Func _Vol() _BASS_ChannelSetAttribute($Stream,$BASS_ATTRIB_VOL,GUICtrlRead($Controls[4])/100) EndFunc Func _Close() _BASS_Free() Exit EndFunc Func _Pos() $Level = _BASS_ChannelGetLevel($Stream) $Labels[99][1] = $Level For $j = 0 to 98 GUICtrlSetBkColor ($Labels[$j+1][0],$Labels[$j][1]) $Labels[$j][1] = $Labels[$j+1][1] Next If _BASS_ChannelBytes2Seconds($Stream,_BASS_ChannelGetPosition($Stream,$BASS_POS_BYTE)) >= $Length Then AdlibUnRegister() EndFunc While(1) Sleep(100) WEnd The problems I have with it are 1. I realized that people can't actually read colors like they can read a waveform so to most if not all people it just looks like random colors. Suggestions to help with visualization would be nice 2. A white line keeps moving back and forth across the image, I know it's not because the Adlib delay is too low because I set it to once a second and it still did it. The second is a full screen visualization that strobes with colors #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Bass.au3> #Include <BassConstants.au3> Global $File Global $Stream Global $Length Global $Controls[5] _BASS_Startup("Bass.dll") _BASS_Init($BASS_DEVICE_NOSPEAKER,1,44100,"NULL") Opt("GUIOnEventMode", 1) $Parent = GUICreate("Visualizer",@DesktopWidth,@DesktopHeight) $Labels = GUICtrlCreateLabel("",0,0,@DesktopWidth,@DesktopHeight) GUICtrlSetBkColor($Labels,0xFFFFFF) GUISetState(@SW_SHOW) $Child= GUICreate("Bass Test",200,100,-1,-1,-1,-1,$Parent) $Controls[0] = GUICtrlCreateButton("Open",10,40) GUICtrlSetOnEvent($Controls[0],"_Open") $Controls[1] = GUICtrlCreateButton(">",50,40) GUICtrlSetOnEvent($Controls[1],"_Play") $Controls[2] = GUICtrlCreateButton("| |",65,40) GUICtrlSetOnEvent($Controls[2],"_Pause") $Controls[3] = GUICtrlCreateButton("[]",80,40) GUICtrlSetOnEvent($Controls[3],"_Stop") $Controls[4] = GUICtrlCreateSlider(10,70,80) GUICtrlSetData($Controls[4],50) GUICtrlSetOnEvent($Controls[4],"_Vol") GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") Func _Open() $File = FileOpenDialog('Music', '', 'MP3 (*.mp3;*.wav)') If $Stream <> "" Then _BASS_StreamFree($Stream) AdlibUnRegister() EndIf $Stream = _BASS_StreamCreateFile(False,$File,0,0,$BASS_SAMPLE_FLOAT) $Length = _BASS_ChannelBytes2Seconds($Stream, _BASS_ChannelGetLength($Stream,$BASS_POS_BYTE)) _Vol() EndFunc Func _Play() _BASS_ChannelPlay($Stream,0) AdlibRegister("_Pos",100) EndFunc Func _Pause() _BASS_ChannelPause($Stream) AdlibUnRegister() EndFunc Func _Stop() _BASS_ChannelStop($Stream) AdlibUnRegister() EndFunc Func _Vol() _BASS_ChannelSetAttribute($Stream,$BASS_ATTRIB_VOL,GUICtrlRead($Controls[4])/100) EndFunc Func _Close() _BASS_Free() Exit EndFunc Func _Pos() $Level = _BASS_ChannelGetLevel($Stream) GUICtrlSetBkColor ($Labels,$Level) If _BASS_ChannelBytes2Seconds($Stream,_BASS_ChannelGetPosition($Stream,$BASS_POS_BYTE)) >= $Length Then AdlibUnRegister() EndFunc While(1) Sleep(100) WEnd The problems I have 1. Same as above 2. The label prevents clicking on the buttons with the mouse so I have to use the keyboard to navigate 3. I'm working on a way to make the strobe speed coincide with the speed of the song. Suggestions on how to do that are very welcome Edit:Changed to 2 gui windows as per suggestion Thank you for the comments and advice, I hope you enjoy.
-
Sprite Funcs.au3 A fork in the road (input apreciated)
Darth replied to Darth's topic in AutoIt Example Scripts
Bump and update. This seems to be mostly ignored by the community which is sad because I'd love some feed back. Anyway yah update and a maybe minor fork in the road. -
Sprite Funcs.au3 A fork in the road (input apreciated)
Darth replied to Darth's topic in AutoIt Example Scripts
Cheers then and best of luck. This'll probably be the only project I'm continuing though, I've learned my lesson about backing up. Edit: yet another hard drive failure, resizing my partition to have room for an XP install and will try to get something up if possible soon. Edit2: partition up xp installed, music blasting and I'm coding as fast as I can understand what my brain's trying to say -
Sprite Funcs.au3 A fork in the road (input apreciated)
Darth replied to Darth's topic in AutoIt Example Scripts
Bump after over a year, I'm going to continue developing this after I get a windows box up and running. I now understand what martin is talking about so I'll impliment his sggestions as elegently as I can, hopefully I'll have a first draft up inside a month. -
More protection for your applications. (updated)
Darth replied to GEOSoft's topic in AutoIt Example Scripts
that is the most convoluted piece of code I've ever read. congrats on the obscufation. -
Antivirus Version Last Update Result a-squared 4.0.0.73 2009.01.22 - AhnLab-V3 5.0.0.2 2009.01.22 - AntiVir 7.9.0.57 2009.01.22 - Authentium 5.1.0.4 2009.01.22 - Avast 4.8.1281.0 2009.01.22 Win32:Trojan-gen {Other} AVG 8.0.0.229 2009.01.22 - BitDefender 7.2 2009.01.22 - CAT-QuickHeal 10.00 2009.01.22 - ClamAV 0.94.1 2009.01.22 - Comodo 942 2009.01.22 - DrWeb 4.44.0.09170 2009.01.22 - eSafe 7.0.17.0 2009.01.22 - eTrust-Vet 31.6.6321 2009.01.22 - F-Prot 4.4.4.56 2009.01.21 - Fortinet 3.117.0.0 2009.01.22 - GData 19 2009.01.22 Win32:Trojan-gen {Other} Ikarus T3.1.1.45.0 2009.01.22 - K7AntiVirus 7.10.599 2009.01.22 - Kaspersky 7.0.0.125 2009.01.22 - McAfee 5502 2009.01.21 - McAfee+Artemis 5502 2009.01.21 - Microsoft 1.4205 2009.01.22 - NOD32 3789 2009.01.22 Win32/Packed.Autoit.Gen Norman 5.93.01 2009.01.21 - nProtect 2009.1.8.0 2009.01.22 - Panda 9.5.1.2 2009.01.21 - PCTools 4.4.2.0 2009.01.22 - Rising 21.13.32.00 2009.01.22 - SecureWeb-Gateway 6.7.6 2009.01.22 - Sophos 4.37.0 2009.01.22 - Sunbelt 3.2.1835.2 2009.01.16 - Symantec 10 2009.01.22 - TheHacker 6.3.1.5.225 2009.01.21 - TrendMicro 8.700.0.1004 2009.01.22 - ViRobot 2009.1.22.1574 2009.01.22 - VirusBuster 4.5.11.0 2009.01.22 - choose accordingly
-
BASS Function Library (Sound and Music Functions)
Darth replied to BrettF's topic in AutoIt Example Scripts
thanks, awesome udf. here's my edit to example one to give it a playlist and global hotkeys. the playlist is annoying to use atm and it isn't saved but I'll fix that eventually. #include <..\Bass.au3> #include <..\BassConstants.au3> #NoTrayIcon Global $playing_state = -1 ;Open Bass.DLL. Required for all function calls. $bass_dll = DllOpen("..\BASS.dll") ;Initalize bass. Required for most functions. _BASS_Init($bass_dll, 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 $song_num=InputBox("Song #","howmany songs in playlist?") dim $song_array[$song_num] for $i = 0 to $song_num-1 ToolTip("Song " & $i+1 & " out of " & $song_num & ".",100,100) $song_array[$i] = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)") Next ToolTip("") HotKeySet("^+=","FFWD");=========> skip to next track HotKeySet("^+-","RWND");=========> skip to previous track HotKeySet("^+p","Pause_play");===> Pause or resume track hotkeyset("^+e", "Stop");========> exit player For $i = 0 to $song_num-1 ;Create a stream from that file. $MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $song_array[$i], 0, 0, 0) ;Check if we opened the file correctly. If @error Then MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error) Exit EndIf ;Iniate playback _BASS_ChannelStop ($bass_dll, $MusicHandle) _BASS_ChannelPlay($bass_dll, $MusicHandle, 1) $isplay=1 ;Get the length of the song in bytes. $song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE) While 1 Sleep(20) ;Get the current position in bytes $current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE) ;Calculate the percentage $percent = Round(($current / $song_length) * 100, 0) ;Display that to the user ToolTip("Completed " & $percent & "%", 0, 0) ;If the song is complete, then exit. If $current >= $song_length Then ExitLoop WEnd Next Func OnAutoItExit() ;Free Resources _BASS_Free($bass_dll) EndFunc ;==>OnAutoItExit Func FFWD() _BASS_ChannelStop ($bass_dll, $MusicHandle) $i = $i+1 if $i > UBound($song_array)-1 Then $i = 0 EndIf $MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $song_array[$i], 0, 0, 0) _BASS_ChannelStop ($bass_dll, $MusicHandle) _BASS_ChannelPlay($bass_dll, $MusicHandle, 1) $song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE) EndFunc func RWND() _BASS_ChannelStop ($bass_dll, $MusicHandle) $i = $i-1 if $i < 0 Then $i = UBound($song_array)-1 EndIf $MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $song_array[$i], 0, 0, 0) _BASS_ChannelStop ($bass_dll, $MusicHandle) _BASS_ChannelPlay($bass_dll, $MusicHandle, 1) $song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE) EndFunc Func Pause_Play() Switch $isplay Case 1 _BASS_Pause ($bass_dll) $isplay = 0 Case 0 _BASS_Start($bass_dll) $isplay = 1 EndSwitch EndFunc func stop() _BASS_Free($bass_dll) Exit EndFunc -
Yah what he said ^ alpha is the designator for any program under version 0.5 I think, but I know it comes first.
-
Never heard of this game so I can't provide testing but I just wanted to point out that alpha comes before beta.
-
check for a process with window title Task manager and close that when it pops up .
-
the text files are the download links. pay attention mon.
-
thanks this'll be great for my battle system once I get around to recoding it
-
PNG as GUI, drop shadows, curved edges, you name it
Darth replied to lod3n's topic in AutoIt Example Scripts
major props, nice job -
edited first post, should work now
-
87 veiws and not a single reply