/[marvin]/marvin/src/gui/identify_user.cc
ViewVC logotype

Diff of /marvin/src/gui/identify_user.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by srv89, Wed Sep 17 00:44:58 2003 UTC revision 1.6 by castor_fou, Wed Sep 17 02:09:04 2003 UTC
# Line 40  Line 40 
40  #include "user.hh"  #include "user.hh"
41  #include "misc.hh"  #include "misc.hh"
42  #include "language/language.hh"  #include "language/language.hh"
43    #include "record.hh"
44    #include "action.hh"
45    
46  int check_password(std::string password, class c_list_user *list_user)  int check_password(std::string password, class c_list_user *list_user)
47  {  {
# Line 71  int check_password(std::string password, Line 73  int check_password(std::string password,
73    return 1;    return 1;
74  }  }
75    
76  int check_voice()  int check_voice(class c_list_user *list_user)
77  {  {
78    // enregistre la voix et la compare avec le reseau de neurone    // enregistre la voix et la compare avec le reseau de neurone
79      std::string file;
80      double *res;
81    
82      std::cout << GORECORD << std::endl;
83      sleep(1);
84      file = "/tmp/identify";
85      file += ".wav";
86      if (record(file.c_str()) != 0)
87        return 1;
88      std::cout << ENDRECORD << std::endl;
89      res = idendify_user_voice();
90      //  recognition (res, list_user->get_list_user()[list_user->get_id_user()]
91      //           ->get_user_name.c_str());
92    return 0;    return 0;
93  }  }
94    
# Line 96  int c_list_user::identify_user() Line 111  int c_list_user::identify_user()
111    while (tmp > (_list_user.size() - 1));    while (tmp > (_list_user.size() - 1));
112    //  std::cout << "utilisateur choisi : " << _list_user[tmp]->get_name_user() << std::endl;    //  std::cout << "utilisateur choisi : " << _list_user[tmp]->get_name_user() << std::endl;
113    if (check_password(_list_user[tmp]->get_password()->get_passphrase(), this))    if (check_password(_list_user[tmp]->get_password()->get_passphrase(), this))
114      if (check_voice())      if (check_voice(this))
115        return 1;        return 1;
116    return 0;    return 0;
117  }  }
# Line 231  double *create_tab() Line 246  double *create_tab()
246    std::cout << "tab\n" << tmp << std::endl;    std::cout << "tab\n" << tmp << std::endl;
247    return tmp;    return tmp;
248  }  }
249    
250    double *idendify_user_voice()
251    {
252      std::string file;
253      double *tmp = (double *)calloc(sizeof (double), 12);
254      DiscSignal res(0, 0);
255      int k, j;
256    
257      if (tmp == NULL)
258        return NULL;
259      file = "/tmp/identify";
260      file += ".wav";
261      std::cout << "path crée" << std::endl;
262      res = create_mfcc(file);
263      if (res.length() == 0)
264        exit(51);
265      for (j = 1, k = 0; j < res.length(); j++, k++)
266        tmp[k] = res.get_data()[j];
267      std::cout << "tab rempli" << std::endl;
268      std::cout << "tab\n" << tmp << std::endl;
269      return tmp;
270    }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26