www.pudn.com > xvoice-0.8.1.rar > Voice.h


/**
 * Voice.h
 *
 * Description: interface to voice glue
 *
 * Copyright (c) 1999, David Z. Creemer.
 * See the LICENSE file. All rights not granted therein are reserved.
 *
 * @author David Z. Creemer and Tom Doris
 * @version 1.0
 *
 * 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 2 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, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#ifndef _VOICE_H
#define _VOICE_H

void TurnMicOn();
void TurnMicOff();

bool initVoice(bool save);
bool exitVoice();
int loadGrammars();

enum {
    G_SUCCESS,
    G_FAIL,
    G_RECO
};

enum vCommandType {
    CCOMMAND = 0,
    CSTOPCOMMAND,
    CDICTATE,
    CSTOPDICTATE,
    CIDLE,
    CMICOFF,
    CCORRECTION,
    CREBUILD,
    CLASTITEM, /* last item with a voice command */
    CMICON
};

struct defVocab {
    int val;
    char *phrase;
};
typedef struct defVocab defVocab;

typedef void (*gramHdlr)(int, void *, const char *ph, const char *tr);
typedef void (*vocHdlr)(int, void *, const char *ph, int val);

void vCommand(vCommandType t);
bool disableCommandGrammar(const char *name);
bool enableCommandGrammar(const char *name, gramHdlr callback, void *u);
bool installVocab(char *name, vocHdlr callback, defVocab *cmds, void *user);
bool enableVocab(char *name);
bool disableVocab(char *name);
int compileGrammar(char *name);

#endif // _VOICE_H