merge with master and fix 4 conflicts by hand
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 2 Jun 2014 15:32:13 +0000 (11:32 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 2 Jun 2014 15:32:13 +0000 (11:32 -0400)
19 files changed:
gtk2_ardour/ardev_common.sh.in
gtk2_ardour/editor_regions.cc
gtk2_ardour/mnemonic-us.bindings.in
gtk2_ardour/opts.cc
gtk2_ardour/sfdb_ui.cc
gtk2_ardour/transcode_ffmpeg.cc
gtk2_ardour/video_server_dialog.cc
gtk2_ardour/video_timeline.cc
libs/ardour/ardour/file_source.h
libs/ardour/ardour/smf_source.h
libs/ardour/plugin_insert.cc
libs/ardour/smf_source.cc
libs/ardour/source_factory.cc
libs/evoral/evoral/SMF.hpp
libs/evoral/src/SMF.cpp
libs/evoral/test/SequenceTest.cpp
libs/pbd/clear_dir.cc
libs/pbd/pbd/clear_dir.h
libs/surfaces/generic_midi/midicontrollable.cc

index d65a287701b3c83fa471417a7d253328c07c40cf..e5a424af6aeab773444e7325145932687121d04a 100644 (file)
@@ -18,6 +18,7 @@ export ARDOUR_MIDIMAPS_PATH=$TOP/midi_maps:.
 export ARDOUR_MCP_PATH=$TOP/mcp:.
 export ARDOUR_EXPORT_FORMATS_PATH=$TOP/export:.
 export ARDOUR_BACKEND_PATH=$libs/backends/jack:$libs/backends/wavesaudio:$libs/backends/dummy
+export ARDOUR_TEST_PATH=$libs/ardour/test/data
 
 #
 # even though we set the above variables, ardour requires that these 
index bf13bd5a6596d496a04a199edc2afd5b303a0ec0..69620d489f978e39d5754635906f312567e69b02 100644 (file)
@@ -114,7 +114,7 @@ EditorRegions::EditorRegions (Editor* e)
                { 3, _("Length"),  _("Length of the region") },
                { 4, _("Sync"),  _("Position of region sync point, relative to start of the region") },
                { 5, _("Fade In"),  _("Length of region fade-in (units: secondary clock), () if disabled") },
-               { 6, _("Fade Out"),  _("Length of region fade-out (units: secondary clock), () if dsisabled") },
+               { 6, _("Fade Out"),  _("Length of region fade-out (units: secondary clock), () if disabled") },
                { 7, _("L"),  _("Region position locked?") },
                { 8, _("G"),  _("Region position glued to Bars|Beats time?") },
                { 9, _("M"),  _("Region muted?") },
index d0bc802b0e7ea44ee4a06fc87c5f92041e8ad880..9b4479a4f7e8317e6ea672593d6ae6d2679bcbd9 100644 (file)
@@ -339,7 +339,7 @@ This mode provides many different operations on both regions and control points,
 @trans|Transport/ToggleAutoPlay|5|toggle auto play
 @trans|Transport/ToggleAutoReturn|6|toggle auto return
 @trans|Transport/ToggleClick|7|toggle click (metronome)
-@ranges|Editor/set-tempo-from-region|9|set tempo (1 bar) from region(s)
+@ranges|Region/set-tempo-from-region|9|set tempo (1 bar) from region(s)
 @ranges|Editor/set-tempo-from-edit-range|0|set tempo (1 bar) from edit range
 
 ; mouse stuff
index 90d753af4c604ed06caa750e9cb3a934fbd6372c..4596b5c62cb3fccc7cf10331e943b3e3c1483987 100644 (file)
@@ -102,7 +102,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
                { "help", 0, 0, 'h' },
                { "no-announcements", 0, 0, 'a' },
                { "bindings", 0, 0, 'b' },
-               { "disable-plugins", 1, 0, 'd' },
+               { "disable-plugins", 0, 0, 'd' },
                { "debug", 1, 0, 'D' },
                { "no-splash", 0, 0, 'n' },
                { "menus", 1, 0, 'm' },
index 8011268335938569bfe7c31583df7221556f687f..72cd75abb1f703f303377958cbe2dd3000074251 100644 (file)
@@ -281,7 +281,7 @@ SoundFileBox::setup_labels (const string& filename)
 
        string error_msg;
 
-       if (SMFSource::safe_midi_file_extension (path)) {
+       if (SMFSource::valid_midi_file (path)) {
 
                boost::shared_ptr<SMFSource> ms =
                        boost::dynamic_pointer_cast<SMFSource> (
@@ -406,7 +406,7 @@ SoundFileBox::audition ()
 
        boost::shared_ptr<Region> r;
 
-       if (SMFSource::safe_midi_file_extension (path)) {
+       if (SMFSource::valid_midi_file (path)) {
 
                boost::shared_ptr<SMFSource> ms =
                        boost::dynamic_pointer_cast<SMFSource> (
@@ -1326,7 +1326,7 @@ SoundFileOmega::reset_options ()
 
        /* See if we are thinking about importing any MIDI files */
        vector<string>::iterator i = paths.begin ();
-       while (i != paths.end() && SMFSource::safe_midi_file_extension (*i) == false) {
+       while (i != paths.end() && SMFSource::valid_midi_file (*i) == false) {
                ++i;
        }
        bool const have_a_midi_file = (i != paths.end ());
@@ -1554,7 +1554,7 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
                                src_needed = true;
                        }
 
-               } else if (SMFSource::safe_midi_file_extension (*i)) {
+               } else if (SMFSource::valid_midi_file (*i)) {
 
                        Evoral::SMF reader;
                        reader.open(*i);
index 4a0fc4b342670025f35ca4afb73d794523fa42c6..ed12184106bca4bfbb6310a75cb7037423c76bec 100644 (file)
@@ -71,17 +71,19 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
        if (ffmpeg_exe.empty() || ffprobe_exe.empty()) {
                warning << string_compose(
                                _(
-                               "No ffprobe or ffmpeg executables could be found on this system.\n"
-                               "Video import and export is not possible until you install those tools.\n"
-                               "%1 requires ffmpeg and ffprobe from ffmpeg.org - version 1.1 or newer.\n"
-                               "\n"
-                               "The tools are included with the %1 releases from ardour.org "
-                               "and also available with the video-server at http://x42.github.com/harvid/\n"
-                               "\n"
-                               "Important: the files need to be installed in $PATH and named ffmpeg_harvid and ffprobe_harvid.\n"
-                               "If you already have a suitable ffmpeg installation on your system, we recommend creating "
-                               "symbolic links from ffmpeg to ffmpeg_harvid and from ffprobe to ffprobe_harvid.\n"
-                               ), PROGRAM_NAME) << endmsg;
+                                       "No ffprobe or ffmpeg executables could be found on this system.\n"
+                                       "Video import and export is not possible until you install those tools.\n"
+                                       "%1 requires ffmpeg and ffprobe from ffmpeg.org - version 1.1 or newer.\n"
+                                       "\n"
+                                       "The tools are included with the %1 releases from ardour.org "
+                                       "and also available with the video-server at http://x42.github.com/harvid/\n"
+                                       "\n"
+                                       "Important: the files need to be installed in $PATH and named ffmpeg_harvid and ffprobe_harvid.\n"
+                                       "If you already have a suitable ffmpeg installation on your system, we recommend creating "
+                                       "symbolic links from ffmpeg to ffmpeg_harvid and from ffprobe to ffprobe_harvid.\n"
+                                       "\n"
+                                       "see also http://manual.ardour.org/video-timeline/setup/"
+                                ), PROGRAM_NAME) << endmsg;
                return;
        }
        ffexecok = true;
index 6d9bb229781532b044cf6bdd503f326d5f3db4ef..add7ea42de8dd22224d8fb5c4152190f8acb44a2 100644 (file)
@@ -123,8 +123,13 @@ VideoServerDialog::VideoServerDialog (Session* s)
        else {
                PBD::warning <<
                        string_compose(
-                       _("The external video server 'harvid' can not be found. The tool is included with the %1 releases from ardour.org, "
-                         "alternatively you can download it from http://x42.github.com/harvid/ or acquire it from your distribution."), PROGRAM_NAME)
+                                       _("The external video server 'harvid' can not be found.\n"
+                                               "The tool is included with the %1 releases from ardour.org, "
+                                               "alternatively you can download it from http://x42.github.com/harvid/ "
+                                               "or acquire it from your distribution.\n"
+                                               "\n"
+                                               "see also http://manual.ardour.org/video-timeline/setup/"
+                                        ), PROGRAM_NAME)
                        << endmsg;
        }
 
index 0defa56be7a3448ec215de34af7c126cab81d3a5..bcbf19d4f7a3e142767f6b3d6eff6f94d9442421 100644 (file)
@@ -765,7 +765,9 @@ VideoTimeLine::find_xjadeo () {
                _xjadeo_bin = X_("");
                warning << _("Video-monitor 'xjadeo' was not found. Please install http://xjadeo.sf.net/ "
                                "(a custom path to xjadeo can be specified by setting the XJREMOTE environment variable. "
-                               "It should point to an application compatible with xjadeo's remote-control interface 'xjremote').")
+                               "It should point to an application compatible with xjadeo's remote-control interface 'xjremote').\n"
+                               "\n"
+                               "see also http://manual.ardour.org/video-timeline/setup/")
                        << endmsg;
        }
 }
index 37a7e67d2ef4c35a460ba151941c84f15ce41c14..c0e4fba0de4b99ecbc189179ec9634b45a7247c4 100644 (file)
@@ -85,6 +85,9 @@ public:
        void existence_check ();
        virtual void prevent_deletion ();
 
+       void existence_check ();
+       virtual void prevent_deletion ();
+
 protected:
        FileSource (Session& session, DataType type,
                    const std::string& path,
index 9d85f943529d3e4d531d1ca27fe542804f8afe87..44d965a4f6dc44f784c9eae62a76da9aaca8a22e 100644 (file)
@@ -36,9 +36,11 @@ template<typename T> class MidiRingBuffer;
 /** Standard Midi File (Type 0) Source */
 class LIBARDOUR_API SMFSource : public MidiSource, public FileSource, public Evoral::SMF {
 public:
+       /** Constructor for new internal-to-session files */
+       SMFSource (Session& session, const std::string& path, Source::Flag flags);
+
        /** Constructor for existing external-to-session files */
-       SMFSource (Session& session, const std::string& path,
-                       Source::Flag flags = Source::Flag(0));
+       SMFSource (Session& session, const std::string& path);
 
        /** Constructor for existing in-session files */
        SMFSource (Session& session, const XMLNode&, bool must_exist = false);
@@ -75,6 +77,9 @@ public:
        void ensure_disk_file ();
 
        static bool safe_midi_file_extension (const std::string& path);
+       static bool valid_midi_file (const std::string& path);
+
+       void prevent_deletion ();
 
        void prevent_deletion ();
 
index 27cae70b62d8dbf41f6effa6b0f06ef3875bdea0..5279a3696216e3ac216ed11e57d8adb5a6b80168 100644 (file)
@@ -1203,6 +1203,10 @@ PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Param
        _logarithmic = desc.logarithmic;
        _sr_dependent = desc.sr_dependent;
        _toggled = desc.toggled;
+
+       if (desc.toggled) {
+               set_flags(Controllable::Toggle);
+       }
 }
 
 /** @param val `user' value */
index 812e06c27b08d30252630d1bb776fc4178567a8c..f6168f9d9b093254b355caa793684217d9e663e4 100644 (file)
@@ -35,6 +35,7 @@
 #include <glibmm/fileutils.h>
 
 #include "evoral/Control.hpp"
+#include "evoral/evoral/SMF.hpp"
 
 #include "ardour/event_type_map.h"
 #include "ardour/midi_model.h"
@@ -49,6 +50,7 @@
 using namespace ARDOUR;
 using namespace Glib;
 using namespace PBD;
+using namespace Evoral;
 
 /** Constructor used for new internal-to-session files.  File cannot exist. */
 SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags)
@@ -83,6 +85,39 @@ SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags)
        _open = true;
 }
 
