Move some sync-related options to being session variables.
[ardour.git] / libs / ardour / session_state.cc
index cb4a9e5813f25b61c7592b24ca4e513b82031797..4d07a6c6e26db883651860a941ef68e0e61456e4 100644 (file)
 #include <glibmm.h>
 #include <glibmm/thread.h>
 
-#include <midi++/mmc.h>
-#include <midi++/port.h>
-
-#include <pbd/error.h>
-#include <pbd/pathscanner.h>
-#include <pbd/pthread_utils.h>
-#include <pbd/search_path.h>
-#include <pbd/stacktrace.h>
-
-#include <ardour/audioengine.h>
-#include <ardour/configuration.h>
-#include <ardour/session.h>
-#include <ardour/session_directory.h>
-#include <ardour/session_utils.h>
-#include <ardour/session_state_utils.h>
-#include <ardour/session_metadata.h>
-#include <ardour/buffer.h>
-#include <ardour/audio_diskstream.h>
-#include <ardour/midi_diskstream.h>
-#include <ardour/utils.h>
-#include <ardour/audioplaylist.h>
-#include <ardour/midi_playlist.h>
-#include <ardour/smf_source.h>
-#include <ardour/audiofilesource.h>
-#include <ardour/silentfilesource.h>
-#include <ardour/sndfilesource.h>
-#include <ardour/midi_source.h>
-#include <ardour/sndfile_helpers.h>
-#include <ardour/auditioner.h>
-#include <ardour/io_processor.h>
-#include <ardour/send.h>
-#include <ardour/processor.h>
-#include <ardour/bundle.h>
-#include <ardour/slave.h>
-#include <ardour/tempo.h>
-#include <ardour/audio_track.h>
-#include <ardour/midi_track.h>
-#include <ardour/midi_patch_manager.h>
-#include <ardour/cycle_timer.h>
-#include <ardour/utils.h>
-#include <ardour/named_selection.h>
-#include <ardour/version.h>
-#include <ardour/location.h>
-#include <ardour/audioregion.h>
-#include <ardour/midi_region.h>
-#include <ardour/crossfade.h>
-#include <ardour/control_protocol_manager.h>
-#include <ardour/region_factory.h>
-#include <ardour/source_factory.h>
-#include <ardour/playlist_factory.h>
-#include <ardour/filename_extensions.h>
-#include <ardour/directory_names.h>
-#include <ardour/template_utils.h>
-#include <ardour/ticker.h>
-
-#include <control_protocol/control_protocol.h>
+#include "midi++/mmc.h"
+#include "midi++/port.h"
+
+#include "pbd/error.h"
+#include "pbd/pathscanner.h"
+#include "pbd/pthread_utils.h"
+#include "pbd/search_path.h"
+#include "pbd/stacktrace.h"
+
+#include "ardour/audioengine.h"
+#include "ardour/configuration.h"
+#include "ardour/session.h"
+#include "ardour/session_directory.h"
+#include "ardour/session_utils.h"
+#include "ardour/session_state_utils.h"
+#include "ardour/session_metadata.h"
+#include "ardour/buffer.h"
+#include "ardour/audio_diskstream.h"
+#include "ardour/midi_diskstream.h"
+#include "ardour/utils.h"
+#include "ardour/audioplaylist.h"
+#include "ardour/midi_playlist.h"
+#include "ardour/smf_source.h"
+#include "ardour/audiofilesource.h"
+#include "ardour/silentfilesource.h"
+#include "ardour/sndfilesource.h"
+#include "ardour/midi_source.h"
+#include "ardour/sndfile_helpers.h"
+#include "ardour/auditioner.h"
+#include "ardour/io_processor.h"
+#include "ardour/send.h"
+#include "ardour/processor.h"
+#include "ardour/user_bundle.h"
+#include "ardour/slave.h"
+#include "ardour/tempo.h"
+#include "ardour/audio_track.h"
+#include "ardour/midi_track.h"
+#include "ardour/midi_patch_manager.h"
+#include "ardour/cycle_timer.h"
+#include "ardour/utils.h"
+#include "ardour/named_selection.h"
+#include "ardour/version.h"
+#include "ardour/location.h"
+#include "ardour/audioregion.h"
+#include "ardour/midi_region.h"
+#include "ardour/crossfade.h"
+#include "ardour/control_protocol_manager.h"
+#include "ardour/region_factory.h"
+#include "ardour/source_factory.h"
+#include "ardour/playlist_factory.h"
+#include "ardour/filename_extensions.h"
+#include "ardour/directory_names.h"
+#include "ardour/template_utils.h"
+#include "ardour/ticker.h"
+#include "ardour/route_group.h"
+
+#include "control_protocol/control_protocol.h"
 
 #include "i18n.h"
 #include <locale.h>
