audioRoute (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, NX-400, NX-900, NX-910

Firmware version:

1.10.00


Controls the routing of the audio between capture devices and playback devices.

 

Instead of using gsmHeadset to route audio between GSM and the analog audio in- and outputs, this function can be used for more advanced routing.

It controls a single direction at a time, so to have audio running in both directions, it must be called twice.

It is currently possible to have 3 routes active at the same time, each using a unique route ID.

Note: gsmHeadset uses two routes when enabled, reducing the total number of available routes.

 

The possible devices are:

Device ID

Name

Capture

Playback

0

Speaker/Line out

No

Yes

1

GSM output (Audio sent to the GSM device)

No

Yes

2

GSM input (Audio from the GSM device)

Yes

No

3

Microphone

Yes

No

10..19

Extension module audio streams

Yes*

Yes*

*: Extension module streams may support Capture, Playback or both. See the RTCU M2M Platform SDK Reference Manual for more details.

 

 

 

Input:

id: INT (1..3) Default 1

The ID of the route to control. This is not related to the Device ID.

 

src: INT

The capture device to read from .

See Device ID table.

 

dest: INT

The playback device to write to.

See Device ID table.

 

enable: BOOL default TRUE

Set to TRUE to enable the route, set to FALSE to disable the route.

 

 

Returns: INT

0

- Operation was successful.

-1

- Invalid route ID

-2

- Route is in use.

-3

- Invalid device.

-4

- Device is already in use.

-5

- No available route could be found.

-6

- Failed to start route.

-7

- Device can not be used in this direction.

 

Declaration:

FUNCTION audioRoute : INT;
VAR_INPUT
  id     : INT := 1;
  src    : INT;
  dest   : INT;
  enable : BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc    : INT;

END_VAR;
...
// Create route from GSM to Speaker
rc := audioRoute(id:=1, src := 2, dest := 0);
DebugFmt(message := "GSM => SPK: \1", v1:= rc);
 
// Create route from Microphone to GSM
rc := audioRoute(id:=2, src := 3, dest := 1);
DebugFmt(message := "MIC => GSM: \1", v1:= rc);
...
BEGIN
  ...
END;
 
END_PROGRAM;