From 7bf89ce109c92a077790910ad57fbeb23fbf7c12 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 6 Apr 2022 21:56:32 -0600 Subject: [PATCH] Constification: make Stateful::get_state() const, with all other required const-ness added (libs) --- libs/ardour/amp.cc | 2 +- libs/ardour/ardour/amp.h | 2 +- libs/ardour/ardour/audio_playlist_source.h | 2 +- libs/ardour/ardour/audio_track.h | 2 +- libs/ardour/ardour/audiofilesource.h | 2 +- libs/ardour/ardour/audioregion.h | 4 +- libs/ardour/ardour/audiosource.h | 2 +- libs/ardour/ardour/automatable.h | 2 +- libs/ardour/ardour/automation_list.h | 6 +- libs/ardour/ardour/beatbox.h | 4 +- libs/ardour/ardour/capturing_processor.h | 2 +- libs/ardour/ardour/control_protocol_manager.h | 4 +- libs/ardour/ardour/delayline.h | 2 +- libs/ardour/ardour/delivery.h | 2 +- libs/ardour/ardour/disk_reader.h | 2 +- libs/ardour/ardour/disk_writer.h | 2 +- .../ardour/export_channel_configuration.h | 2 +- libs/ardour/ardour/export_filename.h | 6 +- .../ardour/export_format_specification.h | 8 +- libs/ardour/ardour/internal_return.h | 2 +- libs/ardour/ardour/internal_send.h | 2 +- libs/ardour/ardour/io.h | 4 +- libs/ardour/ardour/io_processor.h | 2 +- libs/ardour/ardour/location.h | 6 +- libs/ardour/ardour/meter.h | 2 +- libs/ardour/ardour/midi_model.h | 20 +-- libs/ardour/ardour/midi_region.h | 2 +- libs/ardour/ardour/midi_scene_change.h | 2 +- libs/ardour/ardour/midi_source.h | 2 +- libs/ardour/ardour/midi_track.h | 2 +- libs/ardour/ardour/monitor_control.h | 2 +- libs/ardour/ardour/monitor_processor.h | 2 +- libs/ardour/ardour/monitor_return.h | 2 +- libs/ardour/ardour/mute_master.h | 2 +- libs/ardour/ardour/pannable.h | 4 +- libs/ardour/ardour/panner.h | 2 +- libs/ardour/ardour/panner_shell.h | 2 +- libs/ardour/ardour/phase_control.h | 2 +- libs/ardour/ardour/playlist.h | 6 +- libs/ardour/ardour/playlist_source.h | 2 +- libs/ardour/ardour/plugin.h | 2 +- libs/ardour/ardour/plugin_insert.h | 6 +- libs/ardour/ardour/polarity_processor.h | 2 +- libs/ardour/ardour/port.h | 2 +- libs/ardour/ardour/port_insert.h | 2 +- libs/ardour/ardour/presentation_info.h | 2 +- libs/ardour/ardour/processor.h | 4 +- libs/ardour/ardour/rc_configuration.h | 4 +- libs/ardour/ardour/region.h | 4 +- libs/ardour/ardour/return.h | 2 +- libs/ardour/ardour/route.h | 8 +- libs/ardour/ardour/route_group.h | 2 +- libs/ardour/ardour/segment_descriptor.h | 2 +- libs/ardour/ardour/selection.h | 2 +- libs/ardour/ardour/send.h | 2 +- libs/ardour/ardour/session.h | 12 +- libs/ardour/ardour/session_configuration.h | 4 +- libs/ardour/ardour/session_metadata.h | 6 +- libs/ardour/ardour/session_playlists.h | 2 +- libs/ardour/ardour/sidechain.h | 2 +- .../ardour/slavable_automation_control.h | 2 +- libs/ardour/ardour/smf_source.h | 2 +- libs/ardour/ardour/solo_control.h | 2 +- libs/ardour/ardour/solo_isolate_control.h | 2 +- libs/ardour/ardour/solo_safe_control.h | 2 +- libs/ardour/ardour/source.h | 2 +- libs/ardour/ardour/speakers.h | 2 +- libs/ardour/ardour/step_sequencer.h | 6 +- libs/ardour/ardour/track.h | 2 +- libs/ardour/ardour/transport_master.h | 4 +- libs/ardour/ardour/transport_master_manager.h | 2 +- libs/ardour/ardour/triggerbox.h | 10 +- libs/ardour/ardour/unknown_processor.h | 2 +- libs/ardour/ardour/user_bundle.h | 2 +- libs/ardour/ardour/vca.h | 2 +- libs/ardour/ardour/vca_manager.h | 2 +- libs/ardour/audio_playlist_source.cc | 2 +- libs/ardour/audio_track.cc | 4 +- libs/ardour/audiofilesource.cc | 2 +- libs/ardour/audioregion.cc | 4 +- libs/ardour/audiosource.cc | 2 +- libs/ardour/automatable.cc | 4 +- libs/ardour/automation_list.cc | 8 +- libs/ardour/beatbox.cc | 4 +- libs/ardour/capturing_processor.cc | 2 +- libs/ardour/control_protocol_manager.cc | 4 +- libs/ardour/delayline.cc | 2 +- libs/ardour/delivery.cc | 2 +- libs/ardour/disk_reader.cc | 2 +- libs/ardour/disk_writer.cc | 2 +- libs/ardour/export_channel_configuration.cc | 2 +- libs/ardour/export_filename.cc | 4 +- libs/ardour/export_format_specification.cc | 4 +- libs/ardour/internal_return.cc | 2 +- libs/ardour/internal_send.cc | 2 +- libs/ardour/io.cc | 6 +- libs/ardour/io_processor.cc | 2 +- libs/ardour/location.cc | 9 +- libs/ardour/meter.cc | 2 +- libs/ardour/midi_model.cc | 30 ++-- libs/ardour/midi_region.cc | 2 +- libs/ardour/midi_scene_change.cc | 2 +- libs/ardour/midi_source.cc | 2 +- libs/ardour/midi_track.cc | 4 +- libs/ardour/monitor_control.cc | 2 +- libs/ardour/monitor_processor.cc | 2 +- libs/ardour/monitor_return.cc | 2 +- libs/ardour/mute_master.cc | 2 +- libs/ardour/pannable.cc | 4 +- libs/ardour/panner.cc | 2 +- libs/ardour/panner_shell.cc | 2 +- libs/ardour/phase_control.cc | 2 +- libs/ardour/playlist.cc | 4 +- libs/ardour/playlist_source.cc | 2 +- libs/ardour/plugin.cc | 2 +- libs/ardour/plugin_insert.cc | 12 +- libs/ardour/polarity_processor.cc | 2 +- libs/ardour/port_insert.cc | 2 +- libs/ardour/presentation_info.cc | 2 +- libs/ardour/processor.cc | 4 +- libs/ardour/rc_configuration.cc | 4 +- libs/ardour/region.cc | 4 +- libs/ardour/return.cc | 2 +- libs/ardour/route.cc | 18 +- libs/ardour/route_group.cc | 2 +- libs/ardour/segment_descriptor.cc | 2 +- libs/ardour/selection.cc | 2 +- libs/ardour/send.cc | 2 +- libs/ardour/session_configuration.cc | 4 +- libs/ardour/session_metadata.cc | 4 +- libs/ardour/session_playlists.cc | 4 +- libs/ardour/session_state.cc | 165 ++++++++++-------- libs/ardour/sidechain.cc | 2 +- libs/ardour/slavable_automation_control.cc | 4 +- libs/ardour/smf_source.cc | 2 +- libs/ardour/solo_control.cc | 2 +- libs/ardour/solo_isolate_control.cc | 2 +- libs/ardour/solo_safe_control.cc | 2 +- libs/ardour/source.cc | 2 +- libs/ardour/speakers.cc | 2 +- libs/ardour/step_sequencer.cc | 6 +- .../test/automation_list_property_test.cc | 2 +- libs/ardour/track.cc | 2 +- libs/ardour/transport_master.cc | 2 +- libs/ardour/transport_master_manager.cc | 4 +- libs/ardour/triggerbox.cc | 12 +- libs/ardour/unknown_processor.cc | 2 +- libs/ardour/user_bundle.cc | 6 +- libs/ardour/vca.cc | 2 +- libs/ardour/vca_manager.cc | 2 +- libs/gtkmm2ext/gtkmm2ext/keyboard.h | 2 +- libs/gtkmm2ext/gtkmm2ext/window_proxy.h | 2 +- libs/gtkmm2ext/keyboard.cc | 2 +- libs/gtkmm2ext/window_proxy.cc | 2 +- libs/lua/lua/luastate.h | 2 +- libs/lua/luastate.cc | 2 +- libs/midi++2/midi++/midnam_patch.h | 24 +-- libs/midi++2/midi++/port.h | 2 +- libs/midi++2/midnam_patch.cc | 28 +-- libs/panners/1in2out/panner_1in2out.cc | 2 +- libs/panners/1in2out/panner_1in2out.h | 2 +- libs/panners/2in2out/panner_2in2out.cc | 2 +- libs/panners/2in2out/panner_2in2out.h | 2 +- libs/panners/stereobalance/panner_balance.cc | 2 +- libs/panners/stereobalance/panner_balance.h | 2 +- libs/panners/vbap/vbap.cc | 2 +- libs/panners/vbap/vbap.h | 2 +- libs/pbd/command.cc | 2 +- libs/pbd/configuration_variable.cc | 2 +- libs/pbd/controllable.cc | 2 +- libs/pbd/pbd/command.h | 2 +- libs/pbd/pbd/configuration.h | 4 +- libs/pbd/pbd/configuration_variable.h | 2 +- libs/pbd/pbd/controllable.h | 2 +- libs/pbd/pbd/memento_command.h | 2 +- libs/pbd/pbd/stateful.h | 4 +- libs/pbd/pbd/stateful_diff_command.h | 2 +- libs/pbd/pbd/undo.h | 2 +- libs/pbd/stateful.cc | 4 +- libs/pbd/stateful_diff_command.cc | 2 +- libs/pbd/undo.cc | 4 +- libs/surfaces/cc121/cc121.cc | 2 +- libs/surfaces/cc121/cc121.h | 2 +- libs/surfaces/contourdesign/contourdesign.cc | 2 +- libs/surfaces/contourdesign/contourdesign.h | 2 +- .../control_protocol/control_protocol.cc | 2 +- .../control_protocol/control_protocol.h | 2 +- libs/surfaces/faderport/faderport.cc | 2 +- libs/surfaces/faderport/faderport.h | 2 +- libs/surfaces/faderport8/faderport8.cc | 2 +- libs/surfaces/faderport8/faderport8.h | 2 +- .../tranzport/tranzport_control_protocol.cc | 2 +- .../tranzport/tranzport_control_protocol.h | 2 +- .../generic_midi_control_protocol.cc | 8 +- .../generic_midi_control_protocol.h | 4 +- libs/surfaces/generic_midi/midiaction.cc | 2 +- libs/surfaces/generic_midi/midiaction.h | 2 +- .../surfaces/generic_midi/midicontrollable.cc | 2 +- libs/surfaces/generic_midi/midicontrollable.h | 2 +- libs/surfaces/generic_midi/midifunction.cc | 2 +- libs/surfaces/generic_midi/midifunction.h | 2 +- .../launch_control_xl/launch_control_xl.cc | 2 +- .../launch_control_xl/launch_control_xl.h | 2 +- .../mackie/mackie_control_protocol.cc | 8 +- .../surfaces/mackie/mackie_control_protocol.h | 6 +- libs/surfaces/mackie/surface.cc | 2 +- libs/surfaces/mackie/surface.h | 2 +- libs/surfaces/mackie/surface_port.cc | 2 +- libs/surfaces/mackie/surface_port.h | 2 +- libs/surfaces/maschine2/maschine2.cc | 2 +- libs/surfaces/maschine2/maschine2.h | 2 +- libs/surfaces/osc/osc.cc | 2 +- libs/surfaces/osc/osc.h | 2 +- libs/surfaces/osc/osc_controllable.cc | 2 +- libs/surfaces/osc/osc_controllable.h | 2 +- libs/surfaces/push2/push2.cc | 2 +- libs/surfaces/push2/push2.h | 2 +- libs/surfaces/tranzport/state.cc | 2 +- .../tranzport/tranzport_control_protocol.h | 2 +- libs/surfaces/us2400/surface.cc | 2 +- libs/surfaces/us2400/surface.h | 2 +- libs/surfaces/us2400/surface_port.cc | 2 +- libs/surfaces/us2400/surface_port.h | 2 +- .../us2400/us2400_control_protocol.cc | 8 +- .../surfaces/us2400/us2400_control_protocol.h | 6 +- libs/surfaces/wiimote/wiimote.cc | 2 +- libs/surfaces/wiimote/wiimote.h | 2 +- libs/temporal/tempo.cc | 2 +- libs/temporal/temporal/tempo.h | 2 +- libs/widgets/pane.cc | 4 +- libs/widgets/tabbable.cc | 2 +- libs/widgets/widgets/pane.h | 2 +- libs/widgets/widgets/tabbable.h | 2 +- 233 files changed, 476 insertions(+), 460 deletions(-) diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index 0bad76ee08..d9c2f736d4 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -322,7 +322,7 @@ Amp::apply_simple_gain (AudioBuffer& buf, samplecnt_t nframes, gain_t target, sa } XMLNode& -Amp::state () +Amp::state () const { XMLNode& node (Processor::state ()); switch (_gain_control->parameter().type()) { diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index e276336436..58b9dcbf97 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -54,7 +54,7 @@ public: void setup_gain_automation (samplepos_t start_sample, samplepos_t end_sample, samplecnt_t nframes); - XMLNode& state (); + XMLNode& state () const; int set_state (const XMLNode&, int version); static gain_t apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target, bool midi_amp = true); diff --git a/libs/ardour/ardour/audio_playlist_source.h b/libs/ardour/ardour/audio_playlist_source.h index 255dd6f591..1bc3b39ac1 100644 --- a/libs/ardour/ardour/audio_playlist_source.h +++ b/libs/ardour/ardour/audio_playlist_source.h @@ -47,7 +47,7 @@ public: float sample_rate () const; int setup_peakfile (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); bool can_truncate_peaks() const { return false; } diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index deba34e870..3b425309e3 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -57,7 +57,7 @@ class LIBARDOUR_API AudioTrack : public Track boost::shared_ptr write_source (uint32_t n = 0); protected: - XMLNode& state (bool save_template); + XMLNode& state (bool save_template) const; private: int deprecated_use_diskstream_connections (); diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 4394dfbccf..614b26d279 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -66,7 +66,7 @@ public: int setup_peakfile (); void set_gain (float g, bool temporarily = false); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); bool can_truncate_peaks() const { return true; } diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 440944446a..97418a3271 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -127,8 +127,8 @@ class LIBARDOUR_API AudioRegion : public Region, public AudioReadable samplecnt_t read_raw_internal (Sample*, samplepos_t, samplecnt_t, int channel) const; - XMLNode& state (); - XMLNode& get_basic_state (); + XMLNode& state () const; + XMLNode& get_basic_state () const; int set_state (const XMLNode&, int version); void fade_range (samplepos_t, samplepos_t); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index b33ead1541..d880a45029 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -73,7 +73,7 @@ class LIBARDOUR_API AudioSource : virtual public Source, public ARDOUR::AudioRea mutable PBD::Signal0 PeaksReady; mutable PBD::Signal2 PeakRangeReady; - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); int rename_peakfile (std::string newpath); diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index ca2ee38780..2bf122cbdb 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -110,7 +110,7 @@ public: static const std::string xml_node_name; int set_automation_xml_state (const XMLNode&, Evoral::Parameter default_param); - XMLNode& get_automation_xml_state(); + XMLNode& get_automation_xml_state() const; PBD::Signal0 AutomationStateChanged; diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 3b61336f64..4a5d1cf00e 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -113,7 +113,7 @@ public: bool writing () const { return _state == Write; } bool touch_enabled () const { return _state & (Touch | Latch); } - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode &, int version); Command* memento_command (XMLNode* before, XMLNode* after); @@ -130,8 +130,8 @@ private: void create_curve_if_necessary (); int deserialize_events (const XMLNode&); - XMLNode& state (bool save_auto_state, bool need_lock); - XMLNode& serialize_events (bool need_lock); + XMLNode& state (bool save_auto_state, bool need_lock) const; + XMLNode& serialize_events (bool need_lock) const; void maybe_signal_changed (); diff --git a/libs/ardour/ardour/beatbox.h b/libs/ardour/ardour/beatbox.h index ff1fbcb1ce..40e93f4ec2 100644 --- a/libs/ardour/ardour/beatbox.h +++ b/libs/ardour/ardour/beatbox.h @@ -55,8 +55,8 @@ class BeatBox : public ARDOUR::Processor { void silence (samplecnt_t nframes, samplepos_t start_frame); bool can_support_io_configuration (const ChanCount& in, ChanCount& out); - XMLNode& state(); - XMLNode& get_state(void); + XMLNode& state() const; + XMLNode& get_state () const; bool fill_source (boost::shared_ptr); diff --git a/libs/ardour/ardour/capturing_processor.h b/libs/ardour/ardour/capturing_processor.h index 542604845b..fb8354a517 100644 --- a/libs/ardour/ardour/capturing_processor.h +++ b/libs/ardour/ardour/capturing_processor.h @@ -43,7 +43,7 @@ public: // Processor overrides bool can_support_io_configuration (const ChanCount& in, ChanCount& out); protected: - XMLNode& state (); + XMLNode& state () const; private: void realloc_buffers(); diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index 9813311306..ef7541890a 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -82,7 +82,7 @@ class LIBARDOUR_API ControlProtocolManager : public PBD::Stateful, public ARDOUR static const std::string state_node_name; int set_state (const XMLNode&, int version); - XMLNode& get_state (void); + XMLNode& get_state () const; PBD::Signal1 ProtocolStatusChange; @@ -93,7 +93,7 @@ class LIBARDOUR_API ControlProtocolManager : public PBD::Stateful, public ARDOUR ControlProtocolManager (); static ControlProtocolManager* _instance; - Glib::Threads::RWLock protocols_lock; + mutable Glib::Threads::RWLock protocols_lock; std::list control_protocols; void session_going_away (); diff --git a/libs/ardour/ardour/delayline.h b/libs/ardour/ardour/delayline.h index e2016b01b5..abaaec4f53 100644 --- a/libs/ardour/ardour/delayline.h +++ b/libs/ardour/ardour/delayline.h @@ -51,7 +51,7 @@ public: void flush (); protected: - XMLNode& state (); + XMLNode& state () const; private: void allocate_pending_buffers (samplecnt_t, ChanCount const&); diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index 36fd66fa50..cc3b6321c3 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -114,7 +114,7 @@ public: virtual uint32_t pan_outs() const; protected: - XMLNode& state (); + XMLNode& state () const; Role _role; BufferSet* _output_buffers; diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h index cfef323a31..a604a7367a 100644 --- a/libs/ardour/ardour/disk_reader.h +++ b/libs/ardour/ardour/disk_reader.h @@ -146,7 +146,7 @@ protected: bool initialized; }; - XMLNode& state (); + XMLNode& state () const; void resolve_tracker (Evoral::EventSink& buffer, samplepos_t time); diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h index 5307fce179..442253529c 100644 --- a/libs/ardour/ardour/disk_writer.h +++ b/libs/ardour/ardour/disk_writer.h @@ -136,7 +136,7 @@ protected: void resize (samplecnt_t); }; - virtual XMLNode& state (); + virtual XMLNode& state () const; int use_playlist (DataType, boost::shared_ptr); diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h index 5d2431dcdc..3aa8c43b28 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -48,7 +48,7 @@ class LIBARDOUR_API ExportChannelConfiguration : public boost::enable_shared_fro bool operator== (ExportChannelConfiguration const & other) const { return channels == other.channels; } bool operator!= (ExportChannelConfiguration const & other) const { return channels != other.channels; } - XMLNode & get_state (); + XMLNode & get_state () const; int set_state (const XMLNode &); typedef std::list ChannelList; diff --git a/libs/ardour/ardour/export_filename.h b/libs/ardour/ardour/export_filename.h index b961cb3877..b547ffd0c6 100644 --- a/libs/ardour/ardour/export_filename.h +++ b/libs/ardour/ardour/export_filename.h @@ -58,7 +58,7 @@ class LIBARDOUR_API ExportFilename { public: /* Serialization */ - XMLNode & get_state (); + XMLNode & get_state () const; int set_state (const XMLNode &); /* data access */ @@ -122,9 +122,9 @@ class LIBARDOUR_API ExportFilename { typedef std::pair FieldPair; - void add_field (XMLNode * node, std::string const & name, bool enabled, std::string const & value = ""); + static void add_field (XMLNode * node, std::string const & name, bool enabled, std::string const & value = ""); FieldPair get_field (XMLNode const & node, std::string const & name); - FieldPair analyse_folder (); + FieldPair analyse_folder () const; }; diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index 22597108b1..76be3fb217 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -55,7 +55,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { /* Serialization */ - XMLNode & get_state (); + XMLNode & get_state () const; int set_state (const XMLNode & node); private: @@ -201,7 +201,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { /* Serialization */ - XMLNode & get_state (); + XMLNode & get_state () const; int set_state (const XMLNode & root); @@ -256,8 +256,8 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { /* serialization helpers */ - void add_option (XMLNode * node, std::string const & name, std::string const & value); - std::string get_option (XMLNode const * node, std::string const & name); + static void add_option (XMLNode * node, std::string const & name, std::string const & value); + static std::string get_option (XMLNode const * node, std::string const & name); }; diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 667a232588..5c6b09c651 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -46,7 +46,7 @@ public: void set_playback_offset (samplecnt_t cnt); protected: - XMLNode& state (); + XMLNode& state () const; private: /** sends that we are receiving data from */ diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 46402650ba..e6771bb68b 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -64,7 +64,7 @@ public: static PBD::Signal1 CycleStart; protected: - XMLNode& state(); + XMLNode& state() const; private: BufferSet mixbufs; diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index cbeaa03a9f..4232ca109d 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -152,7 +152,7 @@ public: */ PBD::Signal2 changed; - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); int set_state_2X (const XMLNode&, int, bool); @@ -198,7 +198,7 @@ public: int set_ports (const std::string& str); protected: - virtual XMLNode& state (); + virtual XMLNode& state () const; Direction _direction; DataType _default_type; diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index d48e4d16c4..c719c9b72a 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -76,7 +76,7 @@ public: PBD::Signal2 AutomationPlaybackChanged; PBD::Signal2 AutomationChanged; - XMLNode& state (); + XMLNode& state () const; int set_state (const XMLNode&, int version); static void prepare_for_reset (XMLNode& state, const std::string& name); diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 0db7e705e2..29f5dc2d65 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -158,9 +158,9 @@ public: /* CD Track / CD-Text info */ std::map cd_info; - XMLNode& cd_info_node (const std::string &, const std::string &); + static XMLNode& cd_info_node (const std::string &, const std::string &); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); Temporal::TimeDomain position_time_domain() const { return _start.time_domain(); } @@ -216,7 +216,7 @@ public: void ripple (timepos_t const & at, timecnt_t const & distance, bool include_locked, bool notify); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); Location *get_location_by_id(PBD::ID); diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index 41d65e8776..b6fb104a34 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -89,7 +89,7 @@ public: PBD::Signal1 MeterTypeChanged; protected: - XMLNode& state (); + XMLNode& state () const; private: friend class IO; diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 08ea562120..3191d00140 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -73,7 +73,7 @@ public: virtual void undo () = 0; virtual int set_state (const XMLNode&, int version) = 0; - virtual XMLNode & get_state () = 0; + virtual XMLNode & get_state () const = 0; boost::shared_ptr model() const { return _model; } @@ -101,7 +101,7 @@ public: void undo (); int set_state (const XMLNode&, int version); - XMLNode & get_state (); + XMLNode & get_state () const; void add (const NotePtr note); void remove (const NotePtr note); @@ -149,10 +149,10 @@ public: std::set side_effect_removals; - XMLNode &marshal_change(const NoteChange&); + XMLNode &marshal_change(const NoteChange&) const; NoteChange unmarshal_change(XMLNode *xml_note); - XMLNode &marshal_note(const NotePtr note); + XMLNode &marshal_note(const NotePtr note) const; NotePtr unmarshal_note(XMLNode *xml_note); }; @@ -166,7 +166,7 @@ public: }; int set_state (const XMLNode&, int version); - XMLNode & get_state (); + XMLNode & get_state () const; void remove (SysExPtr sysex); void operator() (); @@ -189,7 +189,7 @@ public: std::list _removed; - XMLNode & marshal_change (const Change &); + XMLNode & marshal_change (const Change &) const; Change unmarshal_change (XMLNode *); }; @@ -199,7 +199,7 @@ public: PatchChangeDiffCommand (boost::shared_ptr, const XMLNode &); int set_state (const XMLNode &, int version); - XMLNode & get_state (); + XMLNode & get_state () const; void operator() (); void undo (); @@ -245,10 +245,10 @@ public: std::list _added; std::list _removed; - XMLNode & marshal_change (const Change &); + XMLNode & marshal_change (const Change &) const; Change unmarshal_change (XMLNode *); - XMLNode & marshal_patch_change (constPatchChangePtr); + XMLNode & marshal_patch_change (constPatchChangePtr) const; PatchChangePtr unmarshal_patch_change (XMLNode *); }; @@ -294,7 +294,7 @@ public: // MidiModel doesn't use the normal AutomationList serialisation code // since controller data is stored in the .mid - XMLNode& get_state(); + XMLNode& get_state() const; int set_state(const XMLNode&) { return 0; } PBD::Signal0 ContentsChanged; diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index dc8e418377..3861658134 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -82,7 +82,7 @@ class LIBARDOUR_API MidiRegion : public Region uint32_t chan_n = 0, NoteMode mode = Sustained) const; - XMLNode& state (); + XMLNode& state () const; int set_state (const XMLNode&, int version); int separate_by_channel (std::vector< boost::shared_ptr >&) const; diff --git a/libs/ardour/ardour/midi_scene_change.h b/libs/ardour/ardour/midi_scene_change.h index b24abe1fa5..872a186181 100644 --- a/libs/ardour/ardour/midi_scene_change.h +++ b/libs/ardour/ardour/midi_scene_change.h @@ -49,7 +49,7 @@ class MIDISceneChange : public SceneChange size_t get_bank_lsb_message (uint8_t* buf, size_t size) const; size_t get_program_message (uint8_t* buf, size_t size) const; - XMLNode& get_state(); + XMLNode& get_state() const; int set_state (const XMLNode&, int version); bool operator==(const MIDISceneChange& other) const; diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index d7ff5b9461..78fcebb0b7 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -163,7 +163,7 @@ class LIBARDOUR_API MidiSource : virtual public Source virtual void session_saved(); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); bool length_mutable() const { return true; } diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 13419885f8..77205fb9a3 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -146,7 +146,7 @@ public: protected: - XMLNode& state (bool save_template); + XMLNode& state (bool save_template) const; void act_on_mute (); void monitoring_changed (bool, PBD::Controllable::GroupControlDisposition); diff --git a/libs/ardour/ardour/monitor_control.h b/libs/ardour/ardour/monitor_control.h index a79a9a935f..94078eef31 100644 --- a/libs/ardour/ardour/monitor_control.h +++ b/libs/ardour/ardour/monitor_control.h @@ -43,7 +43,7 @@ class LIBARDOUR_API MonitorControl : public SlavableAutomationControl MonitorState monitoring_state () const { return _monitorable.monitoring_state(); } int set_state (XMLNode const&, int); - XMLNode& get_state (); + XMLNode& get_state () const; protected: void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override); diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h index 93307fa4d4..c6092bff0e 100644 --- a/libs/ardour/ardour/monitor_processor.h +++ b/libs/ardour/ardour/monitor_processor.h @@ -129,7 +129,7 @@ public: void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/); - XMLNode& state (); + XMLNode& state () const; int set_state (const XMLNode&, int /* version */); bool configure_io (ChanCount in, ChanCount out); diff --git a/libs/ardour/ardour/monitor_return.h b/libs/ardour/ardour/monitor_return.h index a774e6d0fc..181de5262f 100644 --- a/libs/ardour/ardour/monitor_return.h +++ b/libs/ardour/ardour/monitor_return.h @@ -34,7 +34,7 @@ public: void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); protected: - XMLNode& state (); + XMLNode& state () const; uint32_t _nch; gain_t _gain; diff --git a/libs/ardour/ardour/mute_master.h b/libs/ardour/ardour/mute_master.h index 8410b2922f..fc390d3bce 100644 --- a/libs/ardour/ardour/mute_master.h +++ b/libs/ardour/ardour/mute_master.h @@ -77,7 +77,7 @@ public: PBD::Signal0 MutePointChanged; - XMLNode& get_state(); + XMLNode& get_state() const; int set_state(const XMLNode&, int version); static const std::string xml_node_name; diff --git a/libs/ardour/ardour/pannable.h b/libs/ardour/ardour/pannable.h index 1e56e7a657..8875e7289c 100644 --- a/libs/ardour/ardour/pannable.h +++ b/libs/ardour/ardour/pannable.h @@ -72,13 +72,13 @@ public: bool writing() const { return _auto_state == Write; } bool touch_enabled() const { return _auto_state & (Touch | Latch); } - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); bool has_state() const { return _has_state; } protected: - virtual XMLNode& state (); + virtual XMLNode& state () const; boost::weak_ptr _panner; AutoState _auto_state; diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index cbd39ff967..fe75192cc7 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -128,7 +128,7 @@ public: pan_t** buffers); int set_state (const XMLNode&, int version); - XMLNode& get_state (); + XMLNode& get_state () const; boost::shared_ptr pannable() const { return _pannable; } diff --git a/libs/ardour/ardour/panner_shell.h b/libs/ardour/ardour/panner_shell.h index 8fed7efa40..4b3df43ee6 100644 --- a/libs/ardour/ardour/panner_shell.h +++ b/libs/ardour/ardour/panner_shell.h @@ -62,7 +62,7 @@ public: /// The fundamental Panner function void run (BufferSet& src, BufferSet& dest, samplepos_t start_sample, samplepos_t end_samples, pframes_t nframes); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); PBD::Signal0 PannableChanged; /* Pannable changed -- l*/ diff --git a/libs/ardour/ardour/phase_control.h b/libs/ardour/ardour/phase_control.h index d875a6411c..af51e19693 100644 --- a/libs/ardour/ardour/phase_control.h +++ b/libs/ardour/ardour/phase_control.h @@ -57,7 +57,7 @@ class LIBARDOUR_API PhaseControl : public AutomationControl void resize (uint32_t); int set_state (XMLNode const&, int); - XMLNode& get_state (); + XMLNode& get_state () const; protected: void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override); diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index fc29eb3fc2..18953812b3 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -241,7 +241,7 @@ public: void foreach_region (boost::function)>); - XMLNode& get_state (); + XMLNode& get_state () const; virtual int set_state (const XMLNode&, int version); XMLNode& get_template (); @@ -304,7 +304,7 @@ protected: class RegionReadLock : public Glib::Threads::RWLock::ReaderLock { public: - RegionReadLock (Playlist* pl) + RegionReadLock (Playlist const * pl) : Glib::Threads::RWLock::ReaderLock (pl->region_lock) { } @@ -424,7 +424,7 @@ protected: virtual void remove_dependents (boost::shared_ptr /*region*/) {} virtual void region_going_away (boost::weak_ptr /*region*/) {} - virtual XMLNode& state (bool); + virtual XMLNode& state (bool) const; bool add_region_internal (boost::shared_ptr, timepos_t const & position, ThawList& thawlist); diff --git a/libs/ardour/ardour/playlist_source.h b/libs/ardour/ardour/playlist_source.h index 90fe5a3a66..2974dbdd35 100644 --- a/libs/ardour/ardour/playlist_source.h +++ b/libs/ardour/ardour/playlist_source.h @@ -52,7 +52,7 @@ protected: timepos_t const & begin, timepos_t const & len, Source::Flag flags); PlaylistSource (Session&, const XMLNode&); - void add_state (XMLNode&); + void add_state (XMLNode&) const; }; } /* namespace */ diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 55295fa2f4..a4fb785fd8 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -77,7 +77,7 @@ public: Plugin (const Plugin&); virtual ~Plugin (); - XMLNode& get_state (); + XMLNode& get_state () const; virtual int set_state (const XMLNode&, int version); virtual void set_insert_id (PBD::ID id) {} diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index f3ebf5bde0..66b955dc90 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -211,7 +211,7 @@ public: double get_value (void) const; void catch_up_with_external_value (double val); - XMLNode& get_state(); + XMLNode& get_state() const; std::string get_user_string() const; private: @@ -228,7 +228,7 @@ public: boost::shared_ptr list=boost::shared_ptr()); double get_value (void) const; - XMLNode& get_state(); + XMLNode& get_state() const; protected: void actually_set_value (double value, PBD::Controllable::GroupControlDisposition); @@ -316,7 +316,7 @@ public: }; protected: - XMLNode& state (); + XMLNode& state () const; private: /* disallow copy construction */ diff --git a/libs/ardour/ardour/polarity_processor.h b/libs/ardour/ardour/polarity_processor.h index 136a726033..4012824e87 100644 --- a/libs/ardour/ardour/polarity_processor.h +++ b/libs/ardour/ardour/polarity_processor.h @@ -41,7 +41,7 @@ public: } protected: - XMLNode& state (); + XMLNode& state () const; private: boost::shared_ptr _control; diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index c7c9aafb89..9e6bcc2bf0 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -150,7 +150,7 @@ public: _global_port_buffer_offset += n; } - virtual XMLNode& get_state (void) const; + virtual XMLNode& get_state () const; virtual int set_state (const XMLNode&, int version); static std::string state_node_name; diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index c5ad6cb5a7..b7c5ac7b4f 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -81,7 +81,7 @@ public: static std::string name_and_id_new_insert (Session&, uint32_t&); protected: - XMLNode& state (); + XMLNode& state () const; private: /* disallow copy construction */ PortInsert (const PortInsert&); diff --git a/libs/ardour/ardour/presentation_info.h b/libs/ardour/ardour/presentation_info.h index 0db9b25337..8e55ccee04 100644 --- a/libs/ardour/ardour/presentation_info.h +++ b/libs/ardour/ardour/presentation_info.h @@ -235,7 +235,7 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful } int set_state (XMLNode const&, int); - XMLNode& get_state (); + XMLNode& get_state () const; bool operator==(PresentationInfo const& other) { return (_order == other.order()) && (_flags == other.flags()); diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 58f1520888..a92967eeee 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -131,7 +131,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public smoothly. */ - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); virtual void set_pre_fader (bool); @@ -158,7 +158,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public SessionObject* owner() const; protected: - virtual XMLNode& state (); + virtual XMLNode& state () const; virtual int set_state_2X (const XMLNode&, int version); bool check_active () { return (_active = _pending_active); } diff --git a/libs/ardour/ardour/rc_configuration.h b/libs/ardour/ardour/rc_configuration.h index 2fe51ccfb6..fe618eff84 100644 --- a/libs/ardour/ardour/rc_configuration.h +++ b/libs/ardour/ardour/rc_configuration.h @@ -45,8 +45,8 @@ class LIBARDOUR_API RCConfiguration : public PBD::Configuration void map_parameters (boost::function&); int set_state (XMLNode const &, int version); - XMLNode& get_state (); - XMLNode& get_variables (); + XMLNode& get_state () const; + XMLNode& get_variables () const; void set_variables (XMLNode const &); int load_state (); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index b90866d210..dbc6acbb7d 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -345,7 +345,7 @@ public: /* serialization */ - XMLNode& get_state (); + XMLNode& get_state () const; virtual int set_state (const XMLNode&, int version); virtual bool do_export (std::string const&) const = 0; @@ -422,7 +422,7 @@ public: void rename_cue_marker (CueMarker&, std::string const &); protected: - virtual XMLNode& state (); + virtual XMLNode& state () const; friend class RegionFactory; diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index ec32270889..8e1cb65939 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -61,7 +61,7 @@ public: static std::string name_and_id_new_return (Session&, uint32_t&); protected: - XMLNode& state(); + XMLNode& state() const; bool _metering; boost::shared_ptr _gain_control; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 8a78dac63c..35dd06d615 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -221,9 +221,9 @@ public: void flush_processors (); - void foreach_processor (boost::function)> method) { + void foreach_processor (boost::function)> method) const { Glib::Threads::RWLock::ReaderLock lm (_processor_lock); - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { method (boost::weak_ptr (*i)); } } @@ -413,7 +413,7 @@ public: PBD::Signal0 io_changed; /* stateful */ - XMLNode& get_state(); + XMLNode& get_state() const; XMLNode& get_template(); virtual int set_state (const XMLNode&, int version); @@ -692,7 +692,7 @@ protected: virtual ChanCount input_streams () const; - virtual XMLNode& state (bool save_template); + virtual XMLNode& state (bool save_template) const; int configure_processors (ProcessorStreams*); diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 338d2c6c79..a6998ccdec 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -146,7 +146,7 @@ public: /** Emitted when a route has been removed from this group */ PBD::Signal2 > RouteRemoved; - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); diff --git a/libs/ardour/ardour/segment_descriptor.h b/libs/ardour/ardour/segment_descriptor.h index f9e7aac285..355f6c2b5f 100644 --- a/libs/ardour/ardour/segment_descriptor.h +++ b/libs/ardour/ardour/segment_descriptor.h @@ -63,7 +63,7 @@ public: /* Replicate the API of PBD::Stateful without the overhead */ - XMLNode& get_state (void) const; + XMLNode& get_state () const; int set_state (const XMLNode&, int version); private: diff --git a/libs/ardour/ardour/selection.h b/libs/ardour/ardour/selection.h index 94222f84ea..d6bf4b3f1c 100644 --- a/libs/ardour/ardour/selection.h +++ b/libs/ardour/ardour/selection.h @@ -76,7 +76,7 @@ class LIBARDOUR_API CoreSelection : public PBD::Stateful { void get_stripables (StripableAutomationControls&) const; - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); protected: diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index e8e3a4d5ec..e52638e2ce 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -114,7 +114,7 @@ public: static std::string name_and_id_new_send (Session&, Delivery::Role r, uint32_t&, bool); protected: - XMLNode& state (); + XMLNode& state () const; bool _metering; boost::shared_ptr _gain_control; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index f8c59ff92f..b15d238412 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1601,7 +1601,7 @@ private: PBD::ReallocPool _mempool; LuaState lua; - Glib::Threads::Mutex lua_lock; + mutable Glib::Threads::Mutex lua_lock; luabridge::LuaRef * _lua_run; luabridge::LuaRef * _lua_add; luabridge::LuaRef * _lua_del; @@ -2097,12 +2097,14 @@ private: XMLNode& state (bool save_template, snapshot_t snapshot_type = NormalSave, - bool only_used_assets = false); + bool only_used_assets = false) const; - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode& node, int version); // not idempotent XMLNode& get_template (); + void maybe_copy_midifiles (snapshot_t, boost::shared_ptr src, XMLNode*); + /* click track */ typedef std::list Clicks; Clicks clicks; @@ -2180,7 +2182,7 @@ private: void config_changed (std::string, bool); - XMLNode& get_control_protocol_state (); + XMLNode& get_control_protocol_state () const; void set_history_depth (uint32_t depth); @@ -2329,7 +2331,7 @@ private: int tb_with_filled_slots; void handle_slots_empty_status (boost::weak_ptr const &); - }; +}; } // namespace ARDOUR diff --git a/libs/ardour/ardour/session_configuration.h b/libs/ardour/ardour/session_configuration.h index c665999fbd..f62495ef2b 100644 --- a/libs/ardour/ardour/session_configuration.h +++ b/libs/ardour/ardour/session_configuration.h @@ -32,8 +32,8 @@ public: void map_parameters (boost::function&); int set_state (XMLNode const &, int version); - XMLNode& get_state (); - XMLNode& get_variables (); + XMLNode& get_state () const; + XMLNode& get_variables () const; void set_variables (XMLNode const &); bool load_state (); diff --git a/libs/ardour/ardour/session_metadata.h b/libs/ardour/ardour/session_metadata.h index a1489a0bd0..edc999a893 100644 --- a/libs/ardour/ardour/session_metadata.h +++ b/libs/ardour/ardour/session_metadata.h @@ -138,8 +138,8 @@ class LIBARDOUR_API SessionMetadata : public PBD::StatefulDestructible void av_export_tag (MetaDataMap&) const; /*** Serialization ***/ - XMLNode & get_state (); //serializes stuff in the map, to be stored in session file - XMLNode & get_user_state (); //serializes stuff in the user_map, to be stored in user's config file + XMLNode& get_state () const; //serializes stuff in the map, to be stored in session file + XMLNode& get_user_state (); //serializes stuff in the user_map, to be stored in user's config file int set_state (const XMLNode &, int version_num); private: @@ -151,7 +151,7 @@ class LIBARDOUR_API SessionMetadata : public PBD::StatefulDestructible PropertyMap map; PropertyMap user_map; - XMLNode * get_xml (const std::string & name); + XMLNode * get_xml (const std::string & name) const; std::string get_value (const std::string & name) const; uint32_t get_uint_value (const std::string & name) const; diff --git a/libs/ardour/ardour/session_playlists.h b/libs/ardour/ardour/session_playlists.h index ea6461907e..14f1c52554 100644 --- a/libs/ardour/ardour/session_playlists.h +++ b/libs/ardour/ardour/session_playlists.h @@ -81,7 +81,7 @@ private: void find_equivalent_playlist_regions (boost::shared_ptr, std::vector >& result); void update_after_tempo_map_change (); - void add_state (XMLNode*, bool save_template, bool include_unused); + void add_state (XMLNode*, bool save_template, bool include_unused) const; bool maybe_delete_unused (boost::function)>); int load (Session &, const XMLNode&); int load_unused (Session &, const XMLNode&); diff --git a/libs/ardour/ardour/sidechain.h b/libs/ardour/ardour/sidechain.h index c3634cad95..2ae315160b 100644 --- a/libs/ardour/ardour/sidechain.h +++ b/libs/ardour/ardour/sidechain.h @@ -41,7 +41,7 @@ public: int set_state(const XMLNode&, int version); protected: - XMLNode& state (); + XMLNode& state () const; private: /* disallow copy construction */ diff --git a/libs/ardour/ardour/slavable_automation_control.h b/libs/ardour/ardour/slavable_automation_control.h index ff0ce07f54..b9c2845ac4 100644 --- a/libs/ardour/ardour/slavable_automation_control.h +++ b/libs/ardour/ardour/slavable_automation_control.h @@ -74,7 +74,7 @@ public: void use_saved_master_ratios (); int set_state (XMLNode const&, int); - XMLNode& get_state(); + XMLNode& get_state() const; bool find_next_event (Temporal::timepos_t const & n, Temporal::timepos_t const & e, Evoral::ControlEvent& ev) const { diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index f20790762c..c7309cad52 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -64,7 +64,7 @@ public: Evoral::Sequence::StuckNoteOption, Temporal::Beats when = Temporal::Beats()); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); void load_model (const WriterLock& lock, bool force_reload=false); diff --git a/libs/ardour/ardour/solo_control.h b/libs/ardour/ardour/solo_control.h index 812978dd3a..020c2c8c2c 100644 --- a/libs/ardour/ardour/solo_control.h +++ b/libs/ardour/ardour/solo_control.h @@ -94,7 +94,7 @@ class LIBARDOUR_API SoloControl : public SlavableAutomationControl void clear_all_solo_state (); int set_state (XMLNode const&, int); - XMLNode& get_state (); + XMLNode& get_state () const; protected: void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override); diff --git a/libs/ardour/ardour/solo_isolate_control.h b/libs/ardour/ardour/solo_isolate_control.h index 8857459be8..812342274a 100644 --- a/libs/ardour/ardour/solo_isolate_control.h +++ b/libs/ardour/ardour/solo_isolate_control.h @@ -70,7 +70,7 @@ class LIBARDOUR_API SoloIsolateControl : public SlavableAutomationControl bool solo_isolated() const { return self_solo_isolated() || solo_isolated_by_upstream(); } int set_state (XMLNode const&, int); - XMLNode& get_state (); + XMLNode& get_state () const; protected: void master_changed (bool from_self, PBD::Controllable::GroupControlDisposition gcd, boost::weak_ptr); diff --git a/libs/ardour/ardour/solo_safe_control.h b/libs/ardour/ardour/solo_safe_control.h index 65eac83fde..7c687e60c1 100644 --- a/libs/ardour/ardour/solo_safe_control.h +++ b/libs/ardour/ardour/solo_safe_control.h @@ -41,7 +41,7 @@ class LIBARDOUR_API SoloSafeControl : public SlavableAutomationControl bool solo_safe() const { return _solo_safe; } int set_state (XMLNode const&, int); - XMLNode& get_state (); + XMLNode& get_state () const; protected: void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override); diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index c4fc443d55..f7dac6932d 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -91,7 +91,7 @@ public: virtual void session_saved() {} - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (XMLNode const &, int version); bool writable () const; diff --git a/libs/ardour/ardour/speakers.h b/libs/ardour/ardour/speakers.h index c35eb7426d..3bcb117b62 100644 --- a/libs/ardour/ardour/speakers.h +++ b/libs/ardour/ardour/speakers.h @@ -52,7 +52,7 @@ public: void dump_speakers (std::ostream&); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); PBD::Signal0 Changed; diff --git a/libs/ardour/ardour/step_sequencer.h b/libs/ardour/ardour/step_sequencer.h index 4570a10e07..6975262885 100644 --- a/libs/ardour/ardour/step_sequencer.h +++ b/libs/ardour/ardour/step_sequencer.h @@ -115,7 +115,7 @@ class Step : public PBD::Stateful { int octave_shift() const { return _octave_shift; } void set_octave_shift (int); - XMLNode& get_state(); + XMLNode& get_state() const; int set_state (XMLNode const &, int); void dump (MusicTimeEvents&, Temporal::Beats const&) const; @@ -208,7 +208,7 @@ class StepSequence : public PBD::Stateful StepSequencer& sequencer() const { return _sequencer; } - XMLNode& get_state(); + XMLNode& get_state() const; int set_state (XMLNode const &, int); void dump (MusicTimeEvents&, Temporal::Beats const &) const; @@ -257,7 +257,7 @@ class StepSequencer : public PBD::Stateful TempoMap& tempo_map() const { return _tempo_map; } - XMLNode& get_state(); + XMLNode& get_state() const; int set_state (XMLNode const &, int); void queue_note_off (Temporal::Beats const &, uint8_t note, uint8_t velocity, uint8_t channel); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 11e85de930..3087494bcf 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -184,7 +184,7 @@ public: PBD::Signal0 ChanCountChanged; protected: - XMLNode& state (bool save_template); + XMLNode& state (bool save_template) const; boost::shared_ptr _playlists[DataType::num_types]; diff --git a/libs/ardour/ardour/transport_master.h b/libs/ardour/ardour/transport_master.h index 736568d0c3..136426ff5e 100644 --- a/libs/ardour/ardour/transport_master.h +++ b/libs/ardour/ardour/transport_master.h @@ -355,7 +355,7 @@ public: void set_name (std::string const&); int set_state (XMLNode const&, int); - XMLNode& get_state (); + XMLNode& get_state () const; static const std::string state_node_name; static void make_property_quarks (); @@ -435,7 +435,7 @@ protected: boost::shared_ptr _port; - XMLNode port_node; + mutable XMLNode port_node; virtual void connection_handler (boost::weak_ptr, std::string name1, boost::weak_ptr, std::string name2, bool yn); diff --git a/libs/ardour/ardour/transport_master_manager.h b/libs/ardour/ardour/transport_master_manager.h index 9621422cec..8404aa8c54 100644 --- a/libs/ardour/ardour/transport_master_manager.h +++ b/libs/ardour/ardour/transport_master_manager.h @@ -70,7 +70,7 @@ class LIBARDOUR_API TransportMasterManager : public boost::noncopyable PBD::Signal2, boost::shared_ptr > CurrentChanged; int set_state (XMLNode const &, int); - XMLNode& get_state(); + XMLNode& get_state() const; void set_session (Session*); Session* session() const { return _session; } diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index 0d026c5f3c..a0f540bc9c 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -317,7 +317,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { samplepos_t transition_samples; Temporal::Beats transition_beats; - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); void maybe_compute_next_transition (samplepos_t start_sample, Temporal::Beats const & start, Temporal::Beats const & end, pframes_t& nframes, pframes_t& dest_offset); @@ -503,7 +503,7 @@ class LIBARDOUR_API AudioTrigger : public Trigger { void jump_start (); void jump_stop (BufferSet& bufs, pframes_t dest_offset); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); RubberBand::RubberBandStretcher* stretcher() { return (_stretcher); } @@ -579,7 +579,7 @@ class LIBARDOUR_API MIDITrigger : public Trigger { void shutdown (BufferSet& bufs, pframes_t dest_offset); void jump_stop (BufferSet& bufs, pframes_t dest_offset); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); SegmentDescriptor get_segment_descriptor () const; @@ -726,7 +726,7 @@ class LIBARDOUR_API TriggerBox : public Processor void set_pending (uint32_t slot, Trigger*); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); void set_from_path (uint32_t slot, std::string const & path); @@ -813,7 +813,7 @@ class LIBARDOUR_API TriggerBox : public Processor DataType _data_type; int32_t _order; - Glib::Threads::RWLock trigger_lock; /* protects all_triggers */ + mutable Glib::Threads::RWLock trigger_lock; /* protects all_triggers */ Triggers all_triggers; typedef std::vector PendingTriggers; diff --git a/libs/ardour/ardour/unknown_processor.h b/libs/ardour/ardour/unknown_processor.h index 8dbaf5d2c3..7239c25aa3 100644 --- a/libs/ardour/ardour/unknown_processor.h +++ b/libs/ardour/ardour/unknown_processor.h @@ -52,7 +52,7 @@ public: void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/); protected: - XMLNode& state (); + XMLNode& state () const; private: XMLNode _state; diff --git a/libs/ardour/ardour/user_bundle.h b/libs/ardour/ardour/user_bundle.h index 49142d83a8..0161685706 100644 --- a/libs/ardour/ardour/user_bundle.h +++ b/libs/ardour/ardour/user_bundle.h @@ -35,7 +35,7 @@ class LIBARDOUR_API UserBundle : public Bundle, public PBD::Stateful { UserBundle (std::string const &); UserBundle (XMLNode const &, bool); - XMLNode& get_state (); + XMLNode& get_state () const; private: int set_state (XMLNode const &, int version); diff --git a/libs/ardour/ardour/vca.h b/libs/ardour/ardour/vca.h index f1a4c3f4df..25701c65b7 100644 --- a/libs/ardour/ardour/vca.h +++ b/libs/ardour/ardour/vca.h @@ -59,7 +59,7 @@ class LIBARDOUR_API VCA : public Stripable, std::string full_name() const; int init (); - XMLNode& get_state(); + XMLNode& get_state() const; int set_state (XMLNode const&, int version); PBD::Signal0 Drop; /* signal to slaves to drop control by this VCA */ diff --git a/libs/ardour/ardour/vca_manager.h b/libs/ardour/ardour/vca_manager.h index 30a8ef2312..2b3235ee67 100644 --- a/libs/ardour/ardour/vca_manager.h +++ b/libs/ardour/ardour/vca_manager.h @@ -56,7 +56,7 @@ public: PBD::Signal1 VCAAdded; PBD::Signal0 VCACreated; /*<< is not emitted during set_state */ - XMLNode& get_state(); + XMLNode& get_state() const; int set_state (XMLNode const&, int version); bool vcas_loaded() const { return _vcas_loaded; } diff --git a/libs/ardour/audio_playlist_source.cc b/libs/ardour/audio_playlist_source.cc index 6434ccdcf1..3f6d5f7913 100644 --- a/libs/ardour/audio_playlist_source.cc +++ b/libs/ardour/audio_playlist_source.cc @@ -78,7 +78,7 @@ AudioPlaylistSource::~AudioPlaylistSource () } XMLNode& -AudioPlaylistSource::get_state () +AudioPlaylistSource::get_state () const { XMLNode& node (AudioSource::get_state ()); diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 149d0e2aa9..9602c6e47c 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -100,7 +100,7 @@ AudioTrack::set_state (const XMLNode& node, int version) } XMLNode& -AudioTrack::state (bool save_template) +AudioTrack::state (bool save_template) const { XMLNode& root (Track::state (save_template)); XMLNode* freeze_node; @@ -113,7 +113,7 @@ AudioTrack::state (bool save_template) freeze_node->set_property ("playlist-id", _freeze_record.playlist->id().to_s ()); freeze_node->set_property ("state", _freeze_record.state); - for (vector::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { + for (vector::const_iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { inode = new XMLNode (X_("processor")); inode->set_property (X_ ("id"), (*i)->id.to_s ()); inode->add_child_copy ((*i)->state); diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index e076d17cfb..b5cb4c7c02 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -221,7 +221,7 @@ AudioFileSource::get_soundfile_info (const string& path, SoundFileInfo& _info, s } XMLNode& -AudioFileSource::get_state () +AudioFileSource::get_state () const { XMLNode& root (AudioSource::get_state()); root.set_property (X_("channel"), _channel); diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 61856a084a..3092817a39 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -789,7 +789,7 @@ AudioRegion::read_from_sources (SourceList const & srcs, samplecnt_t limit, Samp } XMLNode& -AudioRegion::get_basic_state () +AudioRegion::get_basic_state () const { XMLNode& node (Region::state ()); @@ -799,7 +799,7 @@ AudioRegion::get_basic_state () } XMLNode& -AudioRegion::state () +AudioRegion::state () const { XMLNode& node (get_basic_state()); XMLNode *child; diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index bdc432363c..f50d6e607b 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -131,7 +131,7 @@ AudioSource::~AudioSource () } XMLNode& -AudioSource::get_state () +AudioSource::get_state () const { XMLNode& node (Source::get_state()); diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 4101a7b7e1..c6d0364a94 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -308,7 +308,7 @@ Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter le } XMLNode& -Automatable::get_automation_xml_state () +Automatable::get_automation_xml_state () const { Glib::Threads::Mutex::Lock lm (control_lock()); XMLNode* node = new XMLNode (Automatable::xml_node_name); @@ -317,7 +317,7 @@ Automatable::get_automation_xml_state () return *node; } - for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) { + for (Controls::const_iterator li = controls().begin(); li != controls().end(); ++li) { boost::shared_ptr l = boost::dynamic_pointer_cast(li->second->list()); if (l) { node->add_child_nocopy (l->get_state ()); diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index 7b07675327..d96a57f0b8 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -323,13 +323,13 @@ AutomationList::memento_command (XMLNode* before, XMLNode* after) } XMLNode& -AutomationList::get_state () +AutomationList::get_state () const { return state (true, true); } XMLNode& -AutomationList::state (bool save_auto_state, bool need_lock) +AutomationList::state (bool save_auto_state, bool need_lock) const { XMLNode* root = new XMLNode (X_("AutomationList")); @@ -364,7 +364,7 @@ AutomationList::state (bool save_auto_state, bool need_lock) } XMLNode& -AutomationList::serialize_events (bool need_lock) +AutomationList::serialize_events (bool need_lock) const { XMLNode* node = new XMLNode (X_("events")); stringstream str; @@ -373,7 +373,7 @@ AutomationList::serialize_events (bool need_lock) if (need_lock) { lm.acquire (); } - for (iterator xx = _events.begin(); xx != _events.end(); ++xx) { + for (const_iterator xx = _events.begin(); xx != _events.end(); ++xx) { str << PBD::to_string ((*xx)->when); str << ' '; str << PBD::to_string ((*xx)->value); diff --git a/libs/ardour/beatbox.cc b/libs/ardour/beatbox.cc index 32f8fc39ff..f3abfe6de3 100644 --- a/libs/ardour/beatbox.cc +++ b/libs/ardour/beatbox.cc @@ -78,13 +78,13 @@ BeatBox::can_support_io_configuration (const ChanCount& in, ChanCount& out) } XMLNode& -BeatBox::get_state(void) +BeatBox::get_state () const { return state (); } XMLNode& -BeatBox::state() +BeatBox::state() const { XMLNode& node = Processor::state(); node.set_property ("type", "beatbox"); diff --git a/libs/ardour/capturing_processor.cc b/libs/ardour/capturing_processor.cc index a2d281e0f4..6dd35382d1 100644 --- a/libs/ardour/capturing_processor.cc +++ b/libs/ardour/capturing_processor.cc @@ -84,7 +84,7 @@ CapturingProcessor::realloc_buffers() } XMLNode & -CapturingProcessor::state () +CapturingProcessor::state () const { XMLNode& node = Processor::state (); diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index 221e5632a5..41a1679128 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -527,12 +527,12 @@ ControlProtocolManager::set_state (const XMLNode& node, int session_specific_sta } XMLNode& -ControlProtocolManager::get_state () +ControlProtocolManager::get_state () const { XMLNode* root = new XMLNode (state_node_name); Glib::Threads::RWLock::ReaderLock lm (protocols_lock); - for (list::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { + for (list::const_iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { if ((*i)->protocol) { XMLNode& child_state ((*i)->protocol->get_state()); diff --git a/libs/ardour/delayline.cc b/libs/ardour/delayline.cc index 694ea1089d..8e5d8c4227 100644 --- a/libs/ardour/delayline.cc +++ b/libs/ardour/delayline.cc @@ -432,7 +432,7 @@ DelayLine::flush () } XMLNode& -DelayLine::state () +DelayLine::state () const { XMLNode& node (Processor::state ()); node.set_property ("type", "delay"); diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 0b92c0fd4e..ff0c22ff08 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -356,7 +356,7 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample } XMLNode& -Delivery::state () +Delivery::state () const { XMLNode& node (IOProcessor::state ()); diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 4c52c01a34..77e7a9d034 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -166,7 +166,7 @@ DiskReader::set_name (string const& str) } XMLNode& -DiskReader::state () +DiskReader::state () const { XMLNode& node (DiskIOProcessor::state ()); node.set_property (X_("type"), X_("diskreader")); diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 0164341997..c2d59cf1be 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -367,7 +367,7 @@ DiskWriter::set_align_style (AlignStyle a, bool force) } XMLNode& -DiskWriter::state () +DiskWriter::state () const { XMLNode& node (DiskIOProcessor::state ()); node.set_property (X_("type"), X_("diskwriter")); diff --git a/libs/ardour/export_channel_configuration.cc b/libs/ardour/export_channel_configuration.cc index db14b3e6b9..71690b7fa1 100644 --- a/libs/ardour/export_channel_configuration.cc +++ b/libs/ardour/export_channel_configuration.cc @@ -40,7 +40,7 @@ ExportChannelConfiguration::ExportChannelConfiguration (Session & session) } XMLNode & -ExportChannelConfiguration::get_state () +ExportChannelConfiguration::get_state () const { XMLNode * root = new XMLNode ("ExportChannelConfiguration"); XMLNode * channel; diff --git a/libs/ardour/export_filename.cc b/libs/ardour/export_filename.cc index 5a01ebce88..a2f1125534 100644 --- a/libs/ardour/export_filename.cc +++ b/libs/ardour/export_filename.cc @@ -83,7 +83,7 @@ ExportFilename::ExportFilename (Session & session) : } XMLNode & -ExportFilename::get_state () +ExportFilename::get_state () const { XMLNode * node = new XMLNode ("ExportFilename"); XMLNode * child; @@ -399,7 +399,7 @@ ExportFilename::get_field (XMLNode const & node, string const & name) } ExportFilename::FieldPair -ExportFilename::analyse_folder () +ExportFilename::analyse_folder () const { FieldPair pair; diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc index 59c3f2852f..7e83d0c53b 100644 --- a/libs/ardour/export_format_specification.cc +++ b/libs/ardour/export_format_specification.cc @@ -68,7 +68,7 @@ ExportFormatSpecification::Time::get_samples_at (samplepos_t position, samplecnt } XMLNode & -ExportFormatSpecification::Time::get_state () +ExportFormatSpecification::Time::get_state () const { XMLNode * node = new XMLNode ("Duration"); @@ -274,7 +274,7 @@ ExportFormatSpecification::~ExportFormatSpecification () } XMLNode & -ExportFormatSpecification::get_state () +ExportFormatSpecification::get_state () const { XMLNode * node; XMLNode * root = new XMLNode ("ExportFormatSpecification"); diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index bc634fab0d..cdade7499f 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -80,7 +80,7 @@ InternalReturn::set_playback_offset (samplecnt_t cnt) } XMLNode& -InternalReturn::state () +InternalReturn::state () const { XMLNode& node (Processor::state ()); /* override type */ diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index a88cb06fb9..86806047f7 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -380,7 +380,7 @@ InternalSend::feeds (boost::shared_ptr other) const } XMLNode& -InternalSend::state () +InternalSend::state () const { XMLNode& node (Send::state ()); diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index ad7e21187d..2de3c34366 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -519,13 +519,13 @@ IO::ensure_io (ChanCount count, bool clear, void* src) } XMLNode& -IO::get_state () +IO::get_state () const { return state (); } XMLNode& -IO::state () +IO::state () const { XMLNode* node = new XMLNode (state_node_name); int n; @@ -540,7 +540,7 @@ IO::state () node->set_property("pretty-name", _pretty_name_prefix); } - for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { + for (PortSet::const_iterator i = _ports.begin(); i != _ports.end(); ++i) { vector connections; diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 7cc1235244..c2f9f9dfeb 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -116,7 +116,7 @@ IOProcessor::set_output (boost::shared_ptr io) } XMLNode& -IOProcessor::state () +IOProcessor::state () const { XMLNode& node (Processor::state ()); diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index a959c8916a..9764996ac6 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -554,7 +554,7 @@ Location::cd_info_node(const string & name, const string & value) XMLNode& -Location::get_state () +Location::get_state () const { XMLNode *node = new XMLNode ("Location"); @@ -1105,14 +1105,13 @@ Locations::remove (Location *loc) } XMLNode& -Locations::get_state () +Locations::get_state () const { XMLNode *node = new XMLNode ("Locations"); - LocationList::iterator iter; Glib::Threads::RWLock::ReaderLock lm (_lock); - for (iter = locations.begin(); iter != locations.end(); ++iter) { - node->add_child_nocopy ((*iter)->get_state ()); + for (auto const & l : locations) { + node->add_child_nocopy (l->get_state ()); } return *node; diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 24a538c2ad..435d00d8cf 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -461,7 +461,7 @@ PeakMeter::set_meter_type (MeterType t) } XMLNode& -PeakMeter::state () +PeakMeter::state () const { XMLNode& node (Processor::state ()); node.set_property ("type", "meter"); diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index b10750fe94..8bc149853c 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -437,7 +437,7 @@ MidiModel::NoteDiffCommand::undo () } XMLNode& -MidiModel::NoteDiffCommand::marshal_note(const NotePtr note) +MidiModel::NoteDiffCommand::marshal_note(const NotePtr note) const { XMLNode* xml_note = new XMLNode("note"); @@ -491,7 +491,7 @@ MidiModel::NoteDiffCommand::unmarshal_note (XMLNode *xml_note) } XMLNode& -MidiModel::NoteDiffCommand::marshal_change (const NoteChange& change) +MidiModel::NoteDiffCommand::marshal_change (const NoteChange& change) const { XMLNode* xml_change = new XMLNode("Change"); @@ -635,25 +635,25 @@ MidiModel::NoteDiffCommand::set_state (const XMLNode& diff_command, int /*versio } XMLNode& -MidiModel::NoteDiffCommand::get_state () +MidiModel::NoteDiffCommand::get_state () const { XMLNode* diff_command = new XMLNode (NOTE_DIFF_COMMAND_ELEMENT); diff_command->set_property("midi-source", _model->midi_source().id().to_s()); XMLNode* changes = diff_command->add_child(DIFF_NOTES_ELEMENT); - for_each(_changes.begin(), _changes.end(), + for_each(_changes.cbegin(), _changes.cend(), boost::bind ( boost::bind (&XMLNode::add_child_nocopy, changes, _1), boost::bind (&NoteDiffCommand::marshal_change, this, _1))); XMLNode* added_notes = diff_command->add_child(ADDED_NOTES_ELEMENT); - for_each(_added_notes.begin(), _added_notes.end(), + for_each(_added_notes.cbegin(), _added_notes.cend(), boost::bind( boost::bind (&XMLNode::add_child_nocopy, added_notes, _1), boost::bind (&NoteDiffCommand::marshal_note, this, _1))); XMLNode* removed_notes = diff_command->add_child(REMOVED_NOTES_ELEMENT); - for_each(_removed_notes.begin(), _removed_notes.end(), + for_each(_removed_notes.cbegin(), _removed_notes.cend(), boost::bind ( boost::bind (&XMLNode::add_child_nocopy, removed_notes, _1), boost::bind (&NoteDiffCommand::marshal_note, this, _1))); @@ -761,7 +761,7 @@ MidiModel::SysExDiffCommand::remove (SysExPtr sysex) } XMLNode& -MidiModel::SysExDiffCommand::marshal_change (const Change& change) +MidiModel::SysExDiffCommand::marshal_change (const Change& change) const { XMLNode* xml_change = new XMLNode ("Change"); @@ -835,7 +835,7 @@ MidiModel::SysExDiffCommand::set_state (const XMLNode& diff_command, int /*versi } XMLNode& -MidiModel::SysExDiffCommand::get_state () +MidiModel::SysExDiffCommand::get_state () const { XMLNode* diff_command = new XMLNode (SYSEX_DIFF_COMMAND_ELEMENT); diff_command->set_property ("midi-source", _model->midi_source().id().to_s()); @@ -1040,7 +1040,7 @@ MidiModel::PatchChangeDiffCommand::undo () } XMLNode & -MidiModel::PatchChangeDiffCommand::marshal_patch_change (constPatchChangePtr p) +MidiModel::PatchChangeDiffCommand::marshal_patch_change (constPatchChangePtr p) const { XMLNode* n = new XMLNode ("patch-change"); @@ -1054,7 +1054,7 @@ MidiModel::PatchChangeDiffCommand::marshal_patch_change (constPatchChangePtr p) } XMLNode& -MidiModel::PatchChangeDiffCommand::marshal_change (const Change& c) +MidiModel::PatchChangeDiffCommand::marshal_change (const Change& c) const { XMLNode* n = new XMLNode (X_("Change")); @@ -1180,13 +1180,13 @@ MidiModel::PatchChangeDiffCommand::set_state (const XMLNode& diff_command, int / } XMLNode & -MidiModel::PatchChangeDiffCommand::get_state () +MidiModel::PatchChangeDiffCommand::get_state () const { XMLNode* diff_command = new XMLNode (PATCH_CHANGE_DIFF_COMMAND_ELEMENT); diff_command->set_property("midi-source", _model->midi_source().id().to_s()); XMLNode* added = diff_command->add_child (ADDED_PATCH_CHANGES_ELEMENT); - for_each (_added.begin(), _added.end(), + for_each (_added.cbegin(), _added.cend(), boost::bind ( boost::bind (&XMLNode::add_child_nocopy, added, _1), boost::bind (&PatchChangeDiffCommand::marshal_patch_change, this, _1) @@ -1194,7 +1194,7 @@ MidiModel::PatchChangeDiffCommand::get_state () ); XMLNode* removed = diff_command->add_child (REMOVED_PATCH_CHANGES_ELEMENT); - for_each (_removed.begin(), _removed.end(), + for_each (_removed.cbegin(), _removed.cend(), boost::bind ( boost::bind (&XMLNode::add_child_nocopy, removed, _1), boost::bind (&PatchChangeDiffCommand::marshal_patch_change, this, _1) @@ -1202,7 +1202,7 @@ MidiModel::PatchChangeDiffCommand::get_state () ); XMLNode* changes = diff_command->add_child (DIFF_PATCH_CHANGES_ELEMENT); - for_each (_changes.begin(), _changes.end(), + for_each (_changes.cbegin(), _changes.cend(), boost::bind ( boost::bind (&XMLNode::add_child_nocopy, changes, _1), boost::bind (&PatchChangeDiffCommand::marshal_change, this, _1) @@ -1336,7 +1336,7 @@ MidiModel::write_section_to (boost::shared_ptr source, } XMLNode& -MidiModel::get_state() +MidiModel::get_state() const { XMLNode *node = new XMLNode("MidiModel"); return *node; diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index c89a186350..858e4475e7 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -342,7 +342,7 @@ MidiRegion::render_range (Evoral::EventSink& dst, XMLNode& -MidiRegion::state () +MidiRegion::state () const { return Region::state (); } diff --git a/libs/ardour/midi_scene_change.cc b/libs/ardour/midi_scene_change.cc index 8d7b354a64..746836bced 100644 --- a/libs/ardour/midi_scene_change.cc +++ b/libs/ardour/midi_scene_change.cc @@ -96,7 +96,7 @@ MIDISceneChange::get_program_message (uint8_t* buf, size_t size) const } XMLNode& -MIDISceneChange::get_state () +MIDISceneChange::get_state () const { XMLNode* node = new XMLNode (SceneChange::xml_node_name); diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 9effb9ee29..ab2965695e 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -87,7 +87,7 @@ MidiSource::~MidiSource () } XMLNode& -MidiSource::get_state () +MidiSource::get_state () const { XMLNode& node (Source::get_state()); diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 509267fc32..64f2875fb3 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -228,7 +228,7 @@ MidiTrack::set_state (const XMLNode& node, int version) } XMLNode& -MidiTrack::state(bool save_template) +MidiTrack::state(bool save_template) const { XMLNode& root (Track::state (save_template)); XMLNode* freeze_node; @@ -242,7 +242,7 @@ MidiTrack::state(bool save_template) freeze_node->set_property ("playlist-id", _freeze_record.playlist->id().to_s()); freeze_node->set_property ("state", _freeze_record.state); - for (vector::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { + for (vector::const_iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { inode = new XMLNode (X_("processor")); inode->set_property (X_("id"), id()); inode->add_child_copy ((*i)->state); diff --git a/libs/ardour/monitor_control.cc b/libs/ardour/monitor_control.cc index f2426daf3b..5f606f2845 100644 --- a/libs/ardour/monitor_control.cc +++ b/libs/ardour/monitor_control.cc @@ -45,7 +45,7 @@ MonitorControl::actually_set_value (double val, Controllable::GroupControlDispos } XMLNode& -MonitorControl::get_state () +MonitorControl::get_state () const { XMLNode& node (SlavableAutomationControl::get_state()); node.set_property (X_("monitoring"), _monitoring); diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc index 11ae205c95..7782f87d28 100644 --- a/libs/ardour/monitor_processor.cc +++ b/libs/ardour/monitor_processor.cc @@ -228,7 +228,7 @@ MonitorProcessor::set_state (const XMLNode& node, int version) } XMLNode& -MonitorProcessor::state () +MonitorProcessor::state () const { XMLNode& node(Processor::state ()); diff --git a/libs/ardour/monitor_return.cc b/libs/ardour/monitor_return.cc index 43682cc439..e8a5b2bc09 100644 --- a/libs/ardour/monitor_return.cc +++ b/libs/ardour/monitor_return.cc @@ -68,7 +68,7 @@ MonitorReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_s } XMLNode& -MonitorReturn::state () +MonitorReturn::state () const { XMLNode& node (InternalReturn::state ()); node.set_property ("type", "monreturn"); diff --git a/libs/ardour/mute_master.cc b/libs/ardour/mute_master.cc index 25e6f863e2..7f1a8597d4 100644 --- a/libs/ardour/mute_master.cc +++ b/libs/ardour/mute_master.cc @@ -154,7 +154,7 @@ MuteMaster::set_state (const XMLNode& node, int /*version*/) } XMLNode& -MuteMaster::get_state() +MuteMaster::get_state() const { XMLNode* node = new XMLNode (xml_node_name); node->set_property ("mute-point", _mute_point); diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc index 003d3144a3..c6edc347dc 100644 --- a/libs/ardour/pannable.cc +++ b/libs/ardour/pannable.cc @@ -179,13 +179,13 @@ Pannable::stop_touch (timepos_t const & when) } XMLNode& -Pannable::get_state () +Pannable::get_state () const { return state (); } XMLNode& -Pannable::state () +Pannable::state () const { XMLNode* node = new XMLNode (X_("Pannable")); diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 39ca1f03de..e0165a5585 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -42,7 +42,7 @@ Panner::~Panner () } XMLNode& -Panner::get_state () +Panner::get_state () const { return *(new XMLNode (X_("Panner"))); } diff --git a/libs/ardour/panner_shell.cc b/libs/ardour/panner_shell.cc index e24d7ce33a..a53c75b956 100644 --- a/libs/ardour/panner_shell.cc +++ b/libs/ardour/panner_shell.cc @@ -159,7 +159,7 @@ PannerShell::configure_io (ChanCount in, ChanCount out) } XMLNode& -PannerShell::get_state () +PannerShell::get_state () const { XMLNode* node = new XMLNode ("PannerShell"); diff --git a/libs/ardour/phase_control.cc b/libs/ardour/phase_control.cc index 223520fa01..6c63b8dd9e 100644 --- a/libs/ardour/phase_control.cc +++ b/libs/ardour/phase_control.cc @@ -68,7 +68,7 @@ PhaseControl::resize (uint32_t n) } XMLNode& -PhaseControl::get_state () +PhaseControl::get_state () const { XMLNode& node (AutomationControl::get_state ()); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 5f36f60cac..e0e85c4043 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -2290,7 +2290,7 @@ Playlist::set_state (const XMLNode& node, int version) } XMLNode& -Playlist::get_state () +Playlist::get_state () const { return state (true); } @@ -2304,7 +2304,7 @@ Playlist::get_template () /** @param full_state true to include regions in the returned state, otherwise false. */ XMLNode& -Playlist::state (bool full_state) +Playlist::state (bool full_state) const { XMLNode* node = new XMLNode (X_("Playlist")); diff --git a/libs/ardour/playlist_source.cc b/libs/ardour/playlist_source.cc index f3cc71d254..837dd4f1f6 100644 --- a/libs/ardour/playlist_source.cc +++ b/libs/ardour/playlist_source.cc @@ -86,7 +86,7 @@ PlaylistSource::set_owner (PBD::ID const &id) } void -PlaylistSource::add_state (XMLNode& node) +PlaylistSource::add_state (XMLNode& node) const { node.set_property ("playlist", _playlist->id ()); node.set_property ("offset", _playlist_offset); diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index b5f7f59284..49ab47aac6 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -541,7 +541,7 @@ Plugin::set_state (const XMLNode& node, int /*version*/) } XMLNode & -Plugin::get_state () +Plugin::get_state () const { XMLNode* root = new XMLNode (state_node_name ()); diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 8c186f5204..6f88cdba91 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -2518,7 +2518,7 @@ PluginInsert::automatic_can_support_io_configuration (ChanCount const& inx, Chan XMLNode& -PluginInsert::state () +PluginInsert::state () const { XMLNode& node = Processor::state (); @@ -2538,9 +2538,9 @@ PluginInsert::state () for (uint32_t pc = 0; pc < get_count(); ++pc) { char tmp[128]; snprintf (tmp, sizeof(tmp), "InputMap-%d", pc); - node.add_child_nocopy (* _in_map[pc].state (tmp)); + node.add_child_nocopy (* _in_map.p (pc).state (tmp)); snprintf (tmp, sizeof(tmp), "OutputMap-%d", pc); - node.add_child_nocopy (* _out_map[pc].state (tmp)); + node.add_child_nocopy (* _out_map.p (pc).state (tmp)); } node.add_child_nocopy (* _thru_map.state ("ThruMap")); @@ -2551,7 +2551,7 @@ PluginInsert::state () _plugins[0]->set_insert_id(this->id()); node.add_child_nocopy (_plugins[0]->get_state()); - for (Controls::iterator c = controls().begin(); c != controls().end(); ++c) { + for (Controls::const_iterator c = controls().begin(); c != controls().end(); ++c) { boost::shared_ptr ac = boost::dynamic_pointer_cast ((*c).second); if (ac) { node.add_child_nocopy (ac->get_state()); @@ -3085,7 +3085,7 @@ PluginInsert::PluginControl::catch_up_with_external_value (double user_val) } XMLNode& -PluginInsert::PluginControl::get_state () +PluginInsert::PluginControl::get_state () const { XMLNode& node (AutomationControl::get_state()); node.set_property (X_("parameter"), parameter().id()); @@ -3155,7 +3155,7 @@ PluginInsert::PluginPropertyControl::actually_set_value (double user_val, Contro } XMLNode& -PluginInsert::PluginPropertyControl::get_state () +PluginInsert::PluginPropertyControl::get_state () const { XMLNode& node (AutomationControl::get_state()); node.set_property (X_("property"), parameter().id()); diff --git a/libs/ardour/polarity_processor.cc b/libs/ardour/polarity_processor.cc index 71078953e0..e807081489 100644 --- a/libs/ardour/polarity_processor.cc +++ b/libs/ardour/polarity_processor.cc @@ -74,7 +74,7 @@ PolarityProcessor::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos } XMLNode& -PolarityProcessor::state () +PolarityProcessor::state () const { XMLNode& node (Processor::state ()); node.set_property("type", "polarity"); diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index a001712b78..f4a89ad27a 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -158,7 +158,7 @@ PortInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp } XMLNode& -PortInsert::state () +PortInsert::state () const { XMLNode& node = IOProcessor::state (); node.set_property ("type", "port"); diff --git a/libs/ardour/presentation_info.cc b/libs/ardour/presentation_info.cc index 0a91abef8c..37d6e115f3 100644 --- a/libs/ardour/presentation_info.cc +++ b/libs/ardour/presentation_info.cc @@ -158,7 +158,7 @@ PresentationInfo::PresentationInfo (PresentationInfo const& other) } XMLNode& -PresentationInfo::get_state () +PresentationInfo::get_state () const { XMLNode* node = new XMLNode (state_node_name); node->set_property ("order", _order); diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 2d6a78c198..b47b2e4502 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -108,7 +108,7 @@ Processor::~Processor () } XMLNode& -Processor::get_state (void) +Processor::get_state () const { return state (); } @@ -128,7 +128,7 @@ Processor::get_state (void) */ XMLNode& -Processor::state () +Processor::state () const { XMLNode* node = new XMLNode (state_node_name); diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index c7c0d7f7dd..0f5b481a94 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -189,7 +189,7 @@ RCConfiguration::instant_xml(const string& node_name) XMLNode& -RCConfiguration::get_state () +RCConfiguration::get_state () const { XMLNode* root; @@ -213,7 +213,7 @@ RCConfiguration::get_state () } XMLNode& -RCConfiguration::get_variables () +RCConfiguration::get_variables () const { XMLNode* node; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 4f96ee4dda..f8a04648b9 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1218,7 +1218,7 @@ Region::set_layer (layer_t l) } XMLNode& -Region::state () +Region::state () const { XMLNode *node = new XMLNode ("Region"); char buf2[64]; @@ -1300,7 +1300,7 @@ Region::state () } XMLNode& -Region::get_state () +Region::get_state () const { return state (); } diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc index 1389d5fbb6..5559428fab 100644 --- a/libs/ardour/return.cc +++ b/libs/ardour/return.cc @@ -65,7 +65,7 @@ Return::~Return () } XMLNode& -Return::state() +Return::state() const { XMLNode& node = IOProcessor::state (); node.set_property ("type", "return"); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 9b20ea5abd..9f9e88498f 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2514,7 +2514,7 @@ Route::set_strict_io (const bool enable) } XMLNode& -Route::get_state() +Route::get_state() const { return state (false); } @@ -2526,10 +2526,11 @@ Route::get_template() } XMLNode& -Route::state (bool save_template) +Route::state (bool save_template) const { if (!_session._template_state_dir.empty()) { - foreach_processor (sigc::bind (sigc::mem_fun (*this, &Route::set_plugin_state_dir), _session._template_state_dir)); +#warning CONSTIFICATION fix this + // const_cast(this)->foreach_processor (sigc::bind (sigc::mem_fun (*this, &Route::set_plugin_state_dir), _session._template_state_dir)); } XMLNode *node = new XMLNode("Route"); @@ -2600,8 +2601,8 @@ Route::state (bool save_template) { Glib::Threads::RWLock::ReaderLock lm (_processor_lock); - for (i = _processors.begin(); i != _processors.end(); ++i) { - if (*i == _delayline) { + for (auto const & p : _processors) { + if (p == _delayline) { continue; } if (save_template) { @@ -2616,13 +2617,13 @@ Route::state (bool save_template) */ boost::shared_ptr is; - if ((is = boost::dynamic_pointer_cast (*i)) != 0) { + if ((is = boost::dynamic_pointer_cast (p)) != 0) { if (is->role() == Delivery::Listen) { continue; } } } - node->add_child_nocopy((*i)->get_state ()); + node->add_child_nocopy (p->get_state ()); } } @@ -2638,7 +2639,8 @@ Route::state (bool save_template) } if (!_session._template_state_dir.empty()) { - foreach_processor (sigc::bind (sigc::mem_fun (*this, &Route::set_plugin_state_dir), "")); + Route* ncthis = const_cast (this); + foreach_processor (sigc::bind (sigc::mem_fun (*ncthis, &Route::set_plugin_state_dir), "")); } node->add_child_copy (Slavable::get_state()); diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index 105dcf926a..21d84d954e 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -257,7 +257,7 @@ RouteGroup::set_rgba (uint32_t color) { } XMLNode& -RouteGroup::get_state () +RouteGroup::get_state () const { XMLNode *node = new XMLNode ("RouteGroup"); diff --git a/libs/ardour/segment_descriptor.cc b/libs/ardour/segment_descriptor.cc index 942cf1bbd5..336a8b8aeb 100644 --- a/libs/ardour/segment_descriptor.cc +++ b/libs/ardour/segment_descriptor.cc @@ -129,7 +129,7 @@ SegmentDescriptor::set_meter (Meter const & m) } XMLNode& -SegmentDescriptor::get_state (void) const +SegmentDescriptor::get_state () const { XMLNode* root = new XMLNode (X_("SegmentDescriptor")); diff --git a/libs/ardour/selection.cc b/libs/ardour/selection.cc index c75d578c4c..1718933630 100644 --- a/libs/ardour/selection.cc +++ b/libs/ardour/selection.cc @@ -552,7 +552,7 @@ CoreSelection::remove_stripable_by_id (PBD::ID const & id) } XMLNode& -CoreSelection::get_state (void) +CoreSelection::get_state () const { XMLNode* node = new XMLNode (X_("Selection")); diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index d1408c61e0..ba0be0259e 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -274,7 +274,7 @@ Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, do } XMLNode& -Send::state () +Send::state () const { XMLNode& node = Delivery::state (); diff --git a/libs/ardour/session_configuration.cc b/libs/ardour/session_configuration.cc index 8cbfa5a668..9ef899d927 100644 --- a/libs/ardour/session_configuration.cc +++ b/libs/ardour/session_configuration.cc @@ -54,7 +54,7 @@ SessionConfiguration::SessionConfiguration () } XMLNode& -SessionConfiguration::get_state () +SessionConfiguration::get_state () const { XMLNode* root; @@ -66,7 +66,7 @@ SessionConfiguration::get_state () XMLNode& -SessionConfiguration::get_variables () +SessionConfiguration::get_variables () const { XMLNode* node; diff --git a/libs/ardour/session_metadata.cc b/libs/ardour/session_metadata.cc index 10763201b5..5517c10cc1 100644 --- a/libs/ardour/session_metadata.cc +++ b/libs/ardour/session_metadata.cc @@ -107,7 +107,7 @@ SessionMetadata::~SessionMetadata () } XMLNode * -SessionMetadata::get_xml (const string & name) +SessionMetadata::get_xml (const string & name) const { string value = get_value (name); if (value.empty()) { @@ -173,7 +173,7 @@ SessionMetadata::set_value (const string & name, uint32_t value) /*** Serialization ***/ XMLNode & -SessionMetadata::get_state () +SessionMetadata::get_state () const { XMLNode * node = new XMLNode ("Metadata"); XMLNode * prop; diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index 6409458ce8..31eef27e70 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -420,14 +420,14 @@ get_id_sorted_playlists (const List& playlists, IDSortedList& id_sorted_playlist } // anonymous namespace void -SessionPlaylists::add_state (XMLNode* node, bool save_template, bool include_unused) +SessionPlaylists::add_state (XMLNode* node, bool save_template, bool include_unused) const { XMLNode* child = node->add_child ("Playlists"); IDSortedList id_sorted_playlists; get_id_sorted_playlists (playlists, id_sorted_playlists); - for (IDSortedList::iterator i = id_sorted_playlists.begin (); i != id_sorted_playlists.end (); ++i) { + for (IDSortedList::const_iterator i = id_sorted_playlists.begin (); i != id_sorted_playlists.end (); ++i) { if (!(*i)->hidden ()) { if (save_template) { child->add_child_nocopy ((*i)->get_template ()); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 586fc8306b..2f5951993c 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1057,7 +1057,7 @@ Session::save_default_options () } XMLNode& -Session::get_state () +Session::get_state () const { /* this is not directly called, but required by PBD::Stateful */ assert (0); @@ -1169,7 +1169,7 @@ struct route_id_compare { } // anon namespace XMLNode& -Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_assets) +Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_assets) const { LocaleGuard lg; XMLNode* node = new XMLNode("Session"); @@ -1210,8 +1210,8 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass string p; - vector::iterator i = session_dirs.begin(); - vector::iterator next; + vector::const_iterator i = session_dirs.begin(); + vector::const_iterator next; ++i; /* skip the first one */ next = i; @@ -1286,7 +1286,7 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass _playlists->foreach (boost::bind (merge_all_sources, _1, &sources_used_by_this_snapshot), false); } - for (SourceMap::iterator siter = sources.begin(); siter != sources.end(); ++siter) { + for (SourceMap::const_iterator siter = sources.begin(); siter != sources.end(); ++siter) { /* Don't save information about non-file Sources, or * about file sources that are empty @@ -1314,73 +1314,10 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass } if (snapshot_type != NormalSave && fs->within_session ()) { - /* copy MIDI sources to new file - * - * We cannot replace the midi-source and MidiRegion::clobber_sources, - * because the GUI (midi_region) has a direct pointer to the midi-model - * of the source, as does UndoTransaction. - * - * On the upside, .mid files are not kept open. The file is only open - * when reading the model initially and when flushing the model to disk: - * source->session_saved () or export. - * - * We can change the _path of the existing source under the hood, keeping - * all IDs, references and pointers intact. - * */ - boost::shared_ptr ms; - if ((ms = boost::dynamic_pointer_cast (siter->second)) != 0) { - const std::string ancestor_name = ms->ancestor_name(); - const std::string base = PBD::basename_nosuffix(ancestor_name); - const string path = new_midi_source_path (base, false); - - /* Session::save_state() will already have called - * ms->session_saved (); - */ - - /* use SMF-API to clone data (use the midi_model, not data on disk) */ - boost::shared_ptr newsrc (new SMFSource (*this, path, ms->flags())); - { - Source::WriterLock lm (ms->mutex()); - - if (!ms->model()) { - ms->load_model (lm); - } - } - Source::ReaderLock lm (ms->mutex()); - /* write_to() calls newsrc->flush_midi () to write the file to disk */ - if (ms->write_to (lm, newsrc, Temporal::Beats(), std::numeric_limits::max())) { - error << string_compose (_("Session-Save: Failed to copy MIDI Source '%1' for snapshot"), ancestor_name) << endmsg; - } else { - newsrc->session_saved (); /*< this sohuld be a no-op */ - - if (snapshot_type == SnapshotKeep) { - /* keep working on current session. - * - * Save snapshot-state with the original filename. - * Switch to use new path for future saves of the main session. - */ - child->add_child_nocopy (ms->get_state()); - } - - /* swap file-paths. - * ~SMFSource unlinks removable() files. - */ - std::string npath (ms->path ()); - ms->replace_file (newsrc->path ()); - newsrc->replace_file (npath); - - if (snapshot_type == SwitchToSnapshot) { - /* save and switch to snapshot. - * - * Leave the old file in place (as is). - * Snapshot uses new source directly - */ - child->add_child_nocopy (ms->get_state()); - } - } - continue; - } +#warning CONSTIFICATION maybe fix this + const_cast(this)->maybe_copy_midifiles (snapshot_type, siter->second, child); } + child->add_child_nocopy (siter->second->get_state()); } } @@ -1440,11 +1377,12 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass node->add_child_nocopy (_locations->get_state()); } } else { - Locations loc (*this); + Session* ncthis = const_cast (this); + Locations loc (*ncthis); const bool was_dirty = dirty(); // for a template, just create a new Locations, populate it // with the default start and end, and get the state for that. - Location* range = new Location (*this, timepos_t (Temporal::AudioTime), timepos_t (Temporal::AudioTime), _("session"), Location::IsSessionRange); + Location* range = new Location (*ncthis, timepos_t (Temporal::AudioTime), timepos_t (Temporal::AudioTime), _("session"), Location::IsSessionRange); range->set (timepos_t::max (Temporal::AudioTime), timepos_t (Temporal::AudioTime)); loc.add (range); XMLNode& locations_state = loc.get_state(); @@ -1457,7 +1395,7 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass */ if (!was_dirty) { - unset_dirty (); + ncthis->unset_dirty (); } } @@ -1496,7 +1434,7 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass _playlists->add_state (node, save_template, !only_used_assets); child = node->add_child ("RouteGroups"); - for (list::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) { + for (list::const_iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) { child->add_child_nocopy ((*i)->get_state()); } @@ -1537,8 +1475,83 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass return *node; } +void +Session::maybe_copy_midifiles (snapshot_t snapshot_type, boost::shared_ptr src, XMLNode* child) +{ + /* copy MIDI sources to new file + * + * We cannot replace the midi-source and MidiRegion::clobber_sources, + * because the GUI (midi_region) has a direct pointer to the midi-model + * of the source, as does UndoTransaction. + * + * On the upside, .mid files are not kept open. The file is only open + * when reading the model initially and when flushing the model to disk: + * source->session_saved () or export. + * + * We can change the _path of the existing source under the hood, keeping + * all IDs, references and pointers intact. + * */ + + boost::shared_ptr ms; + + if ((ms = boost::dynamic_pointer_cast (src)) == 0) { + return; + } + + const std::string ancestor_name = ms->ancestor_name(); + const std::string base = PBD::basename_nosuffix(ancestor_name); + const string path = new_midi_source_path (base, false); + + /* Session::save_state() will already have called + * ms->session_saved (); + */ + + /* use SMF-API to clone data (use the midi_model, not data on disk) */ + boost::shared_ptr newsrc (new SMFSource (*this, path, ms->flags())); + { + Source::WriterLock lm (ms->mutex()); + + if (!ms->model()) { + ms->load_model (lm); + } + } + Source::ReaderLock lm (ms->mutex()); + /* write_to() calls newsrc->flush_midi () to write the file to disk */ + if (ms->write_to (lm, newsrc, Temporal::Beats(), std::numeric_limits::max())) { + error << string_compose (_("Session-Save: Failed to copy MIDI Source '%1' for snapshot"), ancestor_name) << endmsg; + } else { + newsrc->session_saved (); /*< this sohuld be a no-op */ + + if (snapshot_type == SnapshotKeep) { + /* keep working on current session. + * + * Save snapshot-state with the original filename. + * Switch to use new path for future saves of the main session. + */ + child->add_child_nocopy (ms->get_state()); + } + + /* swap file-paths. + * ~SMFSource unlinks removable() files. + */ + std::string npath (ms->path ()); + ms->replace_file (newsrc->path ()); + newsrc->replace_file (npath); + + if (snapshot_type == SwitchToSnapshot) { + /* save and switch to snapshot. + * + * Leave the old file in place (as is). + * Snapshot uses new source directly + */ + child->add_child_nocopy (ms->get_state()); + } + } +} + + XMLNode& -Session::get_control_protocol_state () +Session::get_control_protocol_state () const { return ControlProtocolManager::instance().get_state (); } diff --git a/libs/ardour/sidechain.cc b/libs/ardour/sidechain.cc index 33aea30761..c2bf2f3c1b 100644 --- a/libs/ardour/sidechain.cc +++ b/libs/ardour/sidechain.cc @@ -45,7 +45,7 @@ SideChain::~SideChain () } XMLNode& -SideChain::state () +SideChain::state () const { XMLNode& node = IOProcessor::state (); node.set_property ("type", "sidechain"); diff --git a/libs/ardour/slavable_automation_control.cc b/libs/ardour/slavable_automation_control.cc index c875aec0ca..39021f3f4c 100644 --- a/libs/ardour/slavable_automation_control.cc +++ b/libs/ardour/slavable_automation_control.cc @@ -656,7 +656,7 @@ SlavableAutomationControl::use_saved_master_ratios () XMLNode& -SlavableAutomationControl::get_state () +SlavableAutomationControl::get_state () const { XMLNode& node (AutomationControl::get_state()); @@ -666,7 +666,7 @@ SlavableAutomationControl::get_state () Glib::Threads::RWLock::ReaderLock lm (master_lock); if (!_masters.empty()) { XMLNode* masters_node = new XMLNode (X_("masters")); - for (Masters::iterator mr = _masters.begin(); mr != _masters.end(); ++mr) { + for (Masters::const_iterator mr = _masters.begin(); mr != _masters.end(); ++mr) { XMLNode* mnode = new XMLNode (X_("master")); mnode->set_property (X_("id"), mr->second.master()->id()); diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 240b7465da..7ed604a93f 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -525,7 +525,7 @@ SMFSource::append_event_samples (const WriterLock& lock, } XMLNode& -SMFSource::get_state () +SMFSource::get_state () const { XMLNode& node = MidiSource::get_state(); node.set_property (X_("origin"), _origin); diff --git a/libs/ardour/solo_control.cc b/libs/ardour/solo_control.cc index dc0c0dd492..14f8c0287b 100644 --- a/libs/ardour/solo_control.cc +++ b/libs/ardour/solo_control.cc @@ -248,7 +248,7 @@ SoloControl::set_state (XMLNode const & node, int version) } XMLNode& -SoloControl::get_state () +SoloControl::get_state () const { XMLNode& node (SlavableAutomationControl::get_state()); diff --git a/libs/ardour/solo_isolate_control.cc b/libs/ardour/solo_isolate_control.cc index 4d021fd68a..f953fc63c6 100644 --- a/libs/ardour/solo_isolate_control.cc +++ b/libs/ardour/solo_isolate_control.cc @@ -164,7 +164,7 @@ SoloIsolateControl::set_state (XMLNode const & node, int version) } XMLNode& -SoloIsolateControl::get_state () +SoloIsolateControl::get_state () const { XMLNode& node (SlavableAutomationControl::get_state()); node.set_property (X_("solo-isolated"), _solo_isolated); diff --git a/libs/ardour/solo_safe_control.cc b/libs/ardour/solo_safe_control.cc index d753503351..4dace9e865 100644 --- a/libs/ardour/solo_safe_control.cc +++ b/libs/ardour/solo_safe_control.cc @@ -77,7 +77,7 @@ SoloSafeControl::set_state (XMLNode const & node, int version) } XMLNode& -SoloSafeControl::get_state () +SoloSafeControl::get_state () const { XMLNode& node (SlavableAutomationControl::get_state()); node.set_property (X_("solo-safe"), _solo_safe); diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 098b3c3415..7bb822363c 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -107,7 +107,7 @@ Source::fix_writable_flags () } XMLNode& -Source::get_state () +Source::get_state () const { XMLNode *node = new XMLNode (X_("Source")); diff --git a/libs/ardour/speakers.cc b/libs/ardour/speakers.cc index 082156c08b..dac8351941 100644 --- a/libs/ardour/speakers.cc +++ b/libs/ardour/speakers.cc @@ -242,7 +242,7 @@ Speakers::setup_default_speakers (uint32_t n) } XMLNode& -Speakers::get_state () +Speakers::get_state () const { XMLNode* node = new XMLNode (X_("Speakers")); diff --git a/libs/ardour/step_sequencer.cc b/libs/ardour/step_sequencer.cc index 1f898c9dd7..d8019ac8ec 100644 --- a/libs/ardour/step_sequencer.cc +++ b/libs/ardour/step_sequencer.cc @@ -437,7 +437,7 @@ Step::reschedule (Temporal::Beats const & start, Temporal::Beats const & offset) } XMLNode& -Step::get_state () +Step::get_state () const { return *new XMLNode (X_("Step")); } @@ -555,7 +555,7 @@ StepSequence::step (size_t n) const XMLNode& -StepSequence::get_state() +StepSequence::get_state() const { return *new XMLNode (X_("StepSequence")); } @@ -747,7 +747,7 @@ StepSequencer::set_end_step (size_t n) } XMLNode& -StepSequencer::get_state() +StepSequencer::get_state() const { return *new XMLNode (X_("StepSequencer")); } diff --git a/libs/ardour/test/automation_list_property_test.cc b/libs/ardour/test/automation_list_property_test.cc index ae082b3b3f..9813ee6648 100644 --- a/libs/ardour/test/automation_list_property_test.cc +++ b/libs/ardour/test/automation_list_property_test.cc @@ -115,7 +115,7 @@ public: add_property (_jim); } - XMLNode & get_state () { + XMLNode & get_state () const { XMLNode* n = new XMLNode ("State"); add_properties (*n); return *n; diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 1cb8b6aea2..c0adddb50c 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -164,7 +164,7 @@ Track::chan_count_changed () } XMLNode& -Track::state (bool save_template) +Track::state (bool save_template) const { XMLNode& root (Route::state (save_template)); diff --git a/libs/ardour/transport_master.cc b/libs/ardour/transport_master.cc index a9debe974e..aac3b84286 100644 --- a/libs/ardour/transport_master.cc +++ b/libs/ardour/transport_master.cc @@ -294,7 +294,7 @@ TransportMaster::connect_port_using_state () } XMLNode& -TransportMaster::get_state () +TransportMaster::get_state () const { XMLNode* node = new XMLNode (state_node_name); node->set_property (X_("type"), _type); diff --git a/libs/ardour/transport_master_manager.cc b/libs/ardour/transport_master_manager.cc index 71c7c93f56..6ccf1edd07 100644 --- a/libs/ardour/transport_master_manager.cc +++ b/libs/ardour/transport_master_manager.cc @@ -646,7 +646,7 @@ TransportMasterManager::set_state (XMLNode const & node, int version) } XMLNode& -TransportMasterManager::get_state () +TransportMasterManager::get_state () const { XMLNode* node = new XMLNode (state_node_name); @@ -656,7 +656,7 @@ TransportMasterManager::get_state () Glib::Threads::RWLock::ReaderLock lm (lock); - for (TransportMasters::iterator t = _transport_masters.begin(); t != _transport_masters.end(); ++t) { + for (TransportMasters::const_iterator t = _transport_masters.begin(); t != _transport_masters.end(); ++t) { node->add_child_nocopy ((*t)->get_state()); } diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index c0e4a2e441..8155ca33a6 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -557,7 +557,7 @@ Trigger::unbang () } XMLNode& -Trigger::get_state (void) +Trigger::get_state () const { XMLNode* node = new XMLNode (X_("Trigger")); @@ -1312,7 +1312,7 @@ AudioTrigger::jump_stop (BufferSet& bufs, pframes_t dest_offset) } XMLNode& -AudioTrigger::get_state (void) +AudioTrigger::get_state () const { XMLNode& node (Trigger::get_state()); @@ -2339,7 +2339,7 @@ MIDITrigger::jump_stop (BufferSet& bufs, pframes_t dest_offset) } XMLNode& -MIDITrigger::get_state (void) +MIDITrigger::get_state () const { XMLNode& node (Trigger::get_state()); @@ -4143,7 +4143,7 @@ TriggerBox::determine_next_trigger (uint32_t current) } XMLNode& -TriggerBox::get_state (void) +TriggerBox::get_state () const { XMLNode& node (Processor::get_state ()); @@ -4154,8 +4154,8 @@ TriggerBox::get_state (void) { Glib::Threads::RWLock::ReaderLock lm (trigger_lock); - for (Triggers::iterator t = all_triggers.begin(); t != all_triggers.end(); ++t) { - trigger_child->add_child_nocopy ((*t)->get_state()); + for (auto const & t : all_triggers) { + trigger_child->add_child_nocopy (t->get_state()); } } diff --git a/libs/ardour/unknown_processor.cc b/libs/ardour/unknown_processor.cc index 0dfeaf02ba..4c621f3185 100644 --- a/libs/ardour/unknown_processor.cc +++ b/libs/ardour/unknown_processor.cc @@ -105,7 +105,7 @@ UnknownProcessor::~UnknownProcessor () { } XMLNode & -UnknownProcessor::state () +UnknownProcessor::state () const { return *(new XMLNode (_state)); } diff --git a/libs/ardour/user_bundle.cc b/libs/ardour/user_bundle.cc index 0e456107de..42b4867dc6 100644 --- a/libs/ardour/user_bundle.cc +++ b/libs/ardour/user_bundle.cc @@ -97,7 +97,7 @@ ARDOUR::UserBundle::set_state (XMLNode const & node, int /*version*/) } XMLNode& -ARDOUR::UserBundle::get_state () +ARDOUR::UserBundle::get_state () const { XMLNode *node; @@ -112,12 +112,12 @@ ARDOUR::UserBundle::get_state () { Glib::Threads::Mutex::Lock lm (_channel_mutex); - for (std::vector::iterator i = _channel.begin(); i != _channel.end(); ++i) { + for (std::vector::const_iterator i = _channel.begin(); i != _channel.end(); ++i) { XMLNode* c = new XMLNode ("Channel"); c->set_property ("name", i->name); c->set_property ("type", i->type); - for (PortList::iterator j = i->ports.begin(); j != i->ports.end(); ++j) { + for (PortList::const_iterator j = i->ports.begin(); j != i->ports.end(); ++j) { XMLNode* p = new XMLNode ("Port"); p->set_property ("name", *j); c->add_child_nocopy (*p); diff --git a/libs/ardour/vca.cc b/libs/ardour/vca.cc index 3574ba8549..c61aa1e979 100644 --- a/libs/ardour/vca.cc +++ b/libs/ardour/vca.cc @@ -117,7 +117,7 @@ VCA::full_name() const } XMLNode& -VCA::get_state () +VCA::get_state () const { XMLNode* node = new XMLNode (xml_node_name); node->set_property (X_("name"), name()); diff --git a/libs/ardour/vca_manager.cc b/libs/ardour/vca_manager.cc index 7b929c2352..cdfaf04b54 100644 --- a/libs/ardour/vca_manager.cc +++ b/libs/ardour/vca_manager.cc @@ -171,7 +171,7 @@ VCAManager::vca_by_name (std::string const& name) const } XMLNode& -VCAManager::get_state () +VCAManager::get_state () const { XMLNode* node = new XMLNode (xml_node_name); diff --git a/libs/gtkmm2ext/gtkmm2ext/keyboard.h b/libs/gtkmm2ext/gtkmm2ext/keyboard.h index 6dd6216f10..dd5a365f32 100644 --- a/libs/gtkmm2ext/gtkmm2ext/keyboard.h +++ b/libs/gtkmm2ext/gtkmm2ext/keyboard.h @@ -50,7 +50,7 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful Keyboard (); ~Keyboard (); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); virtual void setup_keybindings () = 0; diff --git a/libs/gtkmm2ext/gtkmm2ext/window_proxy.h b/libs/gtkmm2ext/gtkmm2ext/window_proxy.h index 04dd248353..38215b9279 100644 --- a/libs/gtkmm2ext/gtkmm2ext/window_proxy.h +++ b/libs/gtkmm2ext/gtkmm2ext/window_proxy.h @@ -65,7 +65,7 @@ public: virtual Gtk::Window* get (bool create = false) = 0; virtual int set_state (const XMLNode&, int version); - virtual XMLNode& get_state (); + virtual XMLNode& get_state () const; enum StateMask { Position = 0x1, diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc index 65dffbcd5c..b3ddc79cc6 100644 --- a/libs/gtkmm2ext/keyboard.cc +++ b/libs/gtkmm2ext/keyboard.cc @@ -173,7 +173,7 @@ Keyboard::~Keyboard () } XMLNode& -Keyboard::get_state (void) +Keyboard::get_state () const { XMLNode* node = new XMLNode ("Keyboard"); diff --git a/libs/gtkmm2ext/window_proxy.cc b/libs/gtkmm2ext/window_proxy.cc index 6e3191abd8..8d751d49ed 100644 --- a/libs/gtkmm2ext/window_proxy.cc +++ b/libs/gtkmm2ext/window_proxy.cc @@ -156,7 +156,7 @@ WindowProxy::xml_node_name() } XMLNode& -WindowProxy::get_state () +WindowProxy::get_state () const { XMLNode* node = new XMLNode (xml_node_name()); diff --git a/libs/lua/lua/luastate.h b/libs/lua/lua/luastate.h index ebe3d70c3d..d2b86b16f0 100644 --- a/libs/lua/lua/luastate.h +++ b/libs/lua/lua/luastate.h @@ -33,7 +33,7 @@ public: int do_command (std::string); int do_file (std::string); - void collect_garbage (); + void collect_garbage () const; void collect_garbage_step (int debt = 0); void tweak_rt_gc (); void sandbox (bool rt_safe = false); diff --git a/libs/lua/luastate.cc b/libs/lua/luastate.cc index 15428b4729..fd33cabb96 100644 --- a/libs/lua/luastate.cc +++ b/libs/lua/luastate.cc @@ -72,7 +72,7 @@ LuaState::do_file (std::string fn) { } void -LuaState::collect_garbage () { +LuaState::collect_garbage () const { lua_gc (L, LUA_GCCOLLECT, 0); } diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index 62b19da0d5..51a7e31746 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -110,7 +110,7 @@ public: const PatchPrimaryKey& patch_primary_key() const { return _id; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); private: @@ -137,7 +137,7 @@ public: int set_patch_name_list (const PatchNameList&); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); private: @@ -206,7 +206,7 @@ public: const std::string& note_list_name() const { return _note_list_name; } const std::string& control_list_name() const { return _control_list_name; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); void set_patch_banks (const PatchBanks&); @@ -239,7 +239,7 @@ public: uint8_t number() const { return _number; } void set_number(uint8_t number) { _number = number; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); private: @@ -260,7 +260,7 @@ public: void set_name(const std::string& name) { _name = name; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); private: @@ -284,7 +284,7 @@ public: void set_number(uint16_t number) { _number = number; } void set_name(const std::string& name) { _name = name; } - XMLNode& get_state(void); + XMLNode& get_state () const; int set_state(const XMLTree&, const XMLNode&); private: @@ -309,7 +309,7 @@ public: const Values& values() const { return _values; } - XMLNode& get_state(void); + XMLNode& get_state () const; int set_state(const XMLTree&, const XMLNode&); private: @@ -340,7 +340,7 @@ public: void set_number(uint16_t number) { _number = number; } void set_name(const std::string& name) { _name = name; } - XMLNode& get_state(void); + XMLNode& get_state () const; int set_state(const XMLTree&, const XMLNode&); private: @@ -368,7 +368,7 @@ public: const Controls& controls() const { return _controls; } - XMLNode& get_state(void); + XMLNode& get_state () const; int set_state(const XMLTree&, const XMLNode&); private: @@ -386,7 +386,7 @@ public: void set_name(const std::string& name) { _name = name; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); /// Note: channel here is 0-based while in the MIDNAM-file it's 1-based @@ -450,7 +450,7 @@ public: uint8_t program, uint8_t number); - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); private: @@ -487,7 +487,7 @@ public: const MasterDeviceNames::Models& all_models() const { return _all_models; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLTree&, const XMLNode&); private: diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index f381bfb364..12470d358e 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -126,7 +126,7 @@ class LIBMIDIPP_API Port { Flags flags; Descriptor (const XMLNode&); - XMLNode& get_state(); + XMLNode& get_state() const; }; static std::string state_node_name; diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index 3d8f2a233c..2d3af4ec48 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -92,7 +92,7 @@ initialize_primary_key_from_commands ( } XMLNode& -Patch::get_state (void) +Patch::get_state () const { XMLNode* node = new XMLNode("Patch"); @@ -153,7 +153,7 @@ Patch::set_state (const XMLTree& tree, const XMLNode& node) } XMLNode& -Note::get_state (void) +Note::get_state () const { XMLNode* node = new XMLNode("Note"); node->set_property("Number", _number); @@ -182,7 +182,7 @@ Note::set_state (const XMLTree& tree, const XMLNode& node) } XMLNode& -NoteNameList::get_state (void) +NoteNameList::get_state () const { XMLNode* node = new XMLNode("NoteNameList"); node->set_property("Name", _name); @@ -236,7 +236,7 @@ NoteNameList::set_state (const XMLTree& tree, const XMLNode& node) } XMLNode& -Control::get_state (void) +Control::get_state () const { XMLNode* node = new XMLNode("Control"); node->set_property("Type", _type); @@ -281,7 +281,7 @@ Control::set_state (const XMLTree& tree, const XMLNode& node) } XMLNode& -ControlNameList::get_state (void) +ControlNameList::get_state () const { XMLNode* node = new XMLNode("ControlNameList"); node->set_property("Name", _name); @@ -327,7 +327,7 @@ ControlNameList::control(uint16_t num) const } XMLNode& -Value::get_state (void) +Value::get_state () const { XMLNode* node = new XMLNode("Value"); node->set_property("Number", _number); @@ -347,7 +347,7 @@ Value::set_state (const XMLTree& tree, const XMLNode& node) } XMLNode& -ValueNameList::get_state (void) +ValueNameList::get_state () const { XMLNode* node = new XMLNode("ValueNameList"); node->set_property("Name", _name); @@ -412,12 +412,12 @@ ValueNameList::max_value_below(uint16_t num) const } XMLNode& -PatchBank::get_state (void) +PatchBank::get_state () const { XMLNode* node = new XMLNode("PatchBank"); node->set_property("Name", _name); XMLNode* patch_name_list = node->add_child("PatchNameList"); - for (PatchNameList::iterator patch = _patch_name_list.begin(); + for (PatchNameList::const_iterator patch = _patch_name_list.begin(); patch != _patch_name_list.end(); ++patch) { patch_name_list->add_child_nocopy((*patch)->get_state()); @@ -532,7 +532,7 @@ ChannelNameSet::use_patch_name_list (const PatchNameList& pnl) } XMLNode& -ChannelNameSet::get_state (void) +ChannelNameSet::get_state () const { XMLNode* node = new XMLNode("ChannelNameSet"); node->set_property("Name", _name); @@ -553,7 +553,7 @@ ChannelNameSet::get_state (void) } } - for (PatchBanks::iterator patch_bank = _patch_banks.begin(); + for (PatchBanks::const_iterator patch_bank = _patch_banks.begin(); patch_bank != _patch_banks.end(); ++patch_bank) { node->add_child_nocopy((*patch_bank)->get_state()); @@ -627,7 +627,7 @@ CustomDeviceMode::set_state(const XMLTree& tree, const XMLNode& a_node) } XMLNode& -CustomDeviceMode::get_state(void) +CustomDeviceMode::get_state () const { XMLNode* custom_device_mode = new XMLNode("CustomDeviceMode"); custom_device_mode->set_property("Name", _name); @@ -890,7 +890,7 @@ MasterDeviceNames::set_state(const XMLTree& tree, const XMLNode&) } XMLNode& -MasterDeviceNames::get_state(void) +MasterDeviceNames::get_state () const { static XMLNode nothing(""); return nothing; @@ -951,7 +951,7 @@ MIDINameDocument::set_state (const XMLTree& tree, const XMLNode&) } XMLNode& -MIDINameDocument::get_state(void) +MIDINameDocument::get_state () const { static XMLNode nothing(""); return nothing; diff --git a/libs/panners/1in2out/panner_1in2out.cc b/libs/panners/1in2out/panner_1in2out.cc index 98d41d8034..30d198a730 100644 --- a/libs/panners/1in2out/panner_1in2out.cc +++ b/libs/panners/1in2out/panner_1in2out.cc @@ -330,7 +330,7 @@ Panner1in2out::factory (boost::shared_ptr p, boost::shared_ptr) const; - XMLNode& get_state (); + XMLNode& get_state () const; void reset (); diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index b141874493..fd67fbe9cc 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -475,7 +475,7 @@ Panner2in2out::factory (boost::shared_ptr p, boost::shared_ptr) const; - XMLNode& get_state (); + XMLNode& get_state () const; void update (); diff --git a/libs/panners/stereobalance/panner_balance.cc b/libs/panners/stereobalance/panner_balance.cc index 149a1f0983..8efd88128a 100644 --- a/libs/panners/stereobalance/panner_balance.cc +++ b/libs/panners/stereobalance/panner_balance.cc @@ -263,7 +263,7 @@ Pannerbalance::factory (boost::shared_ptr p, boost::shared_ptr) const; - XMLNode& get_state (); + XMLNode& get_state () const; void reset (); void thaw (); diff --git a/libs/panners/vbap/vbap.cc b/libs/panners/vbap/vbap.cc index fbb33c53a0..34e841a5a4 100644 --- a/libs/panners/vbap/vbap.cc +++ b/libs/panners/vbap/vbap.cc @@ -365,7 +365,7 @@ VBAPanner::distribute_one_automated (AudioBuffer& /*src*/, BufferSet& /*obufs*/, } XMLNode& -VBAPanner::get_state () +VBAPanner::get_state () const { XMLNode& node (Panner::get_state ()); node.set_property (X_ ("uri"), _descriptor.panner_uri); diff --git a/libs/panners/vbap/vbap.h b/libs/panners/vbap/vbap.h index 584cd29f4b..bc35bcb20b 100644 --- a/libs/panners/vbap/vbap.h +++ b/libs/panners/vbap/vbap.h @@ -57,7 +57,7 @@ public: std::string value_as_string (boost::shared_ptr) const; - XMLNode& get_state (); + XMLNode& get_state () const; PBD::AngularVector signal_position (uint32_t n) const; boost::shared_ptr get_speakers () const; diff --git a/libs/pbd/command.cc b/libs/pbd/command.cc index 69a12d2cbe..bacb9eaa1a 100644 --- a/libs/pbd/command.cc +++ b/libs/pbd/command.cc @@ -21,7 +21,7 @@ #include "pbd/command.h" #include "pbd/xml++.h" -XMLNode &Command::get_state() +XMLNode &Command::get_state() const { XMLNode *node = new XMLNode ("Command"); node->add_content("WARNING: Somebody forgot to subclass Command."); diff --git a/libs/pbd/configuration_variable.cc b/libs/pbd/configuration_variable.cc index 990c838dd6..64e6d2bbaa 100644 --- a/libs/pbd/configuration_variable.cc +++ b/libs/pbd/configuration_variable.cc @@ -32,7 +32,7 @@ using namespace std; using namespace PBD; void -ConfigVariableBase::add_to_node (XMLNode& node) +ConfigVariableBase::add_to_node (XMLNode& node) const { const std::string v = get_as_string (); DEBUG_TRACE (DEBUG::Configuration, string_compose ("Config variable %1 stored as [%2]\n", _name, v)); diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index e60fffe689..e9fd872609 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -52,7 +52,7 @@ Controllable::Controllable (const string& name, Flag f) } XMLNode& -Controllable::get_state () +Controllable::get_state () const { XMLNode* node = new XMLNode (xml_node_name); diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h index eb413e40b8..f72d875676 100644 --- a/libs/pbd/pbd/command.h +++ b/libs/pbd/pbd/command.h @@ -43,7 +43,7 @@ public: virtual void undo() = 0; virtual void redo() { (*this)(); } - virtual XMLNode &get_state(); + virtual XMLNode& get_state() const; virtual int set_state(const XMLNode&, int /*version*/) { /* noop */ return 0; } virtual bool empty () const { diff --git a/libs/pbd/pbd/configuration.h b/libs/pbd/pbd/configuration.h index ca35af2ee1..2692d55a5a 100644 --- a/libs/pbd/pbd/configuration.h +++ b/libs/pbd/pbd/configuration.h @@ -37,8 +37,8 @@ class Configuration : public PBD::Stateful virtual void map_parameters (boost::function&) = 0; virtual int set_state (XMLNode const &, int) = 0; - virtual XMLNode & get_state () = 0; - virtual XMLNode & get_variables () = 0; + virtual XMLNode & get_state () const = 0; + virtual XMLNode & get_variables () const = 0; virtual void set_variables (XMLNode const &) = 0; PBD::Signal1 ParameterChanged; diff --git a/libs/pbd/pbd/configuration_variable.h b/libs/pbd/pbd/configuration_variable.h index 93dcb28429..f3cbd23dbb 100644 --- a/libs/pbd/pbd/configuration_variable.h +++ b/libs/pbd/pbd/configuration_variable.h @@ -34,7 +34,7 @@ class LIBPBD_API ConfigVariableBase { virtual ~ConfigVariableBase() {} std::string name () const { return _name; } - void add_to_node (XMLNode&); + void add_to_node (XMLNode&) const; bool set_from_node (XMLNode const &); virtual std::string get_as_string () const = 0; diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 491760d42c..7f4a202b7f 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -146,7 +146,7 @@ public: PBD::Signal2 Changed; int set_state (const XMLNode&, int version); - virtual XMLNode& get_state (); + virtual XMLNode& get_state () const; std::string name() const { return _name; } diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index 7d9cbf18f9..2e20d51a42 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -141,7 +141,7 @@ public: } } - virtual XMLNode &get_state() { + virtual XMLNode &get_state() const { std::string name; if (before && after) { name = "MementoCommand"; diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h index 4988064f3f..2a5580a933 100644 --- a/libs/pbd/pbd/stateful.h +++ b/libs/pbd/pbd/stateful.h @@ -51,7 +51,7 @@ class LIBPBD_API Stateful { Stateful (); virtual ~Stateful(); - virtual XMLNode& get_state (void) = 0; + virtual XMLNode& get_state () const = 0; virtual int set_state (const XMLNode&, int version) = 0; virtual bool apply_change (PropertyBase const &); @@ -111,7 +111,7 @@ class LIBPBD_API Stateful { void add_instant_xml (XMLNode&, const std::string& directory_path); XMLNode *instant_xml (const std::string& str, const std::string& directory_path); - void add_properties (XMLNode &); + void add_properties (XMLNode &) const; PropertyChange set_values (XMLNode const &); diff --git a/libs/pbd/pbd/stateful_diff_command.h b/libs/pbd/pbd/stateful_diff_command.h index ccf1ae69ef..5b3807aede 100644 --- a/libs/pbd/pbd/stateful_diff_command.h +++ b/libs/pbd/pbd/stateful_diff_command.h @@ -44,7 +44,7 @@ public: void operator() (); void undo (); - XMLNode& get_state (); + XMLNode& get_state () const; bool empty () const; diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 872c865f08..3cf546b606 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -62,7 +62,7 @@ public: void undo (); void redo (); - XMLNode& get_state (); + XMLNode& get_state () const; void set_timestamp (struct timeval& t) { diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 835c977a5e..d7948201bf 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -272,9 +272,9 @@ Stateful::apply_changes (const PropertyList& property_list) * @param owner_state Node. */ void -Stateful::add_properties (XMLNode& owner_state) +Stateful::add_properties (XMLNode& owner_state) const { - for (OwnedPropertyList::iterator i = _properties->begin(); i != _properties->end(); ++i) { + for (OwnedPropertyList::const_iterator i = _properties->begin(); i != _properties->end(); ++i) { i->second->get_value (owner_state); } } diff --git a/libs/pbd/stateful_diff_command.cc b/libs/pbd/stateful_diff_command.cc index b42edcb80b..274eedfe7e 100644 --- a/libs/pbd/stateful_diff_command.cc +++ b/libs/pbd/stateful_diff_command.cc @@ -94,7 +94,7 @@ StatefulDiffCommand::undo () } XMLNode& -StatefulDiffCommand::get_state () +StatefulDiffCommand::get_state () const { boost::shared_ptr s (_object.lock ()); diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index da35bc50ec..1428922ebe 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -141,14 +141,14 @@ UndoTransaction::redo () } XMLNode& -UndoTransaction::get_state () +UndoTransaction::get_state () const { XMLNode* node = new XMLNode ("UndoTransaction"); node->set_property ("tv-sec", (int64_t)_timestamp.tv_sec); node->set_property ("tv-usec", (int64_t)_timestamp.tv_usec); node->set_property ("name", _name); - list::iterator it; + list::const_iterator it; for (it = actions.begin (); it != actions.end (); it++) { node->add_child_nocopy ((*it)->get_state ()); } diff --git a/libs/surfaces/cc121/cc121.cc b/libs/surfaces/cc121/cc121.cc index 76c7abe647..a71733e711 100644 --- a/libs/surfaces/cc121/cc121.cc +++ b/libs/surfaces/cc121/cc121.cc @@ -715,7 +715,7 @@ CC121::midi_input_handler (Glib::IOCondition ioc, boost::shared_ptr { static bool probe() { return true; } static void* request_factory (uint32_t); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); bool has_editor () const { return true; } diff --git a/libs/surfaces/contourdesign/contourdesign.cc b/libs/surfaces/contourdesign/contourdesign.cc index 8f29a23331..c411c501ca 100644 --- a/libs/surfaces/contourdesign/contourdesign.cc +++ b/libs/surfaces/contourdesign/contourdesign.cc @@ -129,7 +129,7 @@ ContourDesignControlProtocol::set_active (bool yn) } XMLNode& -ContourDesignControlProtocol::get_state () +ContourDesignControlProtocol::get_state () const { XMLNode& node (ControlProtocol::get_state()); node.set_property (X_("keep-rolling"), _keep_rolling); diff --git a/libs/surfaces/contourdesign/contourdesign.h b/libs/surfaces/contourdesign/contourdesign.h index 947d6ce2cf..09da0c0240 100644 --- a/libs/surfaces/contourdesign/contourdesign.h +++ b/libs/surfaces/contourdesign/contourdesign.h @@ -88,7 +88,7 @@ public: int set_active (bool yn); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); void stripable_selection_changed () {} diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc index cf445bc095..d47ada96c7 100644 --- a/libs/surfaces/control_protocol/control_protocol.cc +++ b/libs/surfaces/control_protocol/control_protocol.cc @@ -317,7 +317,7 @@ ControlProtocol::bundles () } XMLNode& -ControlProtocol::get_state () +ControlProtocol::get_state () const { XMLNode* node = new XMLNode (state_node_name); diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index 8f86235c83..cba8838d04 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -133,7 +133,7 @@ public: virtual void* get_gui () const { return 0; } virtual void tear_down_gui () {} - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (XMLNode const&, int version); static const std::string state_node_name; diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc index f454f39c4b..24925b1c0a 100644 --- a/libs/surfaces/faderport/faderport.cc +++ b/libs/surfaces/faderport/faderport.cc @@ -756,7 +756,7 @@ FaderPort::midi_input_handler (Glib::IOCondition ioc, boost::weak_ptrget_controllable() && (*i)->learned()) { - children->add_child_nocopy ((*i)->get_state()); + if (c->get_controllable() && c->learned()) { + children->add_child_nocopy (c->get_state()); } } diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h index 14b3e807e4..a310aa6498 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h @@ -87,7 +87,7 @@ public: void maybe_start_touch (boost::shared_ptr); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); bool has_editor () const { return true; } @@ -162,7 +162,7 @@ private: }; typedef std::list MIDIPendingControllables; MIDIPendingControllables pending_controllables; - Glib::Threads::Mutex controllables_lock; + mutable Glib::Threads::Mutex controllables_lock; Glib::Threads::Mutex pending_lock; bool start_learning (boost::weak_ptr); diff --git a/libs/surfaces/generic_midi/midiaction.cc b/libs/surfaces/generic_midi/midiaction.cc index c272bbf13e..355b06f171 100644 --- a/libs/surfaces/generic_midi/midiaction.cc +++ b/libs/surfaces/generic_midi/midiaction.cc @@ -52,7 +52,7 @@ MIDIAction::execute () } XMLNode& -MIDIAction::get_state () +MIDIAction::get_state () const { XMLNode* node = new XMLNode ("MIDIAction"); return *node; diff --git a/libs/surfaces/generic_midi/midiaction.h b/libs/surfaces/generic_midi/midiaction.h index a9cf23e929..a4a00db7b8 100644 --- a/libs/surfaces/generic_midi/midiaction.h +++ b/libs/surfaces/generic_midi/midiaction.h @@ -50,7 +50,7 @@ class MIDIAction : public MIDIInvokable const std::string& action_name() const { return _invokable_name; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); private: diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 75cfec6da0..fa54a2d143 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -802,7 +802,7 @@ MIDIControllable::set_state (const XMLNode& node, int /*version*/) } XMLNode& -MIDIControllable::get_state () +MIDIControllable::get_state () const { char buf[32]; diff --git a/libs/surfaces/generic_midi/midicontrollable.h b/libs/surfaces/generic_midi/midicontrollable.h index 507ef538be..0d8a2aa1a6 100644 --- a/libs/surfaces/generic_midi/midicontrollable.h +++ b/libs/surfaces/generic_midi/midicontrollable.h @@ -99,7 +99,7 @@ public: std::string control_description() const { return _control_description; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); void bind_midi (MIDI::channel_t, MIDI::eventType, MIDI::byte); diff --git a/libs/surfaces/generic_midi/midifunction.cc b/libs/surfaces/generic_midi/midifunction.cc index 493f9c9ba7..beecd45680 100644 --- a/libs/surfaces/generic_midi/midifunction.cc +++ b/libs/surfaces/generic_midi/midifunction.cc @@ -188,7 +188,7 @@ MIDIFunction::execute () } XMLNode& -MIDIFunction::get_state () +MIDIFunction::get_state () const { XMLNode* node = new XMLNode ("MIDIFunction"); diff --git a/libs/surfaces/generic_midi/midifunction.h b/libs/surfaces/generic_midi/midifunction.h index 2ce95e85bf..878806e425 100644 --- a/libs/surfaces/generic_midi/midifunction.h +++ b/libs/surfaces/generic_midi/midifunction.h @@ -70,7 +70,7 @@ class MIDIFunction : public MIDIInvokable const std::string& function_name() const { return _invokable_name; } - XMLNode& get_state (void); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); private: diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.cc b/libs/surfaces/launch_control_xl/launch_control_xl.cc index 44a57e17ae..a59686df38 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.cc +++ b/libs/surfaces/launch_control_xl/launch_control_xl.cc @@ -761,7 +761,7 @@ LaunchControlXL::notify_parameter_changed (std::string param) /* connection handling */ XMLNode& -LaunchControlXL::get_state() +LaunchControlXL::get_state() const { XMLNode& node (ControlProtocol::get_state()); XMLNode* child; diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.h b/libs/surfaces/launch_control_xl/launch_control_xl.h index 4147260524..2a1bd1e78f 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.h +++ b/libs/surfaces/launch_control_xl/launch_control_xl.h @@ -369,7 +369,7 @@ public: int get_amount_of_tracks(); int set_active(bool yn); - XMLNode &get_state(); + XMLNode& get_state() const; int set_state(const XMLNode &node, int version); PBD::Signal0 ConnectionChange; diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 4cbe8e0fec..04d7e24603 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -1016,7 +1016,7 @@ MackieControlProtocol::close() * contains a state node for the device, it will deleted and replaced. */ void -MackieControlProtocol::update_configuration_state () +MackieControlProtocol::update_configuration_state () const { /* CALLER MUST HOLD SURFACES LOCK */ @@ -1032,15 +1032,15 @@ MackieControlProtocol::update_configuration_state () XMLNode* snode = new XMLNode (X_("Surfaces")); - for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) { - snode->add_child_nocopy ((*s)->get_state()); + for (auto const & s : surfaces) { + snode->add_child_nocopy (s->get_state()); } devnode->add_child_nocopy (*snode); } XMLNode& -MackieControlProtocol::get_state() +MackieControlProtocol::get_state() const { XMLNode& node (ControlProtocol::get_state()); diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 6db81cd9f0..c056a966e6 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -147,7 +147,7 @@ class MackieControlProtocol void set_flip_mode (FlipMode); void display_view_mode (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); /* Note: because Mackie control is inherently a duplex protocol, @@ -328,7 +328,7 @@ class MackieControlProtocol bool needs_ipmidi_restart; bool _metering_active; bool _initialized; - XMLNode* configuration_state; + mutable XMLNode* configuration_state; int state_version; int _last_bank[9]; bool marker_modifier_consumed_by_button; @@ -358,7 +358,7 @@ class MackieControlProtocol int ipmidi_restart (); void initialize (); int set_device_info (const std::string& device_name); - void update_configuration_state (); + void update_configuration_state () const; /* MIDI port connection management */ diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 6b5bf7beed..0b973b59b6 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -273,7 +273,7 @@ Surface::connection_handler (boost::weak_ptr, std::string name1, b } XMLNode& -Surface::get_state() +Surface::get_state() const { XMLNode* node = new XMLNode (X_("Surface")); node->set_property (X_("name"), _name); diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index 4580c77d20..92247dbf4e 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -193,7 +193,7 @@ public: void master_monitor_may_have_changed (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); bool get_qcon_flag() { return is_qcon; } diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc index 9d32f816f2..df4662e203 100644 --- a/libs/surfaces/mackie/surface_port.cc +++ b/libs/surfaces/mackie/surface_port.cc @@ -112,7 +112,7 @@ SurfacePort::~SurfacePort() } XMLNode& -SurfacePort::get_state () +SurfacePort::get_state () const { XMLNode* node = new XMLNode (X_("Port")); diff --git a/libs/surfaces/mackie/surface_port.h b/libs/surfaces/mackie/surface_port.h index 4465667c4c..fd6f09372f 100644 --- a/libs/surfaces/mackie/surface_port.h +++ b/libs/surfaces/mackie/surface_port.h @@ -72,7 +72,7 @@ class SurfacePort void reconnect (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); protected: diff --git a/libs/surfaces/maschine2/maschine2.cc b/libs/surfaces/maschine2/maschine2.cc index cecd4b0388..f329bd6049 100644 --- a/libs/surfaces/maschine2/maschine2.cc +++ b/libs/surfaces/maschine2/maschine2.cc @@ -163,7 +163,7 @@ Maschine2::set_active (bool yn) } XMLNode& -Maschine2::get_state() +Maschine2::get_state() const { XMLNode& node (ControlProtocol::get_state()); return node; diff --git a/libs/surfaces/maschine2/maschine2.h b/libs/surfaces/maschine2/maschine2.h index 3992f5e27a..162f1bdbeb 100644 --- a/libs/surfaces/maschine2/maschine2.h +++ b/libs/surfaces/maschine2/maschine2.h @@ -73,7 +73,7 @@ class Maschine2: public ARDOUR::ControlProtocol, public AbstractUI static OSC* instance() { return _instance; } - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); void stripable_selection_changed () {} diff --git a/libs/surfaces/osc/osc_controllable.cc b/libs/surfaces/osc/osc_controllable.cc index dd09dcff61..0224601d14 100644 --- a/libs/surfaces/osc/osc_controllable.cc +++ b/libs/surfaces/osc/osc_controllable.cc @@ -46,7 +46,7 @@ OSCControllable::~OSCControllable () } XMLNode& -OSCControllable::get_state () +OSCControllable::get_state () const { XMLNode& root (controllable->get_state()); return root; diff --git a/libs/surfaces/osc/osc_controllable.h b/libs/surfaces/osc/osc_controllable.h index 37aab181a5..2aefbbd95a 100644 --- a/libs/surfaces/osc/osc_controllable.h +++ b/libs/surfaces/osc/osc_controllable.h @@ -40,7 +40,7 @@ class OSCControllable : public PBD::Stateful lo_address address() const { return addr; } - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode& node, int version); protected: diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index 18a8f0336f..24c50fe689 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -975,7 +975,7 @@ Push2::notify_solo_active_changed (bool yn) } XMLNode& -Push2::get_state() +Push2::get_state() const { XMLNode& node (ControlProtocol::get_state()); XMLNode* child; diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index 72406b909e..70f1e9a854 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -312,7 +312,7 @@ class Push2 : public ARDOUR::ControlProtocol void tear_down_gui (); int set_active (bool yn); - XMLNode& get_state(); + XMLNode& get_state() const; int set_state (const XMLNode & node, int version); PBD::Signal0 ConnectionChange; diff --git a/libs/surfaces/tranzport/state.cc b/libs/surfaces/tranzport/state.cc index f9988a178e..3e86c0d7a8 100644 --- a/libs/surfaces/tranzport/state.cc +++ b/libs/surfaces/tranzport/state.cc @@ -48,7 +48,7 @@ using namespace PBD; // FIXME: How to handle multiple tranzports in a system? XMLNode& -TranzportControlProtocol::get_state () +TranzportControlProtocol::get_state () const { return ControlProtocol::get_state(); } diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.h b/libs/surfaces/tranzport/tranzport_control_protocol.h index 0b4dd15849..0bcf317527 100644 --- a/libs/surfaces/tranzport/tranzport_control_protocol.h +++ b/libs/surfaces/tranzport/tranzport_control_protocol.h @@ -48,7 +48,7 @@ public: static bool probe (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&); private: diff --git a/libs/surfaces/us2400/surface.cc b/libs/surfaces/us2400/surface.cc index a2015d0935..98e63a733f 100644 --- a/libs/surfaces/us2400/surface.cc +++ b/libs/surfaces/us2400/surface.cc @@ -232,7 +232,7 @@ Surface::connection_handler (boost::weak_ptr, std::string name1, b } XMLNode& -Surface::get_state() +Surface::get_state() const { XMLNode* node = new XMLNode (X_("Surface")); node->set_property (X_("name"), _name); diff --git a/libs/surfaces/us2400/surface.h b/libs/surfaces/us2400/surface.h index f8f48685f6..5be5ceb0eb 100644 --- a/libs/surfaces/us2400/surface.h +++ b/libs/surfaces/us2400/surface.h @@ -178,7 +178,7 @@ public: void master_monitor_may_have_changed (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); private: diff --git a/libs/surfaces/us2400/surface_port.cc b/libs/surfaces/us2400/surface_port.cc index 53b1eb20bc..6245b96676 100644 --- a/libs/surfaces/us2400/surface_port.cc +++ b/libs/surfaces/us2400/surface_port.cc @@ -85,7 +85,7 @@ SurfacePort::~SurfacePort() } XMLNode& -SurfacePort::get_state () +SurfacePort::get_state () const { XMLNode* node = new XMLNode (X_("Port")); diff --git a/libs/surfaces/us2400/surface_port.h b/libs/surfaces/us2400/surface_port.h index 53c53b2cc6..3a4b9e3d56 100644 --- a/libs/surfaces/us2400/surface_port.h +++ b/libs/surfaces/us2400/surface_port.h @@ -70,7 +70,7 @@ class SurfacePort void reconnect (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); protected: diff --git a/libs/surfaces/us2400/us2400_control_protocol.cc b/libs/surfaces/us2400/us2400_control_protocol.cc index c9acfd8df3..5c9f1b1fc8 100644 --- a/libs/surfaces/us2400/us2400_control_protocol.cc +++ b/libs/surfaces/us2400/us2400_control_protocol.cc @@ -844,7 +844,7 @@ US2400Protocol::close() * contains a state node for the device, it will deleted and replaced. */ void -US2400Protocol::update_configuration_state () +US2400Protocol::update_configuration_state () const { /* CALLER MUST HOLD SURFACES LOCK */ @@ -860,15 +860,15 @@ US2400Protocol::update_configuration_state () XMLNode* snode = new XMLNode (X_("Surfaces")); - for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) { - snode->add_child_nocopy ((*s)->get_state()); + for (auto const & s : surfaces) { + snode->add_child_nocopy (s->get_state()); } devnode->add_child_nocopy (*snode); } XMLNode& -US2400Protocol::get_state() +US2400Protocol::get_state() const { XMLNode& node (ControlProtocol::get_state()); diff --git a/libs/surfaces/us2400/us2400_control_protocol.h b/libs/surfaces/us2400/us2400_control_protocol.h index 53eda53cf1..3a022b34bd 100644 --- a/libs/surfaces/us2400/us2400_control_protocol.h +++ b/libs/surfaces/us2400/us2400_control_protocol.h @@ -130,7 +130,7 @@ class US2400Protocol int set_subview_mode (SubViewMode, boost::shared_ptr); void display_view_mode (); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); /* Note: because Mackie control is inherently a duplex protocol, @@ -297,7 +297,7 @@ class US2400Protocol ButtonMap button_map; bool _metering_active; bool _initialized; - XMLNode* configuration_state; + mutable XMLNode* configuration_state; int state_version; int _last_bank[9]; bool marker_modifier_consumed_by_button; @@ -319,7 +319,7 @@ class US2400Protocol void stripable_selection_changed (); void initialize (); int set_device_info (const std::string& device_name); - void update_configuration_state (); + void update_configuration_state () const; /* MIDI port connection management */ diff --git a/libs/surfaces/wiimote/wiimote.cc b/libs/surfaces/wiimote/wiimote.cc index 7a14e146ae..e95fb25e3c 100644 --- a/libs/surfaces/wiimote/wiimote.cc +++ b/libs/surfaces/wiimote/wiimote.cc @@ -85,7 +85,7 @@ WiimoteControlProtocol::set_active (bool yn) } XMLNode& -WiimoteControlProtocol::get_state () +WiimoteControlProtocol::get_state () const { XMLNode& node (ControlProtocol::get_state()); node.set_property (X_("feedback"), "0"); diff --git a/libs/surfaces/wiimote/wiimote.h b/libs/surfaces/wiimote/wiimote.h index 5aafc97a64..93c51cb3fb 100644 --- a/libs/surfaces/wiimote/wiimote.h +++ b/libs/surfaces/wiimote/wiimote.h @@ -45,7 +45,7 @@ public: int set_active (bool yn); - XMLNode& get_state (); + XMLNode& get_state () const; int set_state (const XMLNode&, int version); void start_wiimote_discovery (); diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 26171b26a5..ce5bbc5a58 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -2361,7 +2361,7 @@ TempoMap::quarters_at_superclock (superclock_t pos) const } XMLNode& -TempoMap::get_state () +TempoMap::get_state () const { XMLNode* node = new XMLNode (X_("TempoMap")); diff --git a/libs/temporal/temporal/tempo.h b/libs/temporal/temporal/tempo.h index a14bb6b45c..7cc64dac08 100644 --- a/libs/temporal/temporal/tempo.h +++ b/libs/temporal/temporal/tempo.h @@ -856,7 +856,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible LIBTEMPORAL_API static PBD::Signal0 MapChanged; - LIBTEMPORAL_API XMLNode& get_state(); + LIBTEMPORAL_API XMLNode& get_state() const; class MementoBinder : public MementoCommandBinder { public: diff --git a/libs/widgets/pane.cc b/libs/widgets/pane.cc index a671a0c82e..7eabd0e8d1 100644 --- a/libs/widgets/pane.cc +++ b/libs/widgets/pane.cc @@ -593,9 +593,9 @@ Pane::set_divider (Dividers::size_type div, float fract) } float -Pane::get_divider (Dividers::size_type div) +Pane::get_divider (Dividers::size_type div) const { - Dividers::iterator d = dividers.begin(); + Dividers::const_iterator d = dividers.begin(); for (d = dividers.begin(); d != dividers.end() && div != 0; ++d, --div) { /* relax */ diff --git a/libs/widgets/tabbable.cc b/libs/widgets/tabbable.cc index 6d19112708..1005456ee5 100644 --- a/libs/widgets/tabbable.cc +++ b/libs/widgets/tabbable.cc @@ -337,7 +337,7 @@ Tabbable::tabbed_by_default() const } XMLNode& -Tabbable::get_state() +Tabbable::get_state() const { XMLNode& node (WindowProxy::get_state()); diff --git a/libs/widgets/widgets/pane.h b/libs/widgets/widgets/pane.h index 5a46dab759..57a584e737 100644 --- a/libs/widgets/widgets/pane.h +++ b/libs/widgets/widgets/pane.h @@ -61,7 +61,7 @@ public: ~Pane(); void set_divider (std::vector::size_type divider, float fract); - float get_divider (std::vector::size_type divider = 0); + float get_divider (std::vector::size_type divider = 0) const; void set_child_minsize (Gtk::Widget const &, int32_t); GType child_type_vfunc() const; diff --git a/libs/widgets/widgets/tabbable.h b/libs/widgets/widgets/tabbable.h index ec19bb4f33..09c58cca20 100644 --- a/libs/widgets/widgets/tabbable.h +++ b/libs/widgets/widgets/tabbable.h @@ -74,7 +74,7 @@ public: Gtk::Notebook* tab_root_drop (); int set_state (const XMLNode&, int version); - XMLNode& get_state (); + XMLNode& get_state () const; static std::string xml_node_name();