Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

FEAPIExampleHost_C.cpp

Go to the documentation of this file.
00001 
00002 //     /*!  \file FEAPIExampleHost_C.cpp 
00003 //          \brief example win32 C-host implementation for Feature Extraction 
00004 //           plugin API (FEAPI). */
00006 // includes
00007 
00008 // include standard headers
00009 #include <time.h>               // needed for time measurement
00010 #include <cstdlib>
00011 #include <iostream>
00012 #include <string.h>         // needed for memset
00013 
00014 #ifdef WIN32
00015     #include <windows.h>            // needed for dll handling
00016     #include <conio.h>              // needed for keyboard input
00017     #include <io.h>                 // needed for file parsing
00018 #elif MAC
00019     #include <Carbon/Carbon.h>
00020 #endif
00021 
00022 // include project specific headers
00023 #include "sndfile.h"            // libsndfile is used for audio file parsing
00024 #include "FEAPI.h"   // Feature Extraction plugin API
00025 #include "FEAPIHostDeclarations.h"
00026 #include "FEAPIHostUtilities.h"
00027 
00028 
00030 // local defines
00031 
00032 #define _DEFAULT_BLOCKSIZE  1024    
00033 #define _DEFAULT_RESULTSIZE 1       
00034 
00035 
00036 
00038 // local function declarations
00039 
00046 static void     CLShowProgInfo ();
00047 
00059 static void     CLReadArgs (char **pcInputPath, char **pcOutputPath, bool *pbSilentMode, int argc, char *argv[]);
00060 
00068 static void     CLShowProcessedTime (clock_t clTime);
00069 
00070 
00071 
00072 
00074 // main function
00075 int main (int argc, char* argv[])
00076 {
00077   
00078     char                *pcInputPath                = 0,                    
00079                         *pcOutputPath               = 0,                    
00080                         acResult[FEAPI_kMaxDescriptionLength];                                     
00081 
00082     int                 iNumOfFramesNeeded          = 0,
00083                         iNumFramesRead              = 0,
00084                         iMaxBlockSizeInFrames       = _DEFAULT_BLOCKSIZE,
00085                         iMaxResultSizeInValues      = _DEFAULT_RESULTSIZE,
00086                         iNumResults                 = 0,
00087                         iNumParameters              = 0,
00088                         iNumInputs                  = 0,
00089                         iNumPlugins                 = 0,
00090                         h, 
00091                         i, 
00092                         j, 
00093                         iValue                      = 0;
00094 
00095     bool                bReadNextFrame              = true,
00096                         bSilentMode                 = false;
00097     
00098     SNDFILE             *pFInputFile                = 0;
00099     FILE                *pFOutputFile               = 0;
00100 
00101     SF_INFO             sfInputInfo;
00102 
00103     clock_t             clStartTime                 = 0,
00104                         clTotalTime                 = 0;  
00105     
00106     float               *pfDataInterleaved          = 0,
00107                         **ppfDataSorted             = 0,
00108                         **ppfResult                 = 0;
00109     FEAPI_ModuleHandle_t    hLibraryHandle              = 0;
00110     FEAPI_PluginFileNames_t   *pCurrentPlugin       = 0;
00111     
00112    
00113     FEAPI_PluginInstance_t   hPluginInstance;
00114     FEAPI_PluginFunctions_t        stPluginFunctions;
00115     FEAPI_PluginFileNames_t        stPluginFileNames;
00116     
00117     FEAPI_SignalDescription_t      stSignalDescription;
00118     FEAPI_ParameterDescription_t   stParameterDescription;
00119 
00120     FEAPI_TimeStamp_t           *ptInputTimeStamp   = 0,
00121                                 tOutputTimeStamp    = 0; 
00122 
00123 
00124     // initialize structures and arrays
00125     memset (acResult, 0, sizeof(acResult));
00126     memset (&sfInputInfo, 0, sizeof(sfInputInfo));
00127     memset (&hPluginInstance, 0, sizeof(hPluginInstance));
00128     memset (&stPluginFunctions, 0, sizeof(stPluginFunctions));
00129     memset (&stPluginFileNames, 0, sizeof(stPluginFileNames));
00130     memset (&stSignalDescription, 0, sizeof(stSignalDescription));
00131     memset (&stParameterDescription, 0, sizeof(stParameterDescription));
00132 
00133     //check for correct number of command line arguments
00134     if (argc < 2)
00135     {
00136         fprintf(stdout,"Wrong number of command line arguments!\nArguments: Input_Audio_Path.wav [Output_Text_Path.txt]\n");
00137         return -1;
00138     }
00139     
00140     CLShowProgInfo();
00141 
00142     CLReadArgs( &pcInputPath, 
00143                 &pcOutputPath,
00144                 &bSilentMode,
00145                 argc,
00146                 argv);
00147 
00148 
00149     // find plugins in directory
00150     iNumPlugins     = FindPlugins (&stPluginFileNames);
00151     pCurrentPlugin  = &stPluginFileNames;
00152 
00153     fprintf(stderr,"%d Plugins found:\n", iNumPlugins);
00154     if (iNumPlugins == 0)
00155         return -1;
00156 
00157     // output dll names to command line
00158     for (i = 0; i < iNumPlugins; i++)
00159     {
00160         fprintf(stderr, "%d. %s (API Version: %d)\n",i+1, pCurrentPlugin->acFilename, pCurrentPlugin->iMajorVersion);
00161         if (pCurrentPlugin->pNextPlugin == 0)
00162             break;
00163         else
00164             pCurrentPlugin = pCurrentPlugin->pNextPlugin;
00165     }
00166 
00167     // request user input to select a plugin
00168     while (true)
00169     {
00170         fprintf (stderr,"\nSelect Plugin for process: ");
00171         
00172         std::cin >> j; //cscanf ("%i", &j);
00173         if ((j <= iNumPlugins) && (j >= 1))
00174         {
00175             fprintf(stderr, "\n");
00176             break;
00177         }
00178     }
00179 
00180     pCurrentPlugin  = &stPluginFileNames;
00181     for (i = 1; i < j; i++)
00182     {
00183         if (pCurrentPlugin->pNextPlugin == 0)
00184             break;
00185         else
00186             pCurrentPlugin = pCurrentPlugin->pNextPlugin;
00187     }
00188     
00189     // load plugin library
00190     hLibraryHandle  = 0;
00191     LoadPluginModule (pCurrentPlugin->acFilename, &hLibraryHandle);
00192     if (!hLibraryHandle)
00193         return -1;
00194     else
00195         GetFunctionPointers (hLibraryHandle, &stPluginFunctions);
00196 
00197     // open input audio file
00198     if (pcInputPath == 0)
00199         return -1;
00200     pFInputFile      = sf_open (pcInputPath, 
00201                                 SFM_READ,
00202                                 &sfInputInfo);
00203     if (pFInputFile == NULL)
00204     {
00205         fprintf(stdout,"Input file could not be opened!\n");
00206         return -1;
00207     }
00208 
00209 
00210     // open output file if requested
00211     if (pcOutputPath)
00212     {
00213         pFOutputFile         = fopen (  pcOutputPath, 
00214                                         "wt");
00215         if (pFOutputFile == NULL)
00216         {
00217             fprintf(stdout,"Output file could not be opened!\n");
00218             sf_close (pFInputFile);
00219             return -1;
00220         }
00221     }
00222 
00223     // allocate memory for audio data
00224     pfDataInterleaved       = (float*) malloc (sizeof(*pfDataInterleaved) * iMaxBlockSizeInFrames * sfInputInfo.channels);
00225     ptInputTimeStamp        = (FEAPI_TimeStamp_t*) malloc (sizeof(FEAPI_TimeStamp_t) *sfInputInfo.channels);
00226     memset (ptInputTimeStamp, 0, sizeof(FEAPI_TimeStamp_t) *sfInputInfo.channels);
00227     ppfDataSorted           = (float**) malloc (sizeof(*ppfDataSorted) * sfInputInfo.channels);
00228     for ( i = 0; i < sfInputInfo.channels; i++)
00229         ppfDataSorted[i]    = (float*) malloc (sizeof(*ppfDataSorted[i]) * iMaxBlockSizeInFrames);
00230 
00231     // create plug instance 
00232     fprintf (stdout, "Opening new plugin instance...");
00233     if (stPluginFunctions.pFunCreateInstance (   &hPluginInstance) == FEAPI_kNoError)
00234         fprintf (stdout, "  Succeeded\n");
00235     else
00236         fprintf (stdout, "  Failed\n");
00237 
00238     fprintf (stdout, "Plugin API version: %d.", pCurrentPlugin->iMajorVersion);
00239     fprintf (stdout, "%d.", stPluginFunctions.pFunGetApiVersion ( FEAPI_kMinorVersion));
00240     fprintf (stdout, "%d\n", stPluginFunctions.pFunGetApiVersion ( FEAPI_kSubVersion));
00241     
00242     fprintf (stdout, "Minimum supported sample rate: %1.1e\n", stPluginFunctions.pFunGetPluginProperty (hPluginInstance, FEAPI_kMinSampleRate));
00243     fprintf (stdout, "Maximum supported sample rate: %1.1e\n", stPluginFunctions.pFunGetPluginProperty (hPluginInstance, FEAPI_kMaxSampleRate));
00244     fprintf (stdout, "Minimum number of supported channels: %u\n", (int)stPluginFunctions.pFunGetPluginProperty (hPluginInstance, FEAPI_kMinChannels));
00245     fprintf (stdout, "Maximum number of supported channels: %u\n", (int)stPluginFunctions.pFunGetPluginProperty (hPluginInstance, FEAPI_kMaxChannels));
00246     fprintf (stdout, "Minimum supported frame size: %u\n", (int)stPluginFunctions.pFunGetPluginProperty (hPluginInstance, FEAPI_kMinFrameSize));
00247     fprintf (stdout, "Maximum supported frame size: %u\n", (int)stPluginFunctions.pFunGetPluginProperty (hPluginInstance, FEAPI_kMaxFrameSize));
00248     fprintf (stdout, "Preferred frame size: %d\n", (int)stPluginFunctions.pFunGetPluginProperty (hPluginInstance, FEAPI_kOptFrameSize));
00249 
00250     
00251     // init plug instance 
00252     fprintf (stdout, "Initializing new plugin instance...");
00253     if (stPluginFunctions.pFunInitializePlugin (   hPluginInstance, 
00254                                (float)sfInputInfo.samplerate, 
00255                                sfInputInfo.channels,
00256                                pCurrentPlugin->iMajorVersion,
00257                                0) == FEAPI_kNoError)
00258         fprintf (stdout, "  Succeeded\n");
00259     else
00260         fprintf (stdout, "  Failed\n");
00261 
00262     
00263     stPluginFunctions.pFunGetPluginName (hPluginInstance, acResult);
00264     fprintf (stdout, "Plugin Name: %s\n", acResult);
00265     
00266     stPluginFunctions.pFunGetPluginId (hPluginInstance, acResult);
00267     fprintf (stdout, "Plugin Id: %s\n", acResult);
00268 
00269     stPluginFunctions.pFunGetPluginVendor (hPluginInstance, acResult);
00270     fprintf (stdout, "Plugin Vendor: %s\n", acResult);
00271 
00272     fprintf (stdout, "Plugin Vendor version: %d.", stPluginFunctions.pFunGetPluginVendorVersion (hPluginInstance, FEAPI_kMajorVersion));
00273     fprintf (stdout, "%d.", stPluginFunctions.pFunGetPluginVendorVersion (hPluginInstance, FEAPI_kMinorVersion));
00274     fprintf (stdout, "%d\n", stPluginFunctions.pFunGetPluginVendorVersion (hPluginInstance, FEAPI_kSubVersion));
00275 
00276     stPluginFunctions.pFunGetPluginCopyright (hPluginInstance, acResult);
00277     fprintf (stdout, "Plugin Copyright: %s\n", acResult);
00278 
00279     stPluginFunctions.pFunGetPluginDescription (hPluginInstance, acResult);
00280     fprintf (stdout, "Plugin Description: %s\n", acResult);
00281     
00282     iNumInputs = stPluginFunctions.pFunGetNumberOfInputs (hPluginInstance);
00283     fprintf (stdout, "Number of input channels: %d\n", iNumInputs);
00284 
00285     for (i = 0; i < iNumInputs; i++)
00286     {
00287         stPluginFunctions.pFunGetInputDescription (hPluginInstance, i, &stSignalDescription);
00288         fprintf (stdout, "Information about the input %d:\n", i);
00289         fprintf (stdout, "\tInput name: %s\n", stSignalDescription.acName);
00290         fprintf (stdout, "\tInput description: %s\n", stSignalDescription.acDescription);
00291         fprintf (stdout, "\tInput unit: %s\n", stSignalDescription.acUnit);
00292         fprintf (stdout, "\tInput range: %e - %e\n", stSignalDescription.fRangeMin, stSignalDescription.fRangeMax);
00293         fprintf (stdout, "\tInput sample rate: %f\n", stSignalDescription.fSampleRate);
00294         fprintf (stdout, "\n");
00295     }
00296     
00297     iNumParameters = stPluginFunctions.pFunGetNumberOfParameters (hPluginInstance);
00298     fprintf (stdout, "Number of parameters: %d\n", iNumParameters);
00299 
00300     for (i = 0; i < iNumParameters; i++)
00301     {
00302         stPluginFunctions.pFunGetParameterDescription (hPluginInstance, i, &stParameterDescription);
00303         fprintf (stdout, "Information about the parameter %d:\n", i);
00304         fprintf (stdout, "\tParameter name: %s\n", stParameterDescription.acName);
00305         fprintf (stdout, "\tParameter description: %s\n", stParameterDescription.acDescription);
00306         fprintf (stdout, "\tParameter unit: %s\n", stParameterDescription.acUnit);
00307         fprintf (stdout, "\tParameter range: %e - %e\n", stParameterDescription.fRangeMin, stParameterDescription.fRangeMax);
00308         fprintf (stdout, "\tParameter default: %e\n", stParameterDescription.fDefaultValue);
00309         fprintf (stdout, "\tParameter quantized to: %e\n", stParameterDescription.fQuantizedTo);
00310         fprintf (stdout, "\tParameter changeable in real-time: %s\n", (stParameterDescription.bIsChangeableInRealTime)? "Yes" : "No");
00311         fprintf (stdout, "\n");
00312     }
00313 
00314     // set one plugin parameter
00315     //stPluginFunctions.pFunSetParameter (hPluginInstance, 0, 1000);
00316     //stPluginFunctions.pFunSetParameter (hPluginInstance, 1, 3);
00317     
00318     // in case we set a non-realtime parameter, init again
00319     if (stPluginFunctions.pFunInitializePlugin (   hPluginInstance, 
00320         (float)sfInputInfo.samplerate, 
00321         sfInputInfo.channels,
00322         pCurrentPlugin->iMajorVersion,
00323         0) == FEAPI_kNoError)
00324         fprintf (stdout, "  Succeeded\n");
00325     else
00326         fprintf (stdout, "  Failed\n");
00327 
00328     iNumResults = stPluginFunctions.pFunGetNumberOfResults (hPluginInstance);
00329     fprintf (stdout, "Number of features to be extracted: %d\n", iNumResults);
00330 
00331     for (i = 0; i < iNumResults; i++)
00332     {
00333         stPluginFunctions.pFunGetResultDescription (hPluginInstance, i, &stSignalDescription);
00334         fprintf (stdout, "Information about the feature %d:\n", i);
00335         fprintf (stdout, "\tFeature name: %s\n", stSignalDescription.acName);
00336         fprintf (stdout, "\tFeature description: %s\n", stSignalDescription.acDescription);
00337         fprintf (stdout, "\tFeature unit: %s\n", stSignalDescription.acUnit);
00338         fprintf (stdout, "\tFeature range: %e-%e\n", stSignalDescription.fRangeMin, stSignalDescription.fRangeMax);
00339         fprintf (stdout, "\tFeature quantized to: %e\n", stSignalDescription.fQuantizedTo);
00340         fprintf (stdout, "\tFeature sample rate: %f\n", stSignalDescription.fSampleRate);
00341         fprintf (stdout, "\tFeature latency: %d (samples)\n", stPluginFunctions.pFunGetResultLatency (hPluginInstance, i));
00342         fprintf (stdout, "\n");
00343     }
00344 
00345 
00346     // allocate memory for result data
00347     ppfResult           = (float**) malloc (sizeof(*ppfResult) * iNumResults);
00348     for ( i = 0; i < iNumResults; i++)
00349         ppfResult[i]    = (float*) malloc (sizeof(*ppfResult[i]) * iMaxResultSizeInValues);
00350 
00351 
00352 
00353     // now we can begin to process!
00354     while(bReadNextFrame)
00355     {
00356         iNumOfFramesNeeded  = (int)stPluginFunctions.pFunGetPluginProperty (hPluginInstance, 
00357                                                                        FEAPI_kOptFrameSize);
00358         
00359         // adjust memory allocation if required (make sure this is not called often)
00360 //        if (iNumOfFramesNeeded > iMaxBlockSizeInFrames)
00361 //        {
00362 //            iMaxBlockSizeInFrames   = iNumOfFramesNeeded;
00363 //            pfDataInterleaved       = (float*) realloc (pfDataInterleaved, sizeof(*pfDataInterleaved) * iMaxBlockSizeInFrames * sfInputInfo.channels);
00364 //            for ( i = 0; i < sfInputInfo.channels; i++ )
00365 //                ppfDataSorted[i]    = (float*) realloc (ppfDataSorted[i], sizeof(*ppfDataSorted[i]) * iMaxBlockSizeInFrames);
00366 //        }
00367 
00368         // check if we have enough memory allocated for the optimal frame size
00369         if (iMaxBlockSizeInFrames < iNumOfFramesNeeded)
00370             iNumOfFramesNeeded  = iMaxBlockSizeInFrames;
00371 
00372 
00373         // read audio data from file
00374         iNumFramesRead = (int)(sf_readf_float(pFInputFile, pfDataInterleaved, iNumOfFramesNeeded));
00375         
00376         // check for file end and zeropad in case
00377         if(iNumFramesRead < iNumOfFramesNeeded)
00378         {
00379             memset(&pfDataInterleaved[iNumFramesRead*sfInputInfo.channels],0,(iNumOfFramesNeeded-iNumFramesRead)*sfInputInfo.channels*sizeof(float));
00380             bReadNextFrame = false;
00381         }
00382                 
00383 
00384         // sort audio data: interleaved->seperate blocks
00385         h   = 0;
00386         for ( i = 0; i < iNumOfFramesNeeded; i++)
00387             for ( j = 0; j < sfInputInfo.channels; j++)
00388                 ppfDataSorted[j][i] = pfDataInterleaved[h++];
00389                 
00390         clStartTime = clock();
00391 
00392         //processing
00393         stPluginFunctions.pFunProcess (  hPluginInstance, 
00394                                         (const float**)ppfDataSorted, 
00395                                         ptInputTimeStamp,
00396                                         iNumFramesRead);
00397 
00398         clTotalTime += clock() - clStartTime;
00399 
00400         // get results
00401         for (i = 0; i < iNumResults; i++)
00402         {
00403             // get size of result with index i
00404             while ((iValue = stPluginFunctions.pFunGetSizeOfResult (hPluginInstance, i) > 0))
00405             {
00406                 // adjust memory allocation if required (make sure this is not called often)
00407                 if (iValue > iMaxResultSizeInValues)
00408                 {
00409                     iMaxResultSizeInValues  = iValue;
00410                     ppfResult[i]            = (float*) realloc (ppfResult[i], sizeof(*ppfResult[i]) * iMaxResultSizeInValues);
00411                 }
00412                 
00413                 // get results
00414                 stPluginFunctions.pFunGetResult (   hPluginInstance, 
00415                                                     i, 
00416                                                     ppfResult[i], 
00417                                                     &tOutputTimeStamp);
00418                 
00419                 // print result to text file if requested
00420                 if (pFOutputFile)
00421                 {
00422                     for (j = 0; j < iValue; j++)
00423                         fprintf (pFOutputFile, "\t%1.10g", ppfResult[i][j]);
00424                     fprintf (pFOutputFile, "\n");
00425                 }
00426                 if (!bSilentMode)
00427                 {
00428                     for (j = 0; j < iValue; j++)
00429                         fprintf(stderr, "Result %d first value/block: %1.10g\t", i, ppfResult[i][j]);
00430                     fprintf (stderr, "\n");
00431                 }
00432             }
00433         }
00434 
00435         // update stdout for new values
00436         fprintf(stderr,"\r");
00437 
00438         for ( j = 0; j < sfInputInfo.channels; j++)
00439             ptInputTimeStamp[j]    += iNumOfFramesNeeded * 1.0 / sfInputInfo.samplerate;
00440 #ifdef WIN32
00441         if(kbhit())
00442         {
00443             short c;
00444             c = _getch(); 
00445             if(!c) c = _getch();
00446             if(c == 27) 
00447                 break;
00448         }
00449 #elif MAC
00450         // kbhit ang getch are not standard
00451         // so we can't escape the processing loop this way, but ctrl+D should work
00452 #endif
00453     }
00454     
00455     clStartTime = clock();
00456  
00457     // no new audio data available or canceled by user; let the plug notice...
00458     stPluginFunctions.pFunProcessDone (hPluginInstance);
00459 
00460     clTotalTime += clock() - clStartTime;
00461 
00462     // get last results if there are any
00463     for (i = 0; i < iNumResults; i++)
00464     {
00465         // get size of first result (index 0)
00466         iValue = stPluginFunctions.pFunGetSizeOfResult (hPluginInstance, i);
00467 
00468         // adjust memory allocation if required (make sure this is not called often)
00469         if (iValue > iMaxResultSizeInValues)
00470         {
00471             iMaxResultSizeInValues  = iValue;
00472             ppfResult[i]            = (float*) realloc (ppfResult[i], sizeof(*ppfResult[i]) * iMaxResultSizeInValues);
00473         }
00474     
00475         // get results
00476         stPluginFunctions.pFunGetResult (    hPluginInstance, 
00477                                             i, 
00478                                             ppfResult[i],
00479                                             &tOutputTimeStamp);
00480 
00481         // print result to text file if requested
00482         if (pFOutputFile)
00483         {
00484             for (j = 0; j < iValue; j++)
00485                 fprintf (pFOutputFile, "\t%1.10g", ppfResult[i][j]);
00486             fprintf (pFOutputFile, "\n");
00487         }
00488         if (!bSilentMode)
00489         {
00490             for (j = 0; j < iValue; j++)
00491                 fprintf(stderr, "Result %d first value/block: %1.10g\t", i, ppfResult[i][j]);
00492             fprintf (stderr, "\n");
00493         }
00494     }
00495 
00496     fprintf(stderr, "\n\nInputfile processed!\n\n");
00497 
00498     CLShowProcessedTime (clTotalTime);
00499     
00500     fprintf(stdout, "\nDestroying plugin instance...");
00501     if (stPluginFunctions.pFunDestroyInstance (&hPluginInstance) == 0)
00502         fprintf (stdout, "  Succeeded\n");
00503     else
00504         fprintf (stdout, "  Failed\n");
00505 
00506     UnloadPluginModule (hLibraryHandle);
00507 
00508     // free allocated memory
00509     for (i = 0; i < iNumResults; i++)
00510         if (ppfResult[i])
00511             free (ppfResult[i]);
00512     if (ppfResult)
00513         free (ppfResult);
00514     if (ptInputTimeStamp)
00515         free (ptInputTimeStamp);
00516     for(i=0;i<sfInputInfo.channels;i++)
00517         if (ppfDataSorted[i])
00518             free (ppfDataSorted[i]);
00519     if (ppfDataSorted)
00520         free (ppfDataSorted);
00521     if (pfDataInterleaved)
00522         free (pfDataInterleaved);
00523 
00524     // delete plugin list
00525     while (stPluginFileNames.pNextPlugin)
00526     {
00527         FEAPI_PluginFileNames_t   *pLastPlugin = &stPluginFileNames;
00528         pCurrentPlugin  = stPluginFileNames.pNextPlugin;
00529         while (pCurrentPlugin)
00530         {
00531             if (pCurrentPlugin->pNextPlugin)
00532             {
00533                 pLastPlugin     = pCurrentPlugin;
00534                 pCurrentPlugin  = pCurrentPlugin->pNextPlugin;
00535             }
00536             else
00537                 break;
00538         }
00539         if (pCurrentPlugin)
00540             delete pCurrentPlugin;
00541         pLastPlugin->pNextPlugin    = 0;
00542     }
00543     
00544     // close files
00545     sf_close (pFInputFile);
00546     if (pFOutputFile)
00547         fclose (pFOutputFile);
00548     
00549     return 0;
00550 }
00551 
00552 
00553 
00555 // local function definitions
00556 
00557 static void     CLShowProgInfo()
00558 {
00559 
00560     fprintf(stdout, "FEAPI Plugin Host Demo\n\n");
00561     fprintf(stdout, "(c) 2004 by zplane\n");
00562     fprintf(stdout, "Press Escape to cancel...\n\n");
00563 
00564     return;
00565 }
00566 
00567 static void     CLReadArgs(char **pcInputPath, char **pcOutputPath, bool *pbSilentMode, int argc, char *argv[])
00568 {
00569     if (argc > 1)
00570     {
00571         *pcInputPath        = argv[1];
00572     
00573         if (argc > 2)
00574         {
00575             *pcOutputPath   = argv[2];
00576             if (argc > 3)
00577             {
00578 #ifdef WIN32
00579                 *pbSilentMode   = (stricmp(argv[3], "s") == 0);
00580 #elif MAC
00581                 *pbSilentMode   = (strcasecmp(argv[3], "s") == 0);
00582 #endif
00583             }
00584         }
00585         else
00586             *pcOutputPath   = 0;
00587     }
00588     else
00589         pcInputPath         = 0;
00590 
00591     return;
00592 }
00593 
00594 static void     CLShowProcessedTime(clock_t clTime)
00595 {
00596     fprintf(stdout, "\nTime elapsed:\t%2.2f sec\n", (float)(clTime) / CLOCKS_PER_SEC);
00597 
00598     return;
00599 }
00600 

Generated on Fri Mar 23 10:28:52 2007 for FEAPI Host Documentation by  doxygen 1.3.9.1