00001
00002
00003
00004
00005
00006
00007 using namespace std;
00008
00009 #include <iostream>
00010 #include<cstring>
00011 #include<string>
00012
00013 #ifndef CODEFILEINCLUDED
00014 #include "codefile.cpp"
00015 #endif
00016
00017 #ifndef CLUSTERMANAGERINCLUDED
00018 #include "clustermanager.cpp"
00019 #endif
00020
00021 #ifndef FRAMEINCLUDED
00022 #include "frame.cpp"
00023 #endif
00024
00025 #ifndef PARAMETERSINCLUDED
00026 #include "parameters.cpp"
00027 #endif
00028
00029
00030 #define ENCODERINCLUDED
00031
00032 class encoder {
00033
00034 private:
00035
00036 public:
00037
00038 int encode(string filename, string cfname, string email)
00039 {
00040 char* frmdata;
00041 unsigned long int frsize;
00042 wavefile* speechfile=new wavefile(filename);
00043 clustermanager clustermgr;
00044 clustermgr.getallclustercenters(email);
00045 vector<double> mfcc;
00046 int status=SUCCESS;
00047 mfcc=speechfile->getMFCC(&status);
00048 unsigned int code;
00049 codefile cf(cfname,email,speechfile->nFrames());
00050 while(status==SUCCESS)
00051 {
00052 code= clustermgr.compare(mfcc);
00053 cf.append(code);
00054 mfcc=speechfile->getMFCC(&status);
00055 }
00056
00057 delete speechfile;
00058 return 0;
00059 }
00060
00061 };