Classes | Macros | Typedefs | Functions | Variables
main_livedecode.c File Reference

live-mode decoder demo. More...

#include <sys/stat.h>
#include <fcntl.h>
#include <s3_decode.h>
#include <ad.h>
#include <stdio.h>
#include <pthread.h>
#include <sys/time.h>
#include <time.h>

Classes

struct  condition_t
 

Macros

#define BUFSIZE   4096
 
#define TIMEOUT   100
 
#define THREAD_START   void *
 
#define COND_TIMEDOUT   ETIMEDOUT
 
#define cond_wait(c)
 
#define cond_signal(c)
 
#define create_cond(cc)
 
#define create_thread(tt, proc)   pthread_create(tt, NULL, proc, NULL)
 
#define join_thread(t)   pthread_join(t, NULL)
 

Typedefs

typedef pthread_t mythread_t
 

Functions

int cond_wait_timed (condition_t *c, int ticks)
 
THREAD_START process_thread (void *aParam)
 
int main (int argc, char **argv)
 

Variables

condition_t startEvent
 
condition_t finishEvent
 
fe_t * fe
 
s3_decode_t decoder
 
FILE * dump = 0
 

Detailed Description

live-mode decoder demo.

Created by Yitao Sun (yitao.nosp@m.@cs..nosp@m.cmu.e.nosp@m.du). This is a test program written for the Win32 platform. The program initializes Sphinx3 live-decode API, then in a press-to-start and press-to-stop fashion, records and decodes a session of user speech. The threading and synchronization code are Win32- specific. Ravi Mosur (rkm@c.nosp@m.s.cm.nosp@m.u.edu) suggested using select() (and no threads) on the /dev/tty* device to remove Win32 dependency.

Macro Definition Documentation

◆ BUFSIZE

#define BUFSIZE   4096

Referenced by process_thread().

◆ cond_signal

#define cond_signal (   c)
Value:
{ \
pthread_mutex_lock(&(c).mtx); \
(c).fired = 1; \
pthread_cond_signal(&(c).cond); \
pthread_mutex_unlock(&(c).mtx); \
}

◆ COND_TIMEDOUT

#define COND_TIMEDOUT   ETIMEDOUT

Referenced by process_thread().

◆ cond_wait

#define cond_wait (   c)
Value:
{ \
pthread_mutex_lock(&(c).mtx); \
pthread_cond_wait(&(c).cond, &(c).mtx); \
pthread_mutex_unlock(&(c).mtx); \
}

Referenced by process_thread().

◆ create_cond

#define create_cond (   cc)
Value:
{ \
pthread_cond_init(&(cc)->cond, NULL); \
pthread_mutex_init(&(cc)->mtx, NULL); \
(cc)->fired = 0; \
}

◆ create_thread

#define create_thread (   tt,
  proc 
)    pthread_create(tt, NULL, proc, NULL)

◆ join_thread

#define join_thread (   t)    pthread_join(t, NULL)

◆ THREAD_START

#define THREAD_START   void *

◆ TIMEOUT

#define TIMEOUT   100

Referenced by process_thread().

Typedef Documentation

◆ mythread_t

typedef pthread_t mythread_t

Function Documentation

◆ cond_wait_timed()

int cond_wait_timed ( condition_t c,
int  ticks 
)

◆ main()

int main ( int  argc,
char **  argv 
)

initializing a file to dump the recorded audio

◆ process_thread()

THREAD_START process_thread ( void *  aParam)

Variable Documentation

◆ decoder

s3_decode_t decoder

◆ dump

FILE* dump = 0

Referenced by process_thread().

◆ fe

fe_t* fe

Referenced by process_thread().

◆ finishEvent

condition_t finishEvent

◆ startEvent

condition_t startEvent