annotate trunk/swig/aim_modules.i @ 273:c26222c51fb7

- Fixed the python SWIG wrappers - Added stub test for the Gaussian features, and test data - Fixed build errors
author tomwalters
date Mon, 15 Feb 2010 20:37:26 +0000
parents e14c70d1b171
children 6b4921704eb1
rev   line source
tomwalters@268 1 // Copyright 2008-2010, Thomas Walters
tomwalters@268 2 //
tomwalters@268 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@268 4 // http://www.acousticscale.org/AIMC
tomwalters@268 5 //
tomwalters@268 6 // This program is free software: you can redistribute it and/or modify
tomwalters@268 7 // it under the terms of the GNU General Public License as published by
tomwalters@268 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@268 9 // (at your option) any later version.
tomwalters@268 10 //
tomwalters@268 11 // This program is distributed in the hope that it will be useful,
tomwalters@268 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@268 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@268 14 // GNU General Public License for more details.
tomwalters@268 15 //
tomwalters@268 16 // You should have received a copy of the GNU General Public License
tomwalters@268 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@268 18
tomwalters@273 19 %module aimc
tomwalters@273 20 %include "std_string.i"
tomwalters@268 21 %{
tomwalters@268 22 #include "Support/Common.h"
tomwalters@268 23 #include "Support/Module.h"
tomwalters@268 24 #include "Support/Parameters.h"
tomwalters@268 25 #include "Support/SignalBank.h"
tomwalters@268 26 #include "Modules/Features/ModuleGaussians.h"
tomwalters@268 27 %}
tomwalters@268 28
tomwalters@268 29 namespace aimc {
tomwalters@268 30 class Parameters {
tomwalters@268 31 public:
tomwalters@268 32 Parameters();
tomwalters@268 33 ~Parameters();
tomwalters@268 34 bool Load(const char *sParamFilename);
tomwalters@268 35 bool Save(const char *sParamFilename);
tomwalters@273 36 std::string WriteString();
tomwalters@268 37 bool Merge(const char *sParamFilename);
tomwalters@273 38 const char* DefaultString(const char *sName, const char *val);
tomwalters@273 39 int DefaultInt(const char *sName, int val);
tomwalters@273 40 unsigned int DefaultUInt(const char *sName, unsigned int val);
tomwalters@273 41 float DefaultFloat(const char *sName, float val);
tomwalters@273 42 bool DefaultBool(const char *sName, bool val);
tomwalters@268 43 void SetString(const char *sName, const char *val);
tomwalters@268 44 void SetInt(const char *sName, int val);
tomwalters@268 45 void SetUInt(const char *sName, unsigned int val);
tomwalters@268 46 void SetFloat(const char *sName, float val);
tomwalters@268 47 void SetBool(const char *sName, bool val);
tomwalters@268 48 const char *GetString(const char *sName);
tomwalters@268 49 int GetInt(const char *sName);
tomwalters@268 50 unsigned int GetUInt(const char *sName);
tomwalters@268 51 float GetFloat(const char *sName);
tomwalters@268 52 bool GetBool(const char *sName);
tomwalters@268 53 bool IsSet(const char *sName);
tomwalters@268 54 bool Parse(const char *sCmd);
tomwalters@268 55 bool Delete(const char *sName);
tomwalters@268 56 static const unsigned int MaxParamNameLength = 128;
tomwalters@268 57 };
tomwalters@268 58
tomwalters@268 59 class SignalBank {
tomwalters@268 60 public:
tomwalters@273 61 SignalBank();
tomwalters@273 62 ~SignalBank();
tomwalters@273 63 bool Initialize(int channel_count, int signal_length, float sample_rate);
tomwalters@273 64 bool Initialize(const SignalBank &input);
tomwalters@273 65 bool Validate() const;
tomwalters@273 66 const vector<float> &operator[](int channel) const;
tomwalters@273 67 float sample(int channel, int index) const;
tomwalters@273 68 void set_sample(int channel, int index, float value);
tomwalters@273 69 float sample_rate() const;
tomwalters@273 70 int buffer_length() const;
tomwalters@273 71 int start_time() const;
tomwalters@273 72 void set_start_time(int start_time);
tomwalters@273 73 float get_centre_frequency(int i) const;
tomwalters@273 74 void set_centre_frequency(int i, float cf);
tomwalters@273 75 bool initialized() const;
tomwalters@273 76 int channel_count() const;
tomwalters@268 77 };
tomwalters@268 78
tomwalters@268 79 class Module {
tomwalters@268 80 public:
tomwalters@268 81 explicit Module(Parameters *parameters);
tomwalters@268 82 virtual ~Module();
tomwalters@268 83 bool Initialize(const SignalBank &input);
tomwalters@268 84 bool initialized() const;
tomwalters@268 85 bool AddTarget(Module* target_module);
tomwalters@268 86 bool DeleteTarget(Module* target_module);
tomwalters@268 87 void DeleteAllTargets();
tomwalters@268 88 virtual void Process(const SignalBank &input) = 0;
tomwalters@268 89 virtual void Reset() = 0;
tomwalters@268 90 const SignalBank* GetOutputBank() const;
tomwalters@268 91 private:
tomwalters@268 92 DISALLOW_COPY_AND_ASSIGN(Module);
tomwalters@268 93 };
tomwalters@268 94
tomwalters@268 95 class ModuleGaussians : public Module
tomwalters@268 96 {
tomwalters@268 97 public:
tomwalters@268 98 ModuleGaussians(Parameters *pParam);
tomwalters@268 99 virtual ~ModuleGaussians();
tomwalters@268 100 virtual void Process(const SignalBank &input);
tomwalters@268 101 void Reset();
tomwalters@268 102 };
tomwalters@268 103 } // namespace aimc
tomwalters@268 104