TheSwamp
Code Red => VB(A) => Topic started by: Keith™ on March 29, 2004, 10:23:48 AM
-
Ok folks, I have a new MP3 dvb available of all of you who like to play MP3 and wave files from your computer, but don't like that window media player window and best of all, it uses very limited system resources, only 1.2MB of memory on average. (Winamp uses 26MB, Windows Media Player uses 16MB)
A simple toolbar menu is loaded in AutoCAD, then you simply select the play button to select a file to play, pause to pause the file in play, and stop to stop it completely.
It can be downloaded here (http://theswamp.org/lilly.pond/KEB/CadAMP/CadAMP.zip)
Feedback please.....
-
Very nice Keith!! :dood: I've been trying to make my work computer more of a "workstation" and not a "jump-between-programs" station. I didn't know Win-Amp took up more resources than Media Player did, either. If I had one suggestion, it would be for a search bar, or something similar. Awesome, nonetheless :twisted:
-
Maybe... just maybe.... I can implement something of that nature.... We'll see...
Lets see how many other people use it...
-
If I had one suggestion, it would be for a search bar, or something similar. Awesome, nonetheless :twisted:
And by search bar, I meant to skip thru the song, just to clarify...
-
Oh... kinda like fast forward....
-
Oh... kinda like fast forward....
Blingo...I like to listen to comedy, and if I miss something, gotta be able to go back an listen again :twisted:
-
i like i like but yeah a scan feature would be good and multiple track play would be even better. pretty sweet as is though kudos keith :wink:
-
I al looking at making it play Winamp playlists (B4S) and entire folders, also, I am looking at the possibility of rewind and fast forward ... rather like a skip ahead and/or skip back... but I don't want to get it too GUI heavy since that will significantly increase the memory requirements.
-
This is sweeeet, Keith!
Works a treat, as our friends 'cross the pond would say.....
The scan/ffwd/rev option would be cool too, but not if it's gonna get top-heavy.
-
Beautiful man!!!! It is nice to see something like this, integrated into CAD finally. I like the idea of the playlist and multi file idea. Besides that, I am dumbfounded still.
-
Nice, I'll have to load it up at work tomorrow and check it out. Winamp5 is bloat city.
p.s.....The dvb file isn't locked is it? I'd like to take a look at the source.
-
The dvb file isn't locked is it? I'd like to take a look at the source.
Nope.... just don't sell it... if you do, send me some money...
-
I never knew there was a market for AutoCAD mp3 players. :D
-
Well, if you want to know the truth, it can also be used in Microstation....Excel, Word, and ANY VBA enabled program....You just need to export the DVB to a BAS file then import it into the VBA enabled application.
Now that is better isn't it.....
You can now create sound events using mp3 files in any VBA enabled application...just by using the MCI command calls.
-
I loaded it up at work today and I must say it's very nice. A playlist of sorts would be nice as would looping (when a song ends it restarts it). Maybe even an option to set modemacro to the current song playing?
If you want any help with any of this let me know. You've already done the hard part and the rest should be pretty easy.
-
I actually thought of the modemacro thing. It will be pretty easy to implement, I also have figured out for the most part, the ability to adjust the location of the file playing.. by either moving a slider forward or reverse. I am having a bit of difficulty setting the slider position, and I would like to set a timer to move it while it is still visible, but I don't want the slider control to be visible always, this would create overhead, and I don't want overhead.
So essentially I have retrieved the length of the file in milliseconds, retrieved the current position in the file, divided the current position by the length (to get a percentage done) then multiplied it by 100 (to get a whole number)...
Then attempted to set that value to the slider control... but no go...
I may have to set it in the slider initialization stages...
I also set the changed event of the slider to close the form. That way there is no buttons to press. I also need a timer so if the user does not change the slider, it disappears. This could be a variable the user can set to display it for say 5 or 10 seconds... I see alot of other possibilities, but I have to take it slowly...since I am essentially doing it in free time (which is a premium).
If you could create a macro function to parse a b4s file (xml on steriods) that would return an array of the file names (and paths) that would be great.
-
I'll work on that macro tomorrow at lunch if I have time.
-
Ok, to keep everyone up to date on this... tonight I added the following.....
Popup slider control, to position the song at any location
Modemacro showing the current file playing...
Midi support
I am still working on a bug introduced by the length extraction of a MP3 file. It seems the length reported and the length assigned by the timer is not the same. I was presumtuous perhaps to think that the timer milliseconds would correspond to the MP3 milliseconds returned.
I also have to add the modemacro resetting if the user closes the current file, and to kill the timer in that case as well.
As soon as I get a b4s module I will make it loop through the list of files..
Preferrably it will be a function returning the list of songs (with paths) as an array to the calling function.
-
Ok the latest version is up there....for the taking... Follow this link (http://theswamp.org/lilly.pond/KEB/CadAMP/CadAMP.zip)
Feedback please....
D2H ... you got your search bar ....
Tim ... you got the status bar....
Any more requests ... except multiple files, I am still working on that one
Make sure you delete your existing CadAMP.mnc and CadAMP.mnr otherwise you wil not get the correct bitmaps
-
Very smart piece of kit. All I would ask for is the abiliuty to play multipul songs. Again thanks. :P 8)
-
Keith -
I was able to find this by accident today, maybe it might help somewhere.
Private Sub PlaySong(ByVal Index As Integer)
'Purpose: Load a song, then play it
If Index >= 1 Then
LoadSong Index
Else
LoadSong 1
End If
If MediaPlayer1.Filename <> "" Then
MediaPlayer1.Play
bStopPressed = False
End If
End Sub
Private Sub LoadSong(ByVal Index As Integer)
'Purpose: Loads a song into the mediaplayer and sets properties
If Index <= lstPlayList1.ListItems.Count Then
lstPlayList1.ListItems(iCurrentIndex).Bold = False
lstPlayList1.ListItems(iCurrentIndex).ListSubItems(1).Bold = False
lstPlayList1.ListItems(iCurrentIndex).ListSubItems(2).Bold = False
iCurrentIndex = Index
MediaPlayer1.Filename = lstFilenames.List(Index - 1)
Label1.Caption = "Current Song: " & lstPlayList1.ListItems(Index).ListSubItems(1).Text & " by " & lstPlayList1.ListItems(Index).ListSubItems(2).Text
'Label1.Caption = "Current Song: " & Right(lstPlayList.List(Index), Len(lstPlayList.List(Index)) - Len(Str(Index)) - 1)
sFormTitle = frmMain.sPlayerName & " - [" & lstPlayList1.ListItems(Index).ListSubItems(1).Text & "-" & lstPlayList1.ListItems(Index).ListSubItems(2).Text & "] "
frmMain.Caption = sFormTitle
'HCSSlider1.Max = MediaPlayer1.Duration
'HCSSlider1.Min = 0
lstPlayList1.ListItems(Index).Selected = True
lstPlayList1.ListItems(Index).EnsureVisible
lstPlayList1.ListItems(Index).Bold = True
lstPlayList1.ListItems(Index).ListSubItems(1).Bold = True
lstPlayList1.ListItems(Index).ListSubItems(2).Bold = True
lstPlayList1.Refresh
End If
End Sub
-
keith it worked for me before but i downloaded the latest and now i get this message :cry:
Macro name: MP3.PlayFile Execution error
-
Go to menuload, completely remove cadamp, and then completely reload the mnc file. I had the exact same problem.
R
-
Another issue is whether you are using VB6 or VB5. If you have VB5 then you will need to make a few modifications to the code.
Namely, you will need to replace all occurences of
AddressOf
with
MyAddressOf
and enclose the argument in quotes.
-
Keith:
Here's the deal: I honestly don't know how to create a function that returns an array (unless you can assign an array to a function that's supposed to return a string(I've never tried)), so the best thing I can do is return a string that you'd need to run the split() function on. If this is acceptable let me know.
Also, I don't know where you're getting .b4s files from. I have winamp 5 and the only playlist formats it supports are .m3u and .pls (which seem fairly easy to parse). Is a .b4s file a windows media player playlist? If so, could you upload one to the lilypad so I can take a look at it?
-
It is a winamp 4 playlist
The file is xml so the parsing should probably be about the same.
I would expect that you can create a string array then return that string, but you would need to test it to be sure.
-
Keith:
I still don't have a .b4s file to work with but here are two functions I created to read a .m3u and a .pls and return the songs in an array. The .bas file can be downloaded here (http://theswamp.org/lilly.pond/riley/ModPlaylist.bas).
the m3u function:
'This function reads the contents of a WinAMP m3u file and returns the
'file paths in an array
Public Function ParseM3U(M3UFile As String) As String()
Dim M3ULine As String
Dim M3USongs() As String
ReDim M3USongs(0) As String
Open M3UFile For Input As #1
Do While Not EOF(1)
Input #1, M3ULine
If Left(M3ULine, 1) = Chr(92) Then
If M3USongs(0) = Null Then
M3USongs(0) = M3ULine
Else:
ReDim Preserve M3USongs(LBound(M3USongs) To UBound(M3USongs) + 1) As String
M3USongs(UBound(M3USongs)) = M3ULine
End If
End If
Loop
Close #1
ParseM3U = M3USongs
End Function
the pls function:
'This function reads the contents of a WinAMP pls file and returns the
'file paths in an array
Public Function parsePLS(PLSFile As String) As String()
Dim PLSLine As String
Dim PLSLineStripped As String
Dim PLSSongs() As String
Dim I As Integer
ReDim PLSSongs(0) As String
Open PLSFile For Input As #1
Do While Not EOF(1)
Input #1, PLSLine
If LCase(Left(PLSLine, 4)) = "file" Then
Do While Right(Left(PLSLine, I), 1) <> Chr(61)
I = I + 1
Loop
PLSLineStripped = Right(PLSLine, Len(PLSLine) - I)
If PLSSongs(0) = Null Then
PLSSongs(0) = PLSLineStripped
Else:
ReDim Preserve PLSSongs(LBound(PLSSongs) To UBound(PLSSongs) + 1) As String
PLSSongs(UBound(PLSSongs)) = PLSLineStripped
End If
End If
Loop
Close #1
parsePLS = PLSSongs
End Function
Post a .b4s file to the lilly pond and I'll work on it.
Also, you need to revise the code so the seekbar doesn't show unless a mp3 is playing. Showing it without a song playing crashes my AutoCAD instantly. Something like this should work.
Sub StopMP3()
Dim dwreturn As Long
Dim Ret As String * 128
dwreturn = mciSendString("close all", 0&, 0&, 0&)
If dwreturn <> 0 Then
mciGetErrorString dwreturn, Ret, 128
MsgBox Ret, vbCritical
End If
ClearModeMacro
PlayStatus = "stop"
End Sub
Sub SeekMP3Form()
If Not PlayStatus = vbNullString and Not PlayStatus = "stop" Then
RetVal = TimerModule.TimerSetup(6000)
SeekMP3.Show
End If
End Sub
-
Good enough... did you test the code above for the seekbar?
-
I typed that out from here without testing. It should work though.
-
I thought about that and I figured I should make it a bit more foolproof... I added a bit of code to check the status of the player, if it was still playing, it would display, but if it had stopped, then it would not display. This would prevent a user from selecting the button after the song had finished.
I have managed to add multiple file support via selection of multiple files, but it does not work without VB6. I am working on a solution for VB5, but it might not come as readily.
I also have added a skip to next or previous file if there is more than 1 file in the playlist.
I am preparing to add the PlayList mod as I type... give me a few minutes and I will upload the latest version.
-
I am having some trouble getting it to read the M3U file correctly.
I noticed the code searches for a ackslash as the first character of the line where the file name is. Unfortunately all of the M3U files I have are as such:
#EXTM3U
#EXTINF:230,Unknown Artist - Footsteps of Decisive Battle
Mp3\Lunar Eternal Blue - Footsteps of Decisive Battle.mp3
#EXTINF:288,Unknown Artist - The Last Battle
Mp3\Lunar Eternal Blue - Zopha vs. Lucia - The Last Battle.mp3
#EXTINF:210,Hitoshi Sakimoto - Battle on the Bridge
Mp3\Final Fantasy Tactics - Battle on the Bridge.mp3
#EXTINF:142,Lunar Eternal Blue - Field Toward Tomorrow
Mp3\Lunar Eternal Blue - Field Toward Tomorrow.mp3
#EXTINF:131,Soul Blade - The Edge of Soul
Mp3\Soul Blade - The Edge of Soul.mp3
#EXTINF:153,Unknown Artist - Whitendon Theme
Mp3\Anachronox - Whitendon.mp3
#EXTINF:436,Cirque Du Soleil - High Bar
Mp3\High Bar.mp3
#EXTM3U
#EXTINF:234,Unknown Artist - Untitled
C:\WINDOWS\Desktop\Lux Aeterna.mp3
#EXTINF:234,Unknown Artist - Untitled
C:\WINDOWS\Desktop\Lux Aeterna.mp3
#EXTINF:234,Unknown Artist - Untitled
C:\WINDOWS\Desktop\Lux Aeterna.mp3
#EXTINF:234,Unknown Artist - Untitled
C:\WINDOWS\Desktop\Lux Aeterna.mp3
#EXTINF:234,Unknown Artist - Untitled
C:\WINDOWS\Desktop\Lux Aeterna.mp3
#EXTINF:234,Unknown Artist - Untitled
C:\WINDOWS\Desktop\Lux Aeterna.mp3
#EXTINF:234,Unknown Artist - Untitled
C:\WINDOWS\Desktop\Lux Aeterna.mp3
Now one explicitly has the path while the other has the inferred path.
I have no pls files to check.
I will look at it more closely tomorrow.
-
Tim, I uploaded the 3 pertinent files to your folder on the lilly pond. Download them and check them out. I have still not fixed the M3U and PLS thing yet.
-
What the hell. You would think that with different versions of winamp they would at least keep the m3u format the same (I was reading a m3u file generated by winamp5). I guess I'll have to revise those functions to be able to read all the possible formats of m3u files. :(
I'll take a look at it as soon as I get a chance.
-
Check out the player up to this point and let me know of problems you encounter
-
8) NICE.........would be if you select multipul files to play one after the other...like a library or playlist...
But excellent none the less......THUMBS UP TO YOU KEITH......
-
8) NICE.........would be if you select multipul files to play one after the other...like a library or playlist...
But excellent none the less......THUMBS UP TO YOU KEITH......
The new version (for testing and collaboration with Tim) posted in his folder on the lilly pond allows you to select multiple files, only it will not work with playlist files (yet)
-
hey keith was wondering would it be possible for you to send me a copy of the original version of your player. it worked although it played one song at at time without scan. now it doesn't work at all so something is better than nothing. i'd really appreciate it.
-
Follow the link in the original post... it contains the last code that does work.. the one in Tim's folder is for colaboration only...
-
I really need to get back working on that. Sorry, but I've been real busy lately.
-
no problem.. I have been using the previous version for now with with the selection of multiple files via the selection window....I select like 10 or so songs and let it go until it quits then I select 10 more....
-
Keith, is it possible to get this to work with wma files? Or, how do you convert wma's into mp3's or the like?
-
I think you can simply add the WMA filter to the file search window. The media player dll is what is used to manage the files, so I don't think the format will be a problem.
-
I tried just typing *.* and selecting them that way. It crashed. I'll look into it some more. Maybe I didn't do something right in the set up.
-
You will have to do it programmatically, the window will not accept any file type except those listed in the combo box, even if you change the filter.
-
Okay. I think I saw that in the module.
-
A problem occured in initializing MCI
What does that mean?
-
It may not be a supported format... let me check it out ....
-
Appreciate it.
-
you will need to add a couple of lines ...
To the Open_Comdlg32 routine you will need to add this filter ... you can add it directly after the wav filter ...
"Windows Media (*.wma)" & Chr(0) & "*.wma" & Chr(0) & _
In the PlayFile sub add this to the Select Case
Case "WMA"
PlayMp3 (FileName)
It works for me ...
-
Must be something else. I did exactly that.
-
It works without flaw on my installation ... have you tried opening the wma file in media player ... if it does not play it could be codec issue.
-
I'm listening to it now in media player. Maybe I haven't loaded it properly or I have the wrong one. I downloaded the first thread links file.
-
I never, in my wildest dreams would have thought of doing a vba application of an mp3 player for AutoCAD. WOW WOW WOW. Excellent work!
-
Is anyone still working on this program? If so let me know. I've taken a look a the the code and think I have a few things to help out.
For example, change the line where modemacro is set in the MP3 basic module to the two lines below to only show the filename, not the full path:
FileName = Mid(FileName, InStrRev(FileName, "\") + 1, Len(FileName) - InStrRev(FileName, "\") - 4)
ThisDrawing.SetVariable "ModeMacro", "CADAmp: " & FileName
If nobody else is working on it, I would be happy to add in playlist and multi-play functionality.
-
I havn't done anything major to it in a little while, but I would accept any updates to the code to be able to play playlists. Feel free to do so....just keep me posted of the changes.
-
Thats really cool!
Cheers!
-
Glad you like
-
Keith i was trying to use the mp3 player again to see if it would work for me now but it's still no go. the toolbar loads fine and i can browse to my folder but then i get this message. how can i fix this?
runtime error '53':
File not found: VBA332.DLL
if i click on debug this line is highlighted in the code
Call GetCurrentVbaProject(lHproject)
-
i see this when i go to help but not sure what to do.
The file was not found where specified. This error has the following causes and solutions:
A statement, for example, Kill, Name, or Open, refers to a file that doesn't exist.
Check the spelling of the file name and the path specification.
An attempt has been made to call a procedure in a dynamic-link library (DLL) or Macintosh code resource, but the library or resource file name specified in the Lib clause of the Declare statement can't be found.
Check the spelling of the file name and the path specification.
In the development environment, this error occurs if you attempt to open a project or load a text file that doesn't exist.
Check the spelling of the project name or file name and the path specification.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
-
you may not have all of the VBA files installed. Do a search on your computer for that file. If you find it then you have to register the file. If you don't find it, then you don't have that version of VBA installed. You can usually find the file available for download on the web. It would need to be put in C:\Program Files\Common Files\Microsoft Shared\VBA
*edit*
The file can normally be found on the installation CD for Office 97 and AutoCAD 2000.
If your AutoCAD program is 2002+ you may have VB6 installed.. in that case, you should replace all instances of MyAddressOf to AddressOf and the VBA332.dll will not be needed.
This problem most often occurs when the VBA332.dll is deleted or uninstalled.
-
strange, i did a search and it found it exactly where you said it should be :?
-
i just looked down at the bottom of the screen and noticed it now says now playing. i plug in the phones and indeed it is playing but when i go to pick another song i get the message.
-
Dan, what version of AutoCAD are you using? I know t-bear could never get it working right...he is on 2004
Also what version of Windows?
Strangely enough it works for me on 2004 ..
Try this ...
In TimerModule change the file VBA332.dll to the entire path and see if that fixes the problem.
-
hmmm put in the full path but it still doesn't find it. i am using adt 3.3 on windows xp. it's not a big deal right now just wanted to see if it worked for me now. remember i've got my own mp3 player that can play 7000 songs :P
-
Well, it seems that this has gotten quite a bit of attention, some good some bad ... all helpful in development.
What I am considering is further development of this program. Of course the caveat is that if no one uses it (or will use it) then I won't waste my time to improve it.
... and make it more compatable with AutoCAD 2004+
So a show of hands would be great ... should I develop it further ... should I abandon it ... or should I just leave well enough alone ...
-
Great prog. If it could play a palylist without a promt for each track, then it would be all I could ask for. Runs fine on 2005.
-
I agree with the playlist vote...
-
FYI: This works great in 2006 :kewl:
-
cool prog man..i havent tried it yet since i dont have mp3 on my workstation. is there a way you can play a cd from this program?
-
Right now the program only plays MP3, WAV, and MIDI files .... if you burn your MP3 files to CD as MP3s, you can play them.
-
Update:
The following CadAMP program plays in AutoCAD 2004 (will not work in 2000-2) and support multiple files.
Get yours here (http://www.theswamp.org/lilly_pond/index.php?dir=keith/&file=CadAMP2004%2B.zip)
-
hi keith,
im interesred in CADAMP but how can i run those on autocad?
can u giv me some advise on how to do that...
thanks to u sir...
:mrgreen:
-
The code has not been updated in a long time, but it "should" work as long as you have VBA installed.
Download the file from above and place in the path of AutoCAD, then load the CadAMP menu and CadAMP dvb. You should be able to simply play files from the toolbar.