audioGetVolume (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, NX-400

Firmware version:

1.00.00


Retrieves the volume level used by an audio node.

The volume level does not refer to an absolute level and may vary between different device types.

 

Input:

node: SINT Default 0

The audio node to get the volume for.

Available nodes:

Node

Name

0

Microphone

1

Line-out

2

Speaker

 

Output:

volume: SINT

The volume of the node, where 0 is the lowest and 100 is the highest volume.

 

mute: BOOL

Tells if the node is muted or not.

 

 

Returns: INT

0

- Operation was successful.

-2

- Unknown node

 

Declaration:

FUNCTION audioGetVolume : INT;
VAR_INPUT
  node   : SINT := 0;
  volume : ACCESS SINT;
  mute   : ACCESS BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  vol   : SINT;
  muted : BOOL;

END_VAR;
...
BEGIN
  ...
  // Get the volume for Line-out
  IF audioGetVolume(node:=1, volume := vol, mute := muted) = 0 THEN
    IF muted THEN
        DebugFmt(message := "Muted. Volume: \1", v1:= vol);
    ELSE
        DebugFmt(message := "Unmuted. Volume: \1", v1:= vol);
    END_IF;
  END_IF;
  ...
END;
 
END_PROGRAM;