SpectMorph

lib/smmorphplan.hh

00001 /*
00002  * Copyright (C) 2011 Stefan Westerfeld
00003  *
00004  * This library is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License as published by the
00006  * Free Software Foundation; either version 3 of the License, or (at your
00007  * option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
00012  * for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef SPECTMORPH_MORPH_PLAN_HH
00019 #define SPECTMORPH_MORPH_PLAN_HH
00020 
00021 #include "smindex.hh"
00022 #include "smmorphoperator.hh"
00023 #include "smobject.hh"
00024 #include "smaudio.hh"
00025 #include <sigc++/sigc++.h>
00026 
00027 namespace SpectMorph
00028 {
00029 
00030 class MorphPlan : public Object
00031 {
00032   Index                        m_index;
00033   std::vector<MorphOperator *> m_operators;
00034   int                          m_structure_version;
00035 
00036   std::string                  index_filename;
00037   bool                         in_restore;
00038 
00039 public:
00040   MorphPlan();
00041   ~MorphPlan();
00042 
00043   bool   load_index (const std::string& filename);
00044   Index *index();
00045 
00046   void add_operator (MorphOperator *op, const std::string& name = "", const std::string& id = "");
00047   const std::vector<MorphOperator *>& operators();
00048   void remove (MorphOperator *op);
00049   void move (MorphOperator *op, MorphOperator *op_next);
00050 
00051   sigc::signal<void>                  signal_plan_changed;
00052   sigc::signal<void>                  signal_index_changed;
00053   sigc::signal<void, MorphOperator *> signal_operator_removed;
00054 
00055   void set_plan_str (const std::string& plan_str);
00056   void emit_plan_changed();
00057   void emit_index_changed();
00058 
00059   BseErrorType save (GenericOut *file);
00060   BseErrorType load (GenericIn *in);
00061   void clear();
00062 
00063   int  structure_version();
00064 
00065   static std::string id_chars();
00066   static std::string generate_id();
00067 };
00068 
00069 typedef RefPtr<MorphPlan> MorphPlanPtr;
00070 
00071 }
00072 
00073 #endif
 All Classes Functions Variables Enumerations Enumerator