summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2013-07-17 18:15:51 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2013-07-17 18:15:51 +0100
commit5f15bc9f9fe8decfab02db7821b7b15e1d7d95ac (patch)
tree643463d8f156a7ee6b4daa1c776e5ae2a9da16e0 /libs/ardour
parenteeabf89d19214bb075709009a76b3354c4332ccf (diff)
parent82d351f6ca3214ef77df555aca853e18137b7ab4 (diff)
Merge branch 'windows' of git.ardour.org:ardour/ardour into windows
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/midi_track.h4
-rw-r--r--libs/ardour/audio_track.cc5
-rw-r--r--libs/ardour/audio_unit.cc2
-rw-r--r--libs/ardour/audioengine.cc2
-rw-r--r--libs/ardour/io.cc4
-rw-r--r--libs/ardour/kmeterdsp.cc19
-rw-r--r--libs/ardour/ladspa_plugin.cc10
-rw-r--r--libs/ardour/lv2_plugin.cc54
-rw-r--r--libs/ardour/meter.cc4
-rw-r--r--libs/ardour/midi_diskstream.cc4
-rw-r--r--libs/ardour/midi_track.cc10
-rw-r--r--libs/ardour/plugin.cc2
-rw-r--r--libs/ardour/plugin_insert.cc6
-rw-r--r--libs/ardour/route.cc11
-rw-r--r--libs/ardour/track.cc48
-rw-r--r--libs/ardour/vst_plugin.cc4
16 files changed, 137 insertions, 52 deletions
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index 3b75c0a51b..9c1d21a3e4 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -20,6 +20,8 @@
#ifndef __ardour_midi_track_h__
#define __ardour_midi_track_h__
+#include "pbd/ffs.h"
+
#include "ardour/track.h"
#include "ardour/midi_ring_buffer.h"
@@ -183,7 +185,7 @@ private:
/* if mode is ForceChannel, force mask to the lowest set channel or 1 if no
* channels are set.
*/
-#define force_mask(mode,mask) (((mode) == ForceChannel) ? (((mask) ? (1<<(ffs((mask))-1)) : 1)) : mask)
+#define force_mask(mode,mask) (((mode) == ForceChannel) ? (((mask) ? (1<<(PBD::ffs((mask))-1)) : 1)) : mask)
void _set_playback_channel_mode(ChannelMode mode, uint16_t mask) {
mask = force_mask (mode, mask);
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index b4ca9e2df8..4b33bbd4c6 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -325,6 +325,9 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
if (!_active) {
silence (nframes);
+ if (_meter_point == MeterInput && (_monitoring & MonitorInput || _diskstream->record_enabled())) {
+ _meter->reset();
+ }
return 0;
}
@@ -354,7 +357,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
fill_buffers_with_input (bufs, _input, nframes);
- if (_meter_point == MeterInput) {
+ if (_meter_point == MeterInput && (_monitoring & MonitorInput || _diskstream->record_enabled())) {
_meter->run (bufs, start_frame, end_frame, nframes, true);
}
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index ea2e93c5a0..9c86b87415 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -1717,6 +1717,7 @@ AUPlugin::set_state(const XMLNode& node, int version)
return -1;
}
+#ifndef NO_PLUGIN_STATE
if (node.children().empty()) {
return -1;
}
@@ -1752,6 +1753,7 @@ AUPlugin::set_state(const XMLNode& node, int version)
}
CFRelease (propertyList);
}
+#endif
Plugin::set_state (node, version);
return ret;
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index a69e98283e..583ed1ae82 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -1568,7 +1568,7 @@ AudioEngine::stop_process_thread (jack_native_thread_t thread)
* Jack 2 _jack arg is not used so it should be OK
*/
-#ifdef USING_JACK2_EXPANSION_OF_JACK_API
+#if defined(USING_JACK2_EXPANSION_OF_JACK_API) || defined(WIN32)
if (jack_client_stop_thread (_jack, thread) != 0) {
error << "AudioEngine: cannot stop process thread" << endmsg;
return false;
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 4e080b06d8..1349d49a0c 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -1645,7 +1645,9 @@ IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, fr
}
_buffers.get_jack_port_addresses (_ports, nframes);
- proc->run (_buffers, start_frame, end_frame, nframes, true);
+ if (proc) {
+ proc->run (_buffers, start_frame, end_frame, nframes, true);
+ }
}
void
diff --git a/libs/ardour/kmeterdsp.cc b/libs/ardour/kmeterdsp.cc
index 77d1a87a81..afd0f71719 100644
--- a/libs/ardour/kmeterdsp.cc
+++ b/libs/ardour/kmeterdsp.cc
@@ -46,12 +46,6 @@ void Kmeterdsp::process (float *p, int n)
float s, t, z1, z2;
- if (_flag) // Display thread has read the rms value.
- {
- _rms = 0;
- _flag = false;
- }
-
// Get filter state.
z1 = _z1;
z2 = _z2;
@@ -88,9 +82,18 @@ void Kmeterdsp::process (float *p, int n)
_z1 = z1 + 1e-20f;
_z2 = z2 + 1e-20f;
- // Adjust RMS value and update maximum since last read().
s = sqrtf (2 * z2);
- if (s > _rms) _rms = s;
+
+ if (_flag) // Display thread has read the rms value.
+ {
+ _rms = s;
+ _flag = false;
+ }
+ else
+ {
+ // Adjust RMS value and update maximum since last read().
+ if (s > _rms) _rms = s;
+ }
}
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 6ee810f6b1..82bf97264f 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -40,6 +40,7 @@
#include "pbd/compose.h"
#include "pbd/error.h"
#include "pbd/xml++.h"
+#include "pbd/stacktrace.h"
#include "midi++/manager.h"
@@ -372,6 +373,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
return set_state_2X (node, version);
}
+#ifndef NO_PLUGIN_STATE
XMLNodeList nodes;
XMLProperty *prop;
XMLNodeConstIterator iter;
@@ -379,6 +381,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
const char *port;
const char *data;
uint32_t port_id;
+#endif
LocaleGuard lg (X_("POSIX"));
if (node.name() != state_node_name()) {
@@ -386,6 +389,8 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
return -1;
}
+#ifndef NO_PLUGIN_STATE
+
nodes = node.children ("Port");
for (iter = nodes.begin(); iter != nodes.end(); ++iter) {
@@ -408,6 +413,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
sscanf (port, "%" PRIu32, &port_id);
set_parameter (port_id, atof(data));
}
+#endif
latency_compute_run ();
@@ -417,6 +423,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
int
LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
{
+#ifndef NO_PLUGIN_STATE
XMLNodeList nodes;
XMLProperty *prop;
XMLNodeConstIterator iter;
@@ -424,6 +431,7 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
const char *port;
const char *data;
uint32_t port_id;
+#endif
LocaleGuard lg (X_("POSIX"));
if (node.name() != state_node_name()) {
@@ -431,6 +439,7 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
return -1;
}
+#ifndef NO_PLUGIN_STATE
nodes = node.children ("port");
for(iter = nodes.begin(); iter != nodes.end(); ++iter){
@@ -455,6 +464,7 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
}
latency_compute_run ();
+#endif
return 0;
}
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index c5a02575fd..2f46db75a6 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -113,6 +113,8 @@ public:
LV2World ();
~LV2World ();
+ void load_bundled_plugins();
+
LilvWorld* world;
LilvNode* atom_AtomPort;
@@ -141,6 +143,9 @@ public:
LilvNode* time_Position;
LilvNode* ui_GtkUI;
LilvNode* ui_external;
+
+private:
+ bool _bundle_checked;
};
static LV2World _world;
@@ -1229,6 +1234,8 @@ LV2Plugin::set_state(const XMLNode& node, int version)
return -1;
}
+#ifndef NO_PLUGIN_STATE
+
if (version < 3000) {
nodes = node.children("port");
} else {
@@ -1284,6 +1291,7 @@ LV2Plugin::set_state(const XMLNode& node, int version)
}
latency_compute_run();
+#endif
return Plugin::set_state(node, version);
}
@@ -1904,27 +1912,10 @@ static bool lv2_filter (const string& str, void *arg)
LV2World::LV2World()
: world(lilv_world_new())
+ , _bundle_checked(false)
{
lilv_world_load_all(world);
- cout << "Scanning folders for bundled LV2s: " << ARDOUR::lv2_bundled_search_path().to_string() << endl;
- PathScanner scanner;
- vector<string *> *plugin_objects = scanner (ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true);
- if (plugin_objects) {
- for ( vector<string *>::iterator x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
-#ifdef WINDOWS
- string uri = "file:///" + **x + "/";
-#else
- string uri = "file://" + **x + "/";
-#endif
- LilvNode *node = lilv_new_uri(world, uri.c_str());
- lilv_world_load_bundle(world, node);
- lilv_node_free(node);
- }
- }
- delete (plugin_objects);
-
-
atom_AtomPort = lilv_new_uri(world, LV2_ATOM__AtomPort);
atom_Chunk = lilv_new_uri(world, LV2_ATOM__Chunk);
atom_Sequence = lilv_new_uri(world, LV2_ATOM__Sequence);
@@ -1983,6 +1974,31 @@ LV2World::~LV2World()
lilv_node_free(atom_AtomPort);
}
+void
+LV2World::load_bundled_plugins()
+{
+ if (!_bundle_checked) {
+ cout << "Scanning folders for bundled LV2s: " << ARDOUR::lv2_bundled_search_path().to_string() << endl;
+ PathScanner scanner;
+ vector<string *> *plugin_objects = scanner (ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true);
+ if (plugin_objects) {
+ for ( vector<string *>::iterator x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
+#ifdef WINDOWS
+ string uri = "file:///" + **x + "/";
+#else
+ string uri = "file://" + **x + "/";
+#endif
+ LilvNode *node = lilv_new_uri(world, uri.c_str());
+ lilv_world_load_bundle(world, node);
+ lilv_node_free(node);
+ }
+ }
+ delete (plugin_objects);
+
+ _bundle_checked = true;
+ }
+}
+
LV2PluginInfo::LV2PluginInfo (const void* c_plugin)
: _c_plugin(c_plugin)
{
@@ -2014,6 +2030,8 @@ LV2PluginInfo::load(Session& session)
PluginInfoList*
LV2PluginInfo::discover()
{
+ _world.load_bundled_plugins();
+
PluginInfoList* plugs = new PluginInfoList;
const LilvPlugins* plugins = lilv_world_get_all_plugins(_world.world);
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index 304bffe5c9..3d1ab61bbc 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -116,6 +116,10 @@ PeakMeter::reset ()
for (size_t i = 0; i < _peak_signal.size(); ++i) {
_peak_signal[i] = 0.0f;
}
+
+ for (size_t n = 0; n < _kmeter.size(); ++n) {
+ _kmeter[n]->reset();
+ }
}
void
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index a21f3fb6f4..d27c2fa9c7 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -26,10 +26,10 @@
#include <fcntl.h>
#include <cstdlib>
#include <ctime>
-#include <strings.h> // for ffs(3)
#include <sys/stat.h>
#include "pbd/error.h"
+#include "pbd/ffs.h"
#include "pbd/basename.h"
#include <glibmm/threads.h>
#include "pbd/xml++.h"
@@ -438,7 +438,7 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t
break;
case ForceChannel:
if (ev.is_channel_event()) {
- ev.set_channel (ffs(mask) - 1);
+ ev.set_channel (PBD::ffs(mask) - 1);
}
_capture_buf->write(transport_frame + loop_offset + ev.time(),
ev.type(), ev.size(), ev.buffer());
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index f7f9ff7a59..7c4ae24a2a 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -17,8 +17,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <strings.h> // for ffs(3)
-
+#include "pbd/ffs.h"
#include "pbd/enumwriter.h"
#include "pbd/convert.h"
#include "evoral/midi_util.h"
@@ -330,6 +329,9 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
if (!_active) {
silence (nframes);
+ if (_meter_point == MeterInput && (_monitoring & MonitorInput || _diskstream->record_enabled())) {
+ _meter->reset();
+ }
return 0;
}
@@ -354,7 +356,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
fill_buffers_with_input (bufs, _input, nframes);
- if (_meter_point == MeterInput) {
+ if (_meter_point == MeterInput && (_monitoring & MonitorInput || _diskstream->record_enabled())) {
_meter->run (bufs, start_frame, end_frame, nframes, true);
}
@@ -504,7 +506,7 @@ MidiTrack::filter_channels (BufferSet& bufs, ChannelMode mode, uint32_t mask)
}
break;
case ForceChannel:
- ev.set_channel (ffs (mask) - 1);
+ ev.set_channel (PBD::ffs (mask) - 1);
++e;
break;
case AllChannels:
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index ec9e333285..5e0e020bd1 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -397,7 +397,7 @@ Plugin::get_state ()
add_state (root);
#else
if (!seen_get_state_message) {
- info << string_compose (_("Saving AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"),
+ info << string_compose (_("Saving plugin settings is not supported in this build of %1. Consider paying for the full version"),
PROGRAM_NAME)
<< endmsg;
seen_get_state_message = true;
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 23cebf4276..998a03e3aa 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -882,7 +882,12 @@ PluginInsert::set_control_ids (const XMLNode& node, int version)
if ((prop = (*iter)->property (X_("parameter"))) != 0) {
uint32_t p = atoi (prop->value());
+
+ /* this may create the new controllable */
+
boost::shared_ptr<Evoral::Control> c = control (Evoral::Parameter (PluginAutomation, 0, p));
+
+#ifndef NO_PLUGIN_STATE
if (!c) {
continue;
}
@@ -890,6 +895,7 @@ PluginInsert::set_control_ids (const XMLNode& node, int version)
if (ac) {
ac->set_state (**iter, version);
}
+#endif
}
}
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index c6f588a79c..797481b7b8 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -2562,21 +2562,10 @@ Route::set_processor_state (const XMLNode& node)
continue;
}
-#ifndef NO_PLUGIN_STATE
if (processor->set_state (**niter, Stateful::current_state_version) != 0) {
/* This processor could not be configured. Turn it into a UnknownProcessor */
processor.reset (new UnknownProcessor (_session, **niter));
}
-#else
- if (boost::dynamic_pointer_cast<PluginInsert>(processor)) {
- if (processor->set_state (**niter, Stateful::current_state_version) != 0) {
- /* This processor could not be configured. Turn it into a UnknownProcessor */
- processor.reset (new UnknownProcessor (_session, **niter));
- }
- } else {
- /* plugin, but ::set_state() not * allowed no message here - things will get too verbose */
- }
-#endif
/* we have to note the monitor send here, otherwise a new one will be created
and the state of this one will be lost.
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 6d153e1cbf..c6a348ddfb 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -347,6 +347,9 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
if (!_active) {
silence (nframes);
+ if (_meter_point == MeterInput && (_monitoring & MonitorInput || _diskstream->record_enabled())) {
+ _meter->reset();
+ }
return 0;
}
@@ -405,8 +408,39 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
if (be_silent) {
if (_meter_point == MeterInput) {
- /* still need input monitoring */
- _input->process_input (_meter, start_frame, end_frame, nframes);
+ /* still need input monitoring and metering */
+
+ bool const track_rec = _diskstream->record_enabled ();
+ bool const auto_input = _session.config.get_auto_input ();
+ bool const software_monitor = Config->get_monitoring_model() == SoftwareMonitoring;
+ bool const tape_machine_mode = Config->get_tape_machine_mode ();
+ bool no_meter = false;
+
+ /* this needs a proper K-map
+ * and should be separated into a function similar to monitoring_state()
+ * that also handles roll() states in audio_track.cc, midi_track.cc and route.cc
+ *
+ * see http://www.oofus.co.uk/ardour/Ardour3MonitorModesV3.pdf
+ */
+ if (!auto_input && !track_rec) {
+ no_meter=true;
+ }
+ else if (tape_machine_mode && !track_rec && auto_input) {
+ no_meter=true;
+ }
+ else if (!software_monitor && tape_machine_mode && !track_rec) {
+ no_meter=true;
+ }
+ else if (!software_monitor && !tape_machine_mode && !track_rec && !auto_input) {
+ no_meter=true;
+ }
+
+ if (no_meter) {
+ _meter->reset();
+ _input->process_input (boost::shared_ptr<Processor>(), start_frame, end_frame, nframes);
+ } else {
+ _input->process_input (_meter, start_frame, end_frame, nframes);
+ }
}
passthru_silence (start_frame, end_frame, nframes, 0);
@@ -945,6 +979,14 @@ Track::set_monitoring (MonitorChoice mc)
MeterState
Track::metering_state () const
{
- return (_diskstream->record_enabled() || _meter_point == MeterInput) ? MeteringInput : MeteringRoute;
+ bool rv;
+ if (_session.transport_rolling ()) {
+ // audio_track.cc || midi_track.cc roll() runs meter IFF:
+ rv = _meter_point == MeterInput && (_monitoring & MonitorInput || _diskstream->record_enabled());
+ } else {
+ // track no_roll() always metering if
+ rv = _meter_point == MeterInput;
+ }
+ return rv ? MeteringInput : MeteringRoute;
}
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index c385e71a5a..b80a594495 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -197,14 +197,15 @@ int
VSTPlugin::set_state (const XMLNode& node, int version)
{
LocaleGuard lg (X_("POSIX"));
+ int ret = -1;
if (node.name() != state_node_name()) {
error << _("Bad node sent to VSTPlugin::set_state") << endmsg;
return 0;
}
+#ifndef NO_PLUGIN_STATE
XMLNode* child;
- int ret = -1;
if ((child = find_named_node (node, X_("chunk"))) != 0) {
@@ -237,6 +238,7 @@ VSTPlugin::set_state (const XMLNode& node, int version)
ret = 0;
}
+#endif
Plugin::set_state (node, version);
return ret;