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 |
Defines | |
| #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 |
live-mode decoder demo.
Created by Yitao Sun (yitao@cs.cmu.edu). 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@cs.cmu.edu) suggested using select() (and no threads) on the /dev/tty* device to remove Win32 dependency.
| #define BUFSIZE 4096 |
Referenced by process_thread().
| #define cond_signal | ( | c | ) |
{ \
pthread_mutex_lock(&(c).mtx); \
(c).fired = 1; \
pthread_cond_signal(&(c).cond); \
pthread_mutex_unlock(&(c).mtx); \
}
Referenced by main().
| #define COND_TIMEDOUT ETIMEDOUT |
Referenced by process_thread().
| #define cond_wait | ( | c | ) |
{ \
pthread_mutex_lock(&(c).mtx); \
pthread_cond_wait(&(c).cond, &(c).mtx); \
pthread_mutex_unlock(&(c).mtx); \
}
Referenced by process_thread().
| #define create_cond | ( | cc | ) |
{ \
pthread_cond_init(&(cc)->cond, NULL); \
pthread_mutex_init(&(cc)->mtx, NULL); \
(cc)->fired = 0; \
}
Referenced by main().
| #define create_thread | ( | tt, | |
| proc | |||
| ) | pthread_create(tt, NULL, proc, NULL) |
Referenced by main().
| #define join_thread | ( | t | ) | pthread_join(t, NULL) |
Referenced by main().
| #define THREAD_START void * |
| #define TIMEOUT 100 |
Referenced by process_thread().
| typedef pthread_t mythread_t |
| int cond_wait_timed | ( | condition_t * | c, |
| int | ticks | ||
| ) |
References condition_t::cond, condition_t::fired, and condition_t::mtx.
Referenced by process_thread().
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
initializing a file to dump the recorded audio
References cond_signal, create_cond, create_thread, dump, fe, join_thread, process_thread(), S3_DECODE_ARG_DEFS, s3_decode_begin_utt(), s3_decode_close(), s3_decode_hypothesis(), and s3_decode_init().
| THREAD_START process_thread | ( | void * | aParam | ) |
dump the recorded audio to disk
References BUFSIZE, COND_TIMEDOUT, cond_wait, cond_wait_timed(), kbcore_t::config, dump, fe, s3_decode_t::kbcore, s3_decode_end_utt(), s3_decode_hypothesis(), s3_decode_process(), and TIMEOUT.
Referenced by main().
| FILE* dump = 0 |
Referenced by main(), and process_thread().
| fe_t* fe |
Referenced by main(), and process_thread().
1.7.6.1