@@ -155,13 +156,13 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        insert_cnt = 0;
        _transport_speed = 0;
        _last_transport_speed = 0;
+       phi = (uint64_t) (0x1000000);
+       target_phi = phi;
        auto_play_legal = false;
        transport_sub_state = 0;
        _transport_frame = 0;
-       last_stop_frame = 0;
        end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
        start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
-       _end_location_is_free = true;
        g_atomic_int_set (&_record_status, Disabled);
        loop_changing = false;
        play_loop = false;
@@ -203,7 +204,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        _npan_buffers = 0;
        pending_abort = false;
        destructive_index = 0;
-       current_trans = 0;
        first_file_data_format_reset = true;
        first_file_header_format_reset = true;
        butler_thread = (pthread_t) 0;
@@ -213,8 +213,8 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 
        /* default short fade = 15ms */
 
-       Crossfade::set_short_xfade_length ((nframes_t) floor (Config->get_short_xfade_seconds() * frame_rate()));
-       SndFileSource::setup_standard_crossfades (frame_rate());
+       Crossfade::set_short_xfade_length ((nframes_t) floor (config.get_short_xfade_seconds() * frame_rate()));
+       SndFileSource::setup_standard_crossfades (*this, frame_rate());
 
        last_mmc_step.tv_sec = 0;
        last_mmc_step.tv_usec = 0;
@@ -230,7 +230,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 
        process_function = &Session::process_with_events;
 
