|
libpsynth 0.2.1
|
00001 /*************************************************************************** 00002 * * 00003 * PSYCHOSYNTH * 00004 * =========== * 00005 * * 00006 * Copyright (C) Juan Pedro Bolivar Puente 2007, 2008 * 00007 * * 00008 * This program is free software: you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation, either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00020 * * 00021 ***************************************************************************/ 00022 00023 #ifndef PSYNTH_OUTPUT_DIRECTOR_H 00024 #define PSYNTH_OUTPUT_DIRECTOR_H 00025 00026 #include <psynth/base/config.hpp> 00027 #include <psynth/graph/node_output.hpp> 00028 00029 namespace psynth 00030 { 00031 00032 class output_director 00033 { 00034 protected: 00035 base::conf_node* m_conf; 00036 graph::audio_async_output_ptr m_output; 00037 00038 virtual graph::audio_async_output_ptr 00039 do_start (base::conf_node& conf) = 0; 00040 00041 virtual void 00042 do_stop (base::conf_node& conf) = 0; 00043 00044 public: 00045 virtual void defaults (base::conf_node& conf) = 0; 00046 00047 output_director () 00048 : m_conf (0) 00049 , m_output () 00050 {} 00051 00052 virtual ~output_director () {} 00053 00054 void start (base::conf_node& conf) 00055 { 00056 m_conf = &conf; 00057 m_output = do_start (conf); 00058 } 00059 00060 void stop () 00061 { 00062 do_stop (*m_conf); 00063 m_output.reset (); 00064 } 00065 00066 graph::audio_async_output_ptr get_output() const 00067 { return m_output; } 00068 }; 00069 00070 class output_director_factory 00071 { 00072 public: 00073 virtual ~output_director_factory () {} 00074 virtual const char* get_name () = 0; 00075 virtual output_director* create_output_director () = 0; 00076 }; 00077 00078 } /* namespace psynth */ 00079 00080 #endif /* PSYNTH_OUTPUT_DIRECTOR_H */
1.7.4