mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 13:45:43 +01:00
forward-port from 2.X commits 5827-6000 including
git-svn-id: svn://localhost/ardour2/branches/3.0@6914 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d2beb38ea9
commit
dc815ea8e8
19 changed files with 158 additions and 75 deletions
|
|
@ -137,7 +137,7 @@ class LadspaPlugin : public ARDOUR::Plugin
|
|||
|
||||
class LadspaPluginInfo : public PluginInfo {
|
||||
public:
|
||||
LadspaPluginInfo () { };
|
||||
LadspaPluginInfo ();
|
||||
~LadspaPluginInfo () { };
|
||||
|
||||
PluginPtr load (Session& session);
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class VSTPlugin : public ARDOUR::Plugin
|
|||
class VSTPluginInfo : public PluginInfo
|
||||
{
|
||||
public:
|
||||
VSTPluginInfo () {}
|
||||
VSTPluginInfo ();
|
||||
~VSTPluginInfo () {}
|
||||
|
||||
PluginPtr load (Session& session);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
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
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -703,3 +703,8 @@ LadspaPluginInfo::load (Session& session)
|
|||
return PluginPtr ((Plugin*) 0);
|
||||
}
|
||||
}
|
||||
|
||||
LadspaPluginInfo::LadspaPluginInfo()
|
||||
{
|
||||
type = ARDOUR::LADSPA;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -763,13 +763,31 @@ 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,44 +796,56 @@ 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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
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);
|
||||
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*/)
|
||||
Region::trim_end (framepos_t new_endpoint, void* src)
|
||||
{
|
||||
if (locked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (new_endpoint > _position) {
|
||||
trim_to_internal (_position, new_endpoint - _position + 1, this);
|
||||
if (!property_changes_suspended()) {
|
||||
recompute_at_end ();
|
||||
}
|
||||
}
|
||||
modify_end (new_endpoint, false, src);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -524,3 +524,8 @@ VSTPluginInfo::load (Session& session)
|
|||
return PluginPtr ((Plugin*) 0);
|
||||
}
|
||||
}
|
||||
|
||||
VSTPluginInfo::VSTPluginInfo()
|
||||
{
|
||||
type = ARDOUR::VST;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue