diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-04-15 20:42:05 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-04-15 20:42:05 +0000 |
commit | dc815ea8e84d28fc01a68225c2ece4399c4a9c7e (patch) | |
tree | 27954a7b74ea3df1ca87d0ece20ad15a6f46f6be /libs | |
parent | d2beb38ea9fb39dbfb8667784bd248b32d171cbf (diff) |
forward-port from 2.X commits 5827-6000 including
git-svn-id: svn://localhost/ardour2/branches/3.0@6914 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/ladspa_plugin.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/region.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/vst_plugin.h | 2 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 18 | ||||
-rw-r--r-- | libs/ardour/audiosource.cc | 38 | ||||
-rw-r--r-- | libs/ardour/ladspa_plugin.cc | 5 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 1 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 4 | ||||
-rw-r--r-- | libs/ardour/plugin_insert.cc | 25 | ||||
-rw-r--r-- | libs/ardour/region.cc | 60 | ||||
-rw-r--r-- | libs/ardour/sndfile_helpers.cc | 11 | ||||
-rw-r--r-- | libs/ardour/sndfilesource.cc | 12 | ||||
-rw-r--r-- | libs/ardour/vst_plugin.cc | 5 |
13 files changed, 121 insertions, 67 deletions
diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 00f00c99b6..bdad8009f5 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -137,7 +137,7 @@ class LadspaPlugin : public ARDOUR::Plugin class LadspaPluginInfo : public PluginInfo { public: - LadspaPluginInfo () { }; + LadspaPluginInfo (); ~LadspaPluginInfo () { }; PluginPtr load (Session& session); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index a44b3fcb46..2cf9bab97b 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -188,6 +188,9 @@ class Region void trim_end (framepos_t new_position, void *src); void trim_to (framepos_t position, framecnt_t length, void *src); + void cut_front (nframes_t new_position, void *src); + void cut_end (nframes_t new_position, void *src); + void set_layer (layer_t l); /* ONLY Playlist can call this */ void raise (); void lower (); @@ -288,6 +291,8 @@ class Region void trim_to_internal (framepos_t position, framecnt_t length, void *src); virtual void set_position_internal (framepos_t pos, bool allow_bbt_recompute); + void modify_front (nframes_t new_position, bool reset_fade, void* src); + void modify_end (nframes_t new_position, bool reset_fade, void* src); void maybe_uncopy (); void first_edit (); diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 513f24d493..cfc5a117a0 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -101,7 +101,7 @@ class VSTPlugin : public ARDOUR::Plugin class VSTPluginInfo : public PluginInfo { public: - VSTPluginInfo () {} + VSTPluginInfo (); ~VSTPluginInfo () {} PluginPtr load (Session& session); diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index be6cce251a..15110e4869 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -948,15 +948,18 @@ AudioRegion::recompute_at_end () _envelope->set_max_xval (_length); _envelope->thaw (); + if (_left_of_split) { + set_default_fade_out (); + _left_of_split = false; + } else if (_fade_out->back()->when > _length) { + _fade_out->extend_to (_length); + send_change (PropertyChange (Properties::fade_out)); + } + if (_fade_in->back()->when > _length) { _fade_in->extend_to (_length); send_change (PropertyChange (Properties::fade_in)); } - - if (_fade_out->back()->when > _length) { - _fade_out->extend_to (_length); - send_change (PropertyChange (Properties::fade_out)); - } } void @@ -966,7 +969,10 @@ AudioRegion::recompute_at_start () _envelope->truncate_start (_length); - if (_fade_in->back()->when > _length) { + if (_right_of_split) { + set_default_fade_in (); + _right_of_split = false; + } else if (_fade_in->back()->when > _length) { _fade_in->extend_to (_length); send_change (PropertyChange (Properties::fade_in)); } diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 8a367f32a7..60bd5804b3 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -548,22 +548,30 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t to_read = min (chunksize, (framecnt_t)(_length - current_frame)); - if (to_read == 0) { - /* XXX ARGH .. out by one error ... need to figure out why this happens - and fix it rather than do this band-aid move. - */ - zero_fill = npeaks - nvisual_peaks; - npeaks -= zero_fill; - break; - } - - if ((frames_read = read_unlocked (raw_staging, current_frame, to_read)) == 0) { - error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3 of %4 (%5)"), - _name, to_read, current_frame, _length, strerror (errno)) - << endmsg; - goto out; - } + if (current_frame >= _length) { + /* hmm, error condition - we've reached the end of the file + without generating all the peak data. cook up a zero-filled + data buffer and then use it. this is simpler than + adjusting zero_fill and npeaks and then breaking out of + this loop early + */ + + memset (raw_staging, 0, sizeof (Sample) * chunksize); + + } else { + + to_read = min (chunksize, (_length - current_frame)); + + + if ((frames_read = read_unlocked (raw_staging, current_frame, to_read)) == 0) { + error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3 of %4 (%5)"), + _name, to_read, current_frame, _length, strerror (errno)) + << endmsg; + goto out; + } + } + i = 0; } diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index efbc97bc91..81cdff9618 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -703,3 +703,8 @@ LadspaPluginInfo::load (Session& session) return PluginPtr ((Plugin*) 0); } } + +LadspaPluginInfo::LadspaPluginInfo() +{ + type = ARDOUR::LADSPA; +} diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 368c521d0b..9ba4533456 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -680,6 +680,7 @@ LV2PluginInfo::LV2PluginInfo (void* lv2_world, void* slv2_plugin) : _lv2_world(lv2_world) , _slv2_plugin(slv2_plugin) { + type = ARDOUR::LV2; } LV2PluginInfo::~LV2PluginInfo() diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 676d4a820a..57f49a68d5 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1004,7 +1004,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re current->suspend_property_changes (); thawlist.push_back (current); - current->trim_end (pos2, this); + current->cut_end (pos2, this); } else if (overlap == OverlapEnd) { @@ -1043,7 +1043,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re current->suspend_property_changes (); thawlist.push_back (current); - current->trim_end (pos2, this); + current->cut_end (pos2, this); } else if (overlap == OverlapStart) { diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index ddc69a74ac..f50483beaf 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -965,30 +965,7 @@ PluginInsert::signal_latency() const ARDOUR::PluginType PluginInsert::type () { - boost::shared_ptr<LadspaPlugin> lp; -#ifdef VST_SUPPORT - boost::shared_ptr<VSTPlugin> vp; -#endif -#ifdef HAVE_AUDIOUNITS - boost::shared_ptr<AUPlugin> ap; -#endif - - PluginPtr other = plugin (); - - if ((lp = boost::dynamic_pointer_cast<LadspaPlugin> (other)) != 0) { - return ARDOUR::LADSPA; -#ifdef VST_SUPPORT - } else if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (other)) != 0) { - return ARDOUR::VST; -#endif -#ifdef HAVE_AUDIOUNITS - } else if ((ap = boost::dynamic_pointer_cast<AUPlugin> (other)) != 0) { - return ARDOUR::AudioUnit; -#endif - } else { - /* NOT REACHED */ - return (ARDOUR::PluginType) 0; - } + return plugin()->get_info()->type; } PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Parameter ¶m, boost::shared_ptr<AutomationList> list) diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 8625b17a8a..2589f94f81 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -764,12 +764,30 @@ Region::trim_start (framepos_t new_position, void */*src*/) void Region::trim_front (framepos_t new_position, void *src) { + modify_front (new_position, false, src); +} + +void +Region::cut_front (nframes_t new_position, void *src) +{ + modify_front (new_position, true, src); +} + +void +Region::cut_end (nframes_t new_endpoint, void *src) +{ + modify_end (new_endpoint, true, src); +} + +void +Region::modify_front (nframes_t new_position, bool reset_fade, void *src) +{ if (locked()) { return; } - framepos_t end = last_frame(); - framepos_t source_zero; + nframes_t end = last_frame(); + nframes_t source_zero; if (_position > _start) { source_zero = _position - _start; @@ -778,46 +796,58 @@ Region::trim_front (framepos_t new_position, void *src) } if (new_position < end) { /* can't trim it zero or negative length */ - - framecnt_t newlen; + + nframes_t newlen; /* can't trim it back passed where source position zero is located */ - + new_position = max (new_position, source_zero); - - + if (new_position > _position) { newlen = _length - (new_position - _position); } else { newlen = _length + (_position - new_position); } - + trim_to_internal (new_position, newlen, src); - if (!property_changes_suspended()) { + if (reset_fade) { + _right_of_split = true; + } + + if (!property_changes_suspended()) { recompute_at_start (); } } } -/** @param new_endpoint New region end point, such that, for example, - * a region at 0 of length 10 has an endpoint of 9. - */ - void -Region::trim_end (framepos_t new_endpoint, void */*src*/) +Region::modify_end (nframes_t new_endpoint, bool reset_fade, void *src) { if (locked()) { return; } if (new_endpoint > _position) { - trim_to_internal (_position, new_endpoint - _position + 1, this); + trim_to_internal (_position, new_endpoint - _position +1, this); + if (reset_fade) { + _left_of_split = true; + } if (!property_changes_suspended()) { recompute_at_end (); } } } +/** @param new_endpoint New region end point, such that, for example, + * a region at 0 of length 10 has an endpoint of 9. + */ + +void +Region::trim_end (framepos_t new_endpoint, void* src) +{ + modify_end (new_endpoint, false, src); +} + void Region::trim_to (framepos_t position, framecnt_t length, void *src) { diff --git a/libs/ardour/sndfile_helpers.cc b/libs/ardour/sndfile_helpers.cc index 057efff48c..32ff48f485 100644 --- a/libs/ardour/sndfile_helpers.cc +++ b/libs/ardour/sndfile_helpers.cc @@ -17,6 +17,7 @@ */ +#include <strings.h> #include <map> #include <vector> @@ -177,6 +178,16 @@ sndfile_major_format(int format) sf_command (0, SFC_GET_FORMAT_MAJOR, &format_info, sizeof (format_info)); m[format_info.format & SF_FORMAT_TYPEMASK] = format_info.name; + + /* normalize a couple of names rather than use what libsndfile gives us */ + + if (strncasecmp (format_info.name, "OGG", 3) == 0) { + m[format_info.format & SF_FORMAT_TYPEMASK] = "Ogg"; + } else if (strncasecmp (format_info.name, "WAV", 3) == 0) { + m[format_info.format & SF_FORMAT_TYPEMASK] = "WAV"; + } else { + m[format_info.format & SF_FORMAT_TYPEMASK] = format_info.name; + } } } diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index fa709cde24..0ab55d160a 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -816,9 +816,15 @@ SndFileSource::get_soundfile_info (const ustring& path, SoundFileInfo& info, str info.samplerate = sf_info.samplerate; info.channels = sf_info.channels; info.length = sf_info.frames; - info.format_name = string_compose("Format: %1, %2", - sndfile_major_format(sf_info.format), - sndfile_minor_format(sf_info.format)); + + string major = sndfile_major_format(sf_info.format); + string minor = sndfile_minor_format(sf_info.format); + + if (major.length() + minor.length() < 16) { /* arbitrary */ + info.format_name = string_compose("%1/%2", major, minor); + } else { + info.format_name = string_compose("%1\n%2", major, minor); + } info.timecode = binfo.load_from_file (sf) ? binfo.get_time_reference() : 0; diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 6367a668dd..7fb5289f9c 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -524,3 +524,8 @@ VSTPluginInfo::load (Session& session) return PluginPtr ((Plugin*) 0); } } + +VSTPluginInfo::VSTPluginInfo() +{ + type = ARDOUR::VST; +} |