+/** Constructor used for external-to-session files.  File must exist. */
+SMFSource::SMFSource (Session& s, const string& path)
+       : Source(s, DataType::MIDI, path, Source::Flag (0))
+       , MidiSource(s, path, Source::Flag (0))
+       , FileSource(s, DataType::MIDI, path, string(), Source::Flag (0))
+       , Evoral::SMF()
+       , _last_ev_time_beats(0.0)
+       , _last_ev_time_frames(0)
+       , _smf_last_read_end (0)
+       , _smf_last_read_time (0)
+{
+       /* note that origin remains empty */
+
+       if (init (_path, false)) {
+               throw failed_constructor ();
+       }
+        assert (Glib::file_test (_path, Glib::FILE_TEST_EXISTS));
+       existence_check ();
+
+       /* file is not opened until write */
+
+       if (_flags & Writable) {
+               return;
+       }
+
+       if (open (_path)) {
+               throw failed_constructor ();
+       }
+
+       _open = true;
+}
+
 /** Constructor used for existing internal-to-session files. */
 SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
        : Source(s, node)
@@ -464,6 +499,15 @@ SMFSource::mark_midi_streaming_write_completed (Evoral::Sequence<Evoral::Musical
        mark_nonremovable ();
 }
 
+bool
+SMFSource::valid_midi_file (const string& file)
+{
+       if (safe_midi_file_extension (file) ) {
+               return (SMF::test (file) );
+       }
+       return false;
+}
+
 bool
 SMFSource::safe_midi_file_extension (const string& file)
 {
index 0729f21592040c615edc9bf9154247cc59404f6c..391b205a94e88182f93b23ca20a0e58304f6969a 100644 (file)
@@ -272,7 +272,7 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
 
        } else if (type == DataType::MIDI) {
 
-               boost::shared_ptr<SMFSource> src (new SMFSource (s, path, SMFSource::Flag(0)));
+               boost::shared_ptr<SMFSource> src (new SMFSource (s, path));
                src->load_model (true, true);
 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
                // boost_debug_shared_ptr_mark_interesting (src, "Source");
index 91bc928d9abb81560a427b17a17a280ad03021d8..fe81b8f0441e8efd348830da98e678b6b1d4557a 100644 (file)
@@ -52,6 +52,7 @@ public:
        SMF() : _smf(0), _smf_track(0), _empty(true) {};
        virtual ~SMF();
 
+       static bool test(const std::string& path);
        int  open(const std::string& path, int track=1) THROW_FILE_ERROR;
        int  create(const std::string& path, int track=1, uint16_t ppqn=19200) THROW_FILE_ERROR;
        void close() THROW_FILE_ERROR;
index 51ccda583efd2bad5ac143f7a1323b49f4e702e2..dc3512a0f6673d620048aa68746a523344304787 100644 (file)
@@ -71,6 +71,28 @@ SMF::seek_to_track(int track)
        }
 }
 