-       if (Config->get_use_video_sync()) {
+       if (config.get_use_video_sync()) {
                waiting_for_sync_offset = true;
        } else {
                waiting_for_sync_offset = false;
@@ -338,8 +338,7 @@ Session::second_stage_init (bool new_session)
        /* handle this one in a different way than all others, so that its clear what happened */
        
        catch (AudioEngine::PortRegistrationFailure& err) {
-               error << _("Unable to create all required ports")
-                     << endmsg;
+               error << err.what() << endmsg;
                return -1;
        }
 
@@ -363,11 +362,7 @@ Session::second_stage_init (bool new_session)
 
        ControlProtocolManager::instance().set_session (*this);
 
-       if (new_session) {
-               _end_location_is_free = true;
-       } else {
-               _end_location_is_free = false;
-       }
+       config.set_end_marker_is_free (new_session);
 
        _state_of_the_state = Clean;
        
@@ -412,12 +407,7 @@ Session::setup_raid_path (string path)
        SearchPath sound_search_path;
        SearchPath midi_search_path;
 
-       for (
-                       SearchPath::const_iterator i = search_path.begin();
-                       i != search_path.end();
-                       ++i
-               )
-       {
+       for (SearchPath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) {
                sp.path = (*i).to_string ();
                sp.blocks = 0; // not needed
                session_dirs.push_back (sp);
@@ -428,14 +418,11 @@ Session::setup_raid_path (string path)
                midi_search_path += sdir.midi_path ();
        }
 
-       // set the AudioFileSource and SMFSource search path
-
-       AudioFileSource::set_search_path (sound_search_path.to_string ());
-       SMFSource::set_search_path (midi_search_path.to_string ());
-
+       // set the search path for each data type
+       FileSource::set_search_path (DataType::AUDIO, sound_search_path.to_string ());
+       SMFSource::set_search_path (DataType::MIDI, midi_search_path.to_string ());
 
        // reset the round-robin soundfile path thingie
-
        last_rr_session_dir = session_dirs.begin();
 }
 
@@ -768,10 +755,8 @@ Session::restore_state (string snapshot_name)
 int
 Session::load_state (string snapshot_name)
 {
-       if (state_tree) {
-               delete state_tree;
-               state_tree = 0;
-       }
+       delete state_tree;
+       state_tree = 0;
 
        state_was_pending = false;
 
@@ -867,11 +852,9 @@ Session::load_state (string snapshot_name)
 int
 Session::load_options (const XMLNode& node)
 {
-       XMLNode* child;
-       XMLProperty* prop;
        LocaleGuard lg (X_("POSIX"));
 
-       Config->set_variables (node, ConfigVariableBase::Session);
+       config.set_variables (node);
 
        /* now reset MIDI ports because the session can have its own 
           MIDI configuration.
@@ -879,38 +862,9 @@ Session::load_options (const XMLNode& node)
 
        setup_midi ();
 
-       if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
-               if ((prop = child->property ("val")) != 0) {
-                       _end_location_is_free = (prop->value() == "yes");
-               }
-       }
-
        return 0;
 }
 
-bool
-Session::save_config_options_predicate (ConfigVariableBase::Owner owner) const
-{
-       const ConfigVariableBase::Owner modified_by_session_or_user = (ConfigVariableBase::Owner)
-               (ConfigVariableBase::Session|ConfigVariableBase::Interface);
-
-       return owner & modified_by_session_or_user;
-}
-
-XMLNode&
-Session::get_options () const
-{
-       XMLNode* child;
-       LocaleGuard lg (X_("POSIX"));
-
-       XMLNode& option_root = Config->get_variables (mem_fun (*this, &Session::save_config_options_predicate));
-
-       child = option_root.add_child ("end-marker-is-free");
-       child->add_property ("val", _end_location_is_free ? "yes" : "no");
-
-       return option_root;
-}
-
 XMLNode&
 Session::get_state()
 {
@@ -986,7 +940,7 @@ Session::state(bool full_state)
 
        /* various options */
 
-       node->add_child_nocopy (get_options());
+       node->add_child_nocopy (config.get_variables ());
 
        node->add_child_nocopy (_metadata->get_state());
 
@@ -997,18 +951,13 @@ Session::state(bool full_state)
 
                for (SourceMap::iterator siter = sources.begin(); siter != sources.end(); ++siter) {
                        
-                       /* Don't save information about AudioFileSources that are empty */
+                       /* Don't save information about non-destructive file sources that are empty */
+                       /* FIXME: MIDI breaks if this is made FileSource like it should be... */
                        
                        boost::shared_ptr<AudioFileSource> fs;
-
                        if ((fs = boost::dynamic_pointer_cast<AudioFileSource> (siter->second)) != 0) {
-
-                               /* Don't save sources that are empty, unless they're destructive (which are OK
-                                  if they are empty, because we will re-use them every time.)
-                               */
-
                                if (!fs->destructive()) {
-                                       if (fs->length() == 0) {
+                                       if (fs->length(fs->timeline_position()) == 0) {
                                                continue;
                                        }
                                }
@@ -1061,8 +1010,8 @@ Session::state(bool full_state)
        
        child = node->add_child ("Bundles");
        {
-               Glib::Mutex::Lock lm (bundle_lock);
-               for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
+               boost::shared_ptr<BundleList> bundles = _bundles.reader ();
+               for (BundleList::iterator i = bundles->begin(); i != bundles->end(); ++i) {
                        boost::shared_ptr<UserBundle> b = boost::dynamic_pointer_cast<UserBundle> (*i);
                        if (b) {
                                child->add_child_nocopy (b->get_state());
@@ -1212,7 +1161,7 @@ Session::set_state (const XMLNode& node)
        /* Object loading order:
 
        Path
-       extra
+       Extra
        Options/Config
        MIDI Control // relies on data from Options/Config
        Metadata
@@ -1228,7 +1177,7 @@ Session::set_state (const XMLNode& node)
        ControlProtocols
        */
 
-       if ((child = find_named_node (node, "extra")) != 0) {
+       if ((child = find_named_node (node, "Extra")) != 0) {
                _extra_xml = new XMLNode (*child);
        }
 
@@ -1396,7 +1345,7 @@ Session::load_routes (const XMLNode& node)
                boost::shared_ptr<Route> route (XMLRouteFactory (**niter));
 
                if (route == 0) {
-                       error << _("Session: cannot create Route from XML description.")                              << endmsg;
+                       error << _("Session: cannot create Route from XML description.") << endmsg;
                        return -1;
                }
 
@@ -1421,8 +1370,10 @@ Session::XMLRouteFactory (const XMLNode& node)
        
        DataType type = DataType::AUDIO;
        const XMLProperty* prop = node.property("default-type");
-       if (prop)
+
+       if (prop) {
                type = DataType(prop->value());
+       } 
        
        assert(type != DataType::NIL);
 
@@ -1739,14 +1690,11 @@ Session::load_sources (const XMLNode& node)
        set_dirty();
 
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-
                try {
                        if ((source = XMLSourceFactory (**niter)) == 0) {
                                error << _("Session: cannot create Source from XML description.") << endmsg;
                        }
-               }
-
-               catch (non_existent_source& err) {
+               } catch (MissingSource& err) {
                        warning << _("A sound file is missing. It will be replaced by silence.") << endmsg;
                        source = SourceFactory::createSilent (*this, **niter, max_frames, _current_frame_rate);
                }
@@ -2265,29 +2213,36 @@ Session::edit_group_by_name (string name)
 }
 
 void
-Session::begin_reversible_command (const string& name)
+Session::begin_reversible_command(const string& name)
 {
-       current_trans = new UndoTransaction;
-       current_trans->set_name (name);
+       UndoTransaction* trans = new UndoTransaction();
+       trans->set_name(name);
+       if (!_current_trans.empty()) {
+               _current_trans.top()->add_command(trans);
+       }
+       _current_trans.push(trans);
 }
 
 void
-Session::commit_reversible_command (Command *cmd)
+Session::commit_reversible_command(Command *cmd)
 {
+       assert(!_current_trans.empty());
        struct timeval now;
 
        if (cmd) {
-               current_trans->add_command (cmd);
+               _current_trans.top()->add_command(cmd);
        }
 
-       if (current_trans->empty()) {
+       if (_current_trans.top()->empty()) {
+               _current_trans.pop();
                return;
        }
 
-       gettimeofday (&now, 0);
-       current_trans->set_timestamp (now);
+       gettimeofday(&now, 0);
+       _current_trans.top()->set_timestamp(now);
 
-       _history.add (current_trans);
+       _history.add(_current_trans.top());
+       _current_trans.pop();
 }
 
 Session::GlobalRouteBooleanState 
@@ -2376,32 +2331,6 @@ Session::set_global_record_enable (GlobalRouteBooleanState s, void* src)
        set_global_route_boolean (s, &Route::set_record_enable, src);
 }
 
-#if 0
-UndoAction
-Session::global_mute_memento (void* src)
-{
-       return sigc::bind (mem_fun (*this, &Session::set_global_mute), get_global_route_boolean (&Route::muted), src);
-}
-
-UndoAction
-Session::global_metering_memento (void* src)
-{
-       return sigc::bind (mem_fun (*this, &Session::set_global_route_metering), get_global_route_metering (), src);
-}
-
-UndoAction
-Session::global_solo_memento (void* src)
-{
-       return sigc::bind (mem_fun (*this, &Session::set_global_solo), get_global_route_boolean (&Route::soloed), src);
-}
-
-UndoAction
-Session::global_record_enable_memento (void* src)
-{
-       return sigc::bind (mem_fun (*this, &Session::set_global_record_enable), get_global_route_boolean (&Route::record_enabled), src);
-}
-#endif
-
 static bool
 accept_all_non_peak_files (const string& path, void *arg)
 {
@@ -2576,7 +2505,7 @@ Session::cleanup_sources (Session::cleanup_report& rep)
                   capture files.
                */
 
-               if (!i->second->used() && i->second->length() > 0) {
+               if (!i->second->used() && i->second->length(i->second->timeline_position()) > 0) {
                        dead_sources.push_back (i->second);
                        i->second->GoingAway();
                } 
@@ -2622,9 +2551,9 @@ Session::cleanup_sources (Session::cleanup_report& rep)
         */
        
        for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
-               boost::shared_ptr<AudioFileSource> fs;
+               boost::shared_ptr<FileSource> fs;
                
-               if ((fs = boost::dynamic_pointer_cast<AudioFileSource> (i->second)) != 0) {
+               if ((fs = boost::dynamic_pointer_cast<FileSource> (i->second)) != 0) {
                        all_sources.insert (fs->path());
                } 
        }
@@ -2865,7 +2794,12 @@ void
 Session::set_deletion_in_progress ()
 {
        _state_of_the_state = StateOfTheState (_state_of_the_state | Deletion);
+}
 
+void
+Session::clear_deletion_in_progress ()
+{
+       _state_of_the_state = StateOfTheState (_state_of_the_state & (~Deletion));
 }
 
 void
@@ -3066,18 +3000,20 @@ Session::restore_history (string snapshot_name)
 }
 
 void
-Session::config_changed (const char* parameter_name)
+Session::config_changed (std::string p, bool ours)
 {
-#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
-
-       if (PARAM_IS ("seamless-loop")) {
+       if (ours) {
+               set_dirty ();
+       }
+       
+       if (p == "seamless-loop") {
                
-       } else if (PARAM_IS ("rf-speed")) {
+       } else if (p == "rf-speed") {
                
-       } else if (PARAM_IS ("auto-loop")) {
+       } else if (p == "auto-loop") {
+               
+       } else if (p == "auto-input") {
                
-       } else if (PARAM_IS ("auto-input")) {
-
                if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) {
                        /* auto-input only makes a difference if we're rolling */
                        
@@ -3085,38 +3021,38 @@ Session::config_changed (const char* parameter_name)
                        
                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
                                if ((*i)->record_enabled ()) {
-                                       (*i)->monitor_input (!Config->get_auto_input());
+                                       (*i)->monitor_input (!config.get_auto_input());
                                }
                        }
                }
 
-       } else if (PARAM_IS ("punch-in")) {
+       } else if (p == "punch-in") {
 
                Location* location;
                
                if ((location = _locations.auto_punch_location()) != 0) {
                        
-                       if (Config->get_punch_in ()) {
+                       if (config.get_punch_in ()) {
                                replace_event (Event::PunchIn, location->start());
                        } else {
                                remove_event (location->start(), Event::PunchIn);
                        }
                }
                
-       } else if (PARAM_IS ("punch-out")) {
+       } else if (p == "punch-out") {
 
                Location* location;
                
                if ((location = _locations.auto_punch_location()) != 0) {
                        
-                       if (Config->get_punch_out()) {
+                       if (config.get_punch_out()) {
                                replace_event (Event::PunchOut, location->end());
                        } else {
                                clear_events (Event::PunchOut);
                        }
                }
 
-       } else if (PARAM_IS ("edit-mode")) {
+       } else if (p == "edit-mode") {
 
                Glib::Mutex::Lock lm (playlist_lock);
                
@@ -3124,63 +3060,63 @@ Session::config_changed (const char* parameter_name)
                        (*i)->set_edit_mode (Config->get_edit_mode ());
                }
 
-       } else if (PARAM_IS ("use-video-sync")) {
+       } else if (p == "use-video-sync") {
 
-               waiting_for_sync_offset = Config->get_use_video_sync();
+               waiting_for_sync_offset = config.get_use_video_sync();
 
-       } else if (PARAM_IS ("mmc-control")) {
+       } else if (p == "mmc-control") {
 
                //poke_midi_thread ();
 
-       } else if (PARAM_IS ("mmc-device-id") || PARAM_IS ("mmc-receive-id")) {
+       } else if (p == "mmc-device-id" || p == "mmc-receive-id") {
 
                if (mmc) {
                        mmc->set_receive_device_id (Config->get_mmc_receive_device_id());
                }
 
-       } else if (PARAM_IS ("mmc-send-id")) {
+       } else if (p == "mmc-send-id") {
 
                if (mmc) {
                        mmc->set_send_device_id (Config->get_mmc_send_device_id());
                }
 
-       } else if (PARAM_IS ("midi-control")) {
+       } else if (p == "midi-control") {
                
                //poke_midi_thread ();
 
-       } else if (PARAM_IS ("raid-path")) {
+       } else if (p == "raid-path") {
 
-               setup_raid_path (Config->get_raid_path());
+               setup_raid_path (config.get_raid_path());
 
-       } else if (PARAM_IS ("smpte-format")) {
+       } else if (p == "smpte-format") {
 
                sync_time_vars ();
 
-       } else if (PARAM_IS ("video-pullup")) {
+       } else if (p == "video-pullup") {
 
                sync_time_vars ();
 
-       } else if (PARAM_IS ("seamless-loop")) {
+       } else if (p == "seamless-loop") {
 
                if (play_loop && transport_rolling()) {
                        // to reset diskstreams etc
                        request_play_loop (true);
                }
 
-       } else if (PARAM_IS ("rf-speed")) {
+       } else if (p == "rf-speed") {
 
                cumulative_rf_motion = 0;
                reset_rf_scale (0);
 
-       } else if (PARAM_IS ("click-sound")) {
+       } else if (p == "click-sound") {
 
                setup_click_sounds (1);
 
-       } else if (PARAM_IS ("click-emphasis-sound")) {
+       } else if (p == "click-emphasis-sound") {
 
                setup_click_sounds (-1);
 
-       } else if (PARAM_IS ("clicking")) {
+       } else if (p == "clicking") {
 
                if (Config->get_clicking()) {
                        if (_click_io && click_data) { // don't require emphasis data
@@ -3190,7 +3126,7 @@ Session::config_changed (const char* parameter_name)
                        _clicking = false;
                }
 
-       } else if (PARAM_IS ("send-mtc")) {
+       } else if (p == "send-mtc") {
                
                /* only set the internal flag if we have
                   a port.
@@ -3206,7 +3142,7 @@ Session::config_changed (const char* parameter_name)
                        session_send_mtc = false;
                }
 
-       } else if (PARAM_IS ("send-mmc")) {
+       } else if (p == "send-mmc") {
                
                /* only set the internal flag if we have
                   a port.
@@ -3219,7 +3155,7 @@ Session::config_changed (const char* parameter_name)
                        session_send_mmc = false; 
                }
 
-       } else if (PARAM_IS ("midi-feedback")) {
+       } else if (p == "midi-feedback") {
                
                /* only set the internal flag if we have
                   a port.
@@ -3229,11 +3165,11 @@ Session::config_changed (const char* parameter_name)
                        session_midi_feedback = Config->get_midi_feedback();
                }
 
-       } else if (PARAM_IS ("jack-time-master")) {
+       } else if (p == "jack-time-master") {
 
                engine().reset_timebase ();
 
-       } else if (PARAM_IS ("native-file-header-format")) {
+       } else if (p == "native-file-header-format") {
 
                if (!first_file_header_format_reset) {
                        reset_native_file_format ();
@@ -3241,7 +3177,7 @@ Session::config_changed (const char* parameter_name)
 
                first_file_header_format_reset = false;
 
-       } else if (PARAM_IS ("native-file-data-format")) {
+       } else if (p == "native-file-data-format") {
 
                if (!first_file_data_format_reset) {
                        reset_native_file_format ();
@@ -3249,17 +3185,17 @@ Session::config_changed (const char* parameter_name)
 
                first_file_data_format_reset = false;
 
-       } else if (PARAM_IS ("slave-source")) {
-               set_slave_source (Config->get_slave_source());
-       } else if (PARAM_IS ("remote-model")) {
+       } else if (p == "slave-source") {
+                               set_slave_source (Config->get_slave_source());
+       } else if (p == "remote-model") {
                set_remote_control_ids ();
-       }  else if (PARAM_IS ("denormal-model")) {
+       }  else if (p == "denormal-model") {
                setup_fpu ();
-       } else if (PARAM_IS ("history-depth")) {
+       } else if (p == "history-depth") {
                set_history_depth (Config->get_history_depth());
-       } else if (PARAM_IS ("sync-all-route-ordering")) {
+       } else if (p == "sync-all-route-ordering") {
                sync_order_keys ("session");
-       } else if (PARAM_IS ("initial-program-change")) {
+       } else if (p == "initial-program-change") {
 
                if (_mmc_port && Config->get_initial_program_change() >= 0) {
                        MIDI::byte buf[2];
@@ -3269,7 +3205,7 @@ Session::config_changed (const char* parameter_name)
 
                        _mmc_port->midimsg (buf, sizeof (buf), 0);
                }
-       } else if (PARAM_IS ("initial-program-change")) {
+       } else if (p == "initial-program-change") {
 
                if (_mmc_port && Config->get_initial_program_change() >= 0) {
                        MIDI::byte* buf = new MIDI::byte[2];
@@ -3278,14 +3214,11 @@ Session::config_changed (const char* parameter_name)
                        buf[1] = (Config->get_initial_program_change() & 0x7f);
                        // deliver_midi (_mmc_port, buf, 2);
                }
-       } else if (PARAM_IS ("solo-mute-override")) {
+       } else if (p == "solo-mute-override") {
                catch_up_on_solo_mute_override ();
        }
 
        set_dirty ();
-                  
-#undef PARAM_IS
-
 }
 
 void