Comments

Cheesehole wrote on 9/20/2003, 4:08 AM
Can you believe this isn't built into Vegas? Even my first audio editor, Turtle Beach's "Wave 2.0" had a user selectable "done processing" sound :)
johnmeyer wrote on 9/20/2003, 5:59 PM
Couldn't this be done with a call to an external Windows API?
johnmeyer wrote on 9/20/2003, 10:11 PM
I tried to add to my last post by coming up wiht the exact syntax for playing an external WAV file. I came up with the following, but I couldn't find the proper syntax for declaring the external API call. There needs to be a declaration, something like:

public FUNCTION PlaySound(String lpszName, long hModule, long dwFlags);

but this is the wrong syntax for jscript.

Here's my code fragment:


import System;
import System.IO;
import System.Windows.Forms;
import SonicFoundry.Vegas;

try {
var windir : String = Environment.GetEnvironmentVariable("windir");
var soundfile : String = windir & "\MEDIA\The Microsoft Sound.wav";
PlaySound(soundfile, 0,0);
} catch (e) {
MessageBox.Show(e);
}
Cheesehole wrote on 9/21/2003, 3:59 AM
hey thanks! So I just need to figure out how to declare the external API call... any clue where I should start looking? I appreciate the help. At least I know what direction to head.

- Ben
johnmeyer wrote on 9/21/2003, 11:04 AM
I was hoping someone else would chime in. Since I don't program regularly, I couldn't find the proper syntax. In Visual Basic, it is something like this, but I couldn't get it to work in jscript:

public FUNCTION PlaySound(String lpszName, long hModule, long dwFlags);

I think the DLL that contains this function must also be declared with a statement similar to:

[sysimport(dll="winmm.dll")]

but again, I couldn't figure out the right syntax to make this work in Vegas.
SonyPJM wrote on 9/22/2003, 9:41 AM

I'm not sure if you can do a DllImport in JScript but you should be
able to create a C# assembly that makes the call to PlaySound. Then
your script can import that assembly and call a function that calls
PlaySound.

There's some details on using custom assemblies from within a Vegas
script here:

http://www.ayizwe.net/VegasScripts/FAQ.html#1.6

Also, media players such as WinAmp can be launched with command line
args to play a file.
johnmeyer wrote on 9/22/2003, 12:21 PM
Thanks for the link. I'd forgotton about their script tutorial. Unfortunately, it didn't seem to answer the question posed by the original poster.

I guess what you are saying is that Vegas scripts cannot make calls to any Windows APIs, unlike what I can do in Office Applications, as described here:

The Windows API and Other Dynamic-Link Libraries
johnmeyer wrote on 11/5/2003, 12:14 PM
I'm working on a completely unrelated task, but discovered this method to play a sound. It ain't pretty, but it works. It requires that you have the SoundRecorder installed. If you don't, substitute the path and name of some other small applet that will play wav files.


import System;
import System.IO;
import SonicFoundry.Vegas;

try
{
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run ("sndrec32 /play /close c:\\windows\\media\\chimes.wav");

}
catch(e)
{

}