output_file_t represents one XDF output file.
More...
|
| output_file_t (const std::string &prefix, bool use_date) |
| Constructor. More...
|
|
void | initialize_stream (uint32_t stream_id, const std::string &varname, const std::string &channel_format, unsigned num_channels, double sampling_rate=0) |
| Initialize stream. More...
|
|
template<typename T = double> |
void | write (uint32_t stream_id, const T *buf, std::size_t frames, std::size_t channels) |
| Write data chunk to the stream with id stream_id. More...
|
|
void | close_stream (uint32_t stream_id) |
| Close stream with id stream_id by writing stream footer. More...
|
|
|
std::mutex | write_lock |
| Mutex to protect write access to the output file. More...
|
|
std::unique_ptr< XDFWriter > | outfile |
| XDFWriter. Handles the translation into the xdf format and disk writes. More...
|
|
output_file_t represents one XDF output file.
It wraps around the XDFWriter class, which handles the conversion of a stream into the bits and bytes on disk. Access to the output file protected by a lock. There's usually one output file per plugin instance shared by all acwriters.
◆ output_file_t()
ac2xdf::output_file_t::output_file_t |
( |
const std::string & |
prefix, |
|
|
bool |
use_date |
|
) |
| |
Constructor.
- Parameters
-
prefix | Path and start of output file name. Will be extended with file name extension ".xdf". |
use_date | When true, the current date and time will be appended to the output file name before the file name extension. |
◆ initialize_stream()
void ac2xdf::output_file_t::initialize_stream |
( |
uint32_t |
stream_id, |
|
|
const std::string & |
varname, |
|
|
const std::string & |
channel_format, |
|
|
unsigned |
num_channels, |
|
|
double |
sampling_rate = 0 |
|
) |
| |
Initialize stream.
Writes a minimal stream header and a boundary chunk
- Parameters
-
stream_id | Numerical stream id. |
varname | Human-readable stream id. Gets saved as stream name in metadata |
channel_format | Data type of the stream, gets written into the channel_format metadata. must be one of {"int8", "int16", "int32", "int64","float32" ,"double64" , "string"} |
num_channels | Number of channels in stream to be written in metadata |
sampling_rate | Nominal sampling rate in Hz. To be written in metadata. Zero means irregular rate |
◆ write()
template<typename T >
template void ac2xdf::output_file_t::write< mha_real_t > |
( |
uint32_t |
stream_id, |
|
|
const T * |
buf, |
|
|
std::size_t |
frames, |
|
|
std::size_t |
channels |
|
) |
| |
Write data chunk to the stream with id stream_id.
- Parameters
-
stream_id | The stream id. |
buf | Pointer to buffer containing frames entries. The caller retains ownership of buf. |
Pointer | to buffer containing frames * channels values. Interleaved storage: The first channels values in memory contain the values of the first frame, etc. The caller retains ownership of buf. |
frames | Number of entries per channel in buf. |
channels | Number of channels in buf. |
◆ close_stream()
void ac2xdf::output_file_t::close_stream |
( |
uint32_t |
stream_id | ) |
|
Close stream with id stream_id by writing stream footer.
- Parameters
-
stream_id | Numeric ID of the stream to be closed |
◆ write_lock
std::mutex ac2xdf::output_file_t::write_lock |
|
private |
Mutex to protect write access to the output file.
◆ outfile
std::unique_ptr<XDFWriter> ac2xdf::output_file_t::outfile |
|
private |
XDFWriter. Handles the translation into the xdf format and disk writes.
The documentation for this class was generated from the following files: