2 Copyright (C) 2008 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <glib/gstdio.h>
28 #include <glibmm/fileutils.h>
29 #include <glibmm/miscutils.h>
31 #include "pbd/enumwriter.h"
32 #include "pbd/xml++.h"
33 #include "pbd/convert.h"
35 #include "ardour/export_profile_manager.h"
36 #include "ardour/export_format_specification.h"
37 #include "ardour/search_paths.h"
38 #include "ardour/export_timespan.h"
39 #include "ardour/export_channel_configuration.h"
40 #include "ardour/export_filename.h"
41 #include "ardour/export_preset.h"
42 #include "ardour/export_handler.h"
43 #include "ardour/export_failed.h"
44 #include "ardour/directory_names.h"
45 #include "ardour/filename_extensions.h"
46 #include "ardour/route.h"
47 #include "ardour/session.h"
48 #include "ardour/broadcast_info.h"
59 ExportProfileManager::ExportProfileManager (Session & s, ExportType type)
61 , handler (s.get_export_handler())
64 , ranges (new LocationList ())
65 , single_range_mode (false)
67 , format_list (new FormatList ())
71 xml_node_name = X_("ExportProfile");
74 xml_node_name = X_("RangeExportProfile");
77 xml_node_name = X_("SelectionExportProfile");
80 xml_node_name = X_("RegionExportProfile");
83 xml_node_name = X_("StemExportProfile");
87 /* Initialize path variables */
89 export_config_dir = Glib::build_filename (user_config_directory(), export_dir_name);
91 search_path += export_formats_search_path();
93 info << string_compose (_("Searching for export formats in %1"), search_path.to_string()) << endmsg;
95 /* create export config directory if necessary */
97 if (!Glib::file_test (export_config_dir, Glib::FILE_TEST_EXISTS)) {
98 if (g_mkdir_with_parents (export_config_dir.c_str(), 0755) != 0) {
99 error << string_compose (_("Unable to create export format directory %1: %2"), export_config_dir, g_strerror(errno)) << endmsg;
106 /* Initialize all lists with an empty config */
109 init_timespans (dummy);
110 init_channel_configs (dummy);
111 init_formats (dummy);
112 init_filenames (dummy);
115 ExportProfileManager::~ExportProfileManager ()
117 XMLNode * extra_xml (new XMLNode (xml_node_name));
118 serialize_profile (*extra_xml);
119 session.add_extra_xml (*extra_xml);
123 ExportProfileManager::load_profile ()
125 XMLNode * extra_node = session.extra_xml (xml_node_name);
126 /* Legacy sessions used Session instant.xml for this */
128 extra_node = session.instant_xml (xml_node_name);
132 set_state (*extra_node);
134 XMLNode empty_node (xml_node_name);
135 set_state (empty_node);
140 ExportProfileManager::prepare_for_export ()
142 TimespanListPtr ts_list = timespans.front()->timespans;
144 FormatStateList::const_iterator format_it;
145 FilenameStateList::const_iterator filename_it;
148 for (TimespanList::iterator ts_it = ts_list->begin(); ts_it != ts_list->end(); ++ts_it) {
149 // ..., each format-filename pair
150 for (format_it = formats.begin(), filename_it = filenames.begin();
151 format_it != formats.end() && filename_it != filenames.end();
152 ++format_it, ++filename_it) {
154 ExportFilenamePtr filename = (*filename_it)->filename;
155 // filename->include_timespan = (ts_list->size() > 1); Disabled for now...
157 boost::shared_ptr<BroadcastInfo> b;
158 if ((*format_it)->format->has_broadcast_info()) {
159 b.reset (new BroadcastInfo);
160 b->set_from_session (session, (*ts_it)->get_start());
163 // ...and each channel config
164 filename->include_channel_config = (type == StemExport) ||
165 (channel_configs.size() > 1);
166 for(ChannelConfigStateList::iterator cc_it = channel_configs.begin(); cc_it != channel_configs.end(); ++cc_it) {
167 handler->add_export_config (*ts_it, (*cc_it)->config, (*format_it)->format, filename, b);
174 ExportProfileManager::load_preset (ExportPresetPtr preset)
178 current_preset = preset;
179 if (!preset) { return false; }
181 XMLNode const * state;
182 if ((state = preset->get_local_state())) {
183 set_local_state (*state);
184 } else { ok = false; }
186 if ((state = preset->get_global_state())) {
187 if (!set_global_state (*state)) {
190 } else { ok = false; }
196 ExportProfileManager::load_presets ()
198 vector<std::string> found = find_file (string_compose (X_("*%1"),export_preset_suffix));
200 for (vector<std::string>::iterator it = found.begin(); it != found.end(); ++it) {
201 load_preset_from_disk (*it);
206 ExportProfileManager::preset_filename (std::string const & preset_name)
208 string safe_name = legalize_for_path (preset_name);
209 return Glib::build_filename (export_config_dir, safe_name + export_preset_suffix);
213 ExportProfileManager::new_preset (string const & name)
215 // Generate new ID and do regular save
216 string filename = preset_filename (name);
217 current_preset.reset (new ExportPreset (filename, session));
218 preset_list.push_back (current_preset);
219 return save_preset (name);
223 ExportProfileManager::save_preset (string const & name)
225 string filename = preset_filename (name);
227 if (!current_preset) {
228 current_preset.reset (new ExportPreset (filename, session));
229 preset_list.push_back (current_preset);
232 XMLNode * global_preset = new XMLNode ("ExportPreset");
233 XMLNode * local_preset = new XMLNode ("ExportPreset");
235 serialize_global_profile (*global_preset);
236 serialize_local_profile (*local_preset);
238 current_preset->set_name (name);
239 current_preset->set_global_state (*global_preset);
240 current_preset->set_local_state (*local_preset);
242 current_preset->save (filename);
244 return current_preset;
248 ExportProfileManager::remove_preset ()
250 if (!current_preset) { return; }
252 for (PresetList::iterator it = preset_list.begin(); it != preset_list.end(); ++it) {
253 if (*it == current_preset) {
254 preset_list.erase (it);
259 FileMap::iterator it = preset_file_map.find (current_preset->id());
260 if (it != preset_file_map.end()) {
261 if (g_remove (it->second.c_str()) != 0) {
262 error << string_compose (_("Unable to remove export preset %1: %2"), it->second, g_strerror(errno)) << endmsg;
264 preset_file_map.erase (it);
267 current_preset->remove_local();
268 current_preset.reset();
272 ExportProfileManager::load_preset_from_disk (std::string const & path)
274 ExportPresetPtr preset (new ExportPreset (path, session));
276 /* Handle id to filename mapping and don't add duplicates to list */
278 FilePair pair (preset->id(), path);
279 if (preset_file_map.insert (pair).second) {
280 preset_list.push_back (preset);
285 ExportProfileManager::set_state (XMLNode const & root)
287 return set_global_state (root) & set_local_state (root);
291 ExportProfileManager::set_global_state (XMLNode const & root)
293 return init_filenames (root.children ("ExportFilename")) &
294 init_formats (root.children ("ExportFormat"));
298 ExportProfileManager::set_local_state (XMLNode const & root)
300 return init_timespans (root.children ("ExportTimespan")) &
301 init_channel_configs (root.children ("ExportChannelConfiguration"));
305 ExportProfileManager::serialize_profile (XMLNode & root)
307 serialize_local_profile (root);
308 serialize_global_profile (root);
312 ExportProfileManager::serialize_global_profile (XMLNode & root)
314 for (FormatStateList::iterator it = formats.begin(); it != formats.end(); ++it) {
315 root.add_child_nocopy (serialize_format (*it));
318 for (FilenameStateList::iterator it = filenames.begin(); it != filenames.end(); ++it) {
319 root.add_child_nocopy ((*it)->filename->get_state());
324 ExportProfileManager::serialize_local_profile (XMLNode & root)
326 for (TimespanStateList::iterator it = timespans.begin(); it != timespans.end(); ++it) {
327 root.add_child_nocopy (serialize_timespan (*it));
330 for (ChannelConfigStateList::iterator it = channel_configs.begin(); it != channel_configs.end(); ++it) {
331 root.add_child_nocopy ((*it)->config->get_state());
335 std::vector<std::string>
336 ExportProfileManager::find_file (std::string const & pattern)
338 vector<std::string> found;
340 find_files_matching_pattern (found, search_path, pattern);
346 ExportProfileManager::set_selection_range (framepos_t start, framepos_t end)
350 selection_range.reset (new Location (session));
351 selection_range->set_name (_("Selection"));
352 selection_range->set (start, end);
354 selection_range.reset();
357 for (TimespanStateList::iterator it = timespans.begin(); it != timespans.end(); ++it) {
358 (*it)->selection_range = selection_range;
363 ExportProfileManager::set_single_range (framepos_t start, framepos_t end, string name)
365 single_range_mode = true;
367 single_range.reset (new Location (session));
368 single_range->set_name (name);
369 single_range->set (start, end);
373 return single_range->id().to_s();
377 ExportProfileManager::init_timespans (XMLNodeList nodes)
383 for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
384 TimespanStatePtr span = deserialize_timespan (**it);
386 timespans.push_back (span);
387 } else { ok = false; }
390 if (timespans.empty()) {
391 TimespanStatePtr state (new TimespanState (selection_range, ranges));
392 timespans.push_back (state);
394 // Add session as default selection
395 Location * session_range;
397 if (Profile->get_trx()) {
398 session_range = (session.get_play_loop () ? session.locations()->auto_loop_location () : session.locations()->session_range_location());
400 session_range = session.locations()->session_range_location();
403 if (!session_range) { return false; }
405 ExportTimespanPtr timespan = handler->add_timespan();
406 timespan->set_name (session_range->name());
407 timespan->set_range_id (session_range->id().to_s());
408 timespan->set_range (session_range->start(), session_range->end());
409 state->timespans->push_back (timespan);
416 ExportProfileManager::TimespanStatePtr
417 ExportProfileManager::deserialize_timespan (XMLNode & root)
419 TimespanStatePtr state (new TimespanState (selection_range, ranges));
420 XMLProperty const * prop;
422 XMLNodeList spans = root.children ("Range");
423 for (XMLNodeList::iterator node_it = spans.begin(); node_it != spans.end(); ++node_it) {
425 prop = (*node_it)->property ("id");
426 if (!prop) { continue; }
427 string id = prop->value();
429 Location * location = 0;
430 for (LocationList::iterator it = ranges->begin(); it != ranges->end(); ++it) {
431 if ((id == "selection" && *it == selection_range.get()) ||
432 (id == (*it)->id().to_s())) {
438 if (!location) { continue; }
440 ExportTimespanPtr timespan = handler->add_timespan();
441 timespan->set_name (location->name());
442 timespan->set_range_id (location->id().to_s());
443 timespan->set_range (location->start(), location->end());
444 state->timespans->push_back (timespan);
447 if ((prop = root.property ("format"))) {
448 state->time_format = (TimeFormat) string_2_enum (prop->value(), TimeFormat);
451 if (state->timespans->empty()) {
452 return TimespanStatePtr();
459 ExportProfileManager::serialize_timespan (TimespanStatePtr state)
461 XMLNode & root = *(new XMLNode ("ExportTimespan"));
465 for (TimespanList::iterator it = state->timespans->begin(); it != state->timespans->end(); ++it) {
466 if ((span = root.add_child ("Range"))) {
467 span->add_property ("id", (*it)->range_id());
471 root.add_property ("format", enum_2_string (state->time_format));
477 ExportProfileManager::update_ranges () {
480 if (single_range_mode) {
481 ranges->push_back (single_range.get());
487 Location * session_range = (session.get_play_loop () ? session.locations()->auto_loop_location () :
488 session.locations()->session_range_location());
490 ranges->push_back (session_range);
495 if (selection_range) {
496 ranges->push_back (selection_range.get());
501 LocationList const & list (session.locations()->list());
502 for (LocationList::const_iterator it = list.begin(); it != list.end(); ++it) {
503 if ((*it)->is_range_marker()) {
504 ranges->push_back (*it);
509 ExportProfileManager::ChannelConfigStatePtr
510 ExportProfileManager::add_channel_config ()
512 ChannelConfigStatePtr ptr(new ChannelConfigState(handler->add_channel_config()));
513 channel_configs.push_back(ptr);
518 ExportProfileManager::init_channel_configs (XMLNodeList nodes)
520 channel_configs.clear();
523 ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config()));
524 channel_configs.push_back (config);
526 // Add master outs as default
527 if (!session.master_out()) { return false; }
529 IO* master_out = session.master_out()->output().get();
530 if (!master_out) { return false; }
532 for (uint32_t n = 0; n < master_out->n_ports().n_audio(); ++n) {
533 PortExportChannel * channel = new PortExportChannel ();
534 channel->add_port (master_out->audio (n));
536 ExportChannelPtr chan_ptr (channel);
537 config->config->register_channel (chan_ptr);
542 for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
543 ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config()));
544 config->config->set_state (**it);
545 channel_configs.push_back (config);
551 ExportProfileManager::FormatStatePtr
552 ExportProfileManager::duplicate_format_state (FormatStatePtr state)
554 /* Note: The pointer in the new FormatState should point to the same format spec
555 as the original state's pointer. The spec itself should not be copied! */
557 FormatStatePtr format (new FormatState (format_list, state->format));
558 formats.push_back (format);
563 ExportProfileManager::remove_format_state (FormatStatePtr state)
565 for (FormatStateList::iterator it = formats.begin(); it != formats.end(); ++it) {
574 ExportProfileManager::save_format_to_disk (ExportFormatSpecPtr format)
576 // TODO filename character stripping
578 /* Get filename for file */
580 string new_name = format->name();
581 new_name += export_format_suffix;
583 /* make sure its legal for the filesystem */
585 new_name = legalize_for_path (new_name);
587 std::string new_path = Glib::build_filename (export_config_dir, new_name);
589 /* Check if format is on disk already */
590 FileMap::iterator it;
591 if ((it = format_file_map.find (format->id())) != format_file_map.end()) {
593 /* Check if config is not in user config dir */
594 if (Glib::path_get_dirname (it->second) != export_config_dir) {
598 XMLTree tree (new_path);
599 tree.set_root (&format->get_state());
604 /* Update file and rename if necessary */
606 XMLTree tree (it->second);
607 tree.set_root (&format->get_state());
610 if (new_name != Glib::path_get_basename (it->second)) {
611 if (g_rename (it->second.c_str(), new_path.c_str()) != 0) {
612 error << string_compose (_("Unable to rename export format %1 to %2: %3"), it->second, new_path, g_strerror(errno)) << endmsg;
617 it->second = new_path;
622 XMLTree tree (new_path);
623 tree.set_root (&format->get_state());
627 FormatListChanged ();
632 ExportProfileManager::remove_format_profile (ExportFormatSpecPtr format)
634 for (FormatList::iterator it = format_list->begin(); it != format_list->end(); ++it) {
636 format_list->erase (it);
641 FileMap::iterator it = format_file_map.find (format->id());
642 if (it != format_file_map.end()) {
643 if (g_remove (it->second.c_str()) != 0) {
644 error << string_compose (_("Unable to remove export profile %1: %2"), it->second, g_strerror(errno)) << endmsg;
647 format_file_map.erase (it);
650 FormatListChanged ();
654 ExportProfileManager::get_new_format (ExportFormatSpecPtr original)
656 ExportFormatSpecPtr format;
658 format.reset (new ExportFormatSpecification (*original));
659 std::cerr << "After new format created from original, format has id [" << format->id().to_s() << ']' << std::endl;
661 format = handler->add_format();
662 format->set_name (_("empty format"));
665 std::string path = save_format_to_disk (format);
666 FilePair pair (format->id(), path);
667 format_file_map.insert (pair);
669 format_list->push_back (format);
670 FormatListChanged ();
676 ExportProfileManager::init_formats (XMLNodeList nodes)
681 for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
682 FormatStatePtr format = deserialize_format (**it);
684 formats.push_back (format);
685 } else { ok = false; }
688 if (formats.empty ()) {
689 FormatStatePtr format (new FormatState (format_list, ExportFormatSpecPtr ()));
690 formats.push_back (format);
697 ExportProfileManager::FormatStatePtr
698 ExportProfileManager::deserialize_format (XMLNode & root)
703 if ((prop = root.property ("id"))) {
707 for (FormatList::iterator it = format_list->begin(); it != format_list->end(); ++it) {
708 if ((*it)->id() == id) {
709 return FormatStatePtr (new FormatState (format_list, *it));
713 return FormatStatePtr ();
717 ExportProfileManager::serialize_format (FormatStatePtr state)
719 XMLNode * root = new XMLNode ("ExportFormat");
721 string id = state->format ? state->format->id().to_s() : "";
722 root->add_property ("id", id);
728 ExportProfileManager::load_formats ()
730 vector<std::string> found = find_file (string_compose ("*%1", export_format_suffix));
732 for (vector<std::string>::iterator it = found.begin(); it != found.end(); ++it) {
733 load_format_from_disk (*it);
738 ExportProfileManager::load_format_from_disk (std::string const & path)
742 if (!tree.read (path)) {
743 error << string_compose (_("Cannot load export format from %1"), path) << endmsg;
747 XMLNode* root = tree.root();
749 error << string_compose (_("Cannot export format read from %1"), path) << endmsg;
753 ExportFormatSpecPtr format = handler->add_format (*root);
755 /* Handle id to filename mapping and don't add duplicates to list */
757 FilePair pair (format->id(), path);
758 if (format_file_map.insert (pair).second) {
759 format_list->push_back (format);
762 FormatListChanged ();
765 ExportProfileManager::FilenameStatePtr
766 ExportProfileManager::duplicate_filename_state (FilenameStatePtr state)
768 FilenameStatePtr filename (new FilenameState (handler->add_filename_copy (state->filename)));
769 filenames.push_back (filename);
774 ExportProfileManager::remove_filename_state (FilenameStatePtr state)
776 for (FilenameStateList::iterator it = filenames.begin(); it != filenames.end(); ++it) {
778 filenames.erase (it);
785 ExportProfileManager::get_sample_filename_for_format (ExportFilenamePtr filename, ExportFormatSpecPtr format)
789 if (channel_configs.empty()) { return ""; }
791 std::list<string> filenames;
792 build_filenames (filenames, filename, timespans.front()->timespans,
793 channel_configs.front()->config, format);
795 if (filenames.empty()) { return ""; }
796 return filenames.front();
800 ExportProfileManager::init_filenames (XMLNodeList nodes)
804 for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
805 ExportFilenamePtr filename = handler->add_filename();
806 filename->set_state (**it);
807 filenames.push_back (FilenameStatePtr (new FilenameState (filename)));
810 if (filenames.empty()) {
811 FilenameStatePtr filename (new FilenameState (handler->add_filename()));
812 filenames.push_back (filename);
819 boost::shared_ptr<ExportProfileManager::Warnings>
820 ExportProfileManager::get_warnings ()
822 boost::shared_ptr<Warnings> warnings (new Warnings ());
824 ChannelConfigStatePtr channel_config_state;
825 if (!channel_configs.empty ()) {
826 channel_config_state = channel_configs.front();
829 TimespanStatePtr timespan_state = timespans.front();
831 /*** Check "global" config ***/
833 TimespanListPtr timespans = timespan_state->timespans;
835 ExportChannelConfigPtr channel_config;
836 if (channel_config_state) {
837 channel_config = channel_config_state->config;
840 /* Check Timespans are not empty */
842 if (timespans->empty()) {
843 warnings->errors.push_back (_("No timespan has been selected!"));
846 if (channel_config_state == 0) {
847 warnings->errors.push_back (_("No channels have been selected!"));
849 /* Check channel config ports */
850 if (!channel_config->all_channels_have_ports ()) {
851 warnings->warnings.push_back (_("Some channels are empty"));
855 /*** Check files ***/
857 if (channel_config_state) {
858 FormatStateList::const_iterator format_it;
859 FilenameStateList::const_iterator filename_it;
860 for (format_it = formats.begin(), filename_it = filenames.begin();
861 format_it != formats.end() && filename_it != filenames.end();
862 ++format_it, ++filename_it) {
863 check_config (warnings, timespan_state, channel_config_state, *format_it, *filename_it);
871 ExportProfileManager::check_config (boost::shared_ptr<Warnings> warnings,
872 TimespanStatePtr timespan_state,
873 ChannelConfigStatePtr channel_config_state,
874 FormatStatePtr format_state,
875 FilenameStatePtr filename_state)
877 TimespanListPtr timespans = timespan_state->timespans;
878 ExportChannelConfigPtr channel_config = channel_config_state->config;
879 ExportFormatSpecPtr format = format_state->format;
880 ExportFilenamePtr filename = filename_state->filename;
882 /* Check format and maximum channel count */
883 if (!format || !format->type()) {
884 warnings->errors.push_back (_("No format selected!"));
885 } else if (!channel_config->get_n_chans()) {
886 warnings->errors.push_back (_("All channels are empty!"));
887 } else if (!check_format (format, channel_config->get_n_chans())) {
888 warnings->errors.push_back (_("One or more of the selected formats is not compatible with this system!"));
889 } else if (format->channel_limit() < channel_config->get_n_chans()) {
890 warnings->errors.push_back
891 (string_compose (_("%1 supports only %2 channels, but you have %3 channels in your channel configuration"),
892 format->format_name(),
893 format->channel_limit(),
894 channel_config->get_n_chans()));
897 if (!warnings->errors.empty()) { return; }
899 /* Check filenames */
901 // filename->include_timespan = (timespans->size() > 1); Disabled for now...
903 std::list<string> paths;
904 build_filenames(paths, filename, timespans, channel_config, format);
906 for (std::list<string>::const_iterator path_it = paths.begin(); path_it != paths.end(); ++path_it) {
908 string path = *path_it;
910 if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
911 warnings->conflicting_filenames.push_back (path);
914 if (format->with_toc()) {
915 string marker_file = handler->get_cd_marker_filename(path, CDMarkerTOC);
916 if (Glib::file_test (marker_file, Glib::FILE_TEST_EXISTS)) {
917 warnings->conflicting_filenames.push_back (marker_file);
921 if (format->with_cue()) {
922 string marker_file = handler->get_cd_marker_filename(path, CDMarkerCUE);
923 if (Glib::file_test (marker_file, Glib::FILE_TEST_EXISTS)) {
924 warnings->conflicting_filenames.push_back (marker_file);
931 ExportProfileManager::check_format (ExportFormatSpecPtr format, uint32_t channels)
933 switch (format->type()) {
934 case ExportFormatBase::T_Sndfile:
935 return check_sndfile_format (format, channels);
938 throw ExportFailed (X_("Invalid format given for ExportFileFactory::check!"));
943 ExportProfileManager::check_sndfile_format (ExportFormatSpecPtr format, unsigned int channels)
946 sf_info.channels = channels;
947 sf_info.samplerate = format->sample_rate ();
948 sf_info.format = format->format_id () | format->sample_format ();
950 return (sf_format_check (&sf_info) == SF_TRUE ? true : false);
954 ExportProfileManager::build_filenames(std::list<std::string> & result, ExportFilenamePtr filename,
955 TimespanListPtr timespans, ExportChannelConfigPtr channel_config,
956 ExportFormatSpecPtr format)
958 for (std::list<ExportTimespanPtr>::iterator timespan_it = timespans->begin();
959 timespan_it != timespans->end(); ++timespan_it) {
960 filename->set_timespan (*timespan_it);
962 if (channel_config->get_split()) {
963 filename->include_channel = true;
965 for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) {
966 filename->set_channel (chan);
967 result.push_back(filename->get_path (format));
971 filename->include_channel = false;
972 result.push_back(filename->get_path (format));
977 }; // namespace ARDOUR