Skip to content

Class lsl::stream_outlet

ClassList > lsl > stream_outlet

More...

  • #include <lsl_cpp.h>

Public Functions

Type Name
std::shared_ptr< lsl_outlet_struct_ > handle ()
bool have_consumers ()
stream_info info () const
stream_outlet & operator= (stream_outlet && rhs) noexcept
void push_chunk (const std::vector< T > & samples, double timestamp=0.0, bool pushthrough=true)
void push_chunk (const std::vector< T > & samples, const std::vector< double > & timestamps, bool pushthrough=true)
void push_chunk_multiplexed (const std::vector< T > & buffer, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const std::vector< T > & buffer, const std::vector< double > & timestamps, bool pushthrough=true)
void push_chunk_multiplexed (const float * buffer, std::size_t buffer_elements, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const double * buffer, std::size_t buffer_elements, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const int64_t * buffer, std::size_t buffer_elements, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const int32_t * buffer, std::size_t buffer_elements, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const int16_t * buffer, std::size_t buffer_elements, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const char * buffer, std::size_t buffer_elements, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const std::string * buffer, std::size_t buffer_elements, double timestamp=0.0, bool pushthrough=true)
void push_chunk_multiplexed (const float * data_buffer, const double * timestamp_buffer, std::size_t data_buffer_elements, bool pushthrough=true)
void push_chunk_multiplexed (const double * data_buffer, const double * timestamp_buffer, std::size_t data_buffer_elements, bool pushthrough=true)
void push_chunk_multiplexed (const int64_t * data_buffer, const double * timestamp_buffer, std::size_t data_buffer_elements, bool pushthrough=true)
void push_chunk_multiplexed (const int32_t * data_buffer, const double * timestamp_buffer, std::size_t data_buffer_elements, bool pushthrough=true)
void push_chunk_multiplexed (const int16_t * data_buffer, const double * timestamp_buffer, std::size_t data_buffer_elements, bool pushthrough=true)
void push_chunk_multiplexed (const char * data_buffer, const double * timestamp_buffer, std::size_t data_buffer_elements, bool pushthrough=true)
void push_chunk_multiplexed (const std::string * data_buffer, const double * timestamp_buffer, std::size_t data_buffer_elements, bool pushthrough=true)
void push_chunk_numeric_structs (const std::vector< T > & samples, double timestamp=0.0, bool pushthrough=true)
void push_chunk_numeric_structs (const std::vector< T > & samples, const std::vector< double > & timestamps, bool pushthrough=true)
void push_numeric_raw (const void * sample, double timestamp=0.0, bool pushthrough=true)
void push_numeric_struct (const T & sample, double timestamp=0.0, bool pushthrough=true)
void push_sample (const T data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const std::vector< T > & data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const float * data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const double * data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const int64_t * data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const int32_t * data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const int16_t * data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const char * data, double timestamp=0.0, bool pushthrough=true)
void push_sample (const std::string * data, double timestamp=0.0, bool pushthrough=true)
stream_outlet (stream_outlet && res) noexcept
stream_outlet move constructor
stream_outlet (const stream_info & info, int32_t chunk_size=0, int32_t max_buffered=360, lsl_transport_options_t flags=transp_default)
bool wait_for_consumers (double timeout)
~stream_outlet () = default

Detailed Description

A stream outlet. Outlets are used to make streaming data (and the meta-data) available on the lab network.

Public Functions Documentation

function handle

inline std::shared_ptr< lsl_outlet_struct_ > lsl::stream_outlet::handle () 

Return a shared pointer to pass to C-API functions that aren't wrapped yet

Example:

lsl_push_chunk_buft(outlet.handle().get(), data, ); 


function have_consumers

inline bool lsl::stream_outlet::have_consumers () 

Check whether consumers are currently registered. While it does not hurt, there is technically no reason to push samples if there is no consumer.


function info

inline stream_info lsl::stream_outlet::info () const

Retrieve the stream info provided by this outlet. This is what was used to create the stream (and also has the Additional Network Information fields assigned).


function operator=

stream_outlet & lsl::stream_outlet::operator= (
    stream_outlet && rhs
) noexcept

function push_chunk [1/2]

