Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can not get the sound right

Status
Not open for further replies.

Stiddy

IS-IT--Management
Dec 5, 2001
781
US
use Win32::Sound;

&play_trouble;
Guys and Gals

I have the following little code which I am attempting to setup to notify my helpdesk in the case that I virus is detected on my network. Works great except everytime it plays it changes my speakers to only play from the left side. I have read the docs but cant figure it out. please help.


# Subroutine to call wav file to inform administrator of possible virus infection
sub play_trouble {
for ($count = 1; $count <= 2; $count++) {
($L, $R) = Win32::Sound::Volume();
if ( not defined Win32::Sound::Volume() ) {
die "Can't get volume: $!";}
Win32::Sound::Volume($L,$R);
Win32::Sound::play("D:\\scripts\\antivirus\\notification\\virus.wav");
Win32::Sound::Stop();
}
}
 
Are you running this on WinXP? I'm getting the same issue.. since the module was written in 1999, I'm assuming that the way the volume is controlled in Windows has changed since then.
I tried playing around with the numbers, and got it to play at 100% volume (center balance) with:
Win32::Sound::Volume(9999999);

Or, you can just play the sound at the current volume setting just by omitting Win32::Sound::Volume
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top