|
libpsynth 0.2.1
|
00001 /*************************************************************************** 00002 * * 00003 * PSYCHOSYNTH * 00004 * =========== * 00005 * * 00006 * Copyright (C) Juan Pedro Bolivar Puente 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_OBJECTECHO_H 00024 #define PSYNTH_OBJECTECHO_H 00025 00026 #include <vector> 00027 00028 #include <psynth/graph/node.hpp> 00029 #include <psynth/graph/node_factory.hpp> 00030 00031 namespace psynth 00032 { 00033 namespace graph 00034 { 00035 00036 class node_echo : public node 00037 { 00038 public: 00039 enum in_audio_socket_id { 00040 IN_A_INPUT, 00041 N_IN_A_SOCKETS 00042 }; 00043 00044 enum in_control_socket_id { 00045 IN_C_DELAY, 00046 IN_C_FEEDBACK, 00047 N_IN_C_SOCKETS 00048 }; 00049 00050 enum out_audio_socket_id { 00051 OUT_A_OUTPUT, 00052 N_OUT_A_SOCKETS 00053 }; 00054 00055 enum out_control_socket_id { 00056 N_OUT_C_SOCKETS 00057 }; 00058 00059 enum param_id { 00060 PARAM_DELAY = node::N_COMMON_PARAMS, 00061 PARAM_FEEDBACK, 00062 PARAM_HIDAMP, 00063 N_PARAM 00064 }; 00065 00066 static constexpr float MAX_DELAY = 1.0f; 00067 static constexpr float DEFAULT_DELAY = 0.5f; 00068 static constexpr float DEFAULT_FEEDBACK = 0.5f; 00069 static constexpr float DEFAULT_HIDAMP = 0.5f; 00070 00071 private: 00072 float m_param_delay; 00073 float m_old_param_delay; 00074 float m_param_feedback; 00075 float m_param_hidamp; 00076 int m_pos; 00077 00078 std::vector<sample> m_old_val; 00079 00080 audio_buffer m_buffer; 00081 00082 int do_update_channel (int chan); 00083 void do_update (const node* caller, int caller_port_type, int caller_port); 00084 void on_info_change (); 00085 void do_advance () {} 00086 00087 public: 00088 node_echo(const audio_info& prop); 00089 ~node_echo(); 00090 }; 00091 00092 PSYNTH_DECLARE_NODE_FACTORY(node_echo, "echo"); 00093 00094 } /* namespace graph */ 00095 } /* namespace psynth */ 00096 00097 #endif /* PSYNTH_OBJECTECHO_H */
1.7.4