Commit 37e86a85 authored by Jussi Lindgren's avatar Jussi Lindgren

Merge branch 'master' of...

Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/openvibe/openvibe into wip-jlindgre-basic-p300-tweaks
parents 465d069d 945c04af
......@@ -16,16 +16,16 @@ ENDIF(WIN32)
### Do not enable the commented out sikuli tests unless you
### or your lab commits to keep them passing in the long term.
FIND_PROGRAM(SIKULI NAMES sikuli-ide)
IF(SIKULI)
IF(UNIX)
# ADD_TEST(sikuli_basic_interface_designer "${SIKULI}" -t testStartInterface.UNIX.sikuli)
ADD_TEST(sikuli_boxSetAttribute "${SIKULI}" -t testBoxSetAttribute.UNIX.sikuli)
ADD_TEST(sikuli_DrawPerformance3Boxes_designer "${SIKULI}" -t testDrawPerformance3boxes.UNIX.sikuli)
ADD_TEST(sikuli_DrawPerformance400Boxes_designer "${SIKULI}" -t testDrawPerformance400boxes.UNIX.sikuli)
# ADD_TEST(sikuli_ChangeSettingsOnLine "${SIKULI}" -t testModUI.UNIX.sikuli)
ENDIF(UNIX)
ENDIF(SIKULI)
#FIND_PROGRAM(SIKULI NAMES sikuli-ide)
#IF(SIKULI)
# IF(UNIX)
# ADD_TEST(sikuli_basic_interface_designer "${SIKULI}" -t testStartInterface.UNIX.sikuli)
# ADD_TEST(sikuli_boxSetAttribute "${SIKULI}" -t testBoxSetAttribute.UNIX.sikuli)
# ADD_TEST(sikuli_DrawPerformance3Boxes_designer "${SIKULI}" -t testDrawPerformance3boxes.UNIX.sikuli)
# ADD_TEST(sikuli_DrawPerformance400Boxes_designer "${SIKULI}" -t testDrawPerformance400boxes.UNIX.sikuli)
# ADD_TEST(sikuli_ChangeSettingsOnLine "${SIKULI}" -t testModUI.UNIX.sikuli)
# ENDIF(UNIX)
#ENDIF(SIKULI)
......@@ -38,3 +38,21 @@ IF(WIN32)
MESSAGE(STATUS " FAILED to find gUSBampCAPI")
ENDIF(PATH_GUSBampCAPI)
ENDIF(WIN32)
IF(UNIX)
# To try other versions of the gtec's library, change the number below
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so.1.14")
FIND_LIBRARY(gUSBAmpLinux_LIBRARY NAMES "gusbampapi" PATHS "/usr/lib" "/usr/local/lib")
IF(gUSBAmpLinux_LIBRARY)
MESSAGE(STATUS " Found GUSBAmpAPILinux...")
MESSAGE(STATUS " [ OK ] Third party lib ${gUSBAmpLinux_LIBRARY}")
ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyGUSBampCAPI_Linux)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${gUSBAmpLinux_LIBRARY} )
ELSE(gUSBAmpLinux_LIBRARY)
MESSAGE(STATUS " FAILED to find GUSBAmpAPI Linux... ")
MESSAGE(STATUS " : If it should be found, see that 'libgusbampapi.so.1.14' link exists on the fs, with no further nemeric suffixes in the filename.")
MESSAGE(STATUS " : e.g. do 'cd /usr/lib/ ; ln -s libgusbampapi.so.1.14'. See gtec-bcilab/README for details.")
ENDIF(gUSBAmpLinux_LIBRARY)
SET(OV_ThirdPartyGUSBAmp "YES")
ENDIF(UNIX)
FIND_PROGRAM(SIKULI NAMES sikuli-ide)
IF(SIKULI)
IF(UNIX)
ADD_TEST(basic_external_stimulator "${SIKULI}" -t testBasicExternalStimulator.UNIX.sikuli)
ENDIF(UNIX)
ENDIF(SIKULI)
### Do not enable the commented out sikuli tests unless you
### or your lab commits to keep them passing in the long term.
#FIND_PROGRAM(SIKULI NAMES sikuli-ide)
#IF(SIKULI)
# IF(UNIX)
# ADD_TEST(basic_external_stimulator "${SIKULI}" -t testBasicExternalStimulator.UNIX.sikuli)
# ENDIF(UNIX)
#ENDIF(SIKULI)
......
......@@ -42,6 +42,7 @@ OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/cognio
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/ctfvsm-meg")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/field-trip-protocol")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/gtec-gipsa")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/gtec-bcilab")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/gtec-gmobilabplus")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/gtec-gusbamp")
OV_ADD_CONTRIB_DRIVER("${CMAKE_SOURCE_DIR}/contrib/plugins/server-drivers/mbt-smarting")
......
......@@ -13,6 +13,7 @@
#include "ovasCDriverCtfVsmMeg.h"
#include "ovasCDriverGTecGUSBamp.h"
#include "ovasCDriverGTecGUSBampLegacy.h"
#include "ovasCDriverGTecGUSBampLinux.h"
#include "ovasCDriverGTecGMobiLabPlus.h"
#include "ovasCDriverFieldtrip.h"
#include "ovasCDriverMBTSmarting.h"
......@@ -38,6 +39,9 @@ namespace OpenViBEContributions {
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverGTecGUSBamp(pAcquisitionServer->getDriverContext()));
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverGTecGUSBampLegacy(pAcquisitionServer->getDriverContext()));
#endif
#if defined TARGET_HAS_ThirdPartyGUSBampCAPI_Linux
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverGTecGUSBampLinux(pAcquisitionServer->getDriverContext()));
#endif
#if defined TARGET_HAS_ThirdPartyGMobiLabPlusAPI
vDriver->push_back(new OpenViBEAcquisitionServer::CDriverGTecGMobiLabPlus(pAcquisitionServer->getDriverContext()));
#endif
......
......@@ -87,51 +87,68 @@ boolean CDriverEEGO::initialize(
if(m_rDriverContext.isConnected()) return false;
if(!m_oHeader.isChannelCountSet()||!m_oHeader.isSamplingFrequencySet()) return false;
// Builds up a buffer to store
// acquired samples. This buffer
// will be sent to the acquisition
// server later...
m_pSample=new float32[m_oHeader.getChannelCount()*ui32SampleCountPerSentBlock];
m_ui32SamplesInBuffer=0;
if(!m_pSample)
try
{
delete [] m_pSample;
m_pSample=NULL;
return false;
}
// To initialize we need to locate the path of the DLL
// Create path to the dll
const OpenViBE::CString l_oLibDir=Directories::getBinDir()+"\\eego-SDK.dll";
auto l_sPath=l_oLibDir.toASCIIString();
// Builds up a buffer to store
// acquired samples. This buffer
// will be sent to the acquisition
// server later...
m_pSample = new float32[m_oHeader.getChannelCount()*ui32SampleCountPerSentBlock];
m_ui32SamplesInBuffer = 0;
if (!m_pSample)
{
throw std::exception("Failed to allocate sample buffer");
}
// create the amplifier factory
es::factory fact(l_sPath);
// create the amplifier factory
// To initialize we need to locate the path of the DLL
// Create path to the dll
const OpenViBE::CString l_oLibDir = Directories::getBinDir() + "\\eego-SDK.dll";
auto l_sPath = l_oLibDir.toASCIIString();
m_rDriverContext.getLogManager() << LogLevel_Debug << "SDK dll path: " << l_sPath << "\n";
es::factory fact(l_sPath);
// to check what is going on case of error; Log version
const auto version=fact.getVersion();
m_rDriverContext.getLogManager()<<LogLevel_Info<<"EEGO RT: Version: "<<version.major<<"."<<version.minor<<"."<<version.micro<<"."<<version.build<<"\n";
// to check what is going on case of error; Log version
const auto version = fact.getVersion();
m_rDriverContext.getLogManager() << LogLevel_Info << "EEGO RT: Version: " << version.major << "." << version.minor << "." << version.micro << "." << version.build << "\n";
// Get the amplifier. If none is connected an exception will be thrown
try
{
m_pAmplifier=fact.getAmplifier();
// Get the amplifier. If none is connected an exception will be thrown
try
{
m_pAmplifier = fact.getAmplifier();
}
catch (const std::exception& ex)
{
m_rDriverContext.getLogManager() << LogLevel_Warning << "Failure to get an amplifier! Reason: " << ex.what() << "\n";
throw;
}
if (m_rDriverContext.isImpedanceCheckRequested())
{
// After init we are in impedance mode until the recording is started
OpenViBE::uint64 l_i64MaskEEG = getRefChannelMask(); // Only the reference channels can be measured
m_pStream = m_pAmplifier->OpenImpedanceStream(l_i64MaskEEG);
}
}
catch (const std::exception& ex)
{
m_rDriverContext.getLogManager()<<LogLevel_Warning<<"Failure to get an amplifier! Reason: "<<ex.what()<<"\n";
m_rDriverContext.getLogManager() << LogLevel_Error << "Failed to initialize the driver. Exception: " << ex.what() << "\n";
// Cleanup
delete[] m_pSample;
m_pSample = NULL;
delete m_pAmplifier;
m_pAmplifier = NULL;
delete m_pStream;
m_pStream = NULL;
return false;
}
// Saves parameters
// Save parameters
m_pCallback=&rCallback;
m_ui32SampleCountPerSentBlock=ui32SampleCountPerSentBlock;
// After init we are in impedance mode until the recording is started
OpenViBE::uint64 l_i64MaskEEG=getRefChannelMask(); // Only the reference channels can be measured
m_pStream=m_pAmplifier->OpenImpedanceStream(l_i64MaskEEG);
return true;
}
......@@ -264,11 +281,16 @@ boolean CDriverEEGO::start(void)
boolean CDriverEEGO::loop(void)
{
if(!m_rDriverContext.isConnected()) return false;
if (!m_rDriverContext.isStarted()
&& !m_rDriverContext.isImpedanceCheckRequested())
return true; // Nothing to be done here!
if(!m_pStream) return false;
// Check if we really provide enough channels
// When doing impedance only the normal EEG channels are tested. This is fine and handled.
if(m_pStream->getChannelList().size() < m_oHeader.getChannelCount()
&& m_rDriverContext.isStarted()) // !started -> impedance
&& m_rDriverContext.isStarted()) // !started -> impedance
{
m_rDriverContext.getLogManager()<<LogLevel_Error<<"The amplifier got asked for more channels than it could provide";
return false;
......@@ -340,25 +362,26 @@ boolean CDriverEEGO::loop(void)
}
else // Impedance
{
// Get the impedance data, here the data is always the most current state.
// Get the impedance data, here the data is always the most current state.
// The method can block if impedance still needs to be calculated.
eemagine::sdk::buffer data;
try
{
data=m_pStream->getData();
data = m_pStream->getData();
}
catch(const std::exception& ex)
catch (const std::exception& ex)
{
m_rDriverContext.getLogManager()<<LogLevel_Error<<"Error fetching data: "<<ex.what();
m_rDriverContext.getLogManager() << LogLevel_Error << "Error fetching data: " << ex.what();
return false;
}
// We have to take care not to r/w over any boundary.
OpenViBE::uint32 minChannels=min(data.getChannelCount(), m_oHeader.getChannelCount());
for(OpenViBE::uint32 channel=0; channel < minChannels; channel++)
OpenViBE::uint32 minChannels = min(data.getChannelCount(), m_oHeader.getChannelCount());
for (OpenViBE::uint32 channel = 0; channel < minChannels; channel++)
{
m_rDriverContext.updateImpedance(channel, data.getSample(channel, 0));
}
}
return true;
......@@ -375,7 +398,10 @@ boolean CDriverEEGO::stop(void)
// ...
delete m_pStream;
m_pStream=NULL; // Deletion of the stream stops the streaming.
m_pStream=m_pAmplifier->OpenImpedanceStream(getRefChannelMask()); // And we can stream Impedances once more.
if (m_rDriverContext.isImpedanceCheckRequested())
{
m_pStream = m_pAmplifier->OpenImpedanceStream(getRefChannelMask()); // And we can stream Impedances once more.
}
return true;
}
......
The MIT License (MIT)
Copyright (c) 2015 Thomas Stewart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Acknowledgements:
This driver was written by Tom Stewart under the supervision of
Dr. Tomasz M. Rutkowski in the University of Tsukuba's BCI Laboratory
http://bci-lab.info/
Installation:
The driver was developed using gtec's Linux C API 1.14.02. For it build properly,
the install.sh supplied with the gtec API needs to have been run which should
have created the following files:
/usr/lib/libgusbampapiso.so.1.14.02
/usr/include/gAPI.h
/etc/gtec/filter_files/DSPfilter.bin
/etc/gtec/filter_files/DSPNotchfilter.bin
To access the USB without being root, you'll need to add yourself to the
plugdev group and write a udev rule.
To do that, first check if there is a plugdev group:
$ groups
If there isn't already a plugdev group, then add it using:
$ sudo groupadd plugdev
Now execute the following:
$ sudo usermod -a -G plugdev <your-username>
If you're not sure what your username is, check it with:
$ whoami
Next create a file named /etc/udev/rules.d/10-gusbamp-usb.rules
$ sudo touch /etc/udev/rules.d/10-gusbamp-usb.rules
And open it with nano editor
$ sudo nano /etc/udev/rules.d/10-gusbamp-usb.rules
Now paste the following line into the editor:
ATTRS{idProduct}=="0001", ATTRS{idVendor}=="153c", MODE="666", GROUP="plugdev"
The values for idProduct and idVendor should match the ones that show up just
after you've plugged in the amplifier and executed:
$ dmesg
Lastly, be sure to log out and back in.
Useage:
The driver gives access to everything in the API with the exception of the channel
calibration and asynchronous configuration for digital outputs.
To run multiple gUSBAmps in parallel, use multiple instances of the acquisition server
and configure each instance as Master / Slave according to gtec's documentation. When
starting the acquisition, first connect to all the devices then press play on each device
starting with the master.
This source diff could not be displayed because it is too large. You can view the blob instead.
#ifndef QUEUE_H
#define QUEUE_H
#if defined TARGET_HAS_ThirdPartyGUSBampCAPI_Linux
#include <stdint.h>
#include <string.h>
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
template <class QueueType> class Queue
{
QueueType *buffer;
int head, tail;
int size;
public:
Queue() { size = head = tail = 0; }
Queue(QueueType *array, int len)
{
head = tail = 0;
size = len;
buffer = array;
}
void SetBuffer(QueueType *array, int len)
{
size = len;
head = tail = 0;
buffer = array;
}
int Get(QueueType *elements, int len)
{
// Trim the length if necessary to only as large as the number of available elements in the buffer
len = MIN(len, Avail());
int nonwrapped = MIN((size - tail), len), wrapped = len - nonwrapped;
// memcpy the data starting at the head all the way up to the last element *(storage - 1)
memcpy(elements, (buffer + tail), nonwrapped * sizeof(QueueType));
// If there's still data to copy memcpy whatever remains, starting at the first element *(begin) until the end of data. The first step will have ensured
// that we don't crash into the tail during this process.
memcpy((elements + nonwrapped), buffer, wrapped * sizeof(QueueType));
// Recalculate head
tail = (tail + nonwrapped + wrapped) % size;
return len;
}
// Returns the number of bytes actually placed in the array
int Put(const QueueType *elements, int len)
{
// Trim the length if necessary to only as large as the nuber of free elements in the buffer
len = MIN(len, Free());
// Figure out how much to append to the end of the buffer and how much will overlap onto the start
int nonwrapped = MIN((size - head), len), wrapped = len - nonwrapped;
// memcpy the data starting at the head all the way up to the last element *(storage - 1)
memcpy((buffer + head), elements, nonwrapped * sizeof(QueueType));
// If there's still data to copy memcpy whatever remains onto the beginning of the array
memcpy(buffer,(elements + nonwrapped), wrapped * sizeof(QueueType));
// Re-recalculate head
head = (head + nonwrapped + wrapped) % size;
return len;
}
// Expand the size of queue without actually modifying any of the contents - useful for copying directly onto the queu buffer
int Pad(int len)
{
// Trim the length if necessary to only as large as the nuber of free elements in the buffer
len = MIN(len, Free());
// Figure out how much to append to the end of the buffer and how much will overlap onto the start
int nonwrapped = MIN((size - head), len), wrapped = len - nonwrapped;
// Re-recalculate head
head = (head + nonwrapped + wrapped) % size;
return len;
}
// Removes the oldest entry from the Queue
void Pop() { if(Avail()) tail = (tail + 1) % size; }
// Returns the oldest element in the array (the one added before any other)
QueueType &Tail() { return buffer[tail]; }
// Returns the newest element in the array (the one added after every other)
QueueType &Head() { return buffer[(head + size - 1) % size]; }
QueueType &operator[] (int n) { return buffer[tail + n % size]; }
void Clear() { head = tail = 0; }
int Avail() { return (size + head - tail) % size; }
int Free() { return (size - 1 - Avail()); }
// Gets the number of free elements that can be stored contiguously
int FreeContiguous() { return head < tail? tail - head - 1 : MIN(size - head, Free()); }
// Gets a pointer to the next free address in the buffer
QueueType *NextFreeAddress() { return buffer + head; }
};
#endif // TARGET_HAS_ThirdPartyGUSBampCAPI_Linux
#endif // QUEUE_H
#ifndef __OpenViBE_AcquisitionServer_CConfigurationGTecGUSBampLinux_H__
#define __OpenViBE_AcquisitionServer_CConfigurationGTecGUSBampLinux_H__
#if defined TARGET_HAS_ThirdPartyGUSBampCAPI_Linux
#include "../ovasCConfigurationBuilder.h"
#include "ovasIDriver.h"
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gAPI.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
namespace OpenViBEAcquisitionServer
{
/**
* \class CConfigurationGTecGUSBampLinux
* \author Tom Stewart (University of Tsukuba)
* \date Mon Feb 9 18:59:22 2015
* \brief The CConfigurationGTecGUSBampLinux handles the configuration dialog specific to the g.tec g.USBamp for Linux device.
*
* TODO: details
*
* \sa CDriverGTecGUSBampLinux
*/
class CConfigurationGTecGUSBampLinux : public OpenViBEAcquisitionServer::CConfigurationBuilder
{
public:
// Thresholds for reporting on measured impedance, these are the same as the ones that the simulink driver uses
static const int LowImpedance = 5, ModerateImpedance = 7, HighImpedance = 100;
enum ChannelTreeViewColumn { ChannelColumn = 0, BipolarColumn, NotchColumn, NotchIdColumn, BandpassColumn, BandpassIdColumn };
// you may have to add to your constructor some reference parameters
// for example, a connection ID:
CConfigurationGTecGUSBampLinux(OpenViBEAcquisitionServer::IDriverContext& rDriverContext, const char* sGtkBuilderFileName, std::string *pDeviceName, gt_usbamp_config *pConfig);
virtual OpenViBE::boolean preConfigure(void);
virtual OpenViBE::boolean postConfigure(void);
void OnButtonApplyConfigPressed(ChannelTreeViewColumn type);
void OnButtonCheckImpedanceClicked(void);
void OnComboboxSamplingFrequencyChanged(void);
void OnComboboxDeviceChanged(void);
protected:
OpenViBEAcquisitionServer::IDriverContext& m_rDriverContext;
private:
/*
* Insert here all specific attributes, such as a connection ID.
* use references to directly modify the corresponding attribute of the driver
* Example:
*/
std::string *m_pDeviceName;
gt_usbamp_config *m_pConfig;
void UpdateFilters(void);
};
};
#endif // TARGET_HAS_ThirdPartyGUSBampCAPI_Linux
#endif // __OpenViBE_AcquisitionServer_CConfigurationGTecGUSBampLinux_H__
#ifndef __OpenViBE_AcquisitionServer_CDriverGTecGUSBampLinux_H__
#define __OpenViBE_AcquisitionServer_CDriverGTecGUSBampLinux_H__
#if defined TARGET_HAS_ThirdPartyGUSBampCAPI_Linux
#include "ovasIDriver.h"
#include "../ovasCHeader.h"
#include <openvibe/ov_all.h>
#include "../ovasCSettingsHelper.h"
#include "../ovasCSettingsHelperOperators.h"
#include <gAPI.h>
#include "Queue.h"
namespace OpenViBEAcquisitionServer
{
void OnDataReady(void *param);
/**
* \class CDriverGTecGUSBampLinux
* \author Tom Stewart (University of Tsukuba)
* \date Mon Feb 9 18:59:22 2015
* \brief The CDriverGTecGUSBampLinux allows the acquisition server to acquire data from a g.tec g.USBamp from Linux.
*
* \sa CConfigurationGTecGUSBampLinux
*/
class CDriverGTecGUSBampLinux : public OpenViBEAcquisitionServer::IDriver
{
static const int ReceiveBufferSize = 8192;
public:
friend void OnDataReady(void *param);
CDriverGTecGUSBampLinux(OpenViBEAcquisitionServer::IDriverContext& rDriverContext);
virtual ~CDriverGTecGUSBampLinux(void);
virtual const char* getName(void);
virtual OpenViBE::boolean initialize(const OpenViBE::uint32 ui32SampleCountPerSentBlock, OpenViBEAcquisitionServer::IDriverCallback& rCallback);
virtual OpenViBE::boolean uninitialize(void);
virtual OpenViBE::boolean start(void);
virtual OpenViBE::boolean stop(void);
virtual OpenViBE::boolean loop(void);
virtual OpenViBE::boolean isConfigurable(void);
virtual OpenViBE::boolean configure(void);
virtual const OpenViBEAcquisitionServer::IHeader* getHeader(void) { return &m_oHeader; }
virtual OpenViBE::boolean isFlagSet(const OpenViBEAcquisitionServer::EDriverFlag eFlag) const
{
return eFlag==DriverFlag_IsUnstable;
}
protected:
SettingsHelper m_oSettings;
OpenViBEAcquisitionServer::IDriverCallback* m_pCallback;
// Replace this generic Header with any specific header you might have written
OpenViBEAcquisitionServer::CHeader m_oHeader;
OpenViBE::uint32 m_ui32SampleCountPerSentBlock;
OpenViBE::float32 *m_pSampleSend, *m_pSampleReceive, *m_pSampleBuffer;
Queue<OpenViBE::float32> m_oSampleQueue;
private:
/*
* Insert here all specific attributes, such as USB port number or device ID.
*/
std::string m_oDeviceName;
gt_usbamp_config m_oConfig;
gt_usbamp_analog_out_config m_oAnalogOutConfig;
// Keeps track of where we are with filling up the buffer
OpenViBE::uint32 m_ui32CurrentSample, m_ui32CurrentChannel;
};
};
#endif // TARGET_HAS_ThirdPartyGUSBampCAPI_Linux
#endif // __OpenViBE_AcquisitionServer_CDriverGTecGUSBampLinux_H__
......@@ -52,7 +52,7 @@ OpenViBE::uint32 CBoxAlgorithmSpatialFilter::loadCoefficients(const OpenViBE::CS
this->getLogManager() << LogLevel_Error << "Number of coefficients expected ("
<< nRows * nCols << ") did not match the number counted ("
<< l_u32count << ")\n";
return false;
return 0;
}
// Resize in one step for efficiency.
......@@ -68,11 +68,6 @@ OpenViBE::uint32 CBoxAlgorithmSpatialFilter::loadCoefficients(const OpenViBE::CS
uint32 l_ui32currentIdx = 0;
while(*l_sPtr!=0)
{
if(l_ui32currentIdx >= l_u32count) {
this->getLogManager() << LogLevel_Error << "Parsed too many coefficients\n";
return false;
}
const int BUFFSIZE=1024;
char l_sBuffer[BUFFSIZE];
// Skip separator characters
......@@ -99,6 +94,10 @@ OpenViBE::uint32 CBoxAlgorithmSpatialFilter::loadCoefficients(const OpenViBE::CS
}
l_sBuffer[i]=0;