+/** Attempt to open the SMF file just to see if it is valid.
+ *
+ * \return  true on success
+ *          false on failure
+ */
+bool
+SMF::test(const std::string& path)
+{
+       PBD::StdioFileDescriptor d (path, "r");
+       FILE* f = d.allocate ();
+       if (f == 0) {
+               return false;
+       }
+
+       smf_t* test_smf;
+       if ((test_smf = smf_load (f)) == NULL) {
+               return false;
+       }
+       smf_delete (test_smf);
+       return true;
+}
+
 /** Attempt to open the SMF file for reading and/or writing.
  *
  * \return  0 on success
index 69931b8e0d221afbd438b0926d9ffe188bb17cd4..6e07776fdb3877d73c0e5bac8437cc0da5facfd1 100644 (file)
@@ -23,7 +23,7 @@ SequenceTest::preserveEventOrderingTest ()
        seq->start_write();
 
        for (Notes::const_iterator i = test_notes.begin(); i != test_notes.end(); ++i) {
-               uint8_t buffer[2];
+               uint8_t buffer[3];
                Event<Time>* event = new Event<Time>(
                                DummyTypeMap::CONTROL, (*i)->on_event().time(), 3, buffer, true
                );
index 9d2d7ed88311b4024958138a11faac3a4d2484fe..36c6fcf9f8bacd3ba3b3853a5a59329c41f89a14 100644 (file)
@@ -32,7 +32,7 @@ using PBD::closedir;
 #include <errno.h>
 #include <string.h>
 
-#include <glib/gstdio.h>
+#include <glib.h>
 #include <glibmm/miscutils.h>
 
 #include "pbd/error.h"
@@ -122,7 +122,7 @@ PBD::remove_directory (const std::string& dir) {
                }
 
                if (::g_unlink (fullpath.c_str())) {
-                       error << string_compose (_("cannot remove file %1 (%2)"), fullpath, strerror (errno)) << endmsg;
+                       error << string_compose (_("cannot remove file %1 (%2)"), fullpath, strerror (errno)) << endmsg;
                }
        }
        if (::g_rmdir(dir.c_str())) {
index f669b84485d5e03094f9405850977a5b614c8134..efef67012df5b49ecbd7521e0fde10273c4f99d9 100644 (file)
@@ -29,6 +29,8 @@
 namespace PBD {
         LIBPBD_API int clear_directory (const std::string&, size_t* = 0, std::vector<std::string>* = 0);
         LIBPBD_API void remove_directory (const std::string& dir);
+        int clear_directory (const std::string&, size_t* = 0, std::vector<std::string>* = 0);
+        void remove_directory (const std::string& dir);
 }
 
 #endif /* __pbd_clear_dir_h__ */
