I am having problems with getting the sampling frequency. I am working on the CBoxAlgorithmErpPlot class/box.
I have a box with several inputs of type: streamed matrix. For each one of them I have a decoder in m_vDecoders:
the sampling rate is passed in the header chunk of a signal stream, so you won't have a frequency before the header chunk has been decoded. Matrix streams do not have a sampling rate at all, and the decoder should not even have such a getter. You'd need
Yes, but the inputs of the box are "Streamed Matrix", so I can not use the code that is for Signal inputs.
Can I get the frequency from another box and send it to my box somehow? Otherwise the frequency must be always hard-coded in the box, which is not nice.
If you have a signal stream, why not upgrade the box to support signal inputs? Or, if you have matrixes but with
a known sampling rate, it sounds like you lost the sampling frequency somehow along the way, otherwise you'd
still have a signal stream. One option would be to develop a box that upgrades a matrix to a signal, getting the sampling
rate from somewhere (where?) but we don't have one at the moment.
Alternatively, if the matrix stream is continuous, you can guess the sampling rate from the chunk timestamps and
the matrix size. See Signal Display box code for an example calculation.