...
 
Commits (3)
...@@ -23,6 +23,7 @@ void CCommandShipControl::execute(int iButton, int iState) ...@@ -23,6 +23,7 @@ void CCommandShipControl::execute(int iButton, int iState)
case 2: case 2:
l_poShooterApplication->getShip()->rotate(6); l_poShooterApplication->getShip()->rotate(6);
break; break;
default: break;
} }
} }
......
...@@ -19,21 +19,15 @@ namespace OpenViBESSVEP ...@@ -19,21 +19,15 @@ namespace OpenViBESSVEP
~CShooterApplication() override; ~CShooterApplication() override;
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override; bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override;
CStarShip* getShip() { return m_poShip; } CStarShip* getShip() { return m_poShip; }
void startExperiment() override; void startExperiment() override;
void addTarget(uint32_t ui32TargetPosition); void addTarget(uint32_t ui32TargetPosition);
bool m_bTargetRequest = false; bool m_bTargetRequest = false;
private: private:
bool m_bActive = false;
void processFrame(uint32_t ui32CurrentFrame) override; void processFrame(uint32_t ui32CurrentFrame) override;
CEGUI::Window* m_poInstructionsReady = nullptr; CEGUI::Window* m_poInstructionsReady = nullptr;
CStarShip* m_poShip = nullptr; CStarShip* m_poShip = nullptr;
std::vector<CShooterTarget*> m_oTargets; std::vector<CShooterTarget*> m_oTargets;
......
...@@ -32,7 +32,7 @@ bool CTrainerApplication::setup(IKernelContext* poKernelContext) ...@@ -32,7 +32,7 @@ bool CTrainerApplication::setup(IKernelContext* poKernelContext)
// paint targets // paint targets
uint32_t l_ui32TargetCount = (uint32_t)(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}")); uint32_t l_ui32TargetCount = uint32_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}"));
for (uint32_t i = 0; i < l_ui32TargetCount; i++) for (uint32_t i = 0; i < l_ui32TargetCount; i++)
{ {
...@@ -91,12 +91,12 @@ void CTrainerApplication::addObject(CTrainerFlickeringObject* poObject) ...@@ -91,12 +91,12 @@ void CTrainerApplication::addObject(CTrainerFlickeringObject* poObject)
poObject->setVisible(true); poObject->setVisible(true);
} }
void CTrainerApplication::setTarget(int32_t i32Target) void CTrainerApplication::setTarget(int i32Target)
{ {
uint32_t l_ui32CurrentTime = (int32_t)(time(nullptr) - m_ttStartTime); uint32_t l_ui32CurrentTime = int(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Target set to " << i32Target << "\n"; (*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Target set to " << i32Target << "\n";
for (int32_t i = 0; i < int(m_oObjects.size()); i++) { m_oObjects[i]->setTarget(i32Target == i); } for (int i = 0; i < int(m_oObjects.size()); i++) { m_oObjects[i]->setTarget(i32Target == i); }
} }
void CTrainerApplication::startExperiment() void CTrainerApplication::startExperiment()
...@@ -111,14 +111,14 @@ void CTrainerApplication::startExperiment() ...@@ -111,14 +111,14 @@ void CTrainerApplication::startExperiment()
void CTrainerApplication::startFlickering() void CTrainerApplication::startFlickering()
{ {
uint32_t l_ui32CurrentTime = (uint32_t)(time(nullptr) - m_ttStartTime); uint32_t l_ui32CurrentTime = uint32_t(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Starting Visual Stimulation\n"; (*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Starting Visual Stimulation\n";
m_bActive = true; m_bActive = true;
} }
void CTrainerApplication::stopFlickering() void CTrainerApplication::stopFlickering()
{ {
uint32_t l_ui32CurrentTime = (uint32_t)(time(nullptr) - m_ttStartTime); uint32_t l_ui32CurrentTime = uint32_t(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Stopping Visual Stimulation\n"; (*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Stopping Visual Stimulation\n";
m_bActive = false; m_bActive = false;
......
...@@ -15,7 +15,7 @@ namespace OpenViBESSVEP ...@@ -15,7 +15,7 @@ namespace OpenViBESSVEP
~CTrainerApplication() override {} ~CTrainerApplication() override {}
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override; bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override;
void setTarget(int32_t i32Target); void setTarget(int i32Target);
void startExperiment() override; void startExperiment() override;
void startFlickering() override; void startFlickering() override;
......
...@@ -118,7 +118,7 @@ bool CApplication::setup(IKernelContext* poKernelContext) ...@@ -118,7 +118,7 @@ bool CApplication::setup(IKernelContext* poKernelContext)
// create the vector of stimulation frequencies // create the vector of stimulation frequencies
m_f64ScreenRefreshRate = (uint32_t)(l_poConfigurationManager->expandAsUInteger("${SSVEP_ScreenRefreshRate}")); m_f64ScreenRefreshRate = uint32_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_ScreenRefreshRate}"));
(*m_poLogManager) << LogLevel_Info << "Specified screen refresh rate :" << m_f64ScreenRefreshRate << "Hz\n"; (*m_poLogManager) << LogLevel_Info << "Specified screen refresh rate :" << m_f64ScreenRefreshRate << "Hz\n";
...@@ -136,7 +136,7 @@ bool CApplication::setup(IKernelContext* poKernelContext) ...@@ -136,7 +136,7 @@ bool CApplication::setup(IKernelContext* poKernelContext)
double l_f64CurrentFrequency; double l_f64CurrentFrequency;
l_f64CurrentFrequency = (double)(l_poConfigurationManager->expandAsFloat("${SSVEP_Frequency_${SSVEP_FrequencyId}}")); l_f64CurrentFrequency = double(l_poConfigurationManager->expandAsFloat("${SSVEP_Frequency_${SSVEP_FrequencyId}}"));
double l_f64ApproximatedFrameCount = m_f64ScreenRefreshRate / l_f64CurrentFrequency; double l_f64ApproximatedFrameCount = m_f64ScreenRefreshRate / l_f64CurrentFrequency;
......
...@@ -16,10 +16,10 @@ CVRPNServer::CVRPNServer(CApplication* poApplication) ...@@ -16,10 +16,10 @@ CVRPNServer::CVRPNServer(CApplication* poApplication)
{ {
m_poApplication = poApplication; m_poApplication = poApplication;
int l_iPort = (int32_t)(m_poApplication->getConfigurationManager()->expandAsInteger("${VRPN_ExternalServerPort}")); int port = int(m_poApplication->getConfigurationManager()->expandAsInteger("${VRPN_ExternalServerPort}"));
m_poApplication->getLogManager() << LogLevel_Debug << "VRPN SERVER PORT :" << l_iPort << "\n"; m_poApplication->getLogManager() << LogLevel_Debug << "VRPN SERVER PORT :" << port << "\n";
m_poConnection = vrpn_create_server_connection(l_iPort); m_poConnection = vrpn_create_server_connection(port);
} }
CVRPNServer* CVRPNServer::getInstance(CApplication* poApplication) CVRPNServer* CVRPNServer::getInstance(CApplication* poApplication)
......
...@@ -16,17 +16,14 @@ int main(int argc, char** argv) ...@@ -16,17 +16,14 @@ int main(int argc, char** argv)
{ {
if (argc != 2) if (argc != 2)
{ {
printf("Usage : %s [trainer|shooter]\n", argv[0]); std::cout << "Usage: " << argv[0] << " [trainer|shooter]\n";
exit(1); exit(1);
} }
// initialize the OpenViBE kernel // initialize the OpenViBE kernel
CKernelLoader l_oKernelLoader; CKernelLoader l_oKernelLoader;
Kernel::IKernelDesc* l_poKernelDesc = nullptr; Kernel::IKernelDesc* l_poKernelDesc = nullptr;
Kernel::IKernelContext* l_poKernelContext = nullptr;
Kernel::ILogManager* l_poLogManager = nullptr;
Kernel::IConfigurationManager* l_poConfigurationManager = nullptr;
CString l_sError; CString l_sError;
#if defined TARGET_OS_Windows #if defined TARGET_OS_Windows
...@@ -51,7 +48,7 @@ int main(int argc, char** argv) ...@@ -51,7 +48,7 @@ int main(int argc, char** argv)
} }
std::cout << "[ INF ] Got kernel descriptor, trying to create kernel\n"; std::cout << "[ INF ] Got kernel descriptor, trying to create kernel\n";
l_poKernelContext = l_poKernelDesc->createKernel("ssvep-demo", Directories::getDataDir() + "/kernel/openvibe.conf"); Kernel::IKernelContext* l_poKernelContext = l_poKernelDesc->createKernel("ssvep-demo", Directories::getDataDir() + "/kernel/openvibe.conf");
if (!l_poKernelContext) if (!l_poKernelContext)
{ {
...@@ -62,13 +59,13 @@ int main(int argc, char** argv) ...@@ -62,13 +59,13 @@ int main(int argc, char** argv)
OpenViBEToolkit::initialize(*l_poKernelContext); OpenViBEToolkit::initialize(*l_poKernelContext);
l_poConfigurationManager = &(l_poKernelContext->getConfigurationManager()); Kernel::IConfigurationManager* l_poConfigurationManager = &(l_poKernelContext->getConfigurationManager());
l_poConfigurationManager->createConfigurationToken("SSVEP_ApplicationDescriptor", CString(argv[1])); l_poConfigurationManager->createConfigurationToken("SSVEP_ApplicationDescriptor", CString(argv[1]));
CString l_sConfigFile = l_poConfigurationManager->expand("${Path_Data}/applications/ssvep-demo/openvibe-ssvep-demo.conf"); CString l_sConfigFile = l_poConfigurationManager->expand("${Path_Data}/applications/ssvep-demo/openvibe-ssvep-demo.conf");
l_poConfigurationManager->addConfigurationFromFile(l_sConfigFile); l_poConfigurationManager->addConfigurationFromFile(l_sConfigFile);
l_poLogManager = &(l_poKernelContext->getLogManager()); Kernel::ILogManager* l_poLogManager = &(l_poKernelContext->getLogManager());
if (l_poConfigurationManager->expand("$Env{OGRE_HOME}").length() == 0) if (l_poConfigurationManager->expand("$Env{OGRE_HOME}").length() == 0)
{ {
...@@ -83,10 +80,9 @@ int main(int argc, char** argv) ...@@ -83,10 +80,9 @@ int main(int argc, char** argv)
l_poConfigurationManager->addOrReplaceConfigurationToken("BuildType", "Release"); l_poConfigurationManager->addOrReplaceConfigurationToken("BuildType", "Release");
#endif #endif
OpenViBESSVEP::CApplication* app = nullptr; OpenViBESSVEP::CApplication* app;
CString l_sApplicationType = l_poConfigurationManager->expand("${SSVEP_ApplicationType}"); const CString l_sApplicationType = l_poConfigurationManager->expand("${SSVEP_ApplicationType}");
(*l_poLogManager) << Kernel::LogLevel_Info << "Selected Application : '" << l_sApplicationType.toASCIIString() << "'\n"; (*l_poLogManager) << Kernel::LogLevel_Info << "Selected Application : '" << l_sApplicationType.toASCIIString() << "'\n";
...@@ -128,7 +124,7 @@ int main(int argc, char** argv) ...@@ -128,7 +124,7 @@ int main(int argc, char** argv)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
printf("SSVEP demo has not been compiled as it depends on Ogre (missing/disabled)\n"); std::cout << "SSVEP demo has not been compiled as it depends on Ogre (missing/disabled)\n";
return -1; return -1;
} }
......
...@@ -43,7 +43,7 @@ bool CGenericStimulatorApplication::setup(IKernelContext* poKernelContext) ...@@ -43,7 +43,7 @@ bool CGenericStimulatorApplication::setup(IKernelContext* poKernelContext)
// paint targets // paint targets
uint32_t l_ui32TargetCount = (uint32_t)(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}")); uint32_t l_ui32TargetCount = uint32_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}"));
for (uint32_t i = 0; i < l_ui32TargetCount; i++) for (uint32_t i = 0; i < l_ui32TargetCount; i++)
{ {
...@@ -101,12 +101,12 @@ void CGenericStimulatorApplication::addObject(CGenericStimulatorFlickeringObject ...@@ -101,12 +101,12 @@ void CGenericStimulatorApplication::addObject(CGenericStimulatorFlickeringObject
poObject->setVisible(true); poObject->setVisible(true);
} }
void CGenericStimulatorApplication::setTarget(int32_t i32Target) void CGenericStimulatorApplication::setTarget(int i32Target)
{ {
uint32_t l_ui32CurrentTime = (int32_t)(time(nullptr) - m_ttStartTime); uint32_t l_ui32CurrentTime = int(time(nullptr) - m_ttStartTime);
(*m_logManager) << LogLevel_Info << l_ui32CurrentTime << " > Target set to " << i32Target << "\n"; (*m_logManager) << LogLevel_Info << l_ui32CurrentTime << " > Target set to " << i32Target << "\n";
for (int32_t i = 0; i < int(m_oObjects.size()); i++) { m_oObjects[i]->setTarget(i32Target == i); } for (int i = 0; i < int(m_oObjects.size()); i++) { m_oObjects[i]->setTarget(i32Target == i); }
} }
void CGenericStimulatorApplication::startExperiment() void CGenericStimulatorApplication::startExperiment()
...@@ -121,14 +121,14 @@ void CGenericStimulatorApplication::startExperiment() ...@@ -121,14 +121,14 @@ void CGenericStimulatorApplication::startExperiment()
void CGenericStimulatorApplication::startFlickering() void CGenericStimulatorApplication::startFlickering()
{ {
uint32_t l_ui32CurrentTime = (uint32_t)(time(nullptr) - m_ttStartTime); uint32_t l_ui32CurrentTime = uint32_t(time(nullptr) - m_ttStartTime);
(*m_logManager) << LogLevel_Info << l_ui32CurrentTime << " > Starting Visual Stimulation\n"; (*m_logManager) << LogLevel_Info << l_ui32CurrentTime << " > Starting Visual Stimulation\n";
m_bActive = true; m_bActive = true;
} }
void CGenericStimulatorApplication::stopFlickering() void CGenericStimulatorApplication::stopFlickering()
{ {
uint32_t l_ui32CurrentTime = (uint32_t)(time(nullptr) - m_ttStartTime); uint32_t l_ui32CurrentTime = uint32_t(time(nullptr) - m_ttStartTime);
(*m_logManager) << LogLevel_Info << l_ui32CurrentTime << " > Stopping Visual Stimulation\n"; (*m_logManager) << LogLevel_Info << l_ui32CurrentTime << " > Stopping Visual Stimulation\n";
m_bActive = false; m_bActive = false;
......
...@@ -15,7 +15,7 @@ namespace OpenViBESSVEPMindShooter ...@@ -15,7 +15,7 @@ namespace OpenViBESSVEPMindShooter
~CGenericStimulatorApplication() override {} ~CGenericStimulatorApplication() override {}
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override; bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override;
void setTarget(int32_t i32Target) override; void setTarget(int i32Target) override;
void startExperiment() override; void startExperiment() override;
void startFlickering() override; void startFlickering() override;
......
...@@ -69,15 +69,14 @@ void ParseStringVector(Ogre::String& str, Ogre::StringVector& list) ...@@ -69,15 +69,14 @@ void ParseStringVector(Ogre::String& str, Ogre::StringVector& list)
{ {
list.clear(); list.clear();
Ogre::StringUtil::trim(str, true, true); Ogre::StringUtil::trim(str, true, true);
if (str == "") if (str == "") { return; }
return;
size_t pos = str.find(";"); size_t pos = str.find(';');
while (pos != -1) while (pos != -1)
{ {
list.push_back(str.substr(0, pos)); list.push_back(str.substr(0, pos));
str.erase(0, pos + 1); str.erase(0, pos + 1);
pos = str.find(";"); pos = str.find(';');
} }
if (str != "") { list.push_back(str); } if (str != "") { list.push_back(str); }
...@@ -965,7 +964,6 @@ void DotSceneLoader::processEntity(rapidxml::xml_node<>* XMLNode, Ogre::SceneNod ...@@ -965,7 +964,6 @@ void DotSceneLoader::processEntity(rapidxml::xml_node<>* XMLNode, Ogre::SceneNod
void DotSceneLoader::processSubEntity(rapidxml::xml_node<>* XMLNode, Ogre::Entity* pEntity) void DotSceneLoader::processSubEntity(rapidxml::xml_node<>* XMLNode, Ogre::Entity* pEntity)
{ {
int index = 0;
Ogre::String materialName; Ogre::String materialName;
Ogre::String sIndex; Ogre::String sIndex;
...@@ -982,7 +980,7 @@ void DotSceneLoader::processSubEntity(rapidxml::xml_node<>* XMLNode, Ogre::Entit ...@@ -982,7 +980,7 @@ void DotSceneLoader::processSubEntity(rapidxml::xml_node<>* XMLNode, Ogre::Entit
if (!sIndex.empty() && !materialName.empty()) if (!sIndex.empty() && !materialName.empty())
{ {
index = Ogre::StringConverter::parseInt(sIndex); int index = Ogre::StringConverter::parseInt(sIndex);
try try
{ {
pEntity->getSubEntity(index)->setMaterialName(materialName); pEntity->getSubEntity(index)->setMaterialName(materialName);
...@@ -1157,26 +1155,18 @@ void DotSceneLoader::processFog(rapidxml::xml_node<>* XMLNode) ...@@ -1157,26 +1155,18 @@ void DotSceneLoader::processFog(rapidxml::xml_node<>* XMLNode)
Ogre::Real linearStart = getAttribReal(XMLNode, "start", 0.0); Ogre::Real linearStart = getAttribReal(XMLNode, "start", 0.0);
Ogre::Real linearEnd = getAttribReal(XMLNode, "end", 1.0); Ogre::Real linearEnd = getAttribReal(XMLNode, "end", 1.0);
Ogre::FogMode mode = Ogre::FOG_NONE; Ogre::FogMode mode;
Ogre::String sMode = getAttrib(XMLNode, "mode"); Ogre::String sMode = getAttrib(XMLNode, "mode");
if (sMode == "none") if (sMode == "none") mode = Ogre::FOG_NONE;
mode = Ogre::FOG_NONE; else if (sMode == "exp") mode = Ogre::FOG_EXP;
else if (sMode == "exp") else if (sMode == "exp2") mode = Ogre::FOG_EXP2;
mode = Ogre::FOG_EXP; else if (sMode == "linear") { mode = Ogre::FOG_LINEAR; }
else if (sMode == "exp2") else mode = (Ogre::FogMode)Ogre::StringConverter::parseInt(sMode);
mode = Ogre::FOG_EXP2;
else if (sMode == "linear")
{
mode = Ogre::FOG_LINEAR;
}
else
mode = (Ogre::FogMode)Ogre::StringConverter::parseInt(sMode);
// Process colourDiffuse (?) // Process colourDiffuse (?)
Ogre::ColourValue colourDiffuse = Ogre::ColourValue::White; Ogre::ColourValue colourDiffuse = Ogre::ColourValue::White;
rapidxml::xml_node<>* pElement = XMLNode->first_node("colour"); rapidxml::xml_node<>* pElement = XMLNode->first_node("colour");
if (pElement) if (pElement) colourDiffuse = parseColour(pElement);
colourDiffuse = parseColour(pElement);
// Setup the fog // Setup the fog
m_pSceneMgr->setFog(mode, colourDiffuse, expDensity, linearStart, linearEnd); m_pSceneMgr->setFog(mode, colourDiffuse, expDensity, linearStart, linearEnd);
......
...@@ -180,6 +180,7 @@ void CCommandControlAnalog::commandeerShip(const double* pProbs) ...@@ -180,6 +180,7 @@ void CCommandControlAnalog::commandeerShip(const double* pProbs)
} }
if (l_f64Sum <= 0) { l_f64Sum = 1; } if (l_f64Sum <= 0) { l_f64Sum = 1; }
/*
const bool l_bParalyzed = false; const bool l_bParalyzed = false;
if (l_bParalyzed) if (l_bParalyzed)
{ {
...@@ -196,6 +197,7 @@ void CCommandControlAnalog::commandeerShip(const double* pProbs) ...@@ -196,6 +197,7 @@ void CCommandControlAnalog::commandeerShip(const double* pProbs)
return; return;
} }
*/
// In principle here we could do different things with the probabilities. If we predict just the // In principle here we could do different things with the probabilities. If we predict just the
// maximum, this can be expected to be identical to the Classifier Processor box label output, // maximum, this can be expected to be identical to the Classifier Processor box label output,
...@@ -223,12 +225,12 @@ void CCommandControlAnalog::commandeerShip(const double* pProbs) ...@@ -223,12 +225,12 @@ void CCommandControlAnalog::commandeerShip(const double* pProbs)
else if (l_ui32MaxIdx == MOVE_LEFT && m_poApplication->getShip()->getTargetState(1) != CImpactShip::TS_OFF) else if (l_ui32MaxIdx == MOVE_LEFT && m_poApplication->getShip()->getTargetState(1) != CImpactShip::TS_OFF)
{ {
m_vCommandStates[1] = 1; m_vCommandStates[1] = 1;
l_poShip->move(static_cast<int>(-6 * l_f64Strength)); l_poShip->move(int(-6 * l_f64Strength));
} }
else if (l_ui32MaxIdx == MOVE_RIGHT && m_poApplication->getShip()->getTargetState(2) != CImpactShip::TS_OFF) else if (l_ui32MaxIdx == MOVE_RIGHT && m_poApplication->getShip()->getTargetState(2) != CImpactShip::TS_OFF)
{ {
m_vCommandStates[2] = 1; m_vCommandStates[2] = 1;
l_poShip->move(static_cast<int>(6 * l_f64Strength)); l_poShip->move(int(6 * l_f64Strength));
} }
/* /*
......
...@@ -23,6 +23,7 @@ void CCommandControlDiscrete::execute(int iButton, int iState) ...@@ -23,6 +23,7 @@ void CCommandControlDiscrete::execute(int iButton, int iState)
CImpactApplication* l_poImpactApplication = dynamic_cast<CImpactApplication*>(m_poApplication); CImpactApplication* l_poImpactApplication = dynamic_cast<CImpactApplication*>(m_poApplication);
/*
const bool l_bParalyzed = false; const bool l_bParalyzed = false;
if (l_bParalyzed) if (l_bParalyzed)
{ {
...@@ -39,6 +40,7 @@ void CCommandControlDiscrete::execute(int iButton, int iState) ...@@ -39,6 +40,7 @@ void CCommandControlDiscrete::execute(int iButton, int iState)
return; return;
} }
*/
switch (iButton) switch (iButton)
{ {
......
...@@ -33,9 +33,6 @@ CImpactEnemyShip* CImpactEnemyShip::createTarget(Real rPosition) ...@@ -33,9 +33,6 @@ CImpactEnemyShip* CImpactEnemyShip::createTarget(Real rPosition)
} }
CImpactEnemyShip::CImpactEnemyShip(Real rPosition) CImpactEnemyShip::CImpactEnemyShip(Real rPosition)
: m_shipWidth(0.1f),
m_destructionStatus(0),
m_pointValue(100)
{ {
m_bEnemyLeaving = false; m_bEnemyLeaving = false;
int l_iType = m_application->getNextTargetType(); int l_iType = m_application->getNextTargetType();
...@@ -51,7 +48,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition) ...@@ -51,7 +48,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition)
m_enemyNode = m_application->getSceneManager()->getSceneNode("v2_vaisseau"); m_enemyNode = m_application->getSceneManager()->getSceneNode("v2_vaisseau");
m_enemyNode->scale(1.0f, 1.0f, 1.0f); m_enemyNode->scale(1.0f, 1.0f, 1.0f);
m_shipWidth = 0.5f; m_shipWidth = 0.5f;
m_iLeaveCountdown = (int)(2.0f * 3600); m_iLeaveCountdown = int(2.0f * 3600);
m_pointValue = 100; m_pointValue = 100;
break; break;
case 2: case 2:
...@@ -60,7 +57,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition) ...@@ -60,7 +57,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition)
m_enemyNode = m_application->getSceneManager()->getSceneNode("v1_vaisseau"); m_enemyNode = m_application->getSceneManager()->getSceneNode("v1_vaisseau");
m_enemyNode->scale(1.9f, 1.9f, 1.9f); m_enemyNode->scale(1.9f, 1.9f, 1.9f);
m_shipWidth = 0.45f; m_shipWidth = 0.45f;
m_iLeaveCountdown = (int)(1.5f * 3600); m_iLeaveCountdown = int(1.5f * 3600);
m_pointValue = 200; m_pointValue = 200;
break; break;
case 3: case 3:
...@@ -69,7 +66,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition) ...@@ -69,7 +66,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition)
m_enemyNode = m_application->getSceneManager()->getSceneNode("v3_vaisseau"); m_enemyNode = m_application->getSceneManager()->getSceneNode("v3_vaisseau");
m_enemyNode->scale(2.2f, 2.0f, 2.0f); m_enemyNode->scale(2.2f, 2.0f, 2.0f);
m_shipWidth = 0.4f; m_shipWidth = 0.4f;
m_iLeaveCountdown = (int)(1.0f * 3600); m_iLeaveCountdown = int(1.0f * 3600);
m_pointValue = 400; m_pointValue = 400;
break; break;
case 4: case 4:
...@@ -95,7 +92,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition) ...@@ -95,7 +92,7 @@ CImpactEnemyShip::CImpactEnemyShip(Real rPosition)
{ {
m_enemyNode->scale(1.2f, 1.2f, 1.2f); m_enemyNode->scale(1.2f, 1.2f, 1.2f);
m_shipWidth = 0.3f; m_shipWidth = 0.3f;
m_iLeaveCountdown = (int)(1.0f * 3600); m_iLeaveCountdown = int(1.0f * 3600);
} }
...@@ -184,7 +181,7 @@ void CImpactEnemyShip::processFrame() ...@@ -184,7 +181,7 @@ void CImpactEnemyShip::processFrame()
l_iSinOscillator++; l_iSinOscillator++;
l_iSinOscillator = l_iSinOscillator % 360; l_iSinOscillator = l_iSinOscillator % 360;
// m_enemyNode->roll(Radian(Math::Sin(Degree(sin_oscillator)) / 80)); // m_enemyNode->roll(Radian(Math::Sin(Degree(sin_oscillator)) / 80));
m_enemyNode->translate(Math::Sin(Degree((Real)l_iSinOscillator)) / 20.0f * 0, Math::Sin(Degree((Real)(l_iSinOscillator * 2 + 90))) / 20, 0.0f, Node::TS_LOCAL); m_enemyNode->translate(Math::Sin(Degree((Real)l_iSinOscillator)) / 20.0f * 0, Math::Sin(Degree(Real(l_iSinOscillator * 2 + 90))) / 20, 0.0f, Node::TS_LOCAL);
m_hitBox->translate(Math::Sin(Degree((Real)l_iSinOscillator)) / 20.0f / 50.0f * 0, 0.0f, 0.0f, Node::TS_LOCAL); m_hitBox->translate(Math::Sin(Degree((Real)l_iSinOscillator)) / 20.0f / 50.0f * 0, 0.0f, 0.0f, Node::TS_LOCAL);
......
...@@ -47,7 +47,6 @@ namespace OpenViBESSVEPMindShooter ...@@ -47,7 +47,6 @@ namespace OpenViBESSVEPMindShooter
Ogre::SceneNode* m_enemyNode = nullptr; Ogre::SceneNode* m_enemyNode = nullptr;
Ogre::SceneNode* m_hitBox = nullptr; Ogre::SceneNode* m_hitBox = nullptr;
Ogre::SceneNode* m_fragments[4];
Ogre::Real m_incomingStatus = 0; Ogre::Real m_incomingStatus = 0;
Ogre::Real m_shipWidth = 0.1f; Ogre::Real m_shipWidth = 0.1f;
Ogre::uint32 m_destructionStatus = 0; Ogre::uint32 m_destructionStatus = 0;
......
...@@ -18,8 +18,7 @@ using namespace OpenViBESSVEPMindShooter; ...@@ -18,8 +18,7 @@ using namespace OpenViBESSVEPMindShooter;
using namespace Ogre; using namespace Ogre;
//SP CImpactShip::CImpactShip(CImpactApplication* poApplication, Ogre::SceneNode* poParentNode, std::vector<std::pair<uint32_t, uint32_t> >* pFrequencies) : //SP CImpactShip::CImpactShip(CImpactApplication* poApplication, Ogre::SceneNode* poParentNode, std::vector<std::pair<uint32_t, uint32_t> >* pFrequencies) :
CImpactShip::CImpactShip(CImpactApplication* poApplication, SceneNode* poParentNode, std::vector<uint64_t>* pFrequencies) : m_application(poApplication), CImpactShip::CImpactShip(CImpactApplication* poApplication, SceneNode* poParentNode, std::vector<uint64_t>* pFrequencies) : m_application(poApplication), m_currentAngle(0)
m_currentAngle(0)
{ {
m_application->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "Loading ship\n"; m_application->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "Loading ship\n";
......
...@@ -79,9 +79,7 @@ namespace OpenViBESSVEPMindShooter ...@@ -79,9 +79,7 @@ namespace OpenViBESSVEPMindShooter
bool m_focusPointActive = false; bool m_focusPointActive = false;
bool m_cannonInhibited = false; bool m_cannonInhibited = false;
Ogre::Real m_angularSpeed = 0;
Ogre::Radian m_currentAngle = 0; Ogre::Radian m_currentAngle = 0;
int m_currentRotationCount = 0;
int m_currentDisplacementCount = 0; int m_currentDisplacementCount = 0;
int m_shootingCooldown = 0; int m_shootingCooldown = 0;
......
...@@ -11,9 +11,8 @@ using namespace Kernel; ...@@ -11,9 +11,8 @@ using namespace Kernel;
using namespace std; using namespace std;
CLogListenerFileBuffered::CLogListenerFileBuffered(const IKernelContext& rKernelContext, const CString& sApplicationName, const CString& sLogFilename) CLogListenerFileBuffered::CLogListenerFileBuffered(const IKernelContext& context, const CString& applicationName, const CString& logFilename)
: m_sApplicationName(sApplicationName) : m_sApplicationName(applicationName), m_sLogFilename(logFilename)
, m_sLogFilename(sLogFilename)
{ {
m_f = fopen(m_sLogFilename.toASCIIString(), "wt"); m_f = fopen(m_sLogFilename.toASCIIString(), "wt");
if (m_f == nullptr) if (m_f == nullptr)
...@@ -24,8 +23,7 @@ CLogListenerFileBuffered::CLogListenerFileBuffered(const IKernelContext& rKernel ...@@ -24,8 +23,7 @@ CLogListenerFileBuffered::CLogListenerFileBuffered(const IKernelContext& rKernel
CLogListenerFileBuffered::~CLogListenerFileBuffered() CLogListenerFileBuffered::~CLogListenerFileBuffered()
{ {
if (m_f != nullptr) if (m_f != nullptr) { fclose(m_f); }
fclose(m_f);
} }
bool CLogListenerFileBuffered::isActive(ELogLevel eLogLevel) bool CLogListenerFileBuffered::isActive(ELogLevel eLogLevel)
...@@ -82,7 +80,7 @@ void CLogListenerFileBuffered::log(const int64_t value) ...@@ -82,7 +80,7 @@ void CLogListenerFileBuffered::log(const int64_t value)
if (m_f != nullptr) { fprintf(m_f, "%lli", value); } if (m_f != nullptr) { fprintf(m_f, "%lli", value); }
} }
void CLogListenerFileBuffered::log(const int32_t value) void CLogListenerFileBuffered::log(const int value)
{ {
if (m_f != nullptr) {fprintf(m_f, "%i", value); } if (m_f != nullptr) {fprintf(m_f, "%i", value); }
} }
......
...@@ -16,7 +16,7 @@ namespace OpenViBE ...@@ -16,7 +16,7 @@ namespace OpenViBE
{ {
public: public:
CLogListenerFileBuffered(const IKernelContext& rKernelContext, const CString& sApplicationName, const CString& sLogFilename); CLogListenerFileBuffered(const IKernelContext& context, const CString& applicationName, const CString& logFilename);
~CLogListenerFileBuffered() override; ~CLogListenerFileBuffered() override;
bool isActive(ELogLevel eLogLevel) override; bool isActive(ELogLevel eLogLevel) override;
...@@ -32,7 +32,7 @@ namespace OpenViBE ...@@ -32,7 +32,7 @@ namespace OpenViBE
void log(const uint8_t value) override; void log(const uint8_t value) override;
void log(const int64_t value) override; void log(const int64_t value) override;
void log(const int32_t value) override; void log(const int value) override;
void log(const int16_t value) override; void log(const int16_t value) override;
void log(const int8_t value) override; void log(const int8_t value) override;
......
...@@ -148,7 +148,7 @@ bool CApplication::setup(IKernelContext* poKernelContext) ...@@ -148,7 +148,7 @@ bool CApplication::setup(IKernelContext* poKernelContext)
// create the vector of stimulation frequencies // create the vector of stimulation frequencies
m_screenRefreshRate = (uint32_t)(l_poConfigurationManager->expandAsUInteger("${SSVEP_ScreenRefreshRate}", 60)); m_screenRefreshRate = uint32_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_ScreenRefreshRate}", 60));
(*m_logManager) << LogLevel_Info << "Specified screen refresh rate :" << m_screenRefreshRate << "Hz\n"; (*m_logManager) << LogLevel_Info << "Specified screen refresh rate :" << m_screenRefreshRate << "Hz\n";
if (m_screenRefreshRate > 64) if (m_screenRefreshRate > 64)
...@@ -172,7 +172,7 @@ bool CApplication::setup(IKernelContext* poKernelContext) ...@@ -172,7 +172,7 @@ bool CApplication::setup(IKernelContext* poKernelContext)
// Load pre-defined stimulation patterns (binary encoded dark/light frames inside a 64bit integer) // Load pre-defined stimulation patterns (binary encoded dark/light frames inside a 64bit integer)
while (l_poConfigurationManager->lookUpConfigurationTokenIdentifier(l_poConfigurationManager->expand("SSVEP_Pattern_${SSVEP_FrequencyId}")) != OV_UndefinedIdentifier) while (l_poConfigurationManager->lookUpConfigurationTokenIdentifier(l_poConfigurationManager->expand("SSVEP_Pattern_${SSVEP_FrequencyId}")) != OV_UndefinedIdentifier)
{ {
uint64_t l_ui64StimulationPattern = (uint64_t)(l_poConfigurationManager->expandAsInteger("${SSVEP_Pattern_${SSVEP_FrequencyId}}")); uint64_t l_ui64StimulationPattern = uint64_t(l_poConfigurationManager->expandAsInteger("${SSVEP_Pattern_${SSVEP_FrequencyId}}"));
(*m_logManager) << LogLevel_Info << "Pattern number " << i << " pattern : " << l_ui64StimulationPattern << "\n"; (*m_logManager) << LogLevel_Info << "Pattern number " << i << " pattern : " << l_ui64StimulationPattern << "\n";
m_frequencies[i] = l_ui64StimulationPattern; m_frequencies[i] = l_ui64StimulationPattern;
...@@ -192,11 +192,11 @@ bool CApplication::setup(IKernelContext* poKernelContext) ...@@ -192,11 +192,11 @@ bool CApplication::setup(IKernelContext* poKernelContext)
// Load frequencies // Load frequencies
while (l_poConfigurationManager->lookUpConfigurationTokenIdentifier(l_poConfigurationManager->expand("SSVEP_Frequency_${SSVEP_FrequencyId}")) != OV_UndefinedIdentifier) while (l_poConfigurationManager->lookUpConfigurationTokenIdentifier(l_poConfigurationManager->expand("SSVEP_Frequency_${SSVEP_FrequencyId}")) != OV_UndefinedIdentifier)
{ {
const double l_f64CurrentFrequency = (double)(l_poConfigurationManager->expandAsFloat("${SSVEP_Frequency_${SSVEP_FrequencyId}}")); const double l_f64CurrentFrequency = double(l_poConfigurationManager->expandAsFloat("${SSVEP_Frequency_${SSVEP_FrequencyId}}"));
const double l_f64ApproximatedFrameCount = m_screenRefreshRate / l_f64CurrentFrequency; const double l_f64ApproximatedFrameCount = m_screenRefreshRate / l_f64CurrentFrequency;
const uint32_t l_ui32RoundedFrameCount = static_cast<uint32_t>(floor(l_f64ApproximatedFrameCount + 0.5)); const uint32_t l_ui32RoundedFrameCount = uint32_t(floor(l_f64ApproximatedFrameCount + 0.5));
// test if the desired frequency can be reasonably created on the screen // test if the desired frequency can be reasonably created on the screen
if (fabs(l_f64ApproximatedFrameCount - l_ui32RoundedFrameCount) < 0.003) if (fabs(l_f64ApproximatedFrameCount - l_ui32RoundedFrameCount) < 0.003)
......
...@@ -24,6 +24,6 @@ namespace OpenViBESSVEPMindShooter ...@@ -24,6 +24,6 @@ namespace OpenViBESSVEPMindShooter
void updateCamera(); void updateCamera();
std::map<OIS::KeyCode, bool> m_vKeyPressed; std::map<OIS::KeyCode, bool> m_vKeyPressed;
bool m_bCameraMode = 0; bool m_bCameraMode = false;
}; };
} }
...@@ -16,10 +16,10 @@ CVRPNServer::CVRPNServer(CApplication* poApplication) ...@@ -16,10 +16,10 @@ CVRPNServer::CVRPNServer(CApplication* poApplication)
{ {
m_poApplication = poApplication; m_poApplication = poApplication;
int l_iPort = (int32_t)(m_poApplication->getConfigurationManager()->expandAsInteger("${VRPN_ExternalServerPort}")); int port = int(m_poApplication->getConfigurationManager()->expandAsInteger("${VRPN_ExternalServerPort}"));
m_poApplication->getLogManager() << LogLevel_Debug << "VRPN SERVER PORT :" << l_iPort << "\n"; m_poApplication->getLogManager() << LogLevel_Debug << "VRPN SERVER PORT :" << port << "\n";
m_poConnection = vrpn_create_server_connection(l_iPort); m_poConnection = vrpn_create_server_connection(port);
} }
CVRPNServer* CVRPNServer::getInstance(CApplication* poApplication) CVRPNServer* CVRPNServer::getInstance(CApplication* poApplication)
......
...@@ -36,7 +36,6 @@ int main(int argc, char** argv) ...@@ -36,7 +36,6 @@ int main(int argc, char** argv)
Kernel::IKernelDesc* l_poKernelDesc = nullptr; Kernel::IKernelDesc* l_poKernelDesc = nullptr;
Kernel::IKernelContext* l_poKernelContext = nullptr; Kernel::IKernelContext* l_poKernelContext = nullptr;
Kernel::ILogManager* l_poLogManager = nullptr; Kernel::ILogManager* l_poLogManager = nullptr;
Kernel::IConfigurationManager* l_poConfigurationManager = nullptr;
CString l_sApplicationString = CString(argv[1]); CString l_sApplicationString = CString(argv[1]);
CString l_sScenarioFolder = CString(argv[2]); CString l_sScenarioFolder = CString(argv[2]);
...@@ -100,7 +99,7 @@ int main(int argc, char** argv) ...@@ -100,7 +99,7 @@ int main(int argc, char** argv)
OpenViBEToolkit::initialize(*l_poKernelContext); OpenViBEToolkit::initialize(*l_poKernelContext);
l_poConfigurationManager = &(l_poKernelContext->getConfigurationManager()); Kernel::IConfigurationManager* l_poConfigurationManager = &(l_poKernelContext->getConfigurationManager());
l_poConfigurationManager->addConfigurationFromFile(l_poConfigurationManager->expand("${Path_Data}/kernel/openvibe.conf")); l_poConfigurationManager->addConfigurationFromFile(l_poConfigurationManager->expand("${Path_Data}/kernel/openvibe.conf"));
/* /*
l_poConfigurationManager->createConfigurationToken("SSVEP_ApplicationDescriptor", CString(argv[1])); l_poConfigurationManager->createConfigurationToken("SSVEP_ApplicationDescriptor", CString(argv[1]));
...@@ -129,19 +128,19 @@ int main(int argc, char** argv) ...@@ -129,19 +128,19 @@ int main(int argc, char** argv)
} }
OpenViBESSVEPMindShooter::CApplication* l_pApp = nullptr; OpenViBESSVEPMindShooter::CApplication* app;
if (l_sApplicationType == CString("generic")) if (l_sApplicationType == CString("generic"))
{ {
(*l_poLogManager) << Kernel::LogLevel_Debug << "+ app = new OpenViBESSVEPMindShooter::CGenericStimulatorApplication(...)\n"; (*l_poLogManager) << Kernel::LogLevel_Debug << "+ app = new OpenViBESSVEPMindShooter::CGenericStimulatorApplication(...)\n";
l_pApp = new OpenViBESSVEPMindShooter::CGenericStimulatorApplication(l_sScenarioFolder); app = new OpenViBESSVEPMindShooter::CGenericStimulatorApplication(l_sScenarioFolder);
} }
else if (l_sApplicationType == CString("impact")) else if (l_sApplicationType == CString("impact"))
{ {
(*l_poLogManager) << Kernel::LogLevel_Debug << "+ app = new OpenViBESSVEPMindShooter::CImpactApplication(...)\n"; (*l_poLogManager) << Kernel::LogLevel_Debug << "+ app = new OpenViBESSVEPMindShooter::CImpactApplication(...)\n";
(*l_poLogManager) << Kernel::LogLevel_Info << "application subtype " << l_sApplicationSubtype << "\n"; (*l_poLogManager) << Kernel::LogLevel_Info << "application subtype " << l_sApplicationSubtype << "\n";
l_pApp = new OpenViBESSVEPMindShooter::CImpactApplication(l_sScenarioFolder, l_sApplicationSubtype); app = new OpenViBESSVEPMindShooter::CImpactApplication(l_sScenarioFolder, l_sApplicationSubtype);
} }
else else
{ {
...@@ -150,18 +149,18 @@ int main(int argc, char** argv) ...@@ -150,18 +149,18 @@ int main(int argc, char** argv)
exit(1); exit(1);
} }
if (!l_pApp->setup(l_poKernelContext)) if (!app->setup(l_poKernelContext))
{ {
(*l_poLogManager) << Kernel::LogLevel_Error << "Cannot proceed, exiting\n"; (*l_poLogManager) << Kernel::LogLevel_Error << "Cannot proceed, exiting\n";
exit(2); exit(2);
} }
l_pApp->go(); app->go();
(*l_poLogManager) << Kernel::LogLevel_Debug << "- app\n"; (*l_poLogManager) << Kernel::LogLevel_Debug << "- app\n";
delete l_pApp; delete app;
return 0; return 0;
} }
...@@ -172,7 +171,7 @@ int main(int argc, char** argv) ...@@ -172,7 +171,7 @@ int main(int argc, char** argv)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
printf("SSVEP Mind Shooter has not been compiled as it depends on Ogre (missing/disabled)\n"); std::cout << "SSVEP Mind Shooter has not been compiled as it depends on Ogre (missing/disabled)\n";
return -1; return -1;
} }
......
...@@ -286,6 +286,7 @@ bool CHandballBCI::process(double timeSinceLastProcess) ...@@ -286,6 +286,7 @@ bool CHandballBCI::process(double timeSinceLastProcess)
std::cout << std::endl;*/ std::cout << std::endl;*/
break; break;
default: break;
} }
} }
...@@ -316,6 +317,7 @@ bool CHandballBCI::process(double timeSinceLastProcess) ...@@ -316,6 +317,7 @@ bool CHandballBCI::process(double timeSinceLastProcess)
if (m_iMark == Mark_Right && m_dFeedback > 0) { m_iClassificationScore++; } if (m_iMark == Mark_Right && m_dFeedback > 0) { m_iClassificationScore++; }
break; break;
default: break;
} }
m_fBallOrientation += m_fBallSpeed; m_fBallOrientation += m_fBallSpeed;
......
...@@ -577,7 +577,7 @@ void CSpaceshipBCI::processStageFreetime(double timeSinceLastProcess) ...@@ -577,7 +577,7 @@ void CSpaceshipBCI::processStageFreetime(double timeSinceLastProcess)
m_vShipOrientation[0] += g_fRotationSpeed * ((rand() & 1) == 0 ? -1 : 1); m_vShipOrientation[0] += g_fRotationSpeed * ((rand() & 1) == 0 ? -1 : 1);
m_vShipOrientation[1] += g_fRotationSpeed * ((rand() & 1) == 0 ? -1 : 1); m_vShipOrientation[1] += g_fRotationSpeed * ((rand() & 1) == 0 ? -1 : 1);
m_vShipOrientation[2] += g_fRotationSpeed * ((rand() & 1) == 0 ? -1 : 1); m_vShipOrientation[2] += g_fRotationSpeed * ((rand() & 1) == 0 ? -1 : 1);
m_fShipHeight += (float)((m_dFeedback - m_dBetaOffset) * g_fMoveSpeed); m_fShipHeight += float((m_dFeedback - m_dBetaOffset) * g_fMoveSpeed);
if (m_bShouldIncrementStat) { m_dStat_SpaceshipLiftTime += timeSinceLastProcess; } if (m_bShouldIncrementStat) { m_dStat_SpaceshipLiftTime += timeSinceLastProcess; }
if (m_vShipOrientation[0] > 5) { m_vShipOrientation[0] = 5; } if (m_vShipOrientation[0] > 5) { m_vShipOrientation[0] = 5; }
......
...@@ -11,8 +11,8 @@ class CDeviceInfo ...@@ -11,8 +11,8 @@ class CDeviceInfo
public: public:
std::string m_sAddress; std::string m_sAddress;
vrpn_Button_Remote* m_pButton; vrpn_Button_Remote* m_pButton = nullptr;
vrpn_Analog_Remote* m_pAnalog; vrpn_Analog_Remote* m_pAnalog = nullptr;
}; };
namespace namespace
......
...@@ -18,11 +18,10 @@ int main(int argc, char** argv) ...@@ -18,11 +18,10 @@ int main(int argc, char** argv)
{ {
if (argc < 2) if (argc < 2)
{ {
printf("Syntax: %s demo-name\n", argv[0]); std::cout << "Syntax: " << argv[0] << " demo-name\n\n";
printf("\n"); std::cout << "where demo-name could be one of the following :\n";
printf("where demo-name could be one of the following :\n"); std::cout << " - spaceship\n";
printf(" - spaceship\n"); std::cout << " - handball\n";
printf(" - handball\n");
return 1; return 1;
} }
...@@ -32,39 +31,39 @@ int main(int argc, char** argv) ...@@ -32,39 +31,39 @@ int main(int argc, char** argv)
std::string l_slocalization = "eng"; std::string l_slocalization = "eng";
if (argc != 3) if (argc != 3)
{ {
printf("No language selected. Default is: english (eng).\n\n"); std::cout << "No language selected. Default is: english (eng).\n\n";
} }
else else
{ {
l_slocalization = argv[2]; l_slocalization = argv[2];
printf("User defined language: l_slocalization \n"); std::cout << "User defined language: " << l_slocalization << "\n";
printf("WARNING: if the language keyword is not found, default language will be loaded (eng).\n\n"); std::cout << "WARNING: if the language keyword is not found, default language will be loaded (eng).\n\n";
} }
printf("\n"); std::cout << std::endl;
printf(" ___ _.'\\ /'._ ___ \n"); std::cout << " ___ _.'\\ /'._ ___ \n";
printf("/ b__--- | .'\"'. | ---__d \\\n"); std::cout << "/ b__--- | .'\"'. | ---__d \\\n";
printf("\\ p\"\"---_| '._.' |_---\"\"q /\n"); std::cout << "\\ p\"\"---_| '._.' |_---\"\"q /\n";
printf(" / / ./ \\. \\ \\ \n"); std::cout << " / / ./ \\. \\ \\ \n";
printf(" / / '---' \\ \\ \n"); std::cout << " / / '---' \\ \\ \n";
printf(" /_/ \\_\\ \n"); std::cout << " /_/ \\_\\ \n";
printf(" \n\n"); std::cout << " \n\n";
printf("Application started! Lift 'em!\n\n"); std::cout << "Application started! Lift 'em!\n\n";
app = new OpenViBEVRDemos::CSpaceshipBCI(l_slocalization); app = new OpenViBEVRDemos::CSpaceshipBCI(l_slocalization);
} }
else if (strcmp(argv[1], "handball") == 0) else if (strcmp(argv[1], "handball") == 0)
{ {
printf("Handball application started !\n"); std::cout << "Handball application started !\n";
app = new OpenViBEVRDemos::CHandballBCI(); app = new OpenViBEVRDemos::CHandballBCI();
} }
else else
{ {
printf("ERROR: the application specified does not exist (%s).\n", argv[1]); std::cout << "ERROR: the application specified does not exist (" << argv[1] << ").\n";
printf("Please use one of the following applications:\n"); std::cout << "Please use one of the following applications:\n";
printf(" - spaceship\n"); std::cout << " - spaceship\n";
printf(" - handball\n"); std::cout << " - handball\n";
return 2; return 2;
} }
...@@ -79,7 +78,7 @@ int main(int argc, char** argv) ...@@ -79,7 +78,7 @@ int main(int argc, char** argv)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
printf("VR demo has not been compiled as it depends on Ogre (missing/disabled)\n"); std::cout << "VR demo has not been compiled as it depends on Ogre (missing/disabled)\n";
return -1; return -1;
} }
......
...@@ -100,7 +100,7 @@ bool C3DEntityManipulator::processEvent(OMK::Event* pEvent) ...@@ -100,7 +100,7 @@ bool C3DEntityManipulator::processEvent(OMK::Event* pEvent)
if(l_pEvent) if(l_pEvent)
{ {
const VrpnButtonState& l_rVrpnButtonState=l_pEvent->value; const VrpnButtonState& l_rVrpnButtonState=l_pEvent->value;
if(l_rVrpnButtonState.first<(int)(sizeof(m_bButton)/sizeof(m_bButton[0]))) if(l_rVrpnButtonState.first<int(sizeof(m_bButton)/sizeof(m_bButton[0])))
{ {
m_bButton[l_rVrpnButtonState.first]=(l_rVrpnButtonState.second?true:false); m_bButton[l_rVrpnButtonState.first]=(l_rVrpnButtonState.second?true:false);
} }
......
...@@ -56,7 +56,7 @@ void CManipulable3DEntity::compute() ...@@ -56,7 +56,7 @@ void CManipulable3DEntity::compute()
if(l_iDelta>duration-fadeout) if(l_iDelta>duration-fadeout)
{ {
double l_dCoef=(l_iDelta-duration+fadeout)/(double)(fadeout); // 0-1 double l_dCoef=(l_iDelta-duration+fadeout)/double(fadeout); // 0-1
double l_dRotation=3*180*pow(l_dCoef, 4); double l_dRotation=3*180*pow(l_dCoef, 4);
m_oOrientation[0]=l_dRotation; m_oOrientation[0]=l_dRotation;
m_oOrientation[1]=3*l_dRotation*sin(M_PI*pow(l_dCoef, 3)*2); m_oOrientation[1]=3*l_dRotation*sin(M_PI*pow(l_dCoef, 3)*2);
......
...@@ -34,7 +34,7 @@ void CNeurofeedbackScoreCounter::init() ...@@ -34,7 +34,7 @@ void CNeurofeedbackScoreCounter::init()
void CNeurofeedbackScoreCounter::compute() void CNeurofeedbackScoreCounter::compute()
{ {
double l_dSpeed=.01; double l_dSpeed=.01;
m_oScale=(float)l_dSpeed*m_oScaleTarget+(float)(1-l_dSpeed)*m_oScale; m_oScale=(float)l_dSpeed*m_oScaleTarget+float(1-l_dSpeed)*m_oScale;
sendValuedEvent("OpenViBE_score_counter", g_sManipulate3DEntity_SetScale, ScaleType(m_oScale)); sendValuedEvent("OpenViBE_score_counter", g_sManipulate3DEntity_SetScale, ScaleType(m_oScale));
} }
...@@ -47,7 +47,7 @@ bool CNeurofeedbackScoreCounter::processEvent(OMK::Event* pEvent) ...@@ -47,7 +47,7 @@ bool CNeurofeedbackScoreCounter::processEvent(OMK::Event* pEvent)
if(l_pEvent) if(l_pEvent)
{ {
const VrpnButtonState& l_rVrpnButtonState=l_pEvent->value; const VrpnButtonState& l_rVrpnButtonState=l_pEvent->value;
if(l_rVrpnButtonState.first<(int)(sizeof(m_bButton)/sizeof(m_bButton[0]))) if(l_rVrpnButtonState.first<int(sizeof(m_bButton)/sizeof(m_bButton[0])))
{ {
m_bButton[l_rVrpnButtonState.first]=(l_rVrpnButtonState.second?true:false); m_bButton[l_rVrpnButtonState.first]=(l_rVrpnButtonState.second?true:false);
if(l_rVrpnButtonState.first==3) if(l_rVrpnButtonState.first==3)
......
...@@ -39,7 +39,7 @@ bool CNeurofeedbackSwitch::processEvent(OMK::Event* pEvent) ...@@ -39,7 +39,7 @@ bool CNeurofeedbackSwitch::processEvent(OMK::Event* pEvent)
if(l_pEvent) if(l_pEvent)
{ {
const VrpnButtonState& l_rVrpnButtonState=l_pEvent->value; const VrpnButtonState& l_rVrpnButtonState=l_pEvent->value;
if(l_rVrpnButtonState.first<(int)(sizeof(m_bButton)/sizeof(m_bButton[0]))) if(l_rVrpnButtonState.first<int(sizeof(m_bButton)/sizeof(m_bButton[0])))
{ {
m_bButton[l_rVrpnButtonState.first]=(l_rVrpnButtonState.second?true:false); m_bButton[l_rVrpnButtonState.first]=(l_rVrpnButtonState.second?true:false);
......
...@@ -34,8 +34,8 @@ bool CPluginObjectDescEnum::enumeratePluginObjectDesc(const CIdentifier& rParent ...@@ -34,8 +34,8 @@ bool CPluginObjectDescEnum::enumeratePluginObjectDesc(const CIdentifier& rParent
std::string CPluginObjectDescEnum::transform(const std::string& sInput, const bool bRemoveSlash) std::string CPluginObjectDescEnum::transform(const std::string& sInput, const bool bRemoveSlash)
{ {
std::string l_sInput(sInput); std::string l_sInput(sInput);
std::string l_sOutput; std::string output;
bool l_bLastWasSeparator = true; bool lastWasSeparator = true;
for (std::string::size_type i = 0; i < l_sInput.length(); i++) for (std::string::size_type i = 0; i < l_sInput.length(); i++)
{ {
...@@ -43,24 +43,19 @@ std::string CPluginObjectDescEnum::transform(const std::string& sInput, const bo ...@@ -43,24 +43,19 @@ std::string CPluginObjectDescEnum::transform(const std::string& sInput, const bo
{ {
if (l_sInput[i] == '/') if (l_sInput[i] == '/')
{ {
l_sOutput += "_"; output += "_";
} }
else else
{ {
l_sOutput += l_bLastWasSeparator ? std::toupper(l_sInput[i]) : l_sInput[i]; output += lastWasSeparator ? std::toupper(l_sInput[i]) : l_sInput[i];
} }
l_bLastWasSeparator = false; lastWasSeparator = false;
} }
else else
{ {
/* //if(!lastWasSeparator) { output+="_"; }
if(!l_bLastWasSeparator) lastWasSeparator = true;
{
l_sOutput+="_";
}
*/
l_bLastWasSeparator = true;
} }
} }
return l_sOutput; return output;
} }
...@@ -53,9 +53,9 @@ namespace ...@@ -53,9 +53,9 @@ namespace
l_ui64Result+=l_ui32Value2; l_ui64Result+=l_ui32Value2;
l_oGdkColor.pixel=(guint16)0; l_oGdkColor.pixel=(guint16)0;
l_oGdkColor.red =(guint16)(((l_ui64Result )&0xffff)|0x8000); l_oGdkColor.red =guint16(((l_ui64Result )&0xffff)|0x8000);
l_oGdkColor.green=(guint16)(((l_ui64Result>>16)&0xffff)|0x8000); l_oGdkColor.green=guint16(((l_ui64Result>>16)&0xffff)|0x8000);
l_oGdkColor.blue =(guint16)(((l_ui64Result>>32)&0xffff)|0x8000); l_oGdkColor.blue =guint16(((l_ui64Result>>32)&0xffff)|0x8000);
return l_oGdkColor; return l_oGdkColor;
} }
......
...@@ -65,7 +65,7 @@ bool CBoxAlgorithm@@ClassName@@::processInput(const uint32_t ui32InputIndex) ...@@ -65,7 +65,7 @@ bool CBoxAlgorithm@@ClassName@@::processInput(const uint32_t ui32InputIndex)
/*******************************************************************************/ /*******************************************************************************/
@@ProcessMessageCommentIn@@ @@ProcessMessageCommentIn@@
OpenViBE::bool CBoxAlgorithm@@ClassName@@::processMessage(const IMessageWithData& msg, uint32_t inputIndex) OpenViBE::bool CBoxAlgorithm@@ClassName@@::processMessage(const IMessageWithData& msg, uint32_t index)
{ {
//If you know what the message should contain, you can directly access the values by using //If you know what the message should contain, you can directly access the values by using
//getters of the message class with known keys. Otherwise, you can loop over the contents to discover the keys. //getters of the message class with known keys. Otherwise, you can loop over the contents to discover the keys.
......