Julius 4.2
|
00001 00047 #include <stdio.h> 00048 #include <string.h> 00049 #include "plugin_defs.h" 00050 00051 #define PLUGIN_TITLE "Feature vector input plugin for Julius" 00052 #define INPUT_OPT "myfvin" 00053 00054 /************************************************************************/ 00055 00078 int 00079 initialize() 00080 { 00081 return 0; 00082 } 00083 00120 int 00121 get_plugin_info(int opcode, char *buf, int buflen) 00122 { 00123 switch(opcode) { 00124 case 0: 00125 /* plugin description string */ 00126 strncpy(buf, PLUGIN_TITLE, buflen); 00127 break; 00128 } 00129 00130 return 0; 00131 } 00132 00133 /************************************************************************/ 00134 /************************************************************************/ 00135 /* Feature-vector input plugin functions */ 00136 00165 void 00166 fvin_get_optname(char *buf, int buflen) 00167 { 00168 strncpy(buf, INPUT_OPT, buflen); 00169 } 00170 00212 int 00213 fvin_get_configuration(int opcode) 00214 { 00215 switch(opcode) { 00216 case 0: /* return number of elements in a vector */ 00217 return(25); 00218 case 1:/* return msec per frame */ 00219 return(10); 00220 case 2:/* return parameter type specification in HTK format */ 00221 /* return 0xffff to disable checking */ 00222 return(0xffff); 00223 } 00224 } 00225 00226 /************************************************************************/ 00227 00254 boolean 00255 fvin_standby() 00256 { 00257 00258 /* sever socket ready etc... */ 00259 return TRUE; 00260 00261 } 00262 00289 boolean 00290 fvin_open() 00291 { 00292 /* listen and accept socket, or open a file */ 00293 return TRUE; 00294 } 00295 00346 int 00347 fvin_read(float *vecbuf, int veclen) 00348 { 00349 /* read one vector from the input */ 00350 if (0/* error */) return ADIN_ERROR; 00351 if (0/* input should be segmented here */) return ADIN_SEGMENT; 00352 if (0/* EOF */) return ADIN_EOF; 00353 00354 return(0); /* success */ 00355 } 00356 00390 boolean 00391 fvin_close() 00392 { 00393 /* file close, connection close, etc.. */ 00394 return TRUE; 00395 } 00396 00397 /************************************************************************/ 00398 00443 boolean 00444 fvin_terminate() 00445 { 00446 printf("terminate request\n"); 00447 return TRUE; 00448 } 00449 00499 boolean 00500 fvin_pause() 00501 { 00502 printf("pause request\n"); 00503 return TRUE; 00504 } 00505 00546 boolean 00547 fvin_resume() 00548 { 00549 printf("resume request\n"); 00550 return TRUE; 00551 } 00552 00568 char * 00569 fvin_input_name() 00570 { 00571 printf("input name function was called\n"); 00572 return("default"); 00573 } 00574 /* end of file */