---
name: "roar_vs_stream"
section: "3"
platform: "linux"
package: "libroar-dev"
version: "1.0~beta12-4"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/roar_vs_stream"
---

# roar\_vs\_stream(3)

Set up stream parameters for VS object

## NAME

roar\_vs\_stream - Set up stream parameters for VS object

## SYNOPSIS

\#include \<roaraudio.h\>

int roar\_vs\_stream(roar\_vs\_t \* vss, const struct roar\_audio\_info \* info, int dir, int \* error);

## DESCRIPTION

This function asks a VS object opened by [**roar\_vs\_new\_from\_con**(3)](/roar_vs_new_from_con/3.md) or [**roar\_vs\_new**(3)](/roar_vs_new/3.md) to open the data connection using the audio parameters **info** and the stream direction **dir**.

This function needs to be called before data is read or written if one of the above functions is used to create the VS object.

This function is also used to provide parameters for the file mode (which is started by using [**roar\_vs\_file**(3)](/roar_vs_file/3.md) or [**roar\_vs\_file\_simple**(3)](/roar_vs_file_simple/3.md)). To play back a file this is not needed in a common case as the VS API tries to find correct parameters. It is required for all other stream directions. See [**roar\_vs\_file**(3)](/roar_vs_file/3.md) and [**roar\_vs\_file\_simple**(3)](/roar_vs_file_simple/3.md) for more information.

On failture this function can be called again with different parameters.

## PARAMETERS

- **vss**

  The VS object to be updated.

- **info**

  This is a pointer to the roar\_audio\_info structure storing the audio format parameters. The structure contains the following members: rate (sample rate), bits (bits per sample), channels (channels per frame) and codec.

- **dir**

  This is the stream direction. Common values include ROAR\_DIR\_PLAY for waveform playback, ROAR\_DIR\_MONITOR for waveform monitoring, ROAR\_DIR\_RECORD for waveform recording. For MIDI ROAR\_DIR\_MIDI\_IN and ROAR\_DIR\_MIDI\_OUT is used.

- **error**

  This is a pointer to a integer used to store the error value in case of error. This can be NULL if not used but it is very recommended to use this error value to report good error messages to the user.

## RETURN VALUE

On success these calls return 0.  On error, -1 is returned.

## EXAMPLES

 struct roar\_audio\_info info;\
  int err;

 if ( roar\_profile2info(&info, "isdn-eu") == -1 ) {\
   // error handling.\
  }

 if ( roar\_vs\_stream(vss, &info, ROAR\_DIR\_PLAY, &err) == -1 ) {\
   // error handling.\
  }

## SEE ALSO

[**roar\_vs\_file**(3)](/roar_vs_file/3.md), [**roar\_vs\_file\_simple**(3)](/roar_vs_file_simple/3.md), [**roarvs**(7)](/roarvs/7.md), [**libroar**(7)](/libroar/7.md), [**RoarAudio**(7)](/RoarAudio/7.md).
