libpsynth 0.2.1
/home/raskolnikov/dev/psynth/trunk/src/psynth/app/psynth_app.hpp
Go to the documentation of this file.
00001 
00012 /*
00013  *  Copyright (C) 2007, 2008, 2009 Juan Pedro BolĂ­var Puente
00014  *  
00015  *  This program is free software: you can redistribute it and/or modify
00016  *  it under the terms of the GNU General Public License as published by
00017  *  the Free Software Foundation, either version 3 of the License, or
00018  *  (at your option) any later version.
00019  *
00020  *  This program is distributed in the hope that it will be useful,
00021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *  GNU General Public License for more details.
00024  *
00025  *  You should have received a copy of the GNU General Public License
00026  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00027  *
00028  */
00029 
00030 #ifndef PSYNTH_PSYCHOSYNTHAPP_H
00031 #define PSYNTH_PSYCHOSYNTHAPP_H
00032 
00033 #include <boost/filesystem.hpp>
00034 #include <psynth/app/director.hpp>
00035 
00036 namespace psynth
00037 {
00038 
00039 namespace base { class arg_parser; }
00040 
00041 class psynth_app : public boost::noncopyable
00042 {
00043 public:
00044     enum err_code {
00045         ERR_GENERIC = -1,
00046         SUCCESS = 0
00047     };
00048     
00049     director m_director;
00050 
00051     boost::filesystem::path m_cfg_dir;
00052     boost::filesystem::path m_data_dir;
00053     
00054     void generate_paths ();
00055     bool parse_args (int argc, const char* argv[]);
00056     
00057     boost::filesystem::path get_config_path ();
00058     boost::filesystem::path get_data_path ();
00059     
00060     virtual void prepare (base::arg_parser& args) {}
00061     virtual int execute () { return ERR_GENERIC; }
00062 
00063     virtual void print_help () {}
00064     virtual void print_version () {}
00065 
00066 protected:
00067     void print_base_options (std::ostream& out);
00068     
00069 public:
00070     world* get_world () {
00071         return m_director.get_world ();
00072     };
00073     
00074     graph::audio_async_output_ptr get_output () {
00075         return m_director.get_output ();
00076     };
00077     
00078     int run (int argc, const char* argv[]);
00079 
00080     void setup_synth ();
00081     void close_synth ();
00082 };
00083 
00084 } /* namespace psynth */
00085 
00086 #endif /* PSYNTH_PSYCHOSYNTHAPP_H */