int main(int argc, char **argv) { int i; int phonetic = 0; char* wavfilename = NULL; unsigned char input[256]; memset(input, 0, 256); if (argc <= 1) { PrintUsage(); return 1; } i = 1; while(i < argc) { if (argv[i][0] != '-') { strcat_s((char*)input, 256, argv[i]); strcat_s((char*)input, 256, " "); } else { if (strcmp(&argv[i][1], "wav")==0) { wavfilename = argv[i+1]; i++; } else if (strcmp(&argv[i][1], "sing")==0) { EnableSingmode(); } else if (strcmp(&argv[i][1], "phonetic")==0) { phonetic = 1; } else if (strcmp(&argv[i][1], "debug")==0) { debug = 1; } else if (strcmp(&argv[i][1], "pitch")==0) { SetPitch((unsigned char)min(atoi(argv[i+1]),255)); i++; } else if (strcmp(&argv[i][1], "speed")==0) { SetSpeed((unsigned char)min(atoi(argv[i+1]),255)); i++; } else if (strcmp(&argv[i][1], "mouth")==0) { SetMouth((unsigned char)min(atoi(argv[i+1]),255)); i++; } else if (strcmp(&argv[i][1], "throat")==0) { SetThroat((unsigned char)min(atoi(argv[i+1]),255)); i++; } else { PrintUsage(); return 1; } } i++; } //while for(i=0; input[i] != 0; i++) input[i] = (unsigned char)toupper((int)input[i]); if (debug) { if (phonetic) printf("phonetic input: %s\n", input); else printf("text input: %s\n", input); } if (!phonetic) { strcat_s((char*)input, 256, "["); if (!TextToPhonemes(input)) return 1; if (debug) printf("phonetic input: %s\n", input); } else strcat_s((char*)input, 256, "\x9b"); #ifdef USESDL if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) { printf("Unable to init SDL: %s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit); #endif SetInput(input); if (!SAMMain()) { PrintUsage(); return 1; } if (wavfilename != NULL) WriteWav(wavfilename, GetBuffer(), GetBufferLength()/50); else OutputSound(); return 0; }
void MouthView::onMouthChanged(int id) { SetMouth(id); update(); }
bool StudioModel::PostLoadModel( char *modelname ) { // preload textures if (m_pstudiohdr->numtextures == 0) { char texturename[256]; strcpy( texturename, modelname ); strcpy( &texturename[strlen(texturename) - 4], "T.mdl" ); m_ptexturehdr = LoadModel( texturename ); if (!m_ptexturehdr) { FreeModel (); return false; } m_owntexmodel = true; } else { m_ptexturehdr = m_pstudiohdr; m_owntexmodel = false; } // preload animations if (m_pstudiohdr->numseqgroups > 1) { for (int i = 1; i < m_pstudiohdr->numseqgroups; i++) { char seqgroupname[256]; strcpy( seqgroupname, modelname ); sprintf( &seqgroupname[strlen(seqgroupname) - 4], "%02d.mdl", i ); m_panimhdr[i] = LoadModel( seqgroupname ); if (!m_panimhdr[i]) { FreeModel (); return false; } } } SetSequence (0); SetController (0, 0.0f); SetController (1, 0.0f); SetController (2, 0.0f); SetController (3, 0.0f); SetMouth (0.0f); int n; for (n = 0; n < m_pstudiohdr->numbodyparts; n++) SetBodygroup (n, 0); SetSkin (0); /* vec3_t mins, maxs; ExtractBbox (mins, maxs); if (mins[2] < 5.0f) m_origin[2] = -mins[2]; */ return true; }
int main(int argc, char **argv) { int i; int debug = 0; int phonetic = 0; int wavfilenameposition = -1; char input[256]; for(i=0; i<256; i++) input[i] = 0; if (argc <= 1) { printUsage(); return 1; } input[0]=0; strcat(input, " "); i = 1; while(i < argc) { if (argv[i][0] != '-') { strcat(input, argv[i]); strcat(input, " "); } else { if (strcmp(&argv[i][1], "wav")==0) { wavfilenameposition = i+1; i++; } else if (strcmp(&argv[i][1], "sing")==0) { EnableSingmode(1); } else if (strcmp(&argv[i][1], "phonetic")==0) { phonetic = 1; } else if (strcmp(&argv[i][1], "debug")==0) { debug = 1; } else if (strcmp(&argv[i][1], "pitch")==0) { SetPitch(atoi(argv[i+1])); i++; } else if (strcmp(&argv[i][1], "speed")==0) { SetSpeed(atoi(argv[i+1])); i++; } else if (strcmp(&argv[i][1], "mouth")==0) { SetMouth(atoi(argv[i+1])); i++; } else if (strcmp(&argv[i][1], "throat")==0) { SetThroat(atoi(argv[i+1])); i++; } else { printUsage(); return 1; } } i++; } //while strcat(input, " "); for(i=0; input[i] != 0; i++) input[i] = toupper(input[i]); if (debug) { printf("say: %s\n", input); } if (!phonetic) { if (!TextToPhonemes(input)) return 1; if (debug) printf("text translation: %s\n", input); } strcat(input, " \x9b\0"); #ifdef USESDL if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) { printf("Unable to init SDL: %s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit); #endif SetInput(input); if (!Code39771()) { printUsage(); return 1; } if (wavfilenameposition > 0) WriteWav(argv[wavfilenameposition], GetBuffer(), GetBufferLength()/50); else { #ifdef USESDL OutputSound(); #endif } if (debug) PrintDebug(); return 0; }