Commit ff554545 authored by Jussi Lindgren's avatar Jussi Lindgren

Everything: Added Channel Units stream

This replaces the previous idea of changing IMatrix.

- Reverted changes to IMatrix, CMatrix etc.
+ Updated global defines header
+ Made Acquisition Client box fail if connection to server cannot be made
+ Enabled multicore building on Windows
parent e05ac193
......@@ -19,7 +19,7 @@ SET(OV_CUSTOM_DEPENDENCIES_PATH "${CMAKE_SOURCE_DIR}/dependencies")
IF(WIN32)
ADD_DEFINITIONS("-DNOMINMAX -DBOOST_ALL_NO_LIB")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4355")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4355 /MP")
SET(OV_WIN32_BOOST_VERSION "1_47")
ELSEIF(UNIX)
# check for c++11 support
......@@ -91,6 +91,7 @@ ENDIF(UNIX)
#SET(SKIP_MODULES_XML "1")
#SET(SKIP_APPLICATIONS_PLATFORM_ACQUISITION-SERVER "1")
#SET(SKIP_APPLICATIONS_PLATFORM_DESIGNER "1")
#SET(SKIP_PLUGINS_PROCESSING_EXAMPLES "1")
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules")
......
......@@ -740,8 +740,8 @@ boolean CAcquisitionServer::connect(IDriver& rDriver, IHeader& rHeaderCopy, uint
ip_pSignalMatrix->setDimensionLabel(0, i, ss.str().c_str());
}
// std::stringstream ss; ss << "Megabolts " << i+1 ;
ip_pSignalMatrix->setDimensionUnit(0, i, OVTK_UNIT_Volts);
ip_pSignalMatrix->setDimensionFactor(0, i, OVTK_FACTOR_Milli);
//ip_pSignalMatrix->setDimensionUnit(0, i, OVTK_UNIT_Volts);
// ip_pSignalMatrix->setDimensionFactor(0, i, OVTK_FACTOR_Milli);
m_rKernelContext.getLogManager() << LogLevel_Trace << "Channel name : " << CString(ip_pSignalMatrix->getDimensionLabel(0, i)) << "\n";
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -276,6 +276,7 @@ boolean CKernelContext::initialize(void)
m_pTypeManager->registerStreamType( OV_TypeId_Stimulations, "Stimulations", OV_TypeId_EBMLStream);
m_pTypeManager->registerStreamType( OV_TypeId_StreamedMatrix, "Streamed matrix", OV_TypeId_EBMLStream);
m_pTypeManager->registerStreamType( OV_TypeId_ChannelLocalisation, "Channel localisation", OV_TypeId_StreamedMatrix);
m_pTypeManager->registerStreamType( OV_TypeId_ChannelUnits, "Channel units", OV_TypeId_StreamedMatrix);
m_pTypeManager->registerStreamType( OV_TypeId_FeatureVector, "Feature vector", OV_TypeId_StreamedMatrix);
m_pTypeManager->registerStreamType( OV_TypeId_Signal, "Signal", OV_TypeId_StreamedMatrix);
m_pTypeManager->registerStreamType( OV_TypeId_Spectrum, "Spectrum", OV_TypeId_StreamedMatrix);
......
......@@ -46,12 +46,6 @@ namespace OpenViBE
virtual const char* getDimensionLabel(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex) const;
virtual const OpenViBE::uint32 getDimensionUnit(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex) const;
virtual const OpenViBE::uint32 getDimensionFactor(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex) const;
virtual const OpenViBE::float64* getBuffer(void) const;
virtual const OpenViBE::uint32 getBufferElementCount(void) const;
......@@ -64,14 +58,6 @@ namespace OpenViBE
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex,
const char* sDimensionLabel);
virtual OpenViBE::boolean setDimensionUnit(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex,
const OpenViBE::uint32 ui32DimensionUnit);
virtual OpenViBE::boolean setDimensionFactor(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex,
const OpenViBE::uint32 ui32DimensionFactor);
virtual OpenViBE::float64* getBuffer(void);
_IsDerivedFromClass_Final_(OpenViBE::IMatrix, OV_ClassId_MatrixBridge);
......
......@@ -50,13 +50,6 @@ namespace OpenViBE
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex) const=0;
virtual const OpenViBE::uint32 getDimensionUnit(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex) const=0;
virtual const OpenViBE::uint32 getDimensionFactor(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex) const=0;
/**
* \brief Gets the raw buffer for this matrix
* \return the raw buffer for this matrix
......@@ -131,16 +124,6 @@ namespace OpenViBE
const OpenViBE::uint32 ui32DimensionEntryIndex,
const char* sDimensionLabel)=0;
virtual OpenViBE::boolean setDimensionUnit(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex,
const OpenViBE::uint32 ui32DimensionUnit)=0;
virtual OpenViBE::boolean setDimensionFactor(
const OpenViBE::uint32 ui32DimensionIndex,
const OpenViBE::uint32 ui32DimensionEntryIndex,
const OpenViBE::uint32 ui32DimensionFactor)=0;
/**
* \brief Gets a writable raw buffer for this matrix
* \return the raw buffer for this matrix
......
......@@ -189,11 +189,12 @@
#define OV_TypeId_ColorGradient OpenViBE::CIdentifier(0x3D3C7C7F, 0xEF0E7129)
#define OV_TypeId_EBMLStream OpenViBE::CIdentifier(0x434F6587, 0x2EFD2B7E)
#define OV_TypeId_ChannelLocalisation OpenViBE::CIdentifier(0x013DF452, 0xA3A8879A)
#define OV_TypeId_ExperimentInformation OpenViBE::CIdentifier(0x403488E7, 0x565D70B6)
#define OV_TypeId_ExperimentationInformation OpenViBE::CIdentifier(0x403488E7, 0x565D70B6) // deprecated, kept for compatibility
#define OV_TypeId_Stimulations OpenViBE::CIdentifier(0x6F752DD0, 0x082A321E)
#define OV_TypeId_StreamedMatrix OpenViBE::CIdentifier(0x544A003E, 0x6DCBA5F6)
#define OV_TypeId_ChannelLocalisation OpenViBE::CIdentifier(0x013DF452, 0xA3A8879A)
#define OV_TypeId_ChannelUnits OpenViBE::CIdentifier(0x6AB26B81, 0x0F8C02F3)
#define OV_TypeId_FeatureVector OpenViBE::CIdentifier(0x17341935, 0x152FF448)
#define OV_TypeId_Signal OpenViBE::CIdentifier(0x5BA36127, 0x195FEAE1)
#define OV_TypeId_Spectrum OpenViBE::CIdentifier(0x1F261C0A, 0x593BF6BD)
......
......@@ -20,16 +20,12 @@ namespace OpenViBE
virtual const uint32 getDimensionCount(void) const;
virtual const uint32 getDimensionSize(const uint32 ui32DimensionIndex) const;
virtual const char* getDimensionLabel(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex) const;
virtual const uint32 getDimensionUnit(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex) const;
virtual const uint32 getDimensionFactor(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex) const;
virtual const float64* getBuffer(void) const;
virtual const uint32 getBufferElementCount(void) const;
virtual boolean setDimensionCount(const uint32 ui32DimensionCount);
virtual boolean setDimensionSize(const uint32 ui32DimensionIndex, const uint32 ui32DimensionSize);
virtual boolean setDimensionLabel(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex, const char* sDimensionLabel);
virtual boolean setDimensionUnit(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex, const uint32 ui32DimensionUnit);
virtual boolean setDimensionFactor(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex, const uint32 ui32DimensionFactor);
virtual float64* getBuffer(void);
_IsDerivedFromClass_Final_(IMatrix, OV_ClassId_MatrixImpl);
......@@ -45,8 +41,6 @@ namespace OpenViBE
std::vector < uint32 > m_vDimensionSize;
std::vector < std::vector < std::string > > m_vDimensionLabel;
std::vector < std::vector < uint32 > > m_vDimensionUnit;
std::vector < std::vector < uint32 > > m_vDimensionFactor;
};
};
};
......@@ -96,33 +90,6 @@ const char* CMatrixImpl::getDimensionLabel(const uint32 ui32DimensionIndex, cons
return m_vDimensionLabel[ui32DimensionIndex][ui32DimensionEntryIndex].c_str();
}
const uint32 CMatrixImpl::getDimensionUnit(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex) const
{
if(ui32DimensionIndex>=m_vDimensionSize.size())
{
return 0; // 0 == undefined in toolkit
}
if(ui32DimensionEntryIndex>=m_vDimensionSize[ui32DimensionIndex])
{
return 0;
}
return m_vDimensionUnit[ui32DimensionIndex][ui32DimensionEntryIndex];
}
const uint32 CMatrixImpl::getDimensionFactor(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex) const
{
if(ui32DimensionIndex>=m_vDimensionSize.size())
{
return 0; // 0 is a code for 1e00 in toolkit
}
if(ui32DimensionEntryIndex>=m_vDimensionSize[ui32DimensionIndex])
{
return 0;
}
return m_vDimensionUnit[ui32DimensionIndex][ui32DimensionEntryIndex];
}
const float64* CMatrixImpl::getBuffer(void) const
{
if(!m_pBuffer)
......@@ -162,9 +129,6 @@ boolean CMatrixImpl::setDimensionCount(const uint32 ui32DimensionCount)
m_vDimensionLabel.clear();
m_vDimensionLabel.resize(ui32DimensionCount);
m_vDimensionUnit.clear();
m_vDimensionUnit.resize(ui32DimensionCount);
return true;
}
......@@ -184,8 +148,6 @@ boolean CMatrixImpl::setDimensionSize(const uint32 ui32DimensionIndex, const uin
m_vDimensionSize[ui32DimensionIndex]=ui32DimensionSize;
m_vDimensionLabel[ui32DimensionIndex].clear();
m_vDimensionLabel[ui32DimensionIndex].resize(ui32DimensionSize);
m_vDimensionUnit[ui32DimensionIndex].clear();
m_vDimensionUnit[ui32DimensionIndex].resize(ui32DimensionSize);
return true;
}
......@@ -203,35 +165,6 @@ boolean CMatrixImpl::setDimensionLabel(const uint32 ui32DimensionIndex, const ui
return true;
}
boolean CMatrixImpl::setDimensionUnit(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex, const uint32 ui32DimensionUnit)
{
if(ui32DimensionIndex>=m_vDimensionSize.size())
{
return false;
}
if(ui32DimensionEntryIndex>=m_vDimensionSize[ui32DimensionIndex])
{
return false;
}
m_vDimensionUnit[ui32DimensionIndex][ui32DimensionEntryIndex]=ui32DimensionUnit;
return true;
}
boolean CMatrixImpl::setDimensionFactor(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex, const uint32 ui32DimensionFactor)
{
if(ui32DimensionIndex>=m_vDimensionSize.size())
{
return false;
}
if(ui32DimensionEntryIndex>=m_vDimensionSize[ui32DimensionIndex])
{
return false;
}
m_vDimensionUnit[ui32DimensionIndex][ui32DimensionEntryIndex]=ui32DimensionFactor;
return true;
}
float64* CMatrixImpl::getBuffer(void)
{
if(!m_pBuffer)
......@@ -303,17 +236,6 @@ const char* CMatrix::getDimensionLabel(const uint32 ui32DimensionIndex, const ui
return m_pMatrixImpl->getDimensionLabel(ui32DimensionIndex, ui32DimensionEntryIndex);
}
const uint32 CMatrix::getDimensionUnit(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex) const
{
return m_pMatrixImpl->getDimensionUnit(ui32DimensionIndex, ui32DimensionEntryIndex);
}
const uint32 CMatrix::getDimensionFactor(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex) const
{
return m_pMatrixImpl->getDimensionUnit(ui32DimensionIndex, ui32DimensionEntryIndex);
}
const float64* CMatrix::getBuffer(void) const
{
return m_pMatrixImpl->getBuffer();
......@@ -339,16 +261,6 @@ boolean CMatrix::setDimensionLabel(const uint32 ui32DimensionIndex, const uint32
return m_pMatrixImpl->setDimensionLabel(ui32DimensionIndex, ui32DimensionEntryIndex, sDimensionLabel);
}
boolean CMatrix::setDimensionUnit(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex, const uint32 ui32DimensionUnit)
{
return m_pMatrixImpl->setDimensionUnit(ui32DimensionIndex, ui32DimensionEntryIndex, ui32DimensionUnit);
}
boolean CMatrix::setDimensionFactor(const uint32 ui32DimensionIndex, const uint32 ui32DimensionEntryIndex, const uint32 ui32DimensionFactor)
{
return m_pMatrixImpl->setDimensionUnit(ui32DimensionIndex, ui32DimensionEntryIndex, ui32DimensionFactor);
}
float64* CMatrix::getBuffer(void)
{
return m_pMatrixImpl->getBuffer();
......
#include "ovpCBoxAlgorithmAcquisitionClient.h"
#include <cstdlib>
#include <openvibe/ovITimeArithmetics.h>
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
......@@ -25,6 +27,7 @@ boolean CBoxAlgorithmAcquisitionClient::initialize(void)
op_pSignalMemoryBuffer.initialize(m_pAcquisitionStreamDecoder->getOutputParameter(OVP_GD_Algorithm_AcquisitionStreamDecoder_OutputParameterId_SignalStream));
op_pStimulationMemoryBuffer.initialize(m_pAcquisitionStreamDecoder->getOutputParameter(OVP_GD_Algorithm_AcquisitionStreamDecoder_OutputParameterId_StimulationStream));
op_pChannelLocalisationMemoryBuffer.initialize(m_pAcquisitionStreamDecoder->getOutputParameter(OVP_GD_Algorithm_AcquisitionStreamDecoder_OutputParameterId_ChannelLocalisationStream));
op_pChannelUnitsMemoryBuffer.initialize(m_pAcquisitionStreamDecoder->getOutputParameter(OVP_GD_Algorithm_AcquisitionStreamDecoder_OutputParameterId_ChannelUnitsStream));
m_ui64LastChunkStartTime=0;
m_ui64LastChunkEndTime=0;
......@@ -42,6 +45,7 @@ boolean CBoxAlgorithmAcquisitionClient::uninitialize(void)
m_pConnectionClient=NULL;
}
op_pChannelUnitsMemoryBuffer.uninitialize();
op_pChannelLocalisationMemoryBuffer.uninitialize();
op_pStimulationMemoryBuffer.uninitialize();
op_pSignalMemoryBuffer.uninitialize();
......@@ -74,8 +78,8 @@ boolean CBoxAlgorithmAcquisitionClient::processClock(IMessageClock& rMessageCloc
m_pConnectionClient->connect(l_sServerName, l_ui32ServerPort);
if(!m_pConnectionClient->isConnected())
{
this->getLogManager() << LogLevel_ImportantWarning << "Could not connect to server " << l_sServerName << ":" << l_ui32ServerPort << "\n";
return true;
this->getLogManager() << LogLevel_Error << "Could not connect to server " << l_sServerName << ":" << l_ui32ServerPort << "\n";
return false;
}
}
......@@ -101,23 +105,24 @@ boolean CBoxAlgorithmAcquisitionClient::process(void)
op_pSignalMemoryBuffer=l_rDynamicBoxContext.getOutputChunk(1);
op_pStimulationMemoryBuffer=l_rDynamicBoxContext.getOutputChunk(2);
op_pChannelLocalisationMemoryBuffer=l_rDynamicBoxContext.getOutputChunk(3);
op_pChannelUnitsMemoryBuffer=l_rDynamicBoxContext.getOutputChunk(4);
while(m_pConnectionClient->isReadyToReceive())
{
uint64 l_ui64MemoryBufferSize=0;
if(!m_pConnectionClient->receiveBufferBlocking(&l_ui64MemoryBufferSize, sizeof(l_ui64MemoryBufferSize)))
{
getLogManager() << LogLevel_ImportantWarning << "Could not receive memory buffer size\n";
getLogManager() << LogLevel_Error << "Could not receive memory buffer size\n";
return false;
}
if(!ip_pAcquisitionMemoryBuffer->setSize(l_ui64MemoryBufferSize, true))
{
getLogManager() << LogLevel_ImportantWarning << "Could not re allocate memory buffer with size " << l_ui64MemoryBufferSize << "\n";
getLogManager() << LogLevel_Error << "Could not re allocate memory buffer with size " << l_ui64MemoryBufferSize << "\n";
return false;
}
if(!m_pConnectionClient->receiveBufferBlocking(ip_pAcquisitionMemoryBuffer->getDirectPointer(), static_cast<uint32>(l_ui64MemoryBufferSize)))
{
getLogManager() << LogLevel_ImportantWarning << "Could not receive memory buffer content of size " << l_ui64MemoryBufferSize << "\n";
getLogManager() << LogLevel_Error << "Could not receive memory buffer content of size " << l_ui64MemoryBufferSize << "\n";
return false;
}
......@@ -131,9 +136,12 @@ boolean CBoxAlgorithmAcquisitionClient::process(void)
l_rDynamicBoxContext.markOutputAsReadyToSend(1, m_ui64LastChunkStartTime, m_ui64LastChunkEndTime);
l_rDynamicBoxContext.markOutputAsReadyToSend(2, m_ui64LastChunkStartTime, m_ui64LastChunkEndTime);
l_rDynamicBoxContext.markOutputAsReadyToSend(3, m_ui64LastChunkStartTime, m_ui64LastChunkEndTime);
l_rDynamicBoxContext.markOutputAsReadyToSend(4, m_ui64LastChunkStartTime, m_ui64LastChunkEndTime);
m_ui64LastChunkStartTime=m_ui64LastChunkEndTime;
m_ui64LastChunkEndTime+=op_ui64BufferDuration;
float64 l_f64Latency=(int64(m_ui64LastChunkEndTime-this->getPlayerContext().getCurrentTime())/(1LL<<22))/1024.;
// @todo ?
// const float64 l_f64Latency=ITimeArithmetics::timeToSeconds(m_ui64LastChunkEndTime)-ITimeArithmetics::timeToSeconds(this->getPlayerContext().getCurrentTime());
const float64 l_f64Latency=(int64(m_ui64LastChunkEndTime-this->getPlayerContext().getCurrentTime())/(1LL<<22))/1024.;
this->getLogManager() << LogLevel_Debug << "Acquisition inner latency : " << l_f64Latency << "\n";
}
}
......
......@@ -35,6 +35,7 @@ namespace OpenViBEPlugins
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pSignalMemoryBuffer;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pStimulationMemoryBuffer;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pChannelLocalisationMemoryBuffer;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pChannelUnitsMemoryBuffer;
Socket::IConnectionClient* m_pConnectionClient;
......@@ -67,6 +68,7 @@ namespace OpenViBEPlugins
rBoxAlgorithmPrototype.addOutput ("Signal strea", OV_TypeId_Signal);
rBoxAlgorithmPrototype.addOutput ("Stimulations", OV_TypeId_Stimulations);
rBoxAlgorithmPrototype.addOutput ("Channel localisation", OV_TypeId_ChannelLocalisation);
rBoxAlgorithmPrototype.addOutput ("Channel units", OV_TypeId_ChannelUnits);
rBoxAlgorithmPrototype.addSetting("Acquisition server hostname", OV_TypeId_String, "${AcquisitionServer_HostName}");
rBoxAlgorithmPrototype.addSetting("Acquisition server port", OV_TypeId_Integer, "1024");
return true;
......
......@@ -25,12 +25,14 @@ boolean CAcquisitionDecoder::initialize(void)
op_pSignalStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_SignalStream));
op_pStimulationStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_StimulationStream));
op_pChannelLocalisationStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_ChannelLocalisationStream));
op_pChannelUnitsStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_ChannelUnitsStream));
return true;
}
boolean CAcquisitionDecoder::uninitialize(void)
{
op_pChannelUnitsStream.uninitialize();
op_pChannelLocalisationStream.uninitialize();
op_pStimulationStream.uninitialize();
op_pSignalStream.uninitialize();
......@@ -56,6 +58,7 @@ EBML::boolean CAcquisitionDecoder::isMasterChild(const EBML::CIdentifier& rIdent
else if(rIdentifier==OVTK_NodeId_Acquisition_Buffer_Signal) return false;
else if(rIdentifier==OVTK_NodeId_Acquisition_Buffer_Stimulation) return false;
else if(rIdentifier==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation) return false;
else if(rIdentifier==OVTK_NodeId_Acquisition_Buffer_ChannelUnits) return false;
return CEBMLBaseDecoder::isMasterChild(rIdentifier);
}
......@@ -73,7 +76,9 @@ void CAcquisitionDecoder::openChild(const EBML::CIdentifier& rIdentifier)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ExperimentInformation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_Signal)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_Stimulation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation))
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelUnits)
)
{
}
else
......@@ -94,7 +99,9 @@ void CAcquisitionDecoder::processChildData(const void* pBuffer, const EBML::uint
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ExperimentInformation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_Signal)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_Stimulation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation))
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelUnits)
)
{
if(l_rTop==OVTK_NodeId_Acquisition_Header_BufferDuration) op_ui64BufferDuration=m_pEBMLReaderHelper->getUIntegerFromChildData(pBuffer, ui64BufferSize);
if(l_rTop==OVTK_NodeId_Acquisition_Header_ExperimentInformation) this->appendMemoryBuffer(op_pExperimentInformationStream, pBuffer, ui64BufferSize);
......@@ -105,6 +112,7 @@ void CAcquisitionDecoder::processChildData(const void* pBuffer, const EBML::uint
if(l_rTop==OVTK_NodeId_Acquisition_Buffer_Signal) this->appendMemoryBuffer(op_pSignalStream, pBuffer, ui64BufferSize);
if(l_rTop==OVTK_NodeId_Acquisition_Buffer_Stimulation) this->appendMemoryBuffer(op_pStimulationStream, pBuffer, ui64BufferSize);
if(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation) this->appendMemoryBuffer(op_pChannelLocalisationStream, pBuffer, ui64BufferSize);
if(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelUnits) this->appendMemoryBuffer(op_pChannelUnitsStream, pBuffer, ui64BufferSize);
}
else
{
......@@ -124,7 +132,9 @@ void CAcquisitionDecoder::closeChild(void)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ExperimentInformation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_Signal)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_Stimulation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation))
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation)
||(l_rTop==OVTK_NodeId_Acquisition_Buffer_ChannelUnits)
)
{
}
else
......
......@@ -35,6 +35,7 @@ namespace OpenViBEPlugins
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pSignalStream;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pStimulationStream;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pChannelLocalisationStream;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMemoryBuffer* > op_pChannelUnitsStream;
private:
......@@ -53,7 +54,7 @@ namespace OpenViBEPlugins
virtual OpenViBE::CString getShortDescription(void) const { return OpenViBE::CString(""); }
virtual OpenViBE::CString getDetailedDescription(void) const { return OpenViBE::CString(""); }
virtual OpenViBE::CString getCategory(void) const { return OpenViBE::CString("Stream codecs/Decoders"); }
virtual OpenViBE::CString getVersion(void) const { return OpenViBE::CString("1.0"); }
virtual OpenViBE::CString getVersion(void) const { return OpenViBE::CString("1.1"); }
virtual OpenViBE::CIdentifier getCreatedClass(void) const { return OVP_ClassId_Algorithm_AcquisitionStreamDecoder; }
virtual OpenViBE::Plugins::IPluginObject* create(void) { return new OpenViBEPlugins::StreamCodecs::CAcquisitionDecoder(); }
......@@ -68,6 +69,7 @@ namespace OpenViBEPlugins
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_SignalStream, "Signal stream", OpenViBE::Kernel::ParameterType_MemoryBuffer);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_StimulationStream, "Stimulation stream", OpenViBE::Kernel::ParameterType_MemoryBuffer);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_ChannelLocalisationStream, "Channel localisation stream", OpenViBE::Kernel::ParameterType_MemoryBuffer);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_AcquisitionStreamDecoder_OutputParameterId_ChannelUnitsStream, "Channel units stream", OpenViBE::Kernel::ParameterType_MemoryBuffer);
return true;
}
......
#include "ovpCChannelUnitsDecoder.h"
#include <system/ovCMemory.h>
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
using namespace OpenViBEPlugins;
using namespace OpenViBEPlugins::StreamCodecs;
// ________________________________________________________________________________________________________________
//
boolean CChannelUnitsDecoder::initialize(void)
{
CStreamedMatrixDecoder::initialize();
op_bDynamic.initialize(getOutputParameter(OVP_Algorithm_ChannelUnitsStreamDecoder_OutputParameterId_Dynamic));
return true;
}
boolean CChannelUnitsDecoder::uninitialize(void)
{
op_bDynamic.uninitialize();
CStreamedMatrixDecoder::uninitialize();
return true;
}
// ________________________________________________________________________________________________________________
//
EBML::boolean CChannelUnitsDecoder::isMasterChild(const EBML::CIdentifier& rIdentifier)
{
if(rIdentifier==OVTK_NodeId_Header_ChannelUnits) { return true; }
else if(rIdentifier==OVTK_NodeId_Header_ChannelUnits_Dynamic) { return false; }
return CStreamedMatrixDecoder::isMasterChild(rIdentifier);
}
void CChannelUnitsDecoder::openChild(const EBML::CIdentifier& rIdentifier)
{
m_vNodes.push(rIdentifier);
EBML::CIdentifier& l_rTop=m_vNodes.top();
if((l_rTop==OVTK_NodeId_Header_ChannelUnits)
||(l_rTop==OVTK_NodeId_Header_ChannelUnits_Dynamic)
)
{
}
else
{
CStreamedMatrixDecoder::openChild(rIdentifier);
}
}
void CChannelUnitsDecoder::processChildData(const void* pBuffer, const EBML::uint64 ui64BufferSize)
{
EBML::CIdentifier& l_rTop=m_vNodes.top();
if((l_rTop==OVTK_NodeId_Header_ChannelUnits)
||(l_rTop==OVTK_NodeId_Header_ChannelUnits_Dynamic)
)
{
if(l_rTop==OVTK_NodeId_Header_ChannelUnits_Dynamic)
{
op_bDynamic=(m_pEBMLReaderHelper->getUIntegerFromChildData(pBuffer, ui64BufferSize)?true:false);
}
//if(l_rTop==OVTK_NodeId_Header_ChannelUnits_MeasurementUnit_Unit) op_pMeasurementUnits->getBuffer()[m_ui32UnitIndex*2 ]=m_pEBMLReaderHelper->getFloatFromChildData(pBuffer, ui64BufferSize);
//if(l_rTop==OVTK_NodeId_Header_ChannelUnits_MeasurementUnit_Factor) op_pMeasurementUnits->getBuffer()[m_ui32UnitIndex*2+1]=m_pEBMLReaderHelper->getFloatFromChildData(pBuffer, ui64BufferSize);
}
else
{
CStreamedMatrixDecoder::processChildData(pBuffer, ui64BufferSize);
}
}
void CChannelUnitsDecoder::closeChild(void)
{
EBML::CIdentifier& l_rTop=m_vNodes.top();
if((l_rTop==OVTK_NodeId_Header_ChannelUnits)
||(l_rTop==OVTK_NodeId_Header_ChannelUnits_Dynamic)
)
{
//if(l_rTop==OVTK_NodeId_Header_ChannelUnits_MeasurementUnit)
//{
// m_ui32UnitIndex++;
//}
}
else
{
CStreamedMatrixDecoder::closeChild();
}
m_vNodes.pop();
}
#ifndef __SamplePlugin_Algorithms_CChannelUnitsDecoder_H__
#define __SamplePlugin_Algorithms_CChannelUnitsDecoder_H__
#include "ovpCStreamedMatrixDecoder.h"
namespace OpenViBEPlugins
{
namespace StreamCodecs
{
class CChannelUnitsDecoder : public OpenViBEPlugins::StreamCodecs::CStreamedMatrixDecoder
{
public:
virtual void release(void) { delete this; }
virtual OpenViBE::boolean initialize(void);
virtual OpenViBE::boolean uninitialize(void);
_IsDerivedFromClass_Final_(OpenViBEPlugins::StreamCodecs::CStreamedMatrixDecoder, OVP_ClassId_Algorithm_ChannelUnitsStreamDecoder);
// ebml callbacks
virtual EBML::boolean isMasterChild(const EBML::CIdentifier& rIdentifier);
virtual void openChild(const EBML::CIdentifier& rIdentifier);
virtual void processChildData(const void* pBuffer, const EBML::uint64 ui64BufferSize);
virtual void closeChild(void);
protected:
OpenViBE::Kernel::TParameterHandler < OpenViBE::boolean > op_bDynamic;
private:
std::stack<EBML::CIdentifier> m_vNodes;
OpenViBE::uint32 m_ui32UnitIndex;
};
class CChannelUnitsDecoderDesc : public OpenViBEPlugins::StreamCodecs::CStreamedMatrixDecoderDesc
{
public:
virtual void release(void) { }
virtual OpenViBE::CString getName(void) const { return OpenViBE::CString("Channel units stream decoder"); }
virtual OpenViBE::CString getAuthorName(void) const { return OpenViBE::CString("Yann Renard"); }
virtual OpenViBE::CString getAuthorCompanyName(void) const { return OpenViBE::CString("INRIA/IRISA"); }
virtual OpenViBE::CString getShortDescription(void) const { return OpenViBE::CString(""); }
virtual OpenViBE::CString getDetailedDescription(void) const { return OpenViBE::CString(""); }
virtual OpenViBE::CString getCategory(void) const { return OpenViBE::CString("Stream codecs/Decoders"); }
virtual OpenViBE::CString getVersion(void) const { return OpenViBE::CString("1.0"); }
virtual OpenViBE::CIdentifier getCreatedClass(void) const { return OVP_ClassId_Algorithm_ChannelUnitsStreamDecoder; }
virtual OpenViBE::Plugins::IPluginObject* create(void) { return new OpenViBEPlugins::StreamCodecs::CChannelUnitsDecoder(); }
virtual OpenViBE::boolean getAlgorithmPrototype(
OpenViBE::Kernel::IAlgorithmProto& rAlgorithmPrototype) const
{
OpenViBEPlugins::StreamCodecs::CStreamedMatrixDecoderDesc::getAlgorithmPrototype(rAlgorithmPrototype);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_ChannelUnitsStreamDecoder_OutputParameterId_Dynamic, "Dynamic", OpenViBE::Kernel::ParameterType_Boolean);
return true;
}
_IsDerivedFromClass_Final_(OpenViBEPlugins::StreamCodecs::CStreamedMatrixDecoderDesc, OVP_ClassId_Algorithm_ChannelUnitsStreamDecoderDesc);
};
};
};
#endif // __SamplePlugin_Algorithms_CChannelUnitsDecoder_H__
......@@ -46,7 +46,6 @@ EBML::boolean CStreamedMatrixDecoder::isMasterChild(const EBML::CIdentifier& rId
else if(rIdentifier==OVTK_NodeId_Header_StreamedMatrix_DimensionCount) return false;
else if(rIdentifier==OVTK_NodeId_Header_StreamedMatrix_Dimension_Size) return false;
else if(rIdentifier==OVTK_NodeId_Header_StreamedMatrix_Dimension_Label) return false;
else if(rIdentifier==OVTK_NodeId_Header_StreamedMatrix_Dimension_Unit) return false;
else if(rIdentifier==OVTK_NodeId_Buffer_StreamedMatrix) return true;
else if(rIdentifier==OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer) return false;
return CEBMLBaseDecoder::isMasterChild(rIdentifier);
......@@ -63,7 +62,6 @@ void CStreamedMatrixDecoder::openChild(const EBML::CIdentifier& rIdentifier)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_DimensionCount)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Size)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Label)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Unit)
||(l_rTop==OVTK_NodeId_Buffer_StreamedMatrix)
||(l_rTop==OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer))
{
......@@ -98,7 +96,6 @@ void CStreamedMatrixDecoder::processChildData(const void* pBuffer, const EBML::u
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_DimensionCount)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Size)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Label)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Unit)
||(l_rTop==OVTK_NodeId_Buffer_StreamedMatrix)
||(l_rTop==OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer))
{
......@@ -117,14 +114,6 @@ void CStreamedMatrixDecoder::processChildData(const void* pBuffer, const EBML::u
{
op_pMatrix->setDimensionLabel(m_ui32DimensionIndex, m_ui32DimensionEntryIndex++, m_pEBMLReaderHelper->getASCIIStringFromChildData(pBuffer, ui64BufferSize));
}
else if(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Unit)
{
op_pMatrix->setDimensionUnit(m_ui32DimensionIndex, m_ui32DimensionEntryIndexUnit++, static_cast<uint32>(m_pEBMLReaderHelper->getUIntegerFromChildData(pBuffer, ui64BufferSize)));
}
else if(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Factor)
{
op_pMatrix->setDimensionFactor(m_ui32DimensionIndex, m_ui32DimensionEntryIndexUnit++, static_cast<uint32>(m_pEBMLReaderHelper->getUIntegerFromChildData(pBuffer, ui64BufferSize)));
}
else
{
// unknown identifier
......@@ -151,7 +140,6 @@ void CStreamedMatrixDecoder::closeChild(void)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_DimensionCount)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Size)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Label)
||(l_rTop==OVTK_NodeId_Header_StreamedMatrix_Dimension_Unit)
||(l_rTop==OVTK_NodeId_Buffer_StreamedMatrix)
||(l_rTop==OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer))
{
......
......@@ -16,12 +16,14 @@ boolean CAcquisitionEncoder::initialize(void)
ip_pSignalStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionStreamEncoder_InputParameterId_SignalStream));
ip_pStimulationStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionStreamEncoder_InputParameterId_StimulationStream));
ip_pChannelLocalisationStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionStreamEncoder_InputParameterId_ChannelLocalisationStream));
ip_pChannelUnitsStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionStreamEncoder_InputParameterId_ChannelUnitsStream));
return true;