edl plugin names eng, fix segv for opengl brender, renderfarm rework strategy, perf...
[goodguy/history.git] / cinelerra-5.1 / plugins / echocancel / echocancel.C
index b227e6b706a10cb14cf04a507028fc9c5cd776ad..f1ff269ed6cc2881777e27a8ef8abb229f6554f7 100644 (file)
@@ -2,21 +2,21 @@
 /*
  * CINELERRA
  * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  */
 
 #include "bcdisplayinfo.h"
@@ -25,7 +25,7 @@
 #include "bchash.h"
 #include "filexml.h"
 #include "language.h"
-#include "cicolors.h"
+#include "bccolors.h"
 #include "samples.h"
 #include "echocancel.h"
 #include "theme.h"
@@ -90,10 +90,10 @@ void EchoCancelConfig::copy_from(EchoCancelConfig &that)
        CLAMP(cutoff, MIN_CUTOFF, MAX_CUTOFF);
 }
 
-void EchoCancelConfig::interpolate(EchoCancelConfig &prev, 
-       EchoCancelConfig &next, 
-       int64_t prev_frame, 
-       int64_t next_frame, 
+void EchoCancelConfig::interpolate(EchoCancelConfig &prev,
+       EchoCancelConfig &next,
+       int64_t prev_frame,
+       int64_t next_frame,
        int64_t current_frame)
 {
        copy_from(prev);
@@ -175,7 +175,7 @@ int EchoCancelMode::to_mode(const char *text)
 
 
 EchoCancelHistory::EchoCancelHistory(EchoCancel *plugin,
-       int x, 
+       int x,
        int y)
  : BC_IPot(x, y, plugin->config.history_size, MIN_HISTORY, MAX_HISTORY)
 {
@@ -381,7 +381,7 @@ void EchoCancelCanvas::calculate_point(int do_overlay)
        int y = get_cursor_y();
        CLAMP(x, 0, get_w() - 1);
        CLAMP(y, 0, get_h() - 1);
-       
+
        EchoCancelWindow *window = (EchoCancelWindow *)plugin->thread->window;
        window->calculate_frequency(x, y, do_overlay);
 }
@@ -423,7 +423,7 @@ EchoCancelWindow::~EchoCancelWindow()
 void EchoCancelWindow::create_objects()
 {
        int pad = plugin->get_theme()->widget_border;
-       add_subwindow(canvas = new EchoCancelCanvas(plugin, 0, 0, 
+       add_subwindow(canvas = new EchoCancelCanvas(plugin, 0, 0,
                get_w(), get_h() - 2*BC_Pot::calculate_h() - 3*pad));
        canvas->set_cursor(CROSS_CURSOR, 0, 0);
 
@@ -439,7 +439,7 @@ void EchoCancelWindow::create_objects()
        x = x1;
        add_subwindow(normalize = new EchoCancelNormalize(plugin, x, y));
        x += normalize->get_w() + 3*pad;
-       y += normalize->get_h() - BC_Title::calculate_h(this,"Gain: ");
+       y += normalize->get_h() - BC_Title::calculate_h(this,_("Gain: "));
        add_subwindow(gain_title = new EchoCancelTitle(x, y, _("Gain: "), 0.));
        x += gain_title->get_w() + 2*pad;
        add_subwindow(offset_title = new EchoCancelTitle(x, y, _("Offset: "), 0));
@@ -462,7 +462,7 @@ void EchoCancelWindow::create_objects()
        add_subwindow(window_size = new EchoCancelWindowSize(plugin, x, y, wsp));
        x += window_size->get_w();
        add_subwindow(window_size_tumbler = new EchoCancelWindowSizeTumbler(plugin, x, y));
-       
+
        window_size->add_item(new BC_MenuItem(EchoCancelWindowSize::to_text(0)));
        for( int i=MIN_WINDOW; i<=MAX_WINDOW; i*=2 ) {
                window_size->add_item(new BC_MenuItem(EchoCancelWindowSize::to_text(i)));
@@ -500,7 +500,7 @@ void EchoCancelWindow::create_objects()
        y = y1;
        add_subwindow(freq_title = new BC_Title(x, y, _("0 Hz")));
        y += freq_title->get_h() + pad;
-       add_subwindow(amplitude_title = new BC_Title(x, y, "Amplitude: 0 dB"));
+       add_subwindow(amplitude_title = new BC_Title(x, y, _("Amplitude: 0 dB")));
 
        show_window();
 }
@@ -576,14 +576,14 @@ void EchoCancelWindow::calculate_frequency(int x, int y, int do_overlay)
                int freq = plugin->header.sample_rate / offset;
                int msecs = 1000. / freq;
                char string[BCTEXTLEN];
-               sprintf(string, "%d Hz, %d ms (%d))", freq, msecs, (int)offset);
+               sprintf(string, _("%d Hz, %d ms (%d))"), freq, msecs, (int)offset);
                freq_title->update(string);
                int frm_sz1 = frm->size()-1;
                if( freq_pixel > frm_sz1 ) freq_pixel = frm_sz1;
                float *frame_data = frm->samples();
                double level = frame_data[freq_pixel];
                double scale = frm->scale();
-               sprintf(string, "Amplitude: %.3f (%.6g)", level, scale);
+               sprintf(string, _("Amplitude: %.3f (%.6g)"), level, scale);
                amplitude_title->update(string);
        }
        if( y >= 0 ) {
@@ -720,7 +720,7 @@ remove(int len)
                sample_data -= len;
 }
 
-const char* EchoCancel::plugin_title() { return _("EchoCancel"); }
+const char* EchoCancel::plugin_title() { return N_("EchoCancel"); }
 int EchoCancel::is_realtime() { return 1; }
 
 static inline double sqr(double v) { return v*v; }
@@ -743,7 +743,7 @@ static inline void cx_product(int n, int sf, double *rp, double *ip,
 static inline void cj_product(int n, int sf, double *rp, double *ip,
                double *arp, double *aip, double *brp, double *bip)
 {
-       int m = !sf ? n : n/2, i = 0;
+       int m = !sf ? n-1 : n/2, i = 0;
        while( i <= m ) {
                double ar = arp[i], ai = aip[i];
                double br = brp[i], bi = -bip[i];