|
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_OBJECTDELAY_H 00024 #define PSYNTH_OBJECTDELAY_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_delay : 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_DEPTH, 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_DEPTH, 00062 N_PARAM 00063 }; 00064 00065 static constexpr float MAX_DELAY = 0.1f; 00066 static constexpr float DEFAULT_DELAY = 0.0015f; 00067 static constexpr float DEFAULT_DEPTH = 0.5f; 00068 00069 private: 00070 float m_param_delay; 00071 float m_param_depth; 00072 int m_pos; 00073 int m_max_delay_pos; 00074 00075 audio_buffer m_buffer; 00076 00077 int do_update_channel (int chan); 00078 void do_update (const node* caller, int caller_port_type, int caller_port); 00079 void on_info_change (); 00080 void do_advance () {} 00081 00082 public: 00083 node_delay (const audio_info& prop); 00084 ~node_delay (); 00085 }; 00086 00087 PSYNTH_DECLARE_NODE_FACTORY (node_delay, "delay"); 00088 00089 } /* namespace graph */ 00090 } /* namespace psynth */ 00091 00092 #endif /* PSYNTH_OBJECTDELAY_H */ 00093
1.7.4