Multimedia Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Multimedia Commands >

Multimedia Commands

SVL. - Set Volume

Previous Top Next


MiniRobotLanguage (MRL)

 

SVL. Command

Set the Soundcard/Mixer Volume (OS independent)

 

 

Intention

 

Get/Set the Soundcard/Mixer Master-Volume.

Get/Set the Mute-State of the Master- Volume.

 

Modes of operation:

 

 

1.  Mute Master Volume

SVL.Set Mute|1

 

graphicgraphic

 

These two pictures show the result under XP (left picture) and Windows 7/x64 (right picture).

You will also get an OK on TOS. In case the operation would fail, you will get an error-message on TOS instead, and you will get the timeout-flag set, which is cleared otherwise.

 

graphic

 

 

Now lets go the opposite way and UnMute the sytem.

 

SVL.Set Mute|0

 

 

graphicgraphic

 

And voila' the Sound is back!

 

2.  You can find out, if a system is muted or not.

 

SVL.Get Mute|$$RES

DBP.$$RES

 

If you get a "1" back, the system is muted, otherwise you'll get a "0" in $$RES.

And that means that the system is not muted, sound is ON.

 

 

3. You can get the Master Volume.

 

' Get the Master Volume

SVL.get master volume|$$RES

DBP.$$RES

 

No matter, if its XP or Windows 7, the result is always a number in the range

from 0 to 100. About these numbers, 100 is always the maximum volume, and

0 is total silence.

 

 

4. Set/change the Master Volume:

 

' Set Master Volume to 95 (Range is 0 to 100)

SVL.Set Master Volume|95

 

as always you will get a "OK" on the TOS if the operation succeeds.

 

 

So far, all commands are perfectly transparent between different windows OS.

 

The following commands may show different results between different OS.

 

5.  Find out how many channels we can control:

 

SVL.get channel count|$$RES

DBP.$$RES

ENR.

 

The result may be different between XP and higher Windows versions.

 

For Windows XP, I get the  following Results. This may be slightly different on your actual system, depending on the availability of such Sound-Hardware.

 

Channel 1: Master Volume

Channel 2: Wave Volume

Channel 3: CD Volume

Channel 4: SW Synthesizer

Channel 5: Front Speaker

 

In Vista/Windows 7 and higher you should actually avoid these functions, as the result is unpredictable.

 

 

6. Get Channel Volume

 

' Get Volume from Channel No. 2

SVL.Get Channel Volume|2|$$RES

DBP.$$RES

 

 

7. Set Channel Volume

 

' Set Volume from Channel No. 2

SVL.Set Channel Volume|2|55

DBP.$$000

 

 

8. Get Channel Mute

 

SVL.Get Channel Mute|2|$$RES

DBP.$$RES

 

 

9. Set Channel Mute

 

SVL.Set Channel volume|2|1

DBP.$$RES

 

"1" will Mute the Sound-Channel, while "0" will UnMute the Sound-Channel.

 

 

 

 

 

Syntax

 

 

SVL.P1|P2[|P3][|P4]

 

 

Parameter Explanation

 

P1 - Subcommand - choose any of the following Subcommands. This will specify what to do:

 

"gm","get mute" - use P2 for the Result (Variable)

"sm","set mute" - use P2 for the Value (1 - Mute / 0 - UnMute)

 

"gmv","get master volume" - use P2 for the Result (Variable)

"smv","set master volume" - use P2 for the Volume Value

 

"gc","get channel count" - use P2 for the Return Value (Variable)

 

' Avoid the following Subcommands under Vista and higher OS.

----------------------------------------------------------

"gcv","get channel volume" - use P2 for the channel number and

  P3 for the Return Value (Variable)

 

"scv","set channel volume" - use P2 for the channel number and

  P3 for the Volume Value.

 

"gcm","get channel mute" - use P2 for the channel number and

  P3 for the Return Value (Variable)

 

"scm","set channel mute" - use P2 for the channel number and

  P3 for the Mute State (1 - Mute / 0 - UnMute)

----------------------------------------------------------

 

P2 - (optional) - additional Parameter, depending on the used Subcommand.

P3 - (optional) - additional Parameter, depending on the used Subcommand.

 

 

 

 

Example

 

'***********************************

' Mute Volume-Sample

'***********************************

' Mute the PC

SVL.Set Mute|1

 

' UnMute the PC

SVL.Set Mute|0

END.

 

 

 

Remarks

 

The major functions like "Mute/UnMute", "Set Master Volume" etc. are expected to work transparently on any windows OS. From Windows 2000 to Windows 8. If the operation succeeds, you will find an "OK" on TOS. Otherwise an error message.

 

 

 

 

Limitations:

 

See the comments about which functions to avoid, if using an Vista or higher windows version.

 

 

 

See also:

 

 

    SAY. - Say something

    DIT. - Dial Tone MFV

    MPS. - Music Play Speaker

    MPA. - Music Player

    MPB. - Music Play Background

    MPC. - Music Player Command