index a26617fd676d276d89ffdf823dcef6936b27cb7e..1d96a073b0f971837ab63133326155ebf11239af 100644 (file)
@@ -169,7 +169,7 @@ MIDIControllable::control_to_midi (float val)
 
        float control_min = controllable->lower ();
        float control_max = controllable->upper ();
-       const float control_range = control_max - control_min;
+       float control_range = control_max - control_min;
 
        if (controllable->is_toggle()) {
                if (val >= (control_min + (control_range/2.0f))) {
@@ -177,6 +177,14 @@ MIDIControllable::control_to_midi (float val)
                } else {
                        return 0;
                }
+       } else {
+               AutomationControl *actl = dynamic_cast<AutomationControl*> (controllable);
+               if (actl) {
+                       control_min = actl->internal_to_interface(control_min);
+                       control_max = actl->internal_to_interface(control_max);
+                       control_range = control_max - control_min;
+                       val = actl->internal_to_interface(val);
+               }
        }
 
        return (val - control_min) / control_range * max_value_for_type ();
@@ -198,8 +206,17 @@ MIDIControllable::midi_to_control (int val)
 
        float control_min = controllable->lower ();
        float control_max = controllable->upper ();
-       const float control_range = control_max - control_min;
-
+       float control_range = control_max - control_min;
+
+       AutomationControl *actl = dynamic_cast<AutomationControl*> (controllable);
+       if (actl) {
+               if (fv == 0.f) return control_min;
+               if (fv == 1.f) return control_max;
+               control_min = actl->internal_to_interface(control_min);
+               control_max = actl->internal_to_interface(control_max);
+               control_range = control_max - control_min;
+               return actl->interface_to_internal((fv * control_range) + control_min);
+       }
        return (fv * control_range) + control_min;
 }