OutputHandler.hpp

template<unsigned MIC_COUNT>
class mic_array::ChannelSampleTransmitter

OutputHandler which transmits samples over a channel.

This class is intended to be used as an OutputHandler with the MicArray class.

With this class, each call to ProcessSample() attempts to send the sample over a channel. The receiver must know how many channels to expect and should waiting to receive the sample before ProcessSample() is called on this object.

A sample is a vector quantity which corresponds to a single time step and containing one element per audio channel.

Template Parameters

MIC_COUNT – Number of channels in a sample.

Public Functions

inline ChannelSampleTransmitter()

Construct a ChannelSampleTransmitter.

inline ChannelSampleTransmitter(chanend_t c_sample_out)

Construct a ChannelSampleTransmitter.

Parameters

c_sample_out – Channel for sending samples.

void SetChannel(chanend_t c_sample_out)

Set the channel used for sending samples.

Parameters

c_sample_out – Channel for sending samples.

void ProcessSample(int32_t sample[MIC_COUNT])

Transmit the specified sample.

Parameters

sample – Sample to be transmitted.

template<unsigned MIC_COUNT, unsigned SAMPLE_COUNT>
class mic_array::ChannelFrameTransmitter

Frame transmitter which transmits frame over a channel.

When using this frame transmitter, frames are transmitted over a channel using the frame transfer API in mic_array/frame_transfer.h.

Usually, a call to ma_frame_rx_s32() (with the other end of c_frame_out as argument) should be used to receive the frame on another thread.

Frames can be transmitted between tiles using this class.

Template Parameters
  • MIC_COUNT – Number of audio channels in each frame.

  • SAMPLE_COUNT – Number of samples per frame.

Public Functions

inline ChannelFrameTransmitter()

Construct a ChannelFrameTransmitter.

If this constructor is used, SetChannel() must be used to configure the channel over which frames are transmitted prior to any calls to OutputFrame().

inline ChannelFrameTransmitter(chanend_t c_frame_out)

Construct a ChannelFrameTransmitter.

Parameters

c_frame_out – Channel over which frames are transmitted.

void SetChannel(chanend_t c_frame_out)

Set channel used for frame transfers.

Parameters

c_frame_out – Channel to be used for frame transfers.

chanend_t GetChannel()

Get channel used for frame transfers.

Returns

Channel to be used for frame transfers.

void OutputFrame(int32_t frame[MIC_COUNT][SAMPLE_COUNT])

Transmit the specified frame.

Parameters

frame – Frame to be transmitted.