TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Columbia on October 13, 2004, 10:02:39 AM
-
This is for all you guru's among geeks :P
I want to play a *.wav file from my VisualLISP function. How does one go about doing that. I'm already familiar with the DOSLib coolness, however I want to be able to ship this out to another user who may or may not have DOSLib, and I don't want to ship the DOSLib arx to them.
Any and all help here would be appreciated. Thanks.
-
All I have is a VBA thingie:
Private Declare Function PlaySound Lib "winmm.dll" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' file name
Private Const NO_ERROR = 0
Private Sub PlayItSam()
PlaySound "D:\WINNT\Media\notify.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC
End Sub
-
http://theswamp.org/phpBB2/viewtopic.php?t=993&highlight=wav+file
and
http://theswamp.org/phpBB2/viewtopic.php?t=370&highlight=wav+file
-
Out of curiosity how would you do it using doslib?
--ImaJayhawk
-
Really, really simple...
(dos_wav "filename.wav")
-
Stig, CAB, Thanks. I appreciate the info.
...But (there's always a "but", isn't there?) what I really wanted was a method of interacting with Win32API through VLISP to play it. I would still have to ship this file VBA file along with the vlx.
Any thoughts?
-
Have you tried using Rundll32 to play the file through the winmm.dll ?
-
Ummm..... Keith you've caught me completely ignorant. I don't even know what Rundll32 is, nevermind trying to use it.
-
rundll32 is a program that you can use to run exported dll functions (typically C and/or C++ functions) winmm.dll is the dll that contains the function to play multimedia files. I have not explored how to make it happen, but I am quite sure given the correct syntax it would be possible.
-
All I have is a VBA thingie:
Private Declare Function PlaySound Lib "winmm.dll" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' file name
Private Const NO_ERROR = 0
Private Sub PlayItSam()
PlaySound "D:\WINNT\Media\notify.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC
End Sub
Pardon my ignorance, but how do I get that to run?
-
type VBAMAN , click NEW then click VBA EDITOR. Paste that code into the IDE put your cursor somewhere in the sub portion of it and press F5
-
Okay...now what if I wanted to put this in as part of a reactor? Particularly when an object is erased?
-
Private Declare Function PlaySound Lib "winmm.dll" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' file name
Private Const NO_ERROR = 0
Private Sub AcadDocument_ObjectErased(ByVal ObjectID As Long)
PlaySound "D:\WINNT\Media\notify.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC
End Sub
-
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If (VBA.UCase$(CommandName) = "ERASE") Then
Call PlayItSam
End If
End Sub
-
Even when I tried the original code, I never got a macro to execute. I'm not familiar with VBA, so I apologize in advance. But I followed the procedure Bob outlined, but when I hit F5, I don't have anyt macro to select to run. :dummy:
-
try inserting this in a new module in the vbaide
Option Explicit
Private Declare Function PlaySound Lib "winmm.dll" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' file name
Private Const NO_ERROR = 0
Public Sub MakeANoise()
PlaySound "c:\windows\media\ding", ByVal 0&, SND_FILENAME Or SND_ASYNC
End Sub
-
That works! Thanks...now to put that with the Erase reactor...after work...
-
if you try to use simple beep sound..
you can use (acet-sys-beep Yoursoundhere)
or
(startapp "c:/windows/system32/sndrec32.exe /play /close" "C:/windows/media/tada.wav")
but this will show the soundrecorder...
maybe it have a switch / to play background...but i don't know..
-
One more time ... ACET* = Evil.
If you don't want to roll your own functions use DOSLIB (http://www.mcneel.com/cgi-bin/download.cgi?doslib)'s (dos_wav filename) function, but please don't use the ACET* crap, you're just begging for problems down the road and your users are the ones that will pay.
-
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If (VBA.UCase$(CommandName) = "ERASE") Then
Call PlayItSam
End If
End Sub
This will not work the way it should, so please disregard.
-
See this thread ....
http://www.theswamp.org/forum/index.php?topic=993.0
-
lol, this thread reminds me that I used to have the sound of a toilet flush everytime members of Microstation / PDS group changed projects (I had written a project management utility to map the network, modify the registry etc). I didn't keep the code active very long but it was funny while it was enabled.
:-D
-
One more time ... ACET* = Evil.
If you don't want to roll your own functions use DOSLIB (http://www.mcneel.com/cgi-bin/download.cgi?doslib)'s (dos_wav filename) function, but please don't use the ACET* crap, you're just begging for problems down the road and your users are the ones that will pay.
MP could you explain exactly why ACET* is crap ?
I'm new with it...and for my own...seem to work.