diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-03-17 16:15:51 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-03-17 16:15:51 +0000 |
commit | 9184ea73941814b95c2768d8bcca8bdb77655891 (patch) | |
tree | 9cf5977e95abb7e42a719730560c145c1b33c9ba /FTNoIR_Tracker_SM | |
parent | 9ae8a2212d0c85cfa904ea3bf03c0631f6c1369a (diff) |
Changed Tracker code, so the DLL's are true plug-ins.
FaceTrackNoIR will scan the bin folder for FTNoIR_Tracker*.dll and put the names in the combobox.
All Trackers have 3 new member-functions (like the filters).
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@104 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_SM')
-rw-r--r-- | FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h | 60 | ||||
-rw-r--r-- | FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj | 82 | ||||
-rw-r--r-- | FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp | 409 | ||||
-rw-r--r-- | FTNoIR_Tracker_SM/images/SeeingMachines.ico | bin | 0 -> 37798 bytes |
4 files changed, 191 insertions, 360 deletions
diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h index 4a26a824..a4933c35 100644 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h +++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h @@ -1,3 +1,27 @@ +/********************************************************************************
+* FaceTrackNoIR This program is a private project of some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2012 Wim Vriend (Developing) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage: http://facetracknoir.sourceforge.net/home/default.htm *
+* *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 3 of the License, or (at your *
+* option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, but *
+* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
+* more details. *
+* *
+* You should have received a copy of the GNU General Public License along *
+* with this program; if not, see <http://www.gnu.org/licenses/>. *
+* *
+********************************************************************************/
#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h"
#include "..\ftnoir_tracker_base\ftnoir_tracker_sm_types.h"
#include "ui_FTNoIR_SM_controls.h"
@@ -10,11 +34,11 @@ using namespace std;
-class FTNoIR_Tracker_SM : public ITracker
+class FTNoIR_Tracker : public ITracker
{
public:
- FTNoIR_Tracker_SM();
- ~FTNoIR_Tracker_SM();
+ FTNoIR_Tracker();
+ ~FTNoIR_Tracker();
void Release();
void Initialize( QFrame *videoframe );
@@ -24,7 +48,9 @@ public: void loadSettings();
bool SMCreateMapping();
- bool setParameterValue(const int index, const float newvalue);
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
private:
//
@@ -33,32 +59,32 @@ private: HANDLE hSMMemMap;
SMMemMap *pMemData;
HANDLE hSMMutex;
-// smEngineHeadPoseData new_head_pose;
QProcess *faceAPI;
- enum
- {
- kPortAddress=0, // Index in QList
- kNumFilterParameters // Indicate number of parameters used
- };
- QList<std::pair<float,float>> parameterRange;
- QList<float> parameterValueAsFloat;
+ QString trackerFullName; // Trackers' name and description
+ QString trackerShortName;
+ QString trackerDescription;
};
// Widget that has controls for SMoIR protocol client-settings.
-class SMClientControls: public QWidget, Ui::UICSMClientControls, public ITrackerDialog
+class TrackerControls: public QWidget, Ui::UICSMClientControls, public ITrackerDialog
{
Q_OBJECT
public:
- explicit SMClientControls();
- virtual ~SMClientControls();
+ explicit TrackerControls();
+ virtual ~TrackerControls();
void showEvent ( QShowEvent * event );
void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
+ void getIcon(QIcon *icon);
+
private:
Ui::UICSMClientControls ui;
void loadSettings();
@@ -80,6 +106,10 @@ private: smEngineHandle *engine_handle;
QTimer *timUpdateSettings; // Timer to display current settings
+ QString trackerFullName; // Trackers' name and description
+ QString trackerShortName;
+ QString trackerDescription;
+
private slots:
void doOK();
void doCancel();
diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj index b174725d..b5a3e5f4 100644 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj +++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj @@ -171,6 +171,10 @@ RelativePath=".\ftnoir_tracker_faceapi.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_tracker_faceapi_dialog.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
@@ -178,6 +182,14 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
+ RelativePath="..\FTNoIR_Tracker_Base\ftnoir_tracker_base.h"
+ >
+ </File>
+ <File
+ RelativePath="..\FTNoIR_Tracker_Base\ftnoir_tracker_base_global.h"
+ >
+ </File>
+ <File
RelativePath=".\FTNoIR_Tracker_SM.h"
>
<FileConfiguration
@@ -203,6 +215,10 @@ />
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\FTNoIR_Tracker_Base\ftnoir_tracker_types.h"
+ >
+ </File>
</Filter>
<Filter
Name="Form Files"
@@ -242,6 +258,52 @@ UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
ParseFiles="false"
>
+ <File
+ RelativePath=".\images\filter-16-ac.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Tracker.qrc"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Rcc'ing $(InputFileName)..."
+ CommandLine=""$(QTDIR)\bin\rcc.exe" -name "$(InputName)" -no-compress "$(InputPath)" -o .\GeneratedFiles\qrc_$(InputName).cpp
"
+ AdditionalDependencies="$(InputPath);.\images\filter-16-ac.png"
+ Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Rcc'ing $(InputFileName)..."
+ CommandLine=""$(QTDIR)\bin\rcc.exe" -name "$(InputName)" -no-compress "$(InputPath)" -o .\GeneratedFiles\qrc_$(InputName).cpp
"
+ AdditionalDependencies="$(InputPath);.\images\filter-16-ac.png"
+ Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ </File>
</Filter>
<Filter
Name="Generated Files"
@@ -250,6 +312,26 @@ SourceControlFiles="false"
>
<File
+ RelativePath=".\generatedfiles\qrc_Tracker.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\GeneratedFiles\ui_FTNoIR_SM_Controls.h"
>
</File>
diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp index 181a0e1d..c9b3bc0b 100644 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp +++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp @@ -1,20 +1,39 @@ +/********************************************************************************
+* FaceTrackNoIR This program is a private project of some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2012 Wim Vriend (Developing) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage: http://facetracknoir.sourceforge.net/home/default.htm *
+* *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 3 of the License, or (at your *
+* option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, but *
+* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
+* more details. *
+* *
+* You should have received a copy of the GNU General Public License along *
+* with this program; if not, see <http://www.gnu.org/licenses/>. *
+* *
+********************************************************************************/
#include "ftnoir_tracker_sm.h"
-//#include "sm_api_headtrackerv2controls.h"
#include <QtGui>
-FTNoIR_Tracker_SM::FTNoIR_Tracker_SM()
+FTNoIR_Tracker::FTNoIR_Tracker()
{
- //allocate memory for the parameters
- parameterValueAsFloat.clear();
- parameterRange.clear();
-
- // Add the parameters to the list
- parameterRange.append(std::pair<float,float>(1000.0f,9999.0f));
- parameterValueAsFloat.append(0.0f);
- setParameterValue(kPortAddress,5551.0f);
+ //populate the description strings
+ trackerFullName = "faceAPI V3.2.6";
+ trackerShortName = "faceAPI";
+ trackerDescription = "SeeingMachines faceAPI V3.2.6";
}
-FTNoIR_Tracker_SM::~FTNoIR_Tracker_SM()
+FTNoIR_Tracker::~FTNoIR_Tracker()
{
qDebug() << "stopTracker says: terminating";
@@ -27,9 +46,9 @@ FTNoIR_Tracker_SM::~FTNoIR_Tracker_SM() hSMMemMap = 0;
}
-void FTNoIR_Tracker_SM::Release()
+void FTNoIR_Tracker::Release()
{
- qDebug() << "FTNoIR_Tracker_SM::Release says: Starting ";
+ qDebug() << "FTNoIR_Tracker::Release says: Starting ";
if ( pMemData != NULL ) {
pMemData->command = FT_SM_EXIT; // Issue 'exit' command
@@ -37,12 +56,12 @@ void FTNoIR_Tracker_SM::Release() delete this;
}
-void FTNoIR_Tracker_SM::Initialize( QFrame *videoframe )
+void FTNoIR_Tracker::Initialize( QFrame *videoframe )
{
- qDebug() << "FTNoIR_Tracker_SM::Initialize says: Starting ";
+ qDebug() << "FTNoIR_Tracker::Initialize says: Starting ";
if (SMCreateMapping()) {
- qDebug() << "FTNoIR_Tracker_SM::Initialize Mapping created.";
+ qDebug() << "FTNoIR_Tracker::Initialize Mapping created.";
}
else {
QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton);
@@ -63,13 +82,13 @@ void FTNoIR_Tracker_SM::Initialize( QFrame *videoframe ) faceAPI->start(program);
// Show the video widget
- qDebug() << "FTNoIR_Tracker_SM::Initialize says: videoframe = " << videoframe;
+ qDebug() << "FTNoIR_Tracker::Initialize says: videoframe = " << videoframe;
videoframe->show();
return;
}
-void FTNoIR_Tracker_SM::StartTracker( HWND parent_window )
+void FTNoIR_Tracker::StartTracker( HWND parent_window )
{
if ( pMemData != NULL ) {
pMemData->command = FT_SM_START; // Start command
@@ -77,10 +96,10 @@ void FTNoIR_Tracker_SM::StartTracker( HWND parent_window ) return;
}
-void FTNoIR_Tracker_SM::StopTracker( bool exit )
+void FTNoIR_Tracker::StopTracker( bool exit )
{
- qDebug() << "FTNoIR_Tracker_SM::StopTracker says: Starting ";
+ qDebug() << "FTNoIR_Tracker::StopTracker says: Starting ";
// stops the faceapi engine
if ( pMemData != NULL ) {
// if (exit == true) {
@@ -93,14 +112,14 @@ void FTNoIR_Tracker_SM::StopTracker( bool exit ) return;
}
-bool FTNoIR_Tracker_SM::GiveHeadPoseData(THeadPoseData *data)
+bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data)
{
//
// Check if the pointer is OK and wait for the Mutex.
//
if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) {
-// qDebug() << "FTNoIR_Tracker_SM::GiveHeadPoseData says: Retrieving data.";
+// qDebug() << "FTNoIR_Tracker::GiveHeadPoseData says: Retrieving data.";
//
// Copy the measurements to FaceTrackNoIR.
@@ -123,46 +142,35 @@ bool FTNoIR_Tracker_SM::GiveHeadPoseData(THeadPoseData *data) return false;
}
-bool FTNoIR_Tracker_SM::setParameterValue(const int index, const float newvalue)
+void FTNoIR_Tracker::getFullName(QString *strToBeFilled)
{
- if ((index >= 0) && (index < parameterValueAsFloat.size()))
- {
- //
- // Limit the new value, using the defined range.
- //
- if (newvalue < parameterRange[index].first) {
- parameterValueAsFloat[index] = parameterRange[index].first;
- }
- else {
- if (newvalue > parameterRange[index].second) {
- parameterValueAsFloat[index] = parameterRange[index].second;
- }
- else {
- parameterValueAsFloat[index] = newvalue;
- }
- }
+ *strToBeFilled = trackerFullName;
+};
-// updateParameterString(index);
- return true;
- }
- else
- {
- return false;
- }
+
+void FTNoIR_Tracker::getShortName(QString *strToBeFilled)
+{
+ *strToBeFilled = trackerShortName;
+};
+
+
+void FTNoIR_Tracker::getDescription(QString *strToBeFilled)
+{
+ *strToBeFilled = trackerDescription;
};
//
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Tracker_SM::loadSettings() {
+void FTNoIR_Tracker::loadSettings() {
- qDebug() << "FTNoIR_Tracker_SM::loadSettings says: Starting ";
+ qDebug() << "FTNoIR_Tracker::loadSettings says: Starting ";
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
- qDebug() << "FTNoIR_Tracker_SM::loadSettings says: iniFile = " << currentFile;
+ qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile;
iniFile.beginGroup ( "SMTracker" );
if (pMemData) {
@@ -176,9 +184,9 @@ void FTNoIR_Tracker_SM::loadSettings() { // It contains the tracking data, a command-code from FaceTrackNoIR
//
//
-bool FTNoIR_Tracker_SM::SMCreateMapping()
+bool FTNoIR_Tracker::SMCreateMapping()
{
- qDebug() << "FTNoIR_Tracker_SM::FTCreateMapping says: Starting Function";
+ qDebug() << "FTNoIR_Tracker::FTCreateMapping says: Starting Function";
//
// A FileMapping is used to create 'shared memory' between the faceAPI and FaceTrackNoIR.
@@ -191,7 +199,7 @@ bool FTNoIR_Tracker_SM::SMCreateMapping() (LPCSTR) SM_MM_DATA );
if ( hSMMemMap != 0 ) {
- qDebug() << "FTNoIR_Tracker_SM::FTCreateMapping says: FileMapping Created!";
+ qDebug() << "FTNoIR_Tracker::FTCreateMapping says: FileMapping Created!";
}
if ( ( hSMMemMap != 0 ) && ( (long) GetLastError == ERROR_ALREADY_EXISTS ) ) {
@@ -204,16 +212,16 @@ bool FTNoIR_Tracker_SM::SMCreateMapping() //
hSMMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) SM_MM_DATA );
if ( ( hSMMemMap != 0 ) ) {
- qDebug() << "FTNoIR_Tracker_SM::FTCreateMapping says: FileMapping Created again..." << hSMMemMap;
+ qDebug() << "FTNoIR_Tracker::FTCreateMapping says: FileMapping Created again..." << hSMMemMap;
pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TFaceData));
if (pMemData != NULL) {
- qDebug() << "FTNoIR_Tracker_SM::FTCreateMapping says: MapViewOfFile OK.";
+ qDebug() << "FTNoIR_Tracker::FTCreateMapping says: MapViewOfFile OK.";
// pMemData->handle = handle; // The game uses the handle, to send a message that the Program-Name was set!
}
hSMMutex = CreateMutexA(NULL, false, SM_MUTEX);
}
else {
- qDebug() << "FTNoIR_Tracker_SM::FTCreateMapping says: Error creating Shared Memory for faceAPI!";
+ qDebug() << "FTNoIR_Tracker::FTCreateMapping says: Error creating Shared Memory for faceAPI!";
return false;
}
@@ -239,294 +247,5 @@ bool FTNoIR_Tracker_SM::SMCreateMapping() FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
{
- return new FTNoIR_Tracker_SM;
-}
-
-//*******************************************************************************************************
-// faceAPI Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-SMClientControls::SMClientControls() :
-QWidget()
-{
- ui.setupUi( this );
-
- // Connect Qt signals to member-functions
- connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
- connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.btnEngineStart, SIGNAL(clicked()), this, SLOT(doStartEngine()));
- connect(ui.btnEngineStop, SIGNAL(clicked()), this, SLOT(doStopEngine()));
-
- ui.cbxFilterSetting->addItem("None");
- ui.cbxFilterSetting->addItem("Normal");
- ui.cbxFilterSetting->addItem("High");
- connect(ui.cbxFilterSetting, SIGNAL(currentIndexChanged(int)), this, SLOT(doSetFilter( int )));
- connect(ui.btnCameraSettings, SIGNAL(clicked()), this, SLOT(doShowCam()));
-
- if (SMCreateMapping()) {
- qDebug() << "SMClientControls::Initialize Mapping created.";
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton);
- }
-
- // Load the settings from the current .INI-file
- loadSettings();
-
- //Setup the timer for showing the headpose.
- timUpdateSettings = new QTimer(this);
- connect(timUpdateSettings, SIGNAL(timeout()), this, SLOT(doTimUpdate()));
- timUpdateSettings->start(100);
- connect(this, SIGNAL(stateChanged( int )), this, SLOT(showSettings( int )));
-
-}
-
-//
-// Destructor for server-dialog
-//
-SMClientControls::~SMClientControls() {
- qDebug() << "~SMClientControls() says: started";
-}
-
-void SMClientControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void SMClientControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(200, 200);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void SMClientControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void SMClientControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void SMClientControls::doCancel() {
- //
- // Ask if changed Settings should be saved
- //
- if (settingsDirty) {
- int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard );
-
- qDebug() << "doCancel says: answer =" << ret;
-
- switch (ret) {
- case QMessageBox::Save:
- save();
- this->close();
- break;
- case QMessageBox::Discard:
- this->close();
- break;
- case QMessageBox::Cancel:
- // Cancel was clicked
- break;
- default:
- // should never be reached
- break;
- }
- }
- else {
- this->close();
- }
-}
-
-//
-// Load the current Settings from the currently 'active' INI-file.
-//
-void SMClientControls::loadSettings() {
-
-// qDebug() << "loadSettings says: Starting ";
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
-
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
-
-// qDebug() << "loadSettings says: iniFile = " << currentFile;
-
- iniFile.beginGroup ( "SMTracker" );
- ui.cbxFilterSetting->setCurrentIndex(iniFile.value ( "FilterLevel", 1 ).toInt());
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void SMClientControls::save() {
-
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
-
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
-
- iniFile.beginGroup ( "SMTracker" );
- iniFile.setValue ( "FilterLevel", ui.cbxFilterSetting->currentIndex() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Create a memory-mapping to the faceAPI data.
-// It contains the tracking data, a command-code from FaceTrackNoIR
-//
-//
-bool SMClientControls::SMCreateMapping()
-{
- qDebug() << "SMClientControls::FTCreateMapping says: Starting Function";
-
- //
- // A FileMapping is used to create 'shared memory' between the faceAPI and FaceTrackNoIR.
- //
- // Try to create a FileMapping to the Shared Memory.
- // If one already exists: close it.
- //
- hSMMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 ,
- sizeof( TFaceData ) + sizeof( HANDLE ) + 100,
- (LPCSTR) SM_MM_DATA );
-
- if ( hSMMemMap != 0 ) {
- qDebug() << "SMClientControls::FTCreateMapping says: FileMapping Created!";
- }
-
- if ( ( hSMMemMap != 0 ) && ( (long) GetLastError == ERROR_ALREADY_EXISTS ) ) {
- CloseHandle( hSMMemMap );
- hSMMemMap = 0;
- }
-
- //
- // Create a new FileMapping, Read/Write access
- //
- hSMMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) SM_MM_DATA );
- if ( ( hSMMemMap != 0 ) ) {
- qDebug() << "SMClientControls::FTCreateMapping says: FileMapping Created again..." << hSMMemMap;
- pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TFaceData));
- if (pMemData != NULL) {
- qDebug() << "SMClientControls::FTCreateMapping says: MapViewOfFile OK.";
-// pMemData->handle = handle; // The game uses the handle, to send a message that the Program-Name was set!
- }
- hSMMutex = CreateMutexA(NULL, false, SM_MUTEX);
- }
- else {
- qDebug() << "SMClientControls::FTCreateMapping says: Error creating Shared Memory for faceAPI!";
- return false;
- }
-
- //if (pMemData != NULL) {
- // pMemData->data.DataID = 1;
- // pMemData->data.CamWidth = 100;
- // pMemData->data.CamHeight = 250;
- //}
-
- return true;
-}
-
-//
-// Show the current engine-settings etc.
-//
-void SMClientControls::doTimUpdate()
-{
- int state = pMemData->state;
- if ( state != prev_state) {
- emit stateChanged(state);
- prev_state = state;
- }
-}
-
-//
-// Show the current engine-settings etc.
-//
-void SMClientControls::showSettings( int newState )
-{
- qDebug() << "SMClientControls::showSettings says: Starting Function";
- switch (newState)
- {
- case SM_API_ENGINE_STATE_TERMINATED:
- ui._engine_state_label->setText("TERMINATED");
- break;
- case SM_API_ENGINE_STATE_INVALID:
- ui._engine_state_label->setText("INVALID");
- break;
- case SM_API_ENGINE_STATE_IDLE:
- ui._engine_state_label->setText("IDLE");
- break;
- case SM_API_ENGINE_STATE_HT_INITIALIZING:
- ui._engine_state_label->setText("INITIALIZING");
- break;
- case SM_API_ENGINE_STATE_HT_TRACKING:
- ui._engine_state_label->setText("TRACKING");
- break;
- case SM_API_ENGINE_STATE_HT_SEARCHING:
- ui._engine_state_label->setText("SEARCHING");
- break;
- default:
- ui._engine_state_label->setText("Unknown State!");
- break;
- }
-
- ui.cbxFilterSetting->setEnabled( (newState == SM_API_ENGINE_STATE_IDLE) );
-}
-
-//
-// Send a command without parameter-value to the tracking Engine.
-//
-void SMClientControls::doCommand(int command)
-{
- if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) {
- pMemData->command = command; // Send command
- ReleaseMutex(hSMMutex);
- }
- return;
-}
-
-//
-// Send a command with integer parameter-value to the tracking Engine.
-//
-void SMClientControls::doCommand(int command, int value)
-{
- if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) {
- pMemData->command = command; // Send command
- pMemData->par_val_int = value;
- ReleaseMutex(hSMMutex);
- }
- return;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Tracker-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetTrackerDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
-
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
-{
- return new SMClientControls;
+ return new FTNoIR_Tracker;
}
diff --git a/FTNoIR_Tracker_SM/images/SeeingMachines.ico b/FTNoIR_Tracker_SM/images/SeeingMachines.ico Binary files differnew file mode 100644 index 00000000..19b24c84 --- /dev/null +++ b/FTNoIR_Tracker_SM/images/SeeingMachines.ico |