Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

flitecmd.cpp

Go to the documentation of this file.
00001 #include <unistd.h>
00002 #include <sys/types.h>
00003 #include <sys/wait.h>
00004 #include <errno.h>
00005 #include "flitecmd.h"
00006 
00007 void CFliteCmd::output(const QString& txt)
00008 {
00009   pid_t pid;
00010   if ((pid = fork()) <0)
00011     {
00012       qDebug("No memory");
00013     }
00014   else if (pid == 0)
00015     {
00016       execlp("flite", "flite", "-t", (const char*)txt, NULL);
00017       _exit(127);
00018       qDebug("Can't find flite");
00019     }
00020   else
00021     {
00022       int status;
00023       while (waitpid(pid, &status, 0) < 0)
00024         {
00025           if (errno != EINTR)
00026             {
00027               qDebug("Error from flite");
00028               break;
00029             }
00030         }
00031       qDebug("flite status:%d", status);
00032     }
00033 }
00034 
00035 QString CFliteCmd::about()
00036 {
00037   return QString("FliteCmd output codec (c) Tim Wentford\n");
00038 }
00039 
00040 extern "C"
00041 {
00042   COutput* newcodec() { return new CFliteCmd; }
00043 }

Generated on Sat Nov 5 16:16:55 2005 for OPIE by  doxygen 1.4.2