//============================================================================= // // Copyright (c) 2006-2007, Carnegie Mellon University. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in // the documentation and/or other materials provided with the // distribution. // // This work was supported in part by funding from the Defense Advanced // Research Projects Agency and the National Science Foundation of the // United States of America, and the CMU Sphinx Speech Consortium. // // THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND // ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY // NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //============================================================================= //----------------------------------------------------------------------------- // // ENGINESOCKET.H - Functions for communicating with the recognition // engines. // // ---------------------------------------------------------------------------- // // BEFORE MAKING CHANGES TO THIS CODE, please read the appropriate // documentation, available in the Documentation folder. // // ANY SIGNIFICANT CHANGES made should be reflected back in the documentation // file(s) // // ANY CHANGES made (even small bug fixes, should be reflected in the history // below, in reverse chronological order // // HISTORY -------------------------------------------------------------------- // // [2005-08-05] (antoine) : started this // //----------------------------------------------------------------------------- #ifndef __ENGINEINTERFACE_H__ #define __ENGINEINTERFACE_H__ #include using namespace Olympus; /* Engine specifications */ extern int iNumEngines; extern char **asEngineName; extern char **asEngineHost; extern int *pEnginePort; extern int *asEngineNBestSize; // (bthomson) Adding support for N-best lists extern int asTotalNBestSize; // (bthomson) Adding support for N-best lists extern SOCKET *psEngineSocket; extern int iSampleRate; extern int iSampleRateMS; // A: Reads the list of engines and their location from a config file void ReadEngineListFromString( const string sEngineList); // A: Reads the list of engines and their location from a config file void ReadEngineListFromFile( const string sEngineList); // A: Checks the status of a socket and opens it if necessary int CheckEngineConnection(int n); // A: Closes engine connection n void CloseEngineConnection(int n); // A: Closes all sockets and declares them invalid void CloseAllEngineConnections(); // A: Sends a message to engine n int SendMessageToEngine(int n, const char *message); // A: Sends a message to all engines int SendMessageToAllEngines(const char *message); // A: Sends some data to engine n int SendDataToEngine(int n, char *pData, int iSize); // A: Sends some data to all engines int SendDataToAllEngines(char *pData, int iSize); // A: Gets a Galaxy frame from one engine void *GetFrameFromEngine(int n, bool bBlocking); // A: Gets the current partial results from all engines void *GetPartialResultFromAllEngines(); // A: Waits for the result frame from all engines and returns them void *GetFinalResultFromAllEngines(); // A: Flushes the socket from an engine void FlushEngineSocket(int n); // A: Flushes all engine sockets void FlushAllEngineSockets(); // TK: Gets the name of the currect acoustic model void* engine_get_acoustic_model(); // TK: Sets the current acoustic model void* engine_set_acoustic_model(const string& s); #endif // __ENGINEINTERFACE_H__