libASPL
Loading...
Searching...
No Matches
aspl::IORequestHandler Class Reference

Handler for I/O requests to device. More...

#include <aspl/IORequestHandler.hpp>

Public Member Functions

 IORequestHandler (const IORequestHandler &)=delete
 
IORequestHandleroperator= (const IORequestHandler &)=delete
 
Reading per-client samples from device
virtual void OnReadClientInput (const std::shared_ptr< Client > &client, const std::shared_ptr< Stream > &stream, Float64 zeroTimestamp, Float64 timestamp, void *bytes, UInt32 bytesCount)
 Read data from device to client.
 
virtual void OnProcessClientInput (const std::shared_ptr< Client > &client, const std::shared_ptr< Stream > &stream, Float64 zeroTimestamp, Float64 timestamp, Float32 *frames, UInt32 frameCount, UInt32 channelCount)
 Process data returned by ReadClientInput() before passing it to client.
 
Writing per-client samples to device
virtual void OnProcessClientOutput (const std::shared_ptr< Client > &client, const std::shared_ptr< Stream > &stream, Float64 zeroTimestamp, Float64 timestamp, Float32 *frames, UInt32 frameCount, UInt32 channelCount)
 Process data from client before passing it to WriteClientOutput().
 
virtual void OnWriteClientOutput (const std::shared_ptr< Client > &client, const std::shared_ptr< Stream > &stream, Float64 zeroTimestamp, Float64 timestamp, const Float32 *frames, UInt32 frameCount, UInt32 channelCount)
 Write data from client to device.
 
Writing mixed samples to device
virtual void OnProcessMixedOutput (const std::shared_ptr< Stream > &stream, Float64 zeroTimestamp, Float64 timestamp, Float32 *frames, UInt32 frameCount, UInt32 channelCount)
 Process data from client before passing it to WriteMixedOutput().
 
virtual void OnWriteMixedOutput (const std::shared_ptr< Stream > &stream, Float64 zeroTimestamp, Float64 timestamp, const void *bytes, UInt32 bytesCount)
 Write mixed data from all clients to device.
 

Detailed Description

Handler for I/O requests to device.

Device invokes methods of this class when HAL requests it to perform I/O operations. All actual I/O happens here.

What methods are invoked depends on whether the device has input and output streams and what is the value of DeviceParameters::EnableMixing.

All methods of this class are invoked on realtime thread and thus they should not call blocking operations.

It's safe to invoke any GetXXX() and ApplyProcessing() method. It's not safe to invoke any SetXXX() and AddXXX() method and any other method that is modifying object's state.

Definition at line 33 of file IORequestHandler.hpp.

Member Function Documentation

◆ OnProcessClientInput()

virtual void aspl::IORequestHandler::OnProcessClientInput ( const std::shared_ptr< Client > & client,
const std::shared_ptr< Stream > & stream,
Float64 zeroTimestamp,
Float64 timestamp,
Float32 * frames,
UInt32 frameCount,
UInt32 channelCount )
inlinevirtual

Process data returned by ReadClientInput() before passing it to client.

Invoked by Device::DoIOOperation() on realtime thread.

Should modify the passed frames according to per-client or per-stream processing rules.

The samples are in canonical format, i.e. native endian 32-bit interleaved floats.

The provided buffer contains exactly frameCount * channelCount samples.

Default implementation just invokes Stream::ApplyProcessing().

Definition at line 83 of file IORequestHandler.hpp.

◆ OnProcessClientOutput()

virtual void aspl::IORequestHandler::OnProcessClientOutput ( const std::shared_ptr< Client > & client,
const std::shared_ptr< Stream > & stream,
Float64 zeroTimestamp,
Float64 timestamp,
Float32 * frames,
UInt32 frameCount,
UInt32 channelCount )
inlinevirtual

Process data from client before passing it to WriteClientOutput().

Invoked by Device::DoIOOperation() on realtime thread.

Should modify the passed samples according to per-client or per-stream processing rules.

The samples are in canonical format, i.e. native endian 32-bit interleaved floats.

The provided buffer contains exactly frameCount * channelCount samples.

Default implementation just invokes Stream::ApplyProcessing().

Definition at line 112 of file IORequestHandler.hpp.

◆ OnProcessMixedOutput()

virtual void aspl::IORequestHandler::OnProcessMixedOutput ( const std::shared_ptr< Stream > & stream,
Float64 zeroTimestamp,
Float64 timestamp,
Float32 * frames,
UInt32 frameCount,
UInt32 channelCount )
inlinevirtual

Process data from client before passing it to WriteMixedOutput().

Invoked by Device::DoIOOperation() on realtime thread.

Should modify the passed samples according to per-client or per-stream processing rules.

The samples are in canonical format, i.e. native endian 32-bit interleaved floats.

The provided buffer contains exactly frameCount * channelCount samples.

Default implementation just invokes Stream::ApplyProcessing().

Definition at line 166 of file IORequestHandler.hpp.

◆ OnReadClientInput()

virtual void aspl::IORequestHandler::OnReadClientInput ( const std::shared_ptr< Client > & client,
const std::shared_ptr< Stream > & stream,
Float64 zeroTimestamp,
Float64 timestamp,
void * bytes,
UInt32 bytesCount )
inlinevirtual

Read data from device to client.

Invoked by Device::DoIOOperation() on realtime thread.

Should fill the destination buffer with the requested number of bytes with data from device's stream, at given offset (timestamp).

The output data should be in device's stream native format.

Provided with the current current zero timestamp (last value returned by GetZeroTimestamp()), and requested timestamp (offset of the data). Both timestamps are measured in number of frames.

Default implementation fills buffer with zeros.

Definition at line 60 of file IORequestHandler.hpp.

◆ OnWriteClientOutput()

virtual void aspl::IORequestHandler::OnWriteClientOutput ( const std::shared_ptr< Client > & client,
const std::shared_ptr< Stream > & stream,
Float64 zeroTimestamp,
Float64 timestamp,
const Float32 * frames,
UInt32 frameCount,
UInt32 channelCount )
inlinevirtual

Write data from client to device.

Invoked by Device::DoIOOperation() on realtime thread. Used only if DeviceParameters::EnableMixing is false.

Should read the requested number of bytes from the provided buffer and mix them into device at given offset (timestamp).

The input data is already in device's stream native format.

Provided with the current current zero timestamp (last value returned by GetZeroTimestamp()), and requested timestamp (offset of the data). Both timestamps are measured in number of frames.

Default implementation does nothing.

Definition at line 138 of file IORequestHandler.hpp.

◆ OnWriteMixedOutput()

virtual void aspl::IORequestHandler::OnWriteMixedOutput ( const std::shared_ptr< Stream > & stream,
Float64 zeroTimestamp,
Float64 timestamp,
const void * bytes,
UInt32 bytesCount )
inlinevirtual

Write mixed data from all clients to device.

Invoked by Device::DoIOOperation() on realtime thread. Used only if DeviceParameters::EnableMixing is true.

Should read the requested number of bytes from the provided buffer and write them into device at given offset (timestamp).

The input data is already in device's stream native format.

Provided with the current current zero timestamp (last value returned by GetZeroTimestamp()), and requested timestamp (offset of the data). Both timestamps are measured in number of frames.

Default implementation does nothing.

Definition at line 191 of file IORequestHandler.hpp.


The documentation for this class was generated from the following file: