add SRC quality to import dialog; fix instances of missing waveforms where new sources are created; add fader+meter to import dialog; metering now doesn't return -inf for ninputs == 0, only if ninputs & noutputs == 0

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2457 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-09-11 14:34:21 +00:00
parent 772b002fea
commit ced90fa400
15 changed files with 263 additions and 81 deletions

View file

@ -969,13 +969,13 @@ class Editor : public PublicEditor
SoundFileOmega* sfbrowser;
void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, nframes64_t& pos,
int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);

View file

@ -128,8 +128,10 @@ Editor::external_audio_dialog ()
break;
}
SrcQuality quality = sfbrowser->get_src_quality();
if (sfbrowser->copy_files_btn.get_active()) {
do_import (paths, chns, mode, where);
do_import (paths, chns, mode, quality, where);
} else {
do_embed (paths, chns, mode, where);
}
@ -166,7 +168,7 @@ Editor::get_nth_selected_audio_track (int nth) const
}
void
Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mode, nframes64_t& pos)
Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mode, SrcQuality quality, nframes64_t& pos)
{
boost::shared_ptr<AudioTrack> track;
vector<ustring> to_import;
@ -188,7 +190,7 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
track = get_nth_selected_audio_track (nth++);
}
if (import_sndfiles (to_import, mode, pos, 1, -1, track)) {
if (import_sndfiles (to_import, mode, quality, pos, 1, -1, track)) {
goto out;
}
@ -201,7 +203,7 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
to_import.clear ();
to_import.push_back (*a);
if (import_sndfiles (to_import, mode, pos, -1, -1, track)) {
if (import_sndfiles (to_import, mode, quality, pos, -1, -1, track)) {
goto out;
}
@ -212,7 +214,7 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
/* create 1 region from all paths, add to 1 track,
ignore "track"
*/
if (import_sndfiles (paths, mode, pos, 1, 1, track)) {
if (import_sndfiles (paths, mode, quality, pos, 1, 1, track)) {
goto out;
}
break;
@ -227,7 +229,7 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
reuse "track" across paths
*/
if (import_sndfiles (to_import, mode, pos, 1, 1, track)) {
if (import_sndfiles (to_import, mode, quality, pos, 1, 1, track)) {
goto out;
}
@ -329,7 +331,7 @@ Editor::_do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mod
}
int
Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, nframes64_t& pos,
Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality quality, nframes64_t& pos,
int target_regions, int target_tracks, boost::shared_ptr<AudioTrack>& track)
{
WindowTitle title = string_compose (_("importing %1"), paths.front());
@ -346,7 +348,8 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, nframes64_t& po
import_status.cancel = false;
import_status.freeze = false;
import_status.done = 0.0;
import_status.quality = quality;
interthread_progress_connection = Glib::signal_timeout().connect
(bind (mem_fun(*this, &Editor::import_progress_timeout), (gpointer) 0), 100);

View file

@ -147,39 +147,41 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s)
if ((r = dynamic_cast<Route*> (_io.get())) != 0) {
/*
if we have a route (ie. we're not the click),
if we have a non-hidden route (ie. we're not the click or the auditioner),
pack some route-dependent stuff.
*/
gain_display_box.pack_end (peak_display, true, true);
hbox.pack_end (meter_packer, true, true);
using namespace Menu_Helpers;
gain_astate_menu.items().push_back (MenuElem (_("Manual"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Off)));
gain_astate_menu.items().push_back (MenuElem (_("Play"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Play)));
gain_astate_menu.items().push_back (MenuElem (_("Write"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Write)));
gain_astate_menu.items().push_back (MenuElem (_("Touch"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Touch)));
gain_astyle_menu.items().push_back (MenuElem (_("Trim")));
gain_astyle_menu.items().push_back (MenuElem (_("Abs")));
gain_astate_menu.set_name ("ArdourContextMenu");
gain_astyle_menu.set_name ("ArdourContextMenu");
if (!r->hidden()) {
gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_style_button_event), false);
gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_state_button_event), false);
r->gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed));
r->gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed));
fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
gain_automation_state_changed ();
using namespace Menu_Helpers;
gain_astate_menu.items().push_back (MenuElem (_("Manual"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Off)));
gain_astate_menu.items().push_back (MenuElem (_("Play"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Play)));
gain_astate_menu.items().push_back (MenuElem (_("Write"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Write)));
gain_astate_menu.items().push_back (MenuElem (_("Touch"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Touch)));
gain_astyle_menu.items().push_back (MenuElem (_("Trim")));
gain_astyle_menu.items().push_back (MenuElem (_("Abs")));
gain_astate_menu.set_name ("ArdourContextMenu");
gain_astyle_menu.set_name ("ArdourContextMenu");
gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_style_button_event), false);
gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_state_button_event), false);
r->gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed));
r->gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed));
fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
gain_automation_state_changed ();
}
}
set_spacing (2);
@ -339,7 +341,7 @@ GainMeter::update_meters ()
for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) {
if ((*i).packed) {
peak = _io->peak_input_power (n);
(*i).meter->set (log_meter (peak));
mpeak = _io->max_peak_power(n);

View file

@ -35,6 +35,7 @@
#include <gtkmm2ext/utils.h>
#include <ardour/audio_library.h>
#include <ardour/auditioner.h>
#include <ardour/audioregion.h>
#include <ardour/audiofilesource.h>
#include <ardour/region_factory.h>
@ -48,6 +49,7 @@
#include "sfdb_ui.h"
#include "editing.h"
#include "utils.h"
#include "gain_meter.h"
#include "i18n.h"
@ -132,7 +134,7 @@ SoundFileBox::SoundFileBox ()
main_box.pack_start(*vbox, true, true);
main_box.pack_start(bottom_box, false, false);
play_btn.set_image (*(manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON))));
play_btn.set_label (_("Play (double click)"));
@ -168,6 +170,7 @@ SoundFileBox::set_session(Session* s)
stop_btn.set_sensitive (false);
}
length_clock.set_session (s);
timecode_clock.set_session (s);
}
@ -345,17 +348,15 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
{
VBox* vbox;
HBox* hbox;
HBox* hpacker;
set_session (s);
resetting_ourselves = false;
hpacker = manage (new HBox);
hpacker->set_spacing (6);
hpacker->pack_start (notebook, true, true);
hpacker->pack_start (preview, false, false);
hpacker.set_spacing (6);
hpacker.pack_start (notebook, true, true);
hpacker.pack_start (preview, false, false);
get_vbox()->pack_start (*hpacker, true, true);
get_vbox()->pack_start (hpacker, true, true);
hbox = manage(new HBox);
hbox->pack_start (found_entry);
@ -371,6 +372,8 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
notebook.append_page (chooser, _("Browse Files"));
notebook.append_page (*vbox, _("Search Tags"));
notebook.set_size_request (500, -1);
found_list_view.get_selection()->set_mode (SELECTION_MULTIPLE);
found_list_view.signal_row_activated().connect (mem_fun (*this, &SoundFileBrowser::found_list_view_activated));
@ -406,6 +409,14 @@ SoundFileBrowser::~SoundFileBrowser ()
persistent_folder = chooser.get_current_folder();
}
void
SoundFileBrowser::on_show ()
{
ArdourDialog::on_show ();
start_metering ();
}
void
SoundFileBrowser::clear_selection ()
{
@ -430,7 +441,58 @@ SoundFileBrowser::set_session (Session* s)
{
ArdourDialog::set_session (s);
preview.set_session (s);
if (s) {
add_gain_meter ();
} else {
remove_gain_meter ();
}
}
void
SoundFileBrowser::add_gain_meter ()
{
if (gm) {
delete gm;
}
gm = new GainMeter (session->the_auditioner(), *session);
meter_packer.set_border_width (12);
meter_packer.pack_start (*gm, false, true);
hpacker.pack_end (meter_packer, false, false);
meter_packer.show_all ();
start_metering ();
}
void
SoundFileBrowser::remove_gain_meter ()
{
if (gm) {
meter_packer.remove (*gm);
hpacker.remove (meter_packer);
delete gm;
gm = 0;
}
}
void
SoundFileBrowser::start_metering ()
{
metering_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun(*this, &SoundFileBrowser::meter));
}
void
SoundFileBrowser::stop_metering ()
{
metering_connection.disconnect();
}
void
SoundFileBrowser::meter ()
{
if (is_mapped () && session && gm) {
gm->update_meters ();
}
}
bool
@ -562,12 +624,12 @@ SoundFileOmega::reset_options ()
}
bool same_size;
bool err;
bool selection_includes_multichannel = check_multichannel_status (paths, same_size, err);
bool src_needed;
bool selection_includes_multichannel;
bool selection_can_be_embedded_with_links = check_link_status (*session, paths);
ImportMode mode;
if (err) {
if (check_info (paths, same_size, src_needed, selection_includes_multichannel)) {
Glib::signal_idle().connect (mem_fun (*this, &SoundFileOmega::bad_file_message));
return false;
}
@ -691,12 +753,18 @@ SoundFileOmega::reset_options ()
} else {
channel_combo.set_active_text (channel_strings.front());
}
if (src_needed) {
src_combo.set_sensitive (true);
} else {
src_combo.set_sensitive (false);
}
if (Profile->get_sae()) {
if (selection_can_be_embedded_with_links) {
copy_files_btn.set_sensitive (true);
} else {
copy_files_btn.set_sensitive (true);
copy_files_btn.set_sensitive (false);
}
}
@ -721,15 +789,16 @@ SoundFileOmega::bad_file_message()
}
bool
SoundFileOmega::check_multichannel_status (const vector<ustring>& paths, bool& same_size, bool& err)
SoundFileOmega::check_info (const vector<ustring>& paths, bool& same_size, bool& src_needed, bool& multichannel)
{
SNDFILE* sf;
SF_INFO info;
nframes64_t sz = 0;
bool some_mult = false;
bool err = false;
same_size = true;
err = false;
src_needed = false;
multichannel = false;
for (vector<ustring>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
@ -739,7 +808,7 @@ SoundFileOmega::check_multichannel_status (const vector<ustring>& paths, bool& s
sf_close (sf);
if (info.channels > 1) {
some_mult = true;
multichannel = true;
}
if (sz == 0) {
@ -749,12 +818,17 @@ SoundFileOmega::check_multichannel_status (const vector<ustring>& paths, bool& s
same_size = false;
}
}
if ((nframes_t) info.samplerate != session->frame_rate()) {
src_needed = true;
}
} else {
err = true;
}
}
return some_mult;
return err;
}
bool
@ -805,6 +879,8 @@ void
SoundFileChooser::on_hide ()
{
ArdourDialog::on_hide();
stop_metering ();
if (session) {
session->cancel_audition();
}
@ -835,6 +911,7 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
{
VBox* vbox;
HBox* hbox;
vector<string> str;
set_size_request (-1, 450);
@ -844,14 +921,13 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
options.set_spacing (12);
vector<string> where_strings;
where_strings.push_back (_("use file timestamp"));
where_strings.push_back (_("at edit cursor"));
where_strings.push_back (_("at playhead"));
where_strings.push_back (_("at session start"));
set_popdown_strings (where_combo, where_strings);
where_combo.set_active_text (where_strings.front());
str.clear ();
str.push_back (_("use file timestamp"));
str.push_back (_("at edit cursor"));
str.push_back (_("at playhead"));
str.push_back (_("at session start"));
set_popdown_strings (where_combo, str);
where_combo.set_active_text (str.front());
Label* l = manage (new Label);
l->set_text (_("Add files:"));
@ -890,6 +966,35 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
vbox->pack_start (*hbox, false, false);
options.pack_start (*vbox, false, false);
str.clear ();
str.push_back (_("one track per file"));
set_popdown_strings (channel_combo, str);
channel_combo.set_active_text (str.front());
channel_combo.set_sensitive (false);
l = manage (new Label);
l->set_text (_("Conversion Quality:"));
hbox = manage (new HBox);
hbox->set_border_width (12);
hbox->set_spacing (6);
hbox->pack_start (*l, false, false);
hbox->pack_start (src_combo, false, false);
vbox = manage (new VBox);
vbox->pack_start (*hbox, false, false);
options.pack_start (*vbox, false, false);
str.clear ();
str.push_back (_("Best"));
str.push_back (_("Good"));
str.push_back (_("Quick"));
str.push_back (_("Fast"));
str.push_back (_("Fastest"));
set_popdown_strings (src_combo, str);
src_combo.set_active_text (str.front());
src_combo.set_sensitive (false);
reset_options ();
action_combo.signal_changed().connect (mem_fun (*this, &SoundFileOmega::reset_options_noret));
@ -957,6 +1062,24 @@ SoundFileOmega::get_position() const
}
}
SrcQuality
SoundFileOmega::get_src_quality() const
{
ustring str = where_combo.get_active_text();
if (str == _("Best")) {
return SrcBest;
} else if (str == _("Good")) {
return SrcGood;
} else if (str == _("Quick")) {
return SrcQuick;
} else if (str == _("Fast")) {
return SrcFast;
} else {
return SrcFastest;
}
}
ImportDisposition
SoundFileOmega::get_channel_disposition () const
{

View file

@ -47,6 +47,8 @@ namespace ARDOUR {
class Session;
};
class GainMeter;
class SoundFileBox : public Gtk::VBox
{
public:
@ -133,6 +135,7 @@ class SoundFileBrowser : public ArdourDialog
Gtk::FileFilter custom_filter;
Gtk::FileFilter matchall_filter;
SoundFileBox preview;
Gtk::HBox hpacker;
static Glib::ustring persistent_folder;
@ -140,6 +143,15 @@ class SoundFileBrowser : public ArdourDialog
Gtk::Button found_search_btn;
Gtk::Notebook notebook;
GainMeter* gm;
Gtk::VBox meter_packer;
void add_gain_meter ();
void remove_gain_meter ();
void meter ();
void start_metering ();
void stop_metering ();
sigc::connection metering_connection;
void update_preview ();
void found_list_view_selected ();
void found_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
@ -150,6 +162,10 @@ class SoundFileBrowser : public ArdourDialog
bool on_custom (const Gtk::FileFilter::Info& filter_info);
virtual bool reset_options() { return true; }
protected:
void on_show();
};
class SoundFileChooser : public SoundFileBrowser
@ -162,9 +178,6 @@ class SoundFileChooser : public SoundFileBrowser
protected:
void on_hide();
private:
// SoundFileBrowser browser;
};
class SoundFileOmega : public SoundFileBrowser
@ -178,12 +191,14 @@ class SoundFileOmega : public SoundFileBrowser
Gtk::ComboBoxText action_combo;
Gtk::ComboBoxText where_combo;
Gtk::ComboBoxText channel_combo;
Gtk::ComboBoxText src_combo;
Gtk::CheckButton copy_files_btn;
Editing::ImportMode get_mode() const;
Editing::ImportPosition get_position() const;
Editing::ImportDisposition get_channel_disposition() const;
ARDOUR::SrcQuality get_src_quality() const;
protected:
void on_hide();
@ -199,7 +214,9 @@ class SoundFileOmega : public SoundFileBrowser
Gtk::VBox block_three;
Gtk::VBox block_four;
static bool check_multichannel_status (const std::vector<Glib::ustring>& paths, bool& same_size, bool& err);
bool check_info (const std::vector<Glib::ustring>& paths,
bool& same_size, bool& src_needed, bool& multichannel);
static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
void file_selection_changed ();

