This commit is contained in:
2021-10-14 13:47:35 +02:00
commit 6625a8dfaa
4026 changed files with 844291 additions and 0 deletions
@@ -0,0 +1,35 @@
PROJECT(openvibe-plugins-data-generation)
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
SET(PROJECT_VERSION ${OV_GLOBAL_VERSION_STRING})
FILE(GLOB_RECURSE SRC_FILES src/*.cpp src/*.h src/*.inl)
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRC_FILES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
FOLDER ${PLUGINS_FOLDER}
COMPILE_FLAGS "-DOVP_Exports -DOVP_Shared")
INCLUDE("FindOpenViBE")
INCLUDE("FindOpenViBECommon")
INCLUDE("FindOpenViBEToolkit")
INCLUDE("FindOpenViBEModuleEBML")
INCLUDE("FindOpenViBEModuleSystem")
INCLUDE("FindOpenViBEModuleXML")
# ---------------------------------
# ---------------------------------
# -----------------------------
# Install files
# -----------------------------
INSTALL(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${DIST_BINDIR}
LIBRARY DESTINATION ${DIST_LIBDIR}
ARCHIVE DESTINATION ${DIST_LIBDIR})
@@ -0,0 +1,58 @@
/**
* \page BoxAlgorithm_NoiseGenerator Noise generator
__________________________________________________________________
Detailed description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Description|
* The Noise Generator outputs random signals with a configurable number of channels. The sampling frequency and epoch size can be configured as well. The data is sampled from a pseudorandom distribution.
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Description|
__________________________________________________________________
Outputs description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Outputs|
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Outputs|
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Output1|
* Random signal generated.
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Output1|
__________________________________________________________________
Settings description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Settings|
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Settings|
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Setting1|
* Number of channels generated.
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Setting1|
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Setting2|
* Sampling frequency of generated signals.
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Setting2|
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Setting3|
* Number of samples per epoch
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Setting3|
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Setting4|
* Noise type (used distribution)
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Setting4|
__________________________________________________________________
Miscellaneous description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_NoiseGenerator_Miscellaneous|
* Uniform noise is drawn from the range \f$ ( 0,1 ( \f$. Gaussian noise has parameters
* mean = 0, variance = 1.0. You can effectively change these parameters by using
* the Simple DSP box on the resulting stream. For example, the mean and variance of
* the resulting \f$ x \f$ from the Gaussian generator can be changed
* by a formula like \f$ x*\sqrt{v} + m \f$ for new variance and mean, respectively.
* |OVP_DocEnd_BoxAlgorithm_NoiseGenerator_Miscellaneous|
*/
@@ -0,0 +1,69 @@
/**
* \page BoxAlgorithm_SinusOscillator Sinus oscillator
__________________________________________________________________
Detailed description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Description|
The Sinus Oscillator generates sinusoidal signals on a configurable number of channels, and allows for configuring the sampling frequency and epoch size settings.
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Description|
__________________________________________________________________
Outputs description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Outputs|
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Outputs|
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Output1|
Sinusoidal signal generated.
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Output1|
__________________________________________________________________
Settings description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Settings|
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Settings|
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Setting1|
Number of channels for which to generated sinusoidal signals.
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Setting1|
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Setting2|
Sampling frequency of generated signals.
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Setting2|
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Setting3|
Number of samples per epoch
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Setting3|
__________________________________________________________________
Examples description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Examples|
Practical example :
Let's create a simple signal processing scenario using the Signal Generator box and a display plugin to watch the generated signals. First, we add a Signal Generator box by drag and dropping it from the Samples category. A double click on it will display its configurable settings. Let's generate signals for 4 channels at a rate of 512 samples per second (sampling frequency) and send them down the processing line in blocks of 32 samples (epoch sample count). This means there will be 512/32 = 16 data blocks emitted by this box every second.
Now we want to visualize the generated signals. Let's add a Signal Display box. We can set its Time Scale(i.e. the time span that will be displayed) by double clicking on it.
Finally, we forward signals from the Signal Oscillator to the Signal Display box by linking the output of the former to the first input of the latter.
The scenario may be launched by clicking the 'Play' button in the Player toolbar. Random combinations of sinusoidal signals should be displayed in a Signal Display window, along with default channel names. Press the Player 'Stop' button to go back to scenario edition mode.
\image html sinussignalgenerator_scenario.png "A simple sinus oscillator scenario."
\image html sinussignalgenerator_online.png "Visualizing sinus oscillator signals."
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Examples|
__________________________________________________________________
Miscellaneous description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_SinusOscillator_Miscellaneous|
* |OVP_DocEnd_BoxAlgorithm_SinusOscillator_Miscellaneous|
*/
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,66 @@
/*
* Generates a channel units stream with user-specified unit and factor
*/
#include "ovpCBoxAlgorithmChannelUnitsGenerator.h"
namespace OpenViBE {
namespace Plugins {
namespace DataGeneration {
bool CChannelUnitsGenerator::initialize()
{
m_headerSent = false;
m_nChannel = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0)));
m_unit = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1)));
m_factor = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 2)));
m_encoder.initialize(*this, 0);
return true;
}
bool CChannelUnitsGenerator::uninitialize()
{
m_encoder.uninitialize();
return true;
}
bool CChannelUnitsGenerator::processClock(Kernel::CMessageClock& /*msg*/)
{
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
return true;
}
bool CChannelUnitsGenerator::process()
{
Kernel::IBoxIO* boxContext = getBoxAlgorithmContext()->getDynamicBoxContext();
if (!m_headerSent)
{
CMatrix* units = m_encoder.getInputMatrix();
units->resize(m_nChannel, 2);
units->setDimensionLabel(1, 0, "Unit");
units->setDimensionLabel(1, 1, "Factor");
for (size_t i = 0; i < m_nChannel; ++i)
{
units->getBuffer()[i * 2 + 0] = double(m_unit);
units->getBuffer()[i * 2 + 1] = double(m_factor);
units->setDimensionLabel(0, i, ("Channel " + std::to_string(i + 1)).c_str());
}
m_encoder.encodeHeader();
boxContext->markOutputAsReadyToSend(0, 0, 0);
m_encoder.encodeBuffer();
boxContext->markOutputAsReadyToSend(0, 0, 0);
m_headerSent = true;
}
return true;
}
} // namespace DataGeneration
} // namespace Plugins
} // namespace OpenViBE
@@ -0,0 +1,70 @@
#pragma once
#include "../ovp_defines.h"
#include <toolkit/ovtk_all.h>
namespace OpenViBE {
namespace Plugins {
namespace DataGeneration {
class CChannelUnitsGenerator final : public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
{
public:
void release() override { delete this; }
uint64_t getClockFrequency() override { return 1LL << 32; }
bool initialize() override;
bool uninitialize() override;
bool processClock(Kernel::CMessageClock& /*msg*/) override;
bool process() override;
_IsDerivedFromClass_Final_(IBoxAlgorithm, OVP_ClassId_ChannelUnitsGenerator)
protected:
bool m_headerSent = false;
size_t m_nChannel = 0;
size_t m_unit = 0;
size_t m_factor = 0;
Toolkit::TChannelUnitsEncoder<CChannelUnitsGenerator> m_encoder;
};
class CChannelUnitsGeneratorDesc final : public IBoxAlgorithmDesc
{
public:
void release() override { }
CString getName() const override { return CString("Channel units generator"); }
CString getAuthorName() const override { return CString("Jussi T. Lindgren"); }
CString getAuthorCompanyName() const override { return CString("Inria"); }
CString getShortDescription() const override { return CString("Generates channel units"); }
CString getDetailedDescription() const override
{
return CString(
"This box can generate a channel unit stream if specific measurement units are needed. The box is mainly provided for completeness.");
}
CString getCategory() const override { return CString("Data generation"); }
CString getVersion() const override { return CString("1.0"); }
CString getStockItemName() const override { return CString("gtk-execute"); }
CIdentifier getCreatedClass() const override { return OVP_ClassId_ChannelUnitsGenerator; }
IPluginObject* create() override { return new CChannelUnitsGenerator(); }
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
{
prototype.addSetting("Number of channels", OV_TypeId_Integer, "4");
prototype.addSetting("Unit", OV_TypeId_MeasurementUnit, "V");
prototype.addSetting("Factor", OV_TypeId_Factor, "1e-06");
prototype.addOutput("Channel units", OV_TypeId_ChannelUnits);
return true;
}
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_ChannelUnitsGeneratorDesc)
};
} // namespace DataGeneration
} // namespace Plugins
} // namespace OpenViBE
@@ -0,0 +1,111 @@
#include "ovpCBoxAlgorithmNoiseGenerator.h"
#include <system/ovCMath.h>
#include <iostream>
#include <sstream>
namespace OpenViBE {
namespace Plugins {
namespace DataGeneration {
CNoiseGenerator::CNoiseGenerator()
{
// Use the OV random seed (if specified) to get dictate the sequence here
std::random_device device;
m_engine = std::default_random_engine(device());
}
bool CNoiseGenerator::initialize()
{
m_encoder.initialize(*this, 0);
m_nChannel = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0)));
m_sampling = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1)));
m_nGeneratedEpochSample = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 2)));
m_noiseType = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 3)));
m_headerSent = false;
if (m_nChannel == 0)
{
this->getLogManager() << Kernel::LogLevel_Error << "Channel count is 0. At least 1 channel is required. Check box settings.\n";
return false;
}
if (m_sampling == 0)
{
this->getLogManager() << Kernel::LogLevel_Error << "Sampling rate of 0 is not supported. Check box settings.\n";
return false;
}
if (m_nGeneratedEpochSample == 0)
{
this->getLogManager() << Kernel::LogLevel_Error << "Epoch sample count is 0. An epoch must have at least 1 sample. Check box settings.\n";
return false;
}
// Set parameters of the encoder
m_encoder.getInputSamplingRate() = m_sampling;
CMatrix* sample = m_encoder.getInputMatrix();
sample->resize(m_nChannel, m_nGeneratedEpochSample);
for (size_t i = 0; i < m_nChannel; ++i) { sample->setDimensionLabel(0, i, ("Noise " + std::to_string(i + 1)).c_str()); }
return true;
}
bool CNoiseGenerator::uninitialize()
{
m_encoder.uninitialize();
return true;
}
bool CNoiseGenerator::processClock(Kernel::CMessageClock& /*msg*/)
{
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
return true;
}
bool CNoiseGenerator::process()
{
Kernel::IBoxIO* boxContext = getBoxAlgorithmContext()->getDynamicBoxContext();
// Send header?
if (!m_headerSent)
{
m_encoder.encodeHeader();
boxContext->markOutputAsReadyToSend(0, 0, 0);
m_headerSent = true;
}
else
{
// Send buffer
double* sample = m_encoder.getInputMatrix()->getBuffer();
const size_t n = m_encoder.getInputMatrix()->getBufferElementCount();
if (m_noiseType == OVP_TypeId_NoiseType_Uniform) { for (size_t i = 0; i < n; ++i) { sample[i] = double(m_uniformDistrib(m_engine)); } }
else { for (size_t i = 0; i < n; ++i) { sample[i] = double(m_normalDistrib(m_engine)); } }
const size_t prevNSamples = m_nSentSample;
m_nSentSample = prevNSamples + m_nGeneratedEpochSample;
const uint64_t start = CTime(m_sampling, prevNSamples).time();
const uint64_t end = CTime(m_sampling, m_nSentSample).time();
m_encoder.encodeBuffer();
boxContext->markOutputAsReadyToSend(0, start, end);
}
return true;
}
uint64_t CNoiseGenerator::getClockFrequency()
{
// Intentional parameter swap to get the frequency
return CTime(m_nGeneratedEpochSample, m_sampling).time();
}
} // namespace DataGeneration
} // namespace Plugins
} // namespace OpenViBE
@@ -0,0 +1,77 @@
#pragma once
#include "../ovp_defines.h"
#include <toolkit/ovtk_all.h>
#include <random>
namespace OpenViBE {
namespace Plugins {
namespace DataGeneration {
class CNoiseGenerator final : public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
{
public:
CNoiseGenerator();
void release() override { delete this; }
uint64_t getClockFrequency() override;
bool initialize() override;
bool uninitialize() override;
bool processClock(Kernel::CMessageClock& msg) override;
bool process() override;
_IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_NoiseGenerator)
protected:
Toolkit::TSignalEncoder<CNoiseGenerator> m_encoder;
bool m_headerSent = false;
size_t m_nChannel = 0;
size_t m_sampling = 0;
size_t m_nGeneratedEpochSample = 0;
size_t m_nSentSample = 0;
size_t m_noiseType = 0;
std::default_random_engine m_engine;
std::normal_distribution<> m_normalDistrib{ 0.0, 1.0 }; // Mean=0, Var=1
std::uniform_real_distribution<> m_uniformDistrib{ 0.0, 1.0 }; // Min=0, Max=1
};
class CNoiseGeneratorDesc final : public IBoxAlgorithmDesc
{
public:
void release() override { }
CString getName() const override { return CString("Noise generator"); }
CString getAuthorName() const override { return CString("Jussi T. Lindgren"); }
CString getAuthorCompanyName() const override { return CString("Inria"); }
CString getShortDescription() const override { return CString("Simple random noise generator"); }
CString getDetailedDescription() const override { return CString("Generates uniform or Gaussian random data"); }
CString getCategory() const override { return CString("Data generation"); }
CString getVersion() const override { return CString("1.1"); }
CIdentifier getCreatedClass() const override { return OVP_ClassId_NoiseGenerator; }
IPluginObject* create() override { return new CNoiseGenerator(); }
CString getStockItemName() const override { return CString("gtk-execute"); }
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
{
prototype.addOutput("Generated signal", OV_TypeId_Signal);
prototype.addSetting("Channel count", OV_TypeId_Integer, "4");
prototype.addSetting("Sampling frequency", OV_TypeId_Integer, "512");
prototype.addSetting("Generated epoch sample count", OV_TypeId_Integer, "32");
prototype.addSetting("Noise type", OVP_TypeId_NoiseType, std::to_string(OVP_TypeId_NoiseType_Uniform).c_str());
return true;
}
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_NoiseGeneratorDesc)
};
} // namespace DataGeneration
} // namespace Plugins
} // namespace OpenViBE
@@ -0,0 +1,107 @@
#include "ovpCSinusSignalGenerator.h"
#include <cmath>
#include <cstdio>
namespace OpenViBE {
namespace Plugins {
namespace DataGeneration {
bool CSinusSignalGenerator::initialize()
{
m_encoder.initialize(*this, 0);
// Parses box settings to try connecting to server
m_nChannel = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0)));
m_sampling = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1)));
m_nGeneratedEpochSample = size_t(uint64_t(FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 2)));
m_headerSent = false;
if (m_nChannel == 0)
{
this->getLogManager() << Kernel::LogLevel_Error << "Channel count is 0. At least 1 channel required. Check box settings.\n";
return false;
}
if (m_sampling == 0)
{
this->getLogManager() << Kernel::LogLevel_Error << "Sampling rate of 0 is not supported. Check box settings.\n";
return false;
}
if (m_nGeneratedEpochSample == 0)
{
this->getLogManager() << Kernel::LogLevel_Error << "Epoch sample count is 0. An epoch must have at least 1 sample. Check box settings.\n";
return false;
}
return true;
}
bool CSinusSignalGenerator::uninitialize()
{
m_encoder.uninitialize();
return true;
}
bool CSinusSignalGenerator::processClock(Kernel::CMessageClock& /*msg*/)
{
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
return true;
}
bool CSinusSignalGenerator::process()
{
Kernel::IBoxIO* boxContext = getBoxAlgorithmContext()->getDynamicBoxContext();
if (!m_headerSent)
{
m_encoder.getInputSamplingRate() = m_sampling;
CMatrix* matrix = m_encoder.getInputMatrix();
matrix->resize(m_nChannel, m_nGeneratedEpochSample);
for (size_t i = 0; i < m_nChannel; ++i)
{
// Convention: channel shown as users go as 1,2,...
matrix->setDimensionLabel(0, i, ("sinusOsc " + std::to_string(i + 1)).c_str());
}
m_encoder.encodeHeader();
m_headerSent = true;
const uint64_t time = CTime(m_sampling, m_nSentSample).time();
boxContext->markOutputAsReadyToSend(0, time, time);
}
else
{
double* buffer = m_encoder.getInputMatrix()->getBuffer();
const size_t nSentSample = m_nSentSample;
for (size_t i = 0; i < m_nChannel; ++i)
{
for (size_t j = 0; j < m_nGeneratedEpochSample; ++j)
{
buffer[i * m_nGeneratedEpochSample + j] = sin(((j + m_nSentSample) * (i + 1) * 12.3) / m_sampling)
+ sin(((j + m_nSentSample) * (i + 1) * 4.5) / m_sampling)
+ sin(((j + m_nSentSample) * (i + 1) * 67.8) / m_sampling);
}
}
m_encoder.encodeBuffer();
m_nSentSample += m_nGeneratedEpochSample;
const uint64_t start = CTime(m_sampling, nSentSample).time();
const uint64_t end = CTime(m_sampling, m_nSentSample).time();
boxContext->markOutputAsReadyToSend(0, start, end);
}
return true;
}
} // namespace DataGeneration
} // namespace Plugins
} // namespace OpenViBE
@@ -0,0 +1,69 @@
#pragma once
#include "../ovp_defines.h"
#include <toolkit/ovtk_all.h>
namespace OpenViBE {
namespace Plugins {
namespace DataGeneration {
class CSinusSignalGenerator final : public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
{
public:
CSinusSignalGenerator() {}
void release() override { delete this; }
uint64_t getClockFrequency() override { return CTime(m_nGeneratedEpochSample, m_sampling).time(); } // Intentional parameter swap to get the frequency
bool initialize() override;
bool uninitialize() override;
bool processClock(Kernel::CMessageClock& msg) override;
bool process() override;
_IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_SinusSignalGenerator)
protected:
Toolkit::TSignalEncoder<CSinusSignalGenerator> m_encoder;
bool m_headerSent = false;
size_t m_nChannel = 0;
size_t m_sampling = 0;
size_t m_nGeneratedEpochSample = 0;
size_t m_nSentSample = 0;
};
class CSinusSignalGeneratorDesc final : public IBoxAlgorithmDesc
{
public:
void release() override { }
CString getName() const override { return CString("Sinus oscillator"); }
CString getAuthorName() const override { return CString("Yann Renard"); }
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
CString getShortDescription() const override { return CString("Simple sinus signal generator"); }
CString getDetailedDescription() const override { return CString(""); }
CString getCategory() const override { return CString("Data generation"); }
CString getVersion() const override { return CString("1.0"); }
CIdentifier getCreatedClass() const override { return OVP_ClassId_SinusSignalGenerator; }
IPluginObject* create() override { return new CSinusSignalGenerator(); }
CString getStockItemName() const override { return CString("gtk-execute"); }
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
{
prototype.addOutput("Generated signal", OV_TypeId_Signal);
prototype.addSetting("Channel count", OV_TypeId_Integer, "4");
prototype.addSetting("Sampling frequency", OV_TypeId_Integer, "512");
prototype.addSetting("Generated epoch sample count", OV_TypeId_Integer, "32");
return true;
}
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_SinusSignalGeneratorDesc)
};
} // namespace DataGeneration
} // namespace Plugins
} // namespace OpenViBE
@@ -0,0 +1,23 @@
#pragma once
// Boxes
//---------------------------------------------------------------------------------------------------
#define OVP_ClassId_SinusSignalGenerator OpenViBE::CIdentifier(0x7E33BDB8, 0x68194A4A)
#define OVP_ClassId_SinusSignalGeneratorDesc OpenViBE::CIdentifier(0x2633AFA2, 0x6974E32F)
#define OVP_ClassId_TimeSignalGenerator OpenViBE::CIdentifier(0x28A5E7FF, 0x530095DE)
#define OVP_ClassId_TimeSignalGeneratorDesc OpenViBE::CIdentifier(0x57AD8655, 0x1966B4DC)
#define OVP_ClassId_NoiseGenerator OpenViBE::CIdentifier(0x0E3929F1, 0x15AF76B9)
#define OVP_ClassId_NoiseGeneratorDesc OpenViBE::CIdentifier(0x7237458A, 0x1F312C4A)
#define OVP_ClassId_ChannelUnitsGenerator OpenViBE::CIdentifier(0x42B09186, 0x582C8422)
#define OVP_ClassId_ChannelUnitsGeneratorDesc OpenViBE::CIdentifier(0x4901A752, 0xD8578577)
// Global defines
//---------------------------------------------------------------------------------------------------
#ifdef TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
#include "ovp_global_defines.h"
#endif // TARGET_HAS_ThirdPartyOpenViBEPluginsGlobalDefines
#define OVP_TypeId_NoiseType OpenViBE::CIdentifier(0x2E85E95E, 0x8A1A8365)
#define OVP_TypeId_NoiseType_Uniform 1
#define OVP_TypeId_NoiseType_Gaussian 2
@@ -0,0 +1,25 @@
#include "ovp_defines.h"
#include "box-algorithms/ovpCBoxAlgorithmNoiseGenerator.h"
#include "box-algorithms/ovpCSinusSignalGenerator.h"
#include "box-algorithms/ovpCBoxAlgorithmChannelUnitsGenerator.h"
namespace OpenViBE {
namespace Plugins {
namespace DataGeneration {
OVP_Declare_Begin()
OVP_Declare_New(CNoiseGeneratorDesc);
context.getTypeManager().registerEnumerationType(OVP_TypeId_NoiseType, "Noise type");
context.getTypeManager().registerEnumerationEntry(OVP_TypeId_NoiseType, "Uniform", OVP_TypeId_NoiseType_Uniform);
context.getTypeManager().registerEnumerationEntry(OVP_TypeId_NoiseType, "Gaussian", OVP_TypeId_NoiseType_Gaussian);
OVP_Declare_New(CSinusSignalGeneratorDesc);
OVP_Declare_New(CChannelUnitsGeneratorDesc);
OVP_Declare_End()
} // namespace DataGeneration
} // namespace Plugins
} // namespace OpenViBE
@@ -0,0 +1,24 @@
# Basic Template Test for automatic run a scenario that produce a file to be compared to a reference file
# You need to set the name of the test according to name of scenario file and reference file
SET(TEST_NAME SinusOscillator)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
IF(WIN32)
SET(EXT cmd)
SET(OS_FLAGS "--no-pause")
ELSE()
SET(EXT sh)
SET(OS_FLAGS "")
ENDIF()
ADD_TEST(clean_${TEST_NAME} "${CMAKE_COMMAND}" "-E" "remove" "-f" "${TEST_NAME}.csv")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--invisible" "--play" ${SCENARIO_TO_TEST})
ADD_TEST(compare_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_thresholdDataComparison.${EXT}" ${OS_FLAGS} "${TEST_NAME}.csv" "${TEST_NAME}.ref.csv" 0.001)
## add some properties that help to debug
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL ${OV_LOGFILE})
SET_TESTS_PROPERTIES(compare_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "${TEST_NAME}.csv")
SET_TESTS_PROPERTIES(compare_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME})
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES DEPENDS clean_${TEST_NAME})
@@ -0,0 +1,33 @@
Time (s);Channel 0;Sampling Rate
0.000000;0.000000;32
0.031250;1.368734;
0.062500;0.083451;
0.093750;1.396507;
0.125000;2.346035;
0.156250;0.665258;
0.187500;1.634277;
0.218750;2.037404;
0.250000;0.022367;
0.281250;0.858778;
0.312500;1.060520;
0.343750;-0.852792;
0.375000;0.286299;
0.406250;0.674572;
0.437500;-0.846042;
0.468750;0.720929;
0.500000;1.256436;
0.531250;-0.063101;
0.562500;1.591261;
0.593750;1.856456;
0.625000;0.310024;
0.656250;1.653154;
0.687500;1.361267;
0.718750;-0.540488;
0.750000;0.518955;
0.781250;-0.124499;
0.812500;-2.025000;
0.843750;-0.813536;
0.875000;-1.330267;
0.906250;-2.777442;
0.937500;-1.073187;
0.968750;-1.256059;
1 Time (s) Channel 0 Sampling Rate
2 0.000000 0.000000 32
3 0.031250 1.368734
4 0.062500 0.083451
5 0.093750 1.396507
6 0.125000 2.346035
7 0.156250 0.665258
8 0.187500 1.634277
9 0.218750 2.037404
10 0.250000 0.022367
11 0.281250 0.858778
12 0.312500 1.060520
13 0.343750 -0.852792
14 0.375000 0.286299
15 0.406250 0.674572
16 0.437500 -0.846042
17 0.468750 0.720929
18 0.500000 1.256436
19 0.531250 -0.063101
20 0.562500 1.591261
21 0.593750 1.856456
22 0.625000 0.310024
23 0.656250 1.653154
24 0.687500 1.361267
25 0.718750 -0.540488
26 0.750000 0.518955
27 0.781250 -0.124499
28 0.812500 -2.025000
29 0.843750 -0.813536
30 0.875000 -1.330267
31 0.906250 -2.777442
32 0.937500 -1.073187
33 0.968750 -1.256059
@@ -0,0 +1,351 @@
<OpenViBE-Scenario>
<FormatVersion>1</FormatVersion>
<Creator>openvibe</Creator>
<CreatorVersion>2.0</CreatorVersion>
<Boxes>
<Box>
<Identifier>(0x009a83cc, 0x6d4983ad)</Identifier>
<Name>Clock stimulator</Name>
<AlgorithmClassIdentifier>(0x4f756d3f, 0x29ff0b96)</AlgorithmClassIdentifier>
<Outputs>
<Output>
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier>
<Name>Generated stimulations</Name>
</Output>
</Outputs>
<Settings>
<Setting>
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier>
<Name>Interstimulation interval (in sec)</Name>
<DefaultValue>1.0</DefaultValue>
<Value>1.0</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier>
<Name>Stimulation</Name>
<DefaultValue>OVTK_StimulationId_Label_00</DefaultValue>
<Value>OVTK_StimulationId_Label_00</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>112</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>27</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>432</Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0x27b3ee3c, 0xc50527e6)</Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>129</Value>
</Attribute>
<Attribute>
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier>
<Value>1</Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>2</Value>
</Attribute>
</Attributes>
</Box>
<Box>
<Identifier>(0x34167481, 0x00bd5f19)</Identifier>
<Name>Player Controller</Name>
<AlgorithmClassIdentifier>(0x5f426dce, 0x08456e13)</AlgorithmClassIdentifier>
<Inputs>
<Input>
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier>
<Name>Stimulations</Name>
</Input>
</Inputs>
<Settings>
<Setting>
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier>
<Name>Stimulation name</Name>
<DefaultValue>OVTK_StimulationId_Label_00</DefaultValue>
<Value>OVTK_StimulationId_Label_00</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0xcc14d8d6, 0xf27ecb73)</TypeIdentifier>
<Name>Action to perform</Name>
<DefaultValue>Pause</DefaultValue>
<Value>Stop</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>176</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>27</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>432</Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0x568d148e, 0x650792b3)</Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>134</Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>2</Value>
</Attribute>
<Attribute>
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier>
<Value>1</Value>
</Attribute>
</Attributes>
</Box>
<Box>
<Identifier>(0x448f2232, 0x5013f18b)</Identifier>
<Name>Sinus oscillator</Name>
<AlgorithmClassIdentifier>(0x7e33bdb8, 0x68194a4a)</AlgorithmClassIdentifier>
<Outputs>
<Output>
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier>
<Name>Generated signal</Name>
</Output>
</Outputs>
<Settings>
<Setting>
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier>
<Name>Channel count</Name>
<DefaultValue>4</DefaultValue>
<Value>1</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier>
<Name>Sampling frequency</Name>
<DefaultValue>512</DefaultValue>
<Value>32</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier>
<Name>Generated epoch sample count</Name>
<DefaultValue>32</DefaultValue>
<Value>32</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>112</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>27</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>240</Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0x0b214ed8, 0x1f9ad83a)</Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>119</Value>
</Attribute>
<Attribute>
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier>
<Value>1</Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>3</Value>
</Attribute>
</Attributes>
</Box>
<Box>
<Identifier>(0x4f2ecd7a, 0x0d717b09)</Identifier>
<Name>CSV File Writer</Name>
<AlgorithmClassIdentifier>(0x2c9312f1, 0x2d6613e5)</AlgorithmClassIdentifier>
<Inputs>
<Input>
<TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier>
<Name>Streamed matrix</Name>
</Input>
</Inputs>
<Settings>
<Setting>
<TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier>
<Name>Filename</Name>
<DefaultValue>record-[$core{date}-$core{time}].csv</DefaultValue>
<Value>SinusOscillator.csv</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier>
<Name>Column separator</Name>
<DefaultValue>;</DefaultValue>
<Value>;</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier>
<Name>Precision</Name>
<DefaultValue>10</DefaultValue>
<Value>10</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>192</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>42</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>240</Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0x229d1207, 0xebac8ab0)</Value>
</Attribute>
<Attribute>
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>120</Value>
</Attribute>
<Attribute>
<Identifier>(0xc67a01dc, 0x28ce06c1)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>3</Value>
</Attribute>
<Attribute>
<Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier>
<Value>1</Value>
</Attribute>
</Attributes>
</Box>
</Boxes>
<Links>
<Link>
<Identifier>(0x17d96bc0, 0x2dace6ba)</Identifier>
<Source>
<BoxIdentifier>(0x448f2232, 0x5013f18b)</BoxIdentifier>
<BoxOutputIndex>0</BoxOutputIndex>
</Source>
<Target>
<BoxIdentifier>(0x4f2ecd7a, 0x0d717b09)</BoxIdentifier>
<BoxInputIndex>0</BoxInputIndex>
</Target>
<Attributes>
<Attribute>
<Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier>
<Value>132</Value>
</Attribute>
<Attribute>
<Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier>
<Value>240</Value>
</Attribute>
<Attribute>
<Identifier>(0x3f0a3b27, 0x570913d2)</Identifier>
<Value>166</Value>
</Attribute>
<Attribute>
<Identifier>(0x6267b5c5, 0x676e3e42)</Identifier>
<Value>240</Value>
</Attribute>
</Attributes>
</Link>
<Link>
<Identifier>(0x2c1ae6b9, 0x7658f20c)</Identifier>
<Source>
<BoxIdentifier>(0x009a83cc, 0x6d4983ad)</BoxIdentifier>
<BoxOutputIndex>0</BoxOutputIndex>
</Source>
<Target>
<BoxIdentifier>(0x34167481, 0x00bd5f19)</BoxIdentifier>
<BoxInputIndex>0</BoxInputIndex>
</Target>
<Attributes>
<Attribute>
<Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier>
<Value>132</Value>
</Attribute>
<Attribute>
<Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier>
<Value>432</Value>
</Attribute>
<Attribute>
<Identifier>(0x3f0a3b27, 0x570913d2)</Identifier>
<Value>158</Value>
</Attribute>
<Attribute>
<Identifier>(0x6267b5c5, 0x676e3e42)</Identifier>
<Value>432</Value>
</Attribute>
</Attributes>
</Link>
</Links>
<Comments></Comments>
<Metadata>
<Entry>
<Identifier>(0x0000775c, 0x000078ff)</Identifier>
<Type>(0x3bcce5d2, 0x43f2d968)</Type>
<Data>[{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":1,"height":320,"identifier":"(0x08ca2fb9, 0x39407d4e)","index":0,"name":"Default window","parentIdentifier":"(0xffffffff, 0xffffffff)","type":1,"width":480},{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":1,"identifier":"(0x068798dd, 0x7b740a24)","index":0,"name":"Default tab","parentIdentifier":"(0x08ca2fb9, 0x39407d4e)","type":2},{"boxIdentifier":"(0xffffffff, 0xffffffff)","childCount":0,"identifier":"(0x24c82442, 0x11487bbf)","index":0,"name":"Empty","parentIdentifier":"(0x068798dd, 0x7b740a24)","type":0}]</Data>
</Entry>
</Metadata>
<Attributes>
<Attribute>
<Identifier>(0x790d75b8, 0x3bb90c33)</Identifier>
<Value>Guillermo Andrade B.</Value>
</Attribute>
<Attribute>
<Identifier>(0x8c1fc55b, 0x7b433dc2)</Identifier>
<Value>0.0.1</Value>
</Attribute>
<Attribute>
<Identifier>(0x9f5c4075, 0x4a0d3666)</Identifier>
<Value>Simple Scenario for Automatic Test</Value>
</Attribute>
<Attribute>
<Identifier>(0xf36a1567, 0xd13c53da)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xf6b2e3fa, 0x7bd43926)</Identifier>
<Value>Tests</Value>
</Attribute>
<Attribute>
<Identifier>(0xf8034a49, 0x8b3f37cc)</Identifier>
<Value>INRIA</Value>
</Attribute>
</Attributes>
</OpenViBE-Scenario>