signal informations

Making & changing box plugins and external apps
Post Reply
Amélie
Posts: 13
Joined: Wed Nov 24, 2010 3:47 pm

signal informations

Post by Amélie »

Hello all,

I am writing a box whose task is to write a signal from the acquisition client (eventually with some known modifications) and other information channels (text marks) in an smr file.

Is it possible to get informations on the signal (channels number, sampling rate ...) when initializing the box, so before starting the acquisition ?

Thank you,
Amélie

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: signal informations

Post by lbonnet »

Hi Amélie and welcome on board !

You can retrieve all the information you need (channel count, channel name) in the header part of the signal that comes from the acquisition client.

In your box, I assume you have a Signal Decoder, to decode the stream that comes from the acquisition client box.

In the <your-box>.h file it may look like that :

Code: Select all

//the input signal decoder
OpenViBE::Kernel::IAlgorithmProxy* m_pSignalDecoder;
OpenViBE::Kernel::TParameterHandler < const OpenViBE::IMemoryBuffer* > ip_pMemoryBufferToDecode;
OpenViBE::Kernel::TParameterHandler < OpenViBE::uint64 > op_ui64SamplingRate;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMatrix* > op_pDecodedMatrix;
The Stream decoder takes an input memory buffer, and outputs a sampling frequency and a decoded matrix.

One the first call of m_pSignalDecoder->process(), in your <your-box>::process function, the sampling frequency is outputed, and a header is decoded. Check if the signal decoder has decoded a header by checking the related trigger :

Code: Select all

if(m_pSignalDecoder->isOutputTriggerActive(OVP_GD_Algorithm_SignalStreamDecoder_OutputTriggerId_ReceivedHeader))
{
   //matrix information now available !
   //use these information here...
}
At this step, the decoded matrix is empty, but its structure is set.
You can check the matrix dimensions and labels to retrieve the channel count and labels. Look here for the API calls you need.

The structure of the signal stream is explained on this page. The signal stream represents a 2-dimension matrix, channel count and labels on the first dimension.

Hope this helps.

Laurent-
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

Amélie
Posts: 13
Joined: Wed Nov 24, 2010 3:47 pm

Re: signal informations

Post by Amélie »

Hi Laurent,

it was simple and my box works now perfectly.
I did not think these informations would be available at initialization (I wondered when the signal-stream header was receive exactly).

Thank you very much !
Amélie

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: signal informations

Post by lbonnet »

Great ;)

I am curious... what are these smr file you are talking about ?
all I found on the web is something like "Cambridge Electronic Design" file format.

Laurent-
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

Amélie
Posts: 13
Joined: Wed Nov 24, 2010 3:47 pm

Re: signal informations

Post by Amélie »

It is the format of the files generated by the Biomea acquisition system that we use.
Indeed, the only software I know to read this format is provided by Cambridge Electronic Design (Spike2). But I don't know much more about it :roll:

Amélie

Post Reply