View file

@ -192,9 +192,7 @@ class IO : public PBD::StatefulDestructible
/* Peak metering */
float peak_input_power (uint32_t n) {
if (_ninputs == 0) {
return minus_infinity();
} else if (n < std::max (_ninputs, _noutputs)) {
if (n < std::max (_ninputs, _noutputs)) {
return _visible_peak_power[n];
} else {
return minus_infinity();
@ -202,9 +200,7 @@ class IO : public PBD::StatefulDestructible
}
float max_peak_power (uint32_t n) {
if (_ninputs == 0) {
return minus_infinity();
} else if (n < std::max (_ninputs, _noutputs)) {
if (n < std::max (_ninputs, _noutputs)) {
return _max_peak_power[n];
} else {
return minus_infinity();

View file

@ -22,6 +22,7 @@
#include <samplerate.h>
#include <ardour/types.h>
#include <ardour/importable_source.h>
namespace ARDOUR {
@ -29,7 +30,7 @@ namespace ARDOUR {
class ResampledImportableSource : public ImportableSource
{
public:
ResampledImportableSource (SNDFILE* sf, SF_INFO* info, nframes_t rate);
ResampledImportableSource (SNDFILE* sf, SF_INFO* info, nframes_t rate, SrcQuality);
~ResampledImportableSource ();
nframes_t read (Sample* buffer, nframes_t nframes);

View file

@ -564,6 +564,7 @@ class Session : public PBD::StatefulDestructible
/* control info */
bool sample_convert;
SrcQuality quality;
volatile bool freeze;
std::vector<Glib::ustring> paths;

View file

@ -361,6 +361,14 @@ namespace ARDOUR {
typedef std::vector<boost::shared_ptr<AudioSource> > SourceList;
enum SrcQuality {
SrcBest,
SrcGood,
SrcQuick,
SrcFast,
SrcFastest
};
} // namespace ARDOUR
std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);

View file

@ -50,6 +50,7 @@ AudioFilter::make_new_sources (boost::shared_ptr<AudioRegion> region, SourceList
try {
nsrcs.push_back (boost::dynamic_pointer_cast<AudioSource> (SourceFactory::createWritable (session, path, false, session.frame_rate())));
nsrcs.back()->prepare_for_peakfile_writes ();
}
catch (failed_constructor& err) {
@ -76,6 +77,12 @@ AudioFilter::finish (boost::shared_ptr<AudioRegion> region, SourceList& nsrcs)
for (SourceList::iterator si = nsrcs.begin(); si != nsrcs.end(); ++si) {
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*si);
boost::shared_ptr<AudioSource> as = boost::dynamic_pointer_cast<AudioSource>(*si);
if (as) {
as->done_with_peakfile_writes ();
}
if (afs) {
afs->update_header (region->position(), *now, xnow);
afs->mark_immutable ();

View file

@ -81,7 +81,7 @@ Session::import_audiofile (import_status& status)
}
if ((nframes_t) info.samplerate != frame_rate()) {
importable = new ResampledImportableSource (in, &info, frame_rate());
importable = new ResampledImportableSource (in, &info, frame_rate(), status.quality);
} else {
importable = new ImportableSource (in, &info);
}

View file

@ -2475,7 +2475,7 @@ IO::meter ()
{
Glib::Mutex::Lock lm (io_lock); // READER: meter thread.
uint32_t limit = max (_ninputs, _noutputs);
for (uint32_t n = 0; n < limit; ++n) {
/* XXX we should use atomic exchange here */
@ -2497,7 +2497,6 @@ IO::meter ()
_max_peak_power[n] = max (new_peak, _max_peak_power[n]);
if (Config->get_meter_falloff() == 0.0f || new_peak > _visible_peak_power[n]) {
_visible_peak_power[n] = new_peak;
} else {

View file

@ -28,7 +28,7 @@ using namespace PBD;
const uint32_t ResampledImportableSource::blocksize = 4096U;
ResampledImportableSource::ResampledImportableSource (SNDFILE* sf, SF_INFO* info, nframes_t rate)
ResampledImportableSource::ResampledImportableSource (SNDFILE* sf, SF_INFO* info, nframes_t rate, SrcQuality srcq)
: ImportableSource (sf, info)
{
int err;
@ -37,7 +37,27 @@ ResampledImportableSource::ResampledImportableSource (SNDFILE* sf, SF_INFO* info
/* Initialize the sample rate converter. */
if ((src_state = src_new (SRC_SINC_BEST_QUALITY, sf_info->channels, &err)) == 0) {
int src_type;
switch (srcq) {
case SrcBest:
src_type = SRC_SINC_BEST_QUALITY;
break;
case SrcGood:
src_type = SRC_SINC_MEDIUM_QUALITY;
break;
case SrcQuick:
src_type = SRC_SINC_FASTEST;
break;
case SrcFast:
src_type = SRC_ZERO_ORDER_HOLD;
break;
case SrcFastest:
src_type = SRC_LINEAR;
break;
}
if ((src_state = src_new (src_type, sf_info->channels, &err)) == 0) {
error << string_compose(_("Import: src_new() failed : %1"), src_strerror (err)) << endmsg ;
throw failed_constructor ();
}

View file

@ -711,7 +711,6 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
-------------------------------------------------------------------------------------------------- */
if (meter && (_meter_point == MeterPostFader)) {
// cerr << "meter post" << endl;
if ((_gain == 0 && !apply_gain_automation) || dmg == 0) {
uint32_t no = n_outputs();

View file

@ -95,12 +95,12 @@ Session::tempoize_region (TimeStretchRequest& tsr)
try {
sources.push_back (boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createWritable (*this, path, false, frame_rate())));
sources.back()->prepare_for_peakfile_writes ();
} catch (failed_constructor& err) {
error << string_compose (_("tempoize: error creating new audio file %1 (%2)"), path, strerror (errno)) << endmsg;
goto out;
}
}
try {
@ -166,6 +166,12 @@ Session::tempoize_region (TimeStretchRequest& tsr)
for (it = sources.begin(); it != sources.end(); ++it) {
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*it);
boost::shared_ptr<AudioSource> as = boost::dynamic_pointer_cast<AudioSource>(*it);
if (as) {
as->done_with_peakfile_writes ();
}
if (afs) {
afs->update_header (tsr.region->position(), *xnow, now);
}