Author Topic: Wav File Playing...  (Read 6853 times)

0 Members and 1 Guest are viewing this topic.

Columbia

  • Guest
Wav File Playing...
« 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.

SMadsen

  • Guest
Wav File Playing...
« Reply #1 on: October 13, 2004, 10:23:35 AM »
All I have is a VBA thingie:
Code: [Select]
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

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ImaJayhawk

  • Guest
Wav File Playing...
« Reply #3 on: October 13, 2004, 11:26:10 AM »
Out of curiosity how would you do it using doslib?

--ImaJayhawk

Columbia

  • Guest
Wav File Playing...
« Reply #4 on: October 13, 2004, 11:32:44 AM »
Really, really simple...
Code: [Select]

(dos_wav "filename.wav")

Columbia

  • Guest
Wav File Playing...
« Reply #5 on: October 13, 2004, 02:06:21 PM »
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?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Wav File Playing...
« Reply #6 on: October 13, 2004, 03:40:53 PM »
Have you tried using Rundll32 to play the file through the winmm.dll ?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Columbia

  • Guest
Wav File Playing...
« Reply #7 on: October 13, 2004, 03:43:56 PM »
Ummm..... Keith you've caught me completely ignorant.  I don't even know what Rundll32 is, nevermind trying to use it.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Wav File Playing...
« Reply #8 on: October 13, 2004, 04:23:13 PM »
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.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Wav File Playing...
« Reply #9 on: October 11, 2005, 12:59:14 PM »
All I have is a VBA thingie:
Code: [Select]
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?

Bob Wahr

  • Guest
Re: Wav File Playing...
« Reply #10 on: October 11, 2005, 01:06:47 PM »
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

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Wav File Playing...
« Reply #11 on: October 11, 2005, 01:14:04 PM »
Okay...now what if I wanted to put this in as part of a reactor?  Particularly when an object is erased?

Bob Wahr

  • Guest
Re: Wav File Playing...
« Reply #12 on: October 11, 2005, 01:16:03 PM »
Code: [Select]
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

deegeecees

  • Guest
Re: Wav File Playing...
« Reply #13 on: October 11, 2005, 01:19:58 PM »
Code: [Select]
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
    If (VBA.UCase$(CommandName) = "ERASE") Then
        Call PlayItSam
    End If
End Sub

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Wav File Playing...
« Reply #14 on: October 11, 2005, 02:34:59 PM »
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: