Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Set Volume with winmm and mciSendString

by slloyd (Hermit)
on Jun 27, 2004 at 05:06 UTC ( [id://369920]=perlquestion: print w/replies, xml ) Need Help??

slloyd has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone help me out? I cannot seem to figure out how to set the volume on a sound started via winmm through the mciSendString API in windows. I am able to play and stop the sound fine but I cannot figure out the syntax to control the volume.

$mci ||= new Win32::API("winmm", "mciSendStringA", 'PPNN', 'N') || ret +urn 0; #- Init $retstring my $retstring=" "x256; #- Open mp3 file $mci->Call("open \"$file\" alias mysound",$retstring,256,0); #- Play it $mci->Call("play mysound from 1",$retstring,256,0); # - how do I set the volume?

Replies are listed 'Best First'.
Re: Set Volume with winmm and mciSendString
by fglock (Vicar) on Jun 27, 2004 at 05:20 UTC

    Check this out: Win32::Sound. You can take a look at the source code to find out how they do it, or simply use it as-is.

use Win32::MCI::Basic;
by PodMaster (Abbot) on Jun 27, 2004 at 05:57 UTC
    Win32::MCI::Basic
    #synopsis use Win32::MCI::Basic; my $lpszCommand = "status cdaudio number of tracks"; # example MCI c +ommand my ($APICallReturnValue, $lpszReturnString) = mciSendString($lpszCom +mand); print "Number of tracks: $lpszReturnString\n"; my $lpszErrorText = mciGetErrorString($ReturnValue); print "Error: $lpszErrorText\n";

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Win32::MCI::Basic module does not help as I cannot get the syntax for the 'setaudio' command correctly. Either that or it simply does not work.
        The module works. I've used it successfully in the form of Win32::MCI::CD despite the typo.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://369920]
Approved by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found