Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2011 George Tzanetakis <gtzan@cs.uvic.ca> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 2 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef MARSYAS_AIMVQ_H 00020 #define MARSYAS_AIMVQ_H 00021 00022 #include <marsyas/system/MarSystem.h> 00023 00024 #ifdef MARSYAS_ANN 00025 #include "ANN.h" 00026 // include "kd_tree.h" 00027 #endif 00028 00029 // sness - TODO - Eventually make these realvecs. However, in the 00030 // existing code there is quite a bit of stuff that involves STL 00031 // methods, so I thought it would be safer to use STL for now. 00032 #include <vector> 00033 00034 using namespace std; 00035 00036 namespace Marsyas 00037 { 00053 class AimVQ: public MarSystem 00054 { 00055 private: 00056 void myUpdate(MarControlPtr sender); 00057 00058 // Prepare the module 00059 void InitializeInternal(); 00060 00061 // Does the MarSystem need initialization? 00062 bool is_initialized; 00063 00064 // What changes cause it to need initialization? 00065 mrs_real initialized_israte; 00066 00067 // Controls 00068 MarControlPtr ctrl_kd_tree_bucket_size_; 00069 MarControlPtr ctrl_kd_tree_error_bound_; 00070 MarControlPtr ctrl_num_codewords_to_return_; 00071 00072 float sample_rate_; 00073 int buffer_length_; 00074 int channel_count_; 00075 00076 #ifdef MARSYAS_ANN 00077 vector<ANNkd_tree*> sparse_coder_trees_; 00078 vector<ANNpointArray> codebooks_; 00079 #endif 00080 00081 int codebooks_count_; 00082 int codeword_count_; 00083 int codeword_length_; 00084 00085 public: 00086 AimVQ(std::string name); 00087 AimVQ(const AimVQ& a); 00088 00089 ~AimVQ(); 00090 MarSystem* clone() const; 00091 void addControls(); 00092 00093 void myProcess(realvec& in, realvec& out); 00094 }; 00095 00096 }//namespace marsyas 00097 00098 #endif