00001
00002
00003
00004
00005
00006
00007 using namespace std;
00008
00009 #include <iostream>
00010 #include <cstring>
00011 #include <vector>
00012 #include <string>
00013
00014 #ifndef REPOSITORYGENERATORINCLUDED
00015 #include "repositorygenerator.cpp"
00016 #endif
00017
00018 #ifndef ENCODERINCLUDED
00019 #include "encoder.cpp"
00020 #endif
00021
00022 #ifndef DECODERINCLUDED
00023 #include "decoder.cpp"
00024 #endif
00025
00026 #ifndef PARAMETERSINCLUDED
00027 #include "parameters.cpp"
00028 #endif
00029
00030 #define VOXINCLUDED
00031
00032 void usage(void);
00033
00034 int main(int argc, char* argv[])
00035 {
00036 vector<string> argument;
00037 for(int i=0;i<argc;i++)
00038 {
00039 argument.push_back((string)argv[i]);
00040 }
00041
00042 if(argument.size()==1)
00043 {
00044 usage();
00045 return SUCCESS;
00046 }
00047 else if(argument[1]=="-h")
00048 {
00049 usage();
00050 return SUCCESS;
00051 }
00052 else if(argument[1]=="-r")
00053 {
00054 if(argument.size()==4)
00055 {
00056 repositorygenerator repgen;
00057 return repgen.generate(argument[2],argument[3]);
00058 }
00059 else
00060 {
00061 usage();
00062 return FAILURE;
00063 }
00064 }
00065 else if(argument[1]=="-e")
00066 {
00067 if(argument.size()==5)
00068 {
00069 encoder enc;
00070 return enc.encode(argument[2],argument[3],argument[4]);
00071 }
00072 else
00073 {
00074 usage();
00075 return FAILURE;
00076 }
00077 }
00078 else if(argument[1]=="-d")
00079 {
00080 if(argument.size()==4)
00081 {
00082 decoder dec;
00083 return dec.decode(argument[2],argument[3]);
00084 } else
00085 {
00086 usage();
00087 return FAILURE;
00088 }
00089 }
00090 else
00091 {
00092 usage();
00093 return FAILURE;
00094 }
00095 return SUCCESS;
00096 }
00097
00098 void usage(void)
00099 {
00100 cout<<"\tNAME"<<endl;
00101 cout<<"\t\tvox - Voice eXchange"<<endl<<endl;
00102 cout<<"\tSYNOPSIS"<<endl;
00103 cout<<"\t\tvox options input_filename module_specific_options"<<endl<<endl;
00104 cout<<"\toptions:"<<endl;
00105 cout<<"\t\t-h\tdisplay this message"<<endl;
00106 cout<<"\t\t-r\trepository generation"<<endl;
00107 cout<<"\t\t-e\tencoding"<<endl;
00108 cout<<"\t\t-d\tdecoding"<<endl<<endl;
00109 cout<<"\tinput_filename:"<<endl;
00110 cout<<"\t\tpath of the input file"<<endl<<endl;
00111 cout<<"\tmodule_specific_options:"<<endl;
00112 cout<<"\t\tIf\t-r\tthen\temailid"<<endl;
00113 cout<<"\t\tIf\t-e\tthen\toutput_filename\temailid"<<endl;
00114 cout<<"\t\tIf\t-d\tthen\toutput_filename"<<endl<<endl;
00115 cout<<"\temailid:"<<endl;
00116 cout<<"\t\temailid of the repository generator/encoder"<<endl<<endl;
00117 cout<<"\toutput_filename:"<<endl;
00118 cout<<"\t\tpath of the output file"<<endl<<endl;
00119 cout<<"\tDESCRIPTION:"<<endl;
00120 cout<<"\tA system for exchanging voice messages over mail, using very high speech compression. The sender can record his voice message and transform it into the coded, compressed file using the encoder module. The coded file can be transferred as an email attachment. The receiver may then pass the attached file through the decoder module, which reproduces the original speech. Both the encoder and decoder use a repository of speech segments generated using the repository generator module."<<endl;
00121 }
00122