diff options
author | Tim Blechmann <timblech@users.sourceforge.net> | 2005-01-13 13:39:57 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@iem.at> | 2015-10-14 15:11:58 +0200 |
commit | 29520a2b958bcefe3dd774bd71a7b9e0fd2fa18e (patch) | |
tree | 6edff4135c133eb9e7184738589a7cbab995d5fe | |
parent | 7087c18fec98b899854bd8672dfcc7f52a02e8cb (diff) |
smooth interpolation changing
svn path=/trunk/externals/tb/; revision=2500
-rw-r--r-- | chaos/src/chaos_dsp.hpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/chaos/src/chaos_dsp.hpp b/chaos/src/chaos_dsp.hpp index 9704432..879eb49 100644 --- a/chaos/src/chaos_dsp.hpp +++ b/chaos/src/chaos_dsp.hpp @@ -74,6 +74,7 @@ public: void set_imethod(int i) { + int imethod = m_imethod; if( (i >= 0) && (i <= 2) ) { m_imethod = i; @@ -95,13 +96,21 @@ public: post("interpolation method out of range"); return; } - if( i != 2) + + if (imethod == 0) + for (int j = 0; j != m_system->get_num_eq(); ++j) + { + m_values[j] = m_system->get_data(j); + m_slopes[j] = 0; + } + + if( i == 2) { for (int j = 0; j != m_system->get_num_eq(); ++j) { - m_nextvalues[i] = 0; - m_nextmidpts[i] = 0; - m_curves[i] = 0; + m_phase = 0; /* reschedule to avoid click, find a better way later*/ + m_nextvalues[j] = m_values[j]; + m_nextmidpts[j] = m_values[j]; } } @@ -221,9 +230,8 @@ void chaos_dsp<system>::m_signal_n(int n, t_sample *const *insigs, int outlets = m_system->get_num_eq(); int phase = m_phase; - - int i = 0; - + + int offset = 0; while (n) { if (phase == 0) @@ -236,19 +244,15 @@ void chaos_dsp<system>::m_signal_n(int n, t_sample *const *insigs, n -= next; phase -=next; - while (next--) + for (int i = 0; i != outlets; ++i) { - for (int j = 0; j != outlets; ++j) - { - outsigs[j][i] = m_system->get_data(j); - } - ++i; + SetSamples(outsigs[i]+offset, next, m_system->get_data(i)); } + offset += next; } m_phase = phase; } - /* linear and cubic interpolation adapted from supercollider by James McCartney */ template <class system> void chaos_dsp<system>::m_signal_l(int n, t_sample *const *insigs, |