X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fresamplert%2Fresamplert.C;h=af6c4ab6a773a7b1c42e8f639a10a4ee3fb2fb4e;hb=b2eb290b3f6e5c233393017aa152e67c76243130;hp=bde3bbc6efcb005699eeac2a449c7668f9c636bf;hpb=5a1b2bb96f2bd6b7ef4f8031763683726c02219d;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/resamplert/resamplert.C b/cinelerra-5.1/plugins/resamplert/resamplert.C index bde3bbc6..af6c4ab6 100644 --- a/cinelerra-5.1/plugins/resamplert/resamplert.C +++ b/cinelerra-5.1/plugins/resamplert/resamplert.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2010-2016 Adam Williams - * + * * 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" @@ -58,10 +58,10 @@ void ResampleRTConfig::copy_from(ResampleRTConfig &src) this->denom = src.denom; } -void ResampleRTConfig::interpolate(ResampleRTConfig &prev, - ResampleRTConfig &next, - int64_t prev_frame, - int64_t next_frame, +void ResampleRTConfig::interpolate(ResampleRTConfig &prev, + ResampleRTConfig &next, + int64_t prev_frame, + int64_t next_frame, int64_t current_frame) { this->num = prev.num; @@ -78,11 +78,11 @@ void ResampleRTConfig::boundaries() ResampleRTWindow::ResampleRTWindow(ResampleRT *plugin) - : PluginClientWindow(plugin, - 210, - 160, - 200, - 160, + : PluginClientWindow(plugin, + 210, + 160, + 200, + 160, 0) { this->plugin = plugin; @@ -102,13 +102,13 @@ void ResampleRTWindow::create_objects() y += title->get_h() + plugin->get_theme()->widget_border; num = new ResampleRTNum(this, plugin, x, y); num->create_objects(); - + y += num->get_h() + plugin->get_theme()->widget_border; add_subwindow(title = new BC_Title(x, y, _("Output samples:"))); y += title->get_h() + plugin->get_theme()->widget_border; denom = new ResampleRTDenom(this, plugin, x, y); denom->create_objects(); - + show_window(); } @@ -118,15 +118,15 @@ void ResampleRTWindow::create_objects() ResampleRTNum::ResampleRTNum(ResampleRTWindow *window, - ResampleRT *plugin, - int x, + ResampleRT *plugin, + int x, int y) : BC_TumbleTextBox(window, plugin->config.num, (float)0.0001, (float)1000, - x, - y, + x, + y, 100) { this->plugin = plugin; @@ -145,15 +145,15 @@ int ResampleRTNum::handle_event() ResampleRTDenom::ResampleRTDenom(ResampleRTWindow *window, - ResampleRT *plugin, - int x, + ResampleRT *plugin, + int x, int y) : BC_TumbleTextBox(window, plugin->config.denom, (float)0.0001, (float)1000, - x, - y, + x, + y, 100) { this->plugin = plugin; @@ -181,8 +181,8 @@ ResampleRTResample::ResampleRTResample(ResampleRT *plugin) // To get the keyframes to work, resampling is always done in the forward // direction with the plugin converting to reverse. -int ResampleRTResample::read_samples(Samples *buffer, - int64_t start, +int ResampleRTResample::read_samples(Samples *buffer, + int64_t start, int64_t len) { int result = plugin->read_samples(buffer, @@ -196,7 +196,7 @@ int ResampleRTResample::read_samples(Samples *buffer, plugin->source_start += len; else plugin->source_start -= len; - + return result; } @@ -220,7 +220,7 @@ ResampleRT::~ResampleRT() delete resample; } -const char* ResampleRT::plugin_title() { return _("ResampleRT"); } +const char* ResampleRT::plugin_title() { return N_("ResampleRT"); } int ResampleRT::is_realtime() { return 1; } int ResampleRT::is_synthesis() { return 1; } @@ -230,7 +230,7 @@ NEW_WINDOW_MACRO(ResampleRT, ResampleRTWindow) LOAD_CONFIGURATION_MACRO(ResampleRT, ResampleRTConfig) -int ResampleRT::process_buffer(int64_t size, +int ResampleRT::process_buffer(int64_t size, Samples *buffer, int64_t start_position, int sample_rate) @@ -238,8 +238,8 @@ int ResampleRT::process_buffer(int64_t size, if(!resample) resample = new ResampleRTResample(this); need_reconfigure |= load_configuration(); - - + + if(start_position != dest_start) need_reconfigure = 1; dest_start = start_position; @@ -256,7 +256,7 @@ int ResampleRT::process_buffer(int64_t size, prev_position = get_source_start(); } - source_start = (int64_t)((start_position - prev_position) * + source_start = (int64_t)((start_position - prev_position) * config.num / config.denom) + prev_position; resample->reset(); @@ -268,7 +268,7 @@ int ResampleRT::process_buffer(int64_t size, (int)(65536 * config.num), (int)(65536 * config.denom), start_position, - get_direction()); + get_direction()); if(get_direction() == PLAY_FORWARD) dest_start += size; @@ -291,7 +291,7 @@ void ResampleRT::save_data(KeyFrame *keyframe) FileXML output; // cause data to be stored directly in text - output.set_shared_output(keyframe->get_data(), MESSAGESIZE); + output.set_shared_output(keyframe->xbuf); output.tag.set_title("RESAMPLERT"); output.tag.set_property("SCALE", config.num); output.tag.set_property("DENOM", config.denom); @@ -306,7 +306,7 @@ void ResampleRT::read_data(KeyFrame *keyframe) { FileXML input; - input.set_shared_input(keyframe->get_data(), strlen(keyframe->get_data())); + input.set_shared_input(keyframe->xbuf); while(!input.read_tag()) {