template<class T>
inline void lsl::stream_outlet::push_chunk (
    const std::vector< T > & samples,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a chunk of samples (batched into an STL vector) into the outlet.

Parameters:

  • samples A vector of samples in some supported format (each sample can be a data pointer, data array, or std vector of data).
  • timestamp Optionally the capture time of the most recent sample, in agreement with local_clock(); if omitted, the current time is used. The time stamps of other samples are automatically derived according to the sampling rate of the stream.
  • pushthrough Whether to push the chunk through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_chunk [2/2]

template<class T>
inline void lsl::stream_outlet::push_chunk (
    const std::vector< T > & samples,
    const std::vector< double > & timestamps,
    bool pushthrough=true
) 

Push a chunk of samples (batched into an STL vector) into the outlet. Allows to specify a separate time stamp for each sample (for irregular-rate streams).

Parameters:

  • samples A vector of samples in some supported format (each sample can be a data pointer, data array, or std vector of data).
  • timestamps A vector of capture times for each sample, in agreement with local_clock().
  • pushthrough Whether to push the chunk through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_chunk_multiplexed [1/16]

template<typename T>
inline void lsl::stream_outlet::push_chunk_multiplexed (
    const std::vector< T > & buffer,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_chunk_multiplexed [2/16]

template<typename T>
inline void lsl::stream_outlet::push_chunk_multiplexed (
    const std::vector< T > & buffer,
    const std::vector< double > & timestamps,
    bool pushthrough=true
) 

Push a chunk of multiplexed data into the outlet. One timestamp per sample is provided. Allows to specify a separate time stamp for each sample (for irregular-rate streams).

Parameters:

  • buffer A buffer of channel values holding the data for zero or more successive samples to send.
  • timestamps A buffer of timestamp values holding time stamps for each sample in the data buffer.
  • pushthrough Whether to push the chunk through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_chunk_multiplexed [3/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const float * buffer,
    std::size_t buffer_elements,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a chunk of multiplexed samples into the outlet. Single timestamp provided.

Warning:

The provided buffer size is measured in channel values (e.g., floats), not samples.

Parameters:

  • buffer A buffer of channel values holding the data for zero or more successive samples to send.
  • buffer_elements The number of channel values (of type T) in the buffer. Must be a multiple of the channel count.
  • timestamp Optionally the capture time of the most recent sample, in agreement with local_clock(); if omitted, the current time is used. The time stamps of other samples are automatically derived based on the sampling rate of the stream.
  • pushthrough Whether to push the chunk through to the receivers instead of buffering it with subsequent samples. Note that the stream_outlet() constructur parameter chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_chunk_multiplexed [4/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const double * buffer,
    std::size_t buffer_elements,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_chunk_multiplexed [5/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const int64_t * buffer,
    std::size_t buffer_elements,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_chunk_multiplexed [6/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const int32_t * buffer,
    std::size_t buffer_elements,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_chunk_multiplexed [7/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const int16_t * buffer,
    std::size_t buffer_elements,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_chunk_multiplexed [8/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const char * buffer,
    std::size_t buffer_elements,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_chunk_multiplexed [9/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const std::string * buffer,
    std::size_t buffer_elements,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_chunk_multiplexed [10/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const float * data_buffer,
    const double * timestamp_buffer,
    std::size_t data_buffer_elements,
    bool pushthrough=true
) 

Push a chunk of multiplexed samples into the outlet. One timestamp per sample is provided.

Warning:

Note that the provided buffer size is measured in channel values (e.g., floats) rather than in samples.

Parameters:

  • data_buffer A buffer of channel values holding the data for zero or more successive samples to send.
  • timestamp_buffer A buffer of timestamp values holding time stamps for each sample in the data buffer.
  • data_buffer_elements The number of data values (of type T) in the data buffer. Must be a multiple of the channel count.
  • pushthrough Whether to push the chunk through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_chunk_multiplexed [11/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const double * data_buffer,
    const double * timestamp_buffer,
    std::size_t data_buffer_elements,
    bool pushthrough=true
) 

function push_chunk_multiplexed [12/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const int64_t * data_buffer,
    const double * timestamp_buffer,
    std::size_t data_buffer_elements,
    bool pushthrough=true
) 

function push_chunk_multiplexed [13/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const int32_t * data_buffer,
    const double * timestamp_buffer,
    std::size_t data_buffer_elements,
    bool pushthrough=true
) 

function push_chunk_multiplexed [14/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const int16_t * data_buffer,
    const double * timestamp_buffer,
    std::size_t data_buffer_elements,
    bool pushthrough=true
) 

function push_chunk_multiplexed [15/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const char * data_buffer,
    const double * timestamp_buffer,
    std::size_t data_buffer_elements,
    bool pushthrough=true
) 

function push_chunk_multiplexed [16/16]

inline void lsl::stream_outlet::push_chunk_multiplexed (
    const std::string * data_buffer,
    const double * timestamp_buffer,
    std::size_t data_buffer_elements,
    bool pushthrough=true
) 

function push_chunk_numeric_structs [1/2]

template<class T>
inline void lsl::stream_outlet::push_chunk_numeric_structs (
    const std::vector< T > & samples,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a chunk of numeric data as C-style structs (batched into an STL vector) into the outlet. This performs some size checking but no type checking. Can not be used for variable-size / string-formatted data.

Parameters:

  • samples A vector of samples, as C structs.
  • timestamp Optionally the capture time of the sample, in agreement with local_clock(); if omitted, the current time is used.
  • pushthrough Whether to push the chunk through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_chunk_numeric_structs [2/2]

template<class T>
inline void lsl::stream_outlet::push_chunk_numeric_structs (
    const std::vector< T > & samples,
    const std::vector< double > & timestamps,
    bool pushthrough=true
) 

Push a chunk of numeric data from C-style structs (batched into an STL vector), into the outlet. This performs some size checking but no type checking. Can not be used for variable-size / string-formatted data.

Parameters:

  • samples A vector of samples, as C structs.
  • timestamps A vector of capture times for each sample, in agreement with local_clock().
  • pushthrough Whether to push the chunk through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_numeric_raw

inline void lsl::stream_outlet::push_numeric_raw (
    const void * sample,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a pointer to raw numeric data as one sample into the outlet. This is the lowest-level function; performs no checking whatsoever. Cannot be used for variable-size / string-formatted channels.

Parameters:

  • sample A pointer to the raw sample data to push.
  • timestamp Optionally the capture time of the sample, in agreement with local_clock(); if omitted, the current time is used.
  • pushthrough Whether to push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_numeric_struct

template<class T>
inline void lsl::stream_outlet::push_numeric_struct (
    const T & sample,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a packed C struct (of numeric data) as one sample into the outlet (search for #``pragma pack for information on packing structs appropriately). Overall size checking but no type checking or conversion are done. Can not be used forvariable-size / string-formatted data.

Parameters:

  • sample The sample struct to push.
  • timestamp Optionally the capture time of the sample, in agreement with local_clock(); if omitted, the current time is used.
  • pushthrough Whether to push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_sample [1/9]

template<class T, int32_t N>
inline void lsl::stream_outlet::push_sample (
    const T data,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a C array of values as a sample into the outlet. Each entry in the array corresponds to one channel. The function handles type checking & conversion.

Parameters:

  • data An array of values to push (one per channel).
  • timestamp Optionally the capture time of the sample, in agreement with lsl::local_clock(); if omitted, the current time is used.
  • pushthrough Whether to push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_sample [2/9]

template<typename T>
inline void lsl::stream_outlet::push_sample (
    const std::vector< T > & data,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a std vector of values as a sample into the outlet. Each entry in the vector corresponds to one channel. The function handles type checking & conversion.

Parameters:

  • data A vector of values to push (one for each channel).
  • timestamp Optionally the capture time of the sample, in agreement with local_clock(); if omitted, the current time is used.
  • pushthrough Whether to push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_sample [3/9]

inline void lsl::stream_outlet::push_sample (
    const float * data,
    double timestamp=0.0,
    bool pushthrough=true
) 

Push a pointer to some values as a sample into the outlet. This is a lower-level function for cases where data is available in some buffer. Handles type checking & conversion.

Parameters:

  • data A pointer to values to push. The number of values pointed to must not be less than the number of channels in the sample.
  • timestamp Optionally the capture time of the sample, in agreement with local_clock(); if omitted, the current time is used.
  • pushthrough Whether to push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

function push_sample [4/9]

inline void lsl::stream_outlet::push_sample (
    const double * data,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_sample [5/9]

inline void lsl::stream_outlet::push_sample (
    const int64_t * data,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_sample [6/9]

inline void lsl::stream_outlet::push_sample (
    const int32_t * data,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_sample [7/9]

inline void lsl::stream_outlet::push_sample (
    const int16_t * data,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_sample [8/9]

inline void lsl::stream_outlet::push_sample (
    const char * data,
    double timestamp=0.0,
    bool pushthrough=true
) 

function push_sample [9/9]

inline void lsl::stream_outlet::push_sample (
    const std::string * data,
    double timestamp=0.0,
    bool pushthrough=true
) 

function stream_outlet [1/3]

stream_outlet move constructor

lsl::stream_outlet::stream_outlet (
    stream_outlet && res
) noexcept


function stream_outlet [3/3]

inline lsl::stream_outlet::stream_outlet (
    const stream_info & info,
    int32_t chunk_size=0,
    int32_t max_buffered=360,
    lsl_transport_options_t flags=transp_default
) 

Establish a new stream outlet. This makes the stream discoverable.

Parameters:

  • info The stream information to use for creating this stream. Stays constant over the lifetime of the outlet.
  • chunk_size Optionally the desired chunk granularity (in samples) for transmission. If unspecified, each push operation yields one chunk. Inlets can override this setting.
  • max_buffered Optionally the maximum amount of data to buffer (in seconds if there is a nominal sampling rate, otherwise x100 in samples). The default is 6 minutes of data.

function wait_for_consumers

inline bool lsl::stream_outlet::wait_for_consumers (
    double timeout
) 

Wait until some consumer shows up (without wasting resources).

Returns:

True if the wait was successful, false if the timeout expired.


function ~stream_outlet

lsl::stream_outlet::~stream_outlet () = default

Destructor. The stream will no longer be discoverable after destruction and all paired inlets will stop delivering data.



The documentation for this class was generated from the following file liblsl/include/lsl_cpp.h