From f85161c5d0ac5649bf33cf7d165213295a2a9d16 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 13 Mar 2010 19:22:34 +0000 Subject: [PATCH] "Ardour" -> PROGRAM_NAME change for libardour and setup for gtk2_ardour git-svn-id: svn://localhost/ardour2/branches/3.0@6757 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/wscript | 1 + libs/ardour/audio_unit.cc | 2 +- libs/ardour/audiofilesource.cc | 12 ++++--- libs/ardour/broadcast_info.cc | 2 +- libs/ardour/file_source.cc | 4 +-- libs/ardour/globals.cc | 2 +- libs/ardour/import.cc | 62 ++++++++++++++------------------ libs/ardour/lv2_plugin.cc | 4 +-- libs/ardour/rc_configuration.cc | 14 ++++---- libs/ardour/session.cc | 2 +- libs/ardour/session_midi.cc | 4 +-- libs/ardour/session_state.cc | 11 +++--- libs/ardour/session_transport.cc | 7 ++-- libs/ardour/wscript | 2 ++ wscript | 4 +++ 15 files changed, 69 insertions(+), 64 deletions(-) diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index e328a96263..6a71c7718b 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -254,6 +254,7 @@ def build(bld): obj.cxxflags += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"'] obj.cxxflags += ['-DLOCALEDIR="' + os.path.join( os.path.normpath(bld.env['DATADIR']), 'locale') + '"'] + obj.cxxflags += ['-DPROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'] if bld.env['HAVE_SLV2']: obj.source += [ 'lv2_plugin_ui.cc' ] diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index ca5362004c..090dd49e88 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1027,7 +1027,7 @@ AUPlugin::get_state() CFRelease (propertyList); #else if (!seen_get_state_message) { - info << _("Saving AudioUnit settings is not supported in this build of Ardour. Consider paying for a newer version") + info << string_compose (_("Saving AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"), PROGRAM_NAME) << endmsg; seen_get_state_message = true; } diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 297c02e418..0e498c3d59 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -235,16 +235,20 @@ AudioFileSource::old_peak_path (ustring audio_path) bool AudioFileSource::get_soundfile_info (ustring path, SoundFileInfo& _info, string& error_msg) { + /* try sndfile first because it gets timecode info from .wav (BWF) if it exists, + which at present, ExtAudioFile from Apple seems unable to do. + */ + + if (SndFileSource::get_soundfile_info (path, _info, error_msg) != 0) { + return true; + } + #ifdef HAVE_COREAUDIO if (CoreAudioSource::get_soundfile_info (path, _info, error_msg) == 0) { return true; } #endif // HAVE_COREAUDIO - if (SndFileSource::get_soundfile_info (path, _info, error_msg) != 0) { - return true; - } - return false; } diff --git a/libs/ardour/broadcast_info.cc b/libs/ardour/broadcast_info.cc index f956e1207d..ccdb4a331e 100644 --- a/libs/ardour/broadcast_info.cc +++ b/libs/ardour/broadcast_info.cc @@ -19,7 +19,7 @@ */ #include "ardour/broadcast_info.h" - +#include #include #include diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index caddc12b5b..c00e3ddbc3 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -386,8 +386,8 @@ FileSource::set_source_name (const ustring& newname, bool destructive) } // Test whether newpath exists, if yes notify the user but continue. - if (access(newpath.c_str(),F_OK) == 0) { - error << _("Programming error! Ardour tried to rename a file over another file! It's safe to continue working, but please report this to the developers.") << endmsg; + if (Glib::file_test (newpath, Glib::FILE_TEST_EXISTS)) { + error << string_compose (_("Programming error! %1 tried to rename a file over another file! It's safe to continue working, but please report this to the developers."), PROGRAM_NAME) << endmsg; return -1; } diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 389bcc196c..9f3d99ead4 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -309,7 +309,7 @@ lotsa_files_please () if (rl.rlim_cur == RLIM_INFINITY) { info << _("Removed open file count limit. Excellent!") << endmsg; } else { - info << string_compose (_("Ardour will be limited to %1 open files"), rl.rlim_cur) << endmsg; + info << string_compose (_("%1 will be limited to %2 open files"), PROGRAM_NAME, rl.rlim_cur) << endmsg; } } } else { diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index d621afe297..035772305a 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -63,10 +63,8 @@ #include "ardour/tempo.h" #ifdef HAVE_COREAUDIO -#ifdef USE_COREAUDIO_FOR_FILE_IO #include "ardour/caimportable.h" #endif -#endif #include "i18n.h" @@ -77,51 +75,45 @@ using namespace PBD; static boost::shared_ptr open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQuality quality) { -#ifdef HAVE_COREAUDIO -#ifdef USE_COREAUDIO_FOR_FILE_IO - - /* see if we can use CoreAudio to handle the IO */ - - try { - CAImportableSource* src = new CAImportableSource(path); - boost::shared_ptr source (src); + /* try libsndfile first, because it can get BWF info from .wav, which ExtAudioFile cannot. + We don't necessarily need that information in an ImportableSource, but it keeps the + logic the same as in SourceFactory::create() + */ + try { + boost::shared_ptr source(new SndFileImportableSource(path)); + if (source->samplerate() == samplerate) { return source; } - + /* rewrap as a resampled source */ - + return boost::shared_ptr(new ResampledImportableSource(source, samplerate, quality)); } catch (...) { - /* fall back to SndFile */ -#endif -#endif - - try { - boost::shared_ptr source(new SndFileImportableSource(path)); - - if (source->samplerate() == samplerate) { - return source; - } - - /* rewrap as a resampled source */ - - return boost::shared_ptr(new ResampledImportableSource(source, samplerate, quality)); - } - - catch (...) { - throw; // rethrow - } - #ifdef HAVE_COREAUDIO -#ifdef USE_COREAUDIO_FOR_FILE_IO + + /* libsndfile failed, see if we can use CoreAudio to handle the IO */ + + CAImportableSource* src = new CAImportableSource(path); + boost::shared_ptr source (src); + + if (source->samplerate() == samplerate) { + return source; + } + + /* rewrap as a resampled source */ + + return boost::shared_ptr(new ResampledImportableSource(source, samplerate, quality)); + +#else + throw; // rethrow +#endif + } -#endif -#endif } static std::string diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index b48395b40f..faaf41fd35 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -236,8 +236,8 @@ LV2Plugin::set_parameter (uint32_t which, float val) } else { warning << string_compose (_("Illegal parameter number used with plugin \"%1\"." - "This is a bug in either Ardour or the LV2 plugin (%2)"), - name(), unique_id()) << endmsg; + "This is a bug in either %2 or the LV2 plugin (%3)"), + name(), PROGRAM_NAME, unique_id()) << endmsg; } } diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index f1b7748f73..4c9e35924a 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -99,16 +99,16 @@ RCConfiguration::load_state () XMLTree tree; if (!tree.read (rcfile.c_str())) { - error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg; + error << string_compose(_("%1: cannot read system configuration file \"%2\""), PROGRAM_NAME, rcfile) << endmsg; return -1; } if (set_state (*tree.root(), Stateful::current_state_version)) { - error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg; + error << string_compose(_("%1: system configuration file \"%2\" not loaded successfully."), PROGRAM_NAME, rcfile) << endmsg; return -1; } } else { - error << _("your system Ardour configuration file is empty. This probably means that there as an error installing Ardour") << endmsg; + error << string_compose (_("your system %1 configuration file is empty. This probably means that there as an error installing %1"), PROGRAM_NAME) << endmsg; } } @@ -134,21 +134,21 @@ RCConfiguration::load_state () XMLTree tree; if (!tree.read (rcfile)) { - error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg; + error << string_compose(_("%1: cannot read configuration file \"%2\""), PROGRAM_NAME, rcfile) << endmsg; return -1; } if (set_state (*tree.root(), Stateful::current_state_version)) { - error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg; + error << string_compose(_("%1: user configuration file \"%2\" not loaded successfully."), PROGRAM_NAME, rcfile) << endmsg; return -1; } } else { - warning << _("your Ardour configuration file is empty. This is not normal.") << endmsg; + warning << string_compose (_("your %1 configuration file is empty. This is not normal."), PROGRAM_NAME) << endmsg; } } if (!found) - error << "Ardour: could not find configuration file (ardour.rc), canvas will look broken." << endmsg; + error << string_compose (_("%1: could not find configuration file (ardour.rc), canvas will look broken."), PROGRAM_NAME) << endmsg; return 0; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index c38b5a8660..80a175bf30 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1639,7 +1639,7 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m catch (AudioEngine::PortRegistrationFailure& pfe) { - error << _("No more JACK ports are available. You will need to stop Ardour and restart JACK with ports if you need this many tracks.") << endmsg; + error << string_compose (_("No more JACK ports are available. You will need to stop %1 and restart JACK with ports if you need this many tracks."), PROGRAM_NAME) << endmsg; if (track) { /* we need to get rid of this, since the track failed to be created */ diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index e8b7b12e2f..6035a8a077 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -120,7 +120,7 @@ Session::set_mtc_port (string port_tag) if (port_tag.length() == 0) { if (_slave && ((ms = dynamic_cast (_slave)) != 0)) { - error << _("Ardour is slaved to MTC - port cannot be reset") << endmsg; + error << string_compose (_("%1 is slaved to MTC - port cannot be reset"), PROGRAM_NAME) << endmsg; return -1; } @@ -278,7 +278,7 @@ Session::set_midi_clock_port (string port_tag) if (port_tag.length() == 0) { if (_slave && ((ms = dynamic_cast (_slave)) != 0)) { - error << _("Ardour is slaved to MIDI Clock - port cannot be reset") << endmsg; + error << string_compose (_("%1 is slaved to MIDI Clock - port cannot be reset"), PROGRAM_NAME) << endmsg; return -1; } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index d6060cf6ad..1d785c52f3 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -687,7 +687,8 @@ Session::save_state (string snapshot_name, bool pending) } if (!_engine.connected ()) { - error << _("Ardour's audio engine is not connected and state saving would lose all I/O connections. Session not saved") + error << string_compose (_("the %1 audio engine is not connected and state saving would lose all I/O connections. Session not saved"), + PROGRAM_NAME) << endmsg; return 1; } @@ -826,7 +827,7 @@ Session::load_state (string snapshot_name) XMLNode& root (*state_tree->root()); if (root.name() != X_("Session")) { - error << string_compose (_("Session file %1 is not an Ardour session"), xmlpath.to_string()) << endmsg; + error << string_compose (_("Session file %1 is not a session"), xmlpath.to_string()) << endmsg; delete state_tree; state_tree = 0; return -1; @@ -857,8 +858,8 @@ Session::load_state (string snapshot_name) return 0; } - info << string_compose (_("Copying old session file %1 to %2\nUse %2 with Ardour versions before 2.0 from now on"), - xmlpath.to_string(), backup_path.to_string()) + info << string_compose (_("Copying old session file %1 to %2\nUse %2 with %3 versions before 2.0 from now on"), + xmlpath.to_string(), backup_path.to_string(), PROGRAM_NAME) << endmsg; try @@ -1734,7 +1735,7 @@ Session::XMLSourceFactory (const XMLNode& node) } catch (failed_constructor& err) { - error << _("Found a sound file that cannot be used by Ardour. Talk to the progammers.") << endmsg; + error << string_compose (_("Found a sound file that cannot be used by %1. Talk to the progammers."), PROGRAM_NAME) << endmsg; return boost::shared_ptr(); } } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 0e808accb7..7d08c62113 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -640,8 +640,8 @@ Session::set_play_loop (bool yn) set_dirty(); if (yn && Config->get_seamless_loop() && synced_to_jack()) { - warning << _("Seamless looping cannot be supported while Ardour is using JACK transport.\n" - "Recommend changing the configured options") + warning << string_compose (_("Seamless looping cannot be supported while %1 is using JACK transport.\n" + "Recommend changing the configured options"), PROGRAM_NAME) << endmsg; return; } @@ -964,7 +964,8 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state) } if ((synced_to_jack()) && speed != 0.0 && speed != 1.0) { - warning << _("Global varispeed cannot be supported while Ardour is connected to JACK transport control") + warning << string_compose (_("Global varispeed cannot be supported while %1 is connected to JACK transport control"), + PROGRAM_NAME) << endmsg; return; } diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 2fd3a013f8..ce1905afd2 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -278,6 +278,8 @@ def build(bld): os.path.normpath(bld.env['DATADIR']), 'locale') + '"'] obj.cxxflags += ['-DVAMP_DIR="' + os.path.join( os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'] + obj.cxxflags += ['-DPROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'] + #obj.source += ' st_stretch.cc st_pitch.cc ' #obj.uselib += ' SOUNDTOUCH ' #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o' diff --git a/wscript b/wscript index f69cb63931..3ceb9ee471 100644 --- a/wscript +++ b/wscript @@ -313,6 +313,8 @@ def set_compiler_flags (conf,opt): def set_options(opt): autowaf.set_options(opt) + opt.add_option('--program-name', type='string', action='store', default='Ardour', dest='program_name', + help='The user-visible name of the program being built') opt.add_option('--arch', type='string', action='store', dest='arch', help='Architecture-specific compiler flags') opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug', @@ -528,6 +530,8 @@ def configure(conf): if opts.windows_key: conf.define('WINDOWS_KEY', opts.windows_key) autowaf.display_msg(conf, 'Windows Key', opts.windows_key) + conf.env['PROGRAM_NAME'] = opts.program_name + autowaf.display_msg(conf, 'Program Name', opts.program_name) set_compiler_flags (conf, Options.options)