diff options
author | David Robillard <d@drobilla.net> | 2006-07-14 03:43:32 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-07-14 03:43:32 +0000 |
commit | 50a3102b9b533d7f8786d220f8df67421b9227c8 (patch) | |
tree | 669f84631ba1d9a1d312e3f76b226ca938c75c0f /libs/ardour/ardour | |
parent | edd841895b873b14c4aa814a80de5dc20ff30618 (diff) |
Merge big changes (mostly Controllable) from trunk
git-svn-id: svn://localhost/ardour2/branches/midi@682 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
34 files changed, 191 insertions, 262 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index c0dfea9a95..dba588702f 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -58,7 +58,7 @@ namespace ARDOUR { const layer_t max_layer = UCHAR_MAX; - id_t new_id(); + microseconds_t get_microseconds (); Change new_change (); diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index d1833d01a5..8e0f892e5a 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -33,7 +33,7 @@ #include <pbd/fastlog.h> #include <pbd/ringbufferNPT.h> - +#include <pbd/stateful.h> #include <ardour/ardour.h> #include <ardour/configuration.h> @@ -44,6 +44,7 @@ #include <ardour/utils.h> #include <ardour/diskstream.h> #include <ardour/audioplaylist.h> + struct tm; namespace ARDOUR { @@ -160,6 +161,17 @@ class AudioDiskstream : public Diskstream //static sigc::signal<void,AudioDiskstream*> AudioDiskstreamCreated; // XXX use a ref with sigc2 static sigc::signal<void,list<AudioFileSource*>*> DeleteSources; + int set_loop (Location *loc); + sigc::signal<void,Location *> LoopSet; + + std::list<Region*>& last_capture_regions () { + return _last_capture_regions; + } + + void handle_input_change (IOChange, void *src); + + const PBD::ID& id() const { return _id; } + protected: friend class Session; @@ -284,10 +296,11 @@ class AudioDiskstream : public Diskstream void set_align_style_from_io(); void setup_destructive_playlist (); void use_destructive_playlist (); - ChannelList channels; AudioPlaylist* _playlist; + void engage_record_enable (void* src); + void disengage_record_enable (void* src); }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/audio_library.h b/libs/ardour/ardour/audio_library.h index 2f9e84551b..3d4585fbd8 100644 --- a/libs/ardour/ardour/audio_library.h +++ b/libs/ardour/ardour/audio_library.h @@ -28,18 +28,23 @@ #include <sigc++/signal.h> +#include <pbd/stateful.h> + using std::vector; using std::string; using std::map; namespace ARDOUR { -class AudioLibrary +class AudioLibrary : public Stateful { public: AudioLibrary (); ~AudioLibrary (); + XMLNode& get_state (void); + int set_state (const XMLNode&); + void set_paths (vector<string> paths); vector<string> get_paths (); void scan_paths (); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 9d06f9425d..e92c11faff 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -55,7 +55,7 @@ class AudioTrack : public Route AudioDiskstream& disk_stream() const { return *_diskstream; } int set_diskstream (AudioDiskstream&, void *); int use_diskstream (string name); - int use_diskstream (id_t id); + int use_diskstream (const PBD::ID& id); TrackMode mode() const { return _mode; } void set_mode (TrackMode m); @@ -88,13 +88,10 @@ class AudioTrack : public Route XMLNode& get_template(); int set_state(const XMLNode& node); - MIDI::Controllable& midi_rec_enable_control() { - return _midi_rec_enable_control; + PBD::Controllable& rec_enable_control() { + return _rec_enable_control; } - void reset_midi_control (MIDI::Port*, bool); - void send_all_midi_feedback (); - bool record_enabled() const; void set_meter_point (MeterPoint, void* src); @@ -116,9 +113,9 @@ class AudioTrack : public Route FreezeRecordInsertInfo(XMLNode& st) : state (st), insert (0) {} - XMLNode state; - Insert* insert; - id_t id; + XMLNode state; + Insert* insert; + PBD::ID id; UndoAction memento; }; @@ -151,17 +148,16 @@ class AudioTrack : public Route void set_state_part_two (); void set_state_part_three (); - struct MIDIRecEnableControl : public MIDI::Controllable { - MIDIRecEnableControl (AudioTrack&, MIDI::Port *); - void set_value (float); - void send_feedback (bool); - MIDI::byte* write_feedback (MIDI::byte* buf, int32_t& bufsize, bool val, bool force = false); - AudioTrack& track; - bool setting; - bool last_written; + struct RecEnableControllable : public PBD::Controllable { + RecEnableControllable (AudioTrack&); + + void set_value (float); + float get_value (void) const; + + AudioTrack& track; }; - MIDIRecEnableControl _midi_rec_enable_control; + RecEnableControllable _rec_enable_control; bool _destructive; }; diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 36251c07ff..b793ed14f0 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -95,7 +95,7 @@ class AudioFileSource : public AudioSource { static void set_bwf_serial_number (int); static void set_search_path (string); - static void set_header_position_offset (jack_nframes_t offset, bool negative); + static void set_header_position_offset (jack_nframes_t offset ); static sigc::signal<void> HeaderPositionOffsetChanged; @@ -107,7 +107,7 @@ class AudioFileSource : public AudioSource { to cause issues. */ - void handle_header_position_change (); + virtual void handle_header_position_change (); protected: @@ -141,7 +141,6 @@ class AudioFileSource : public AudioSource { static char bwf_serial_number[13]; static uint64_t header_position_offset; - static bool header_position_negative; virtual void set_timeline_position (jack_nframes_t pos); virtual void set_header_timeline_position () = 0; diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 1dcf5b42f3..35158a24e7 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -33,7 +33,7 @@ #include <ardour/source.h> #include <ardour/ardour.h> -#include <ardour/stateful.h> +#include <pbd/stateful.h> #include <pbd/xml++.h> using std::list; @@ -51,6 +51,13 @@ class AudioSource : public Source AudioSource (const XMLNode&); virtual ~AudioSource (); + /* one could argue that this should belong to Source, but other data types + generally do not come with a model of "offset along an audio timeline" + so its here in AudioSource for now. + */ + + virtual jack_nframes_t natural_position() const { return 0; } + /* returns the number of items in this `audio_source' */ virtual jack_nframes_t length() const { diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 60b5e8a2c3..cc4376f781 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -27,8 +27,9 @@ #include <sys/types.h> #include <string> +#include <pbd/stateful.h> + #include <ardour/types.h> -#include <ardour/stateful.h> #include <ardour/utils.h> #include <ardour/configuration_variable.h> diff --git a/libs/ardour/ardour/connection.h b/libs/ardour/ardour/connection.h index 899bffc06a..da4d4e2684 100644 --- a/libs/ardour/ardour/connection.h +++ b/libs/ardour/ardour/connection.h @@ -25,7 +25,7 @@ #include <string> #include <sigc++/signal.h> #include <glibmm/thread.h> -#include <ardour/stateful.h> +#include <pbd/stateful.h> using std::vector; using std::string; diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index 03b21a299c..8eda7a4555 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -8,7 +8,7 @@ #include <glibmm/thread.h> -#include <ardour/stateful.h> +#include <pbd/stateful.h> namespace ARDOUR { @@ -23,6 +23,7 @@ struct ControlProtocolInfo { std::string path; bool requested; bool mandatory; + XMLNode* state; }; class ControlProtocolManager : public sigc::trackable, public Stateful diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h index 2d10528ac8..947367f754 100644 --- a/libs/ardour/ardour/destructive_filesource.h +++ b/libs/ardour/ardour/destructive_filesource.h @@ -49,6 +49,8 @@ class DestructiveFileSource : public SndFileSource { protected: jack_nframes_t write_unlocked (Sample *src, jack_nframes_t cnt, char * workbuf); + virtual void handle_header_position_change (); + private: static jack_nframes_t xfade_frames; static gain_t* out_coefficient; diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index a72289acd1..f9c662203c 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -33,7 +33,7 @@ #include <pbd/fastlog.h> #include <pbd/ringbufferNPT.h> - +#include <pbd/stateful.h> #include <ardour/ardour.h> #include <ardour/configuration.h> @@ -42,7 +42,7 @@ #include <ardour/route.h> #include <ardour/port.h> #include <ardour/utils.h> -#include <ardour/stateful.h> + struct tm; @@ -67,9 +67,6 @@ class Diskstream : public Stateful, public sigc::trackable Destructive = 0x4 }; - Diskstream (Session &, const string& name, Flag f = Recordable); - Diskstream (Session &, const XMLNode&); - string name () const { return _name; } virtual int set_name (string str, void* src); @@ -99,11 +96,11 @@ class Diskstream : public Stateful, public sigc::trackable bool destructive() const { return _flags & Destructive; } virtual void set_destructive (bool yn); - id_t id() const { return _id; } - bool hidden() const { return _flags & Hidden; } - bool recordable() const { return _flags & Recordable; } - bool reversed() const { return _actual_speed < 0.0f; } - double speed() const { return _visible_speed; } + const PBD::ID& id() const { return _id; } + bool hidden() const { return _flags & Hidden; } + bool recordable() const { return _flags & Recordable; } + bool reversed() const { return _actual_speed < 0.0f; } + double speed() const { return _visible_speed; } virtual void punch_in() {} virtual void punch_out() {} @@ -165,6 +162,9 @@ class Diskstream : public Stateful, public sigc::trackable protected: friend class Session; + Diskstream (Session &, const string& name, Flag f = Recordable); + Diskstream (Session &, const XMLNode&); + /* the Session is the only point of access for these because they require that the Session is "inactive" while they are called. @@ -280,7 +280,7 @@ class Diskstream : public Stateful, public sigc::trackable ARDOUR::Session& _session; ARDOUR::IO* _io; uint32_t _n_channels; - id_t _id; + PBD::ID _id; mutable gint _record_enabled; double _visible_speed; diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index 803e16497d..2d6b672064 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -133,9 +133,6 @@ class PluginInsert : public Insert bool is_generator() const; - void reset_midi_control (MIDI::Port*, bool); - void send_all_midi_feedback (); - void set_parameter (uint32_t port, float val); AutoState get_port_automation_state (uint32_t port); diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index fa2fe9851d..f696295b58 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -31,11 +31,10 @@ #include <pbd/fastlog.h> #include <pbd/undo.h> - -#include <midi++/controllable.h> +#include <pbd/stateful.h> +#include <pbd/controllable.h> #include <ardour/ardour.h> -#include <ardour/stateful.h> #include <ardour/utils.h> #include <ardour/state_manager.h> #include <ardour/curve.h> @@ -186,25 +185,10 @@ class IO : public Stateful, public ARDOUR::StateManager static sigc::signal<void,uint32_t> MoreOutputs; static sigc::signal<int> PortsCreated; - /* MIDI control */ - - void set_midi_to_gain_function (gain_t (*function)(double val)) { - _midi_gain_control.midi_to_gain = function; - } - - void set_gain_to_midi_function (double (*function)(gain_t gain)) { - _midi_gain_control.gain_to_midi = function; - } - - MIDI::Controllable& midi_gain_control() { - return _midi_gain_control; + PBD::Controllable& gain_control() { + return _gain_control; } - virtual void reset_midi_control (MIDI::Port*, bool on); - - virtual void send_all_midi_feedback (); - virtual MIDI::byte* write_midi_feedback (MIDI::byte*, int32_t& bufsize); - /* Peak metering */ float peak_input_power (uint32_t n) { @@ -266,7 +250,7 @@ public: void start_pan_touch (uint32_t which); void end_pan_touch (uint32_t which); - id_t id() const { return _id; } + const PBD::ID& id() const { return _id; } void defer_pan_reset (); void allow_pan_reset (); @@ -295,7 +279,7 @@ public: string _name; Connection* _input_connection; Connection* _output_connection; - id_t _id; + PBD::ID _id; bool no_panner_reset; XMLNode* deferred_state; Buffer::Type _default_type; @@ -310,31 +294,22 @@ public: static void apply_declick (vector<Sample*>&, uint32_t nbufs, jack_nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity); - struct MIDIGainControl : public MIDI::Controllable { - MIDIGainControl (IO&, MIDI::Port *); - void set_value (float); - - void send_feedback (gain_t); - MIDI::byte* write_feedback (MIDI::byte* buf, int32_t& bufsize, gain_t val, bool force = false); - + struct GainControllable : public PBD::Controllable { + GainControllable (IO& i) : io (i) {} + + void set_value (float val); + float get_value (void) const; + IO& io; - bool setting; - MIDI::byte last_written; - - gain_t (*midi_to_gain) (double val); - double (*gain_to_midi) (gain_t gain); }; - MIDIGainControl _midi_gain_control; + GainControllable _gain_control; /* state management */ Change restore_state (State&); StateManager::State* state_factory (std::string why) const; - bool get_midi_node_info (XMLNode * node, MIDI::eventType & ev, MIDI::channel_t & chan, MIDI::byte & additional); - bool set_midi_node_info (XMLNode * node, MIDI::eventType ev, MIDI::channel_t chan, MIDI::byte additional); - /* automation */ jack_nframes_t last_automation_snapshot; diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 2451953ce5..e4aba93ef6 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -27,12 +27,12 @@ #include <string> #include <dlfcn.h> -#include <midi++/controllable.h> #include <sigc++/signal.h> +#include <pbd/stateful.h> + #include <jack/types.h> #include <ardour/ladspa.h> -#include <ardour/stateful.h> #include <ardour/plugin_state.h> #include <ardour/plugin.h> #include <ardour/ladspa_plugin.h> diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 75f4c5d12a..2c9f947541 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -32,10 +32,10 @@ #include <glibmm/thread.h> #include <pbd/undo.h> +#include <pbd/stateful.h> -#include "ardour.h" -#include "stateful.h" -#include "state_manager.h" +#include <ardour/ardour.h> +#include <ardour/state_manager.h> using std::string; diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 735ebba447..8e4da44082 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -30,7 +30,7 @@ #include <ardour/source.h> #include <ardour/ardour.h> -#include <ardour/stateful.h> +#include <pbd/stateful.h> #include <pbd/xml++.h> using std::string; diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 1ef9bedf8d..090ca6b729 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -54,11 +54,11 @@ public: void set_record_enable (bool yn, void *src); - MidiDiskstream& disk_stream() const { return *diskstream; } + MidiDiskstream& disk_stream() const { return *_diskstream; } int set_diskstream (MidiDiskstream&, void *); int use_diskstream (string name); - int use_diskstream (id_t id); + int use_diskstream (const PBD::ID& id); TrackMode mode() const { return _mode; } @@ -93,16 +93,13 @@ public: XMLNode& get_template(); int set_state(const XMLNode& node); - MIDI::Controllable& midi_rec_enable_control() { return _midi_rec_enable_control; } - - void reset_midi_control (MIDI::Port*, bool); - void send_all_midi_feedback (); + PBD::Controllable& rec_enable_control() { return _rec_enable_control; } bool record_enabled() const; void set_meter_point (MeterPoint, void* src); protected: - MidiDiskstream *diskstream; + MidiDiskstream *_diskstream; MeterPoint _saved_meter_point; TrackMode _mode; @@ -123,7 +120,7 @@ private: XMLNode state; Insert* insert; - id_t id; + PBD::ID id; UndoAction memento; }; @@ -158,18 +155,16 @@ private: void set_state_part_two (); void set_state_part_three (); - struct MIDIRecEnableControl : public MIDI::Controllable - { - MIDIRecEnableControl (MidiTrack&, MIDI::Port *); - void set_value (float); - void send_feedback (bool); - MIDI::byte* write_feedback (MIDI::byte* buf, int32_t& bufsize, bool val, bool force = false); - MidiTrack& track; - bool setting; - bool last_written; + struct MIDIRecEnableControllable : public PBD::Controllable { + MIDIRecEnableControllable (MidiTrack&); + + void set_value (float); + float get_value (void) const; + + MidiTrack& track; }; - MIDIRecEnableControl _midi_rec_enable_control; + MIDIRecEnableControllable _rec_enable_control; bool _destructive; }; diff --git a/libs/ardour/ardour/named_selection.h b/libs/ardour/ardour/named_selection.h index 91bb816181..87b71e73ff 100644 --- a/libs/ardour/ardour/named_selection.h +++ b/libs/ardour/ardour/named_selection.h @@ -24,7 +24,7 @@ #include <string> #include <list> -#include <ardour/stateful.h> +#include <pbd/stateful.h> class XMLNode; diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 806f350e03..37c985a2ef 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -27,10 +27,10 @@ #include <iostream> #include <sigc++/signal.h> -#include <midi++/controllable.h> +#include <pbd/stateful.h> +#include <pbd/controllable.h> #include <ardour/types.h> -#include <ardour/stateful.h> #include <ardour/curve.h> using std::istream; @@ -75,24 +75,7 @@ class StreamPanner : public sigc::trackable, public Stateful virtual void set_automation_state (AutoState) = 0; virtual void set_automation_style (AutoStyle) = 0; - /* MIDI control */ - - struct MIDIControl : public MIDI::Controllable { - MIDIControl (StreamPanner&, MIDI::Port *); - void set_value (float); - void send_feedback (gain_t); - MIDI::byte* write_feedback (MIDI::byte* buf, int32_t& bufsize, gain_t val, bool force = false); - - pan_t (*midi_to_pan)(double val); - double (*pan_to_midi)(pan_t p); - - StreamPanner& sp; - bool setting; - gain_t last_written; - }; - - MIDIControl& midi_control() { return _midi_control; } - void reset_midi_control (MIDI::Port *, bool); + PBD::Controllable& control() { return _control; } /* XXX this is wrong. for multi-dimensional panners, there must surely be more than 1 automation curve. @@ -100,7 +83,6 @@ class StreamPanner : public sigc::trackable, public Stateful virtual Curve& automation() = 0; - virtual int load (istream&, string path, uint32_t&) = 0; virtual int save (ostream&) const = 0; @@ -130,12 +112,20 @@ class StreamPanner : public sigc::trackable, public Stateful float effective_z; bool _muted; - MIDIControl _midi_control; - void add_state (XMLNode&); - bool get_midi_node_info (XMLNode * node, MIDI::eventType & ev, MIDI::channel_t & chan, MIDI::byte & additional); - bool set_midi_node_info (XMLNode * node, MIDI::eventType ev, MIDI::channel_t chan, MIDI::byte additional); + struct PanControllable : public PBD::Controllable { + PanControllable (StreamPanner& p) : panner (p) {} + + StreamPanner& panner; + + void set_value (float); + float get_value (void) const; + bool can_send_feedback() const; + }; + PanControllable _control; + + void add_state (XMLNode&); virtual void update () = 0; }; @@ -290,10 +280,6 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: std::vector<Output> outputs; Session& session() const { return _session; } - void reset_midi_control (MIDI::Port *, bool); - void send_all_midi_feedback (); - MIDI::byte* write_midi_feedback (MIDI::byte*, int32_t& bufsize); - enum LinkDirection { SameDirection, OppositeDirection diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 0a988b3c10..69b6a1fbc3 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -31,12 +31,13 @@ #include <glib.h> #include <sigc++/signal.h> + #include <pbd/undo.h> +#include <pbd/stateful.h> #include <ardour/ardour.h> #include <ardour/crossfade_compare.h> #include <ardour/location.h> -#include <ardour/stateful.h> #include <ardour/state_manager.h> namespace ARDOUR { @@ -86,7 +87,7 @@ class Playlist : public Stateful, public StateManager { void duplicate (Region&, jack_nframes_t position, float times); void nudge_after (jack_nframes_t start, jack_nframes_t distance, bool forwards); - Region* find_region (id_t) const; + Region* find_region (const PBD::ID&) const; Playlist* cut (list<AudioRange>&, bool result_is_hidden = true); Playlist* copy (list<AudioRange>&, bool result_is_hidden = true); @@ -135,8 +136,8 @@ class Playlist : public Stateful, public StateManager { Session& session() { return _session; } - id_t get_orig_diskstream_id () const { return _orig_diskstream_id; } - void set_orig_diskstream_id (id_t did) { _orig_diskstream_id = did; } + const PBD::ID& get_orig_diskstream_id () const { return _orig_diskstream_id; } + void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; } /* destructive editing */ @@ -190,7 +191,7 @@ class Playlist : public Stateful, public StateManager { bool _frozen; uint32_t subcnt; uint32_t _read_data_count; - id_t _orig_diskstream_id; + PBD::ID _orig_diskstream_id; uint64_t layer_op_counter; jack_nframes_t freeze_length; diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 211b00d0bb..e7d05aa352 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -21,12 +21,13 @@ #ifndef __ardour_ladspa_h__ #define __ardour_ladspa_h__ -#include <midi++/controllable.h> #include <sigc++/signal.h> +#include <pbd/stateful.h> +#include <pbd/controllable.h> + #include <jack/types.h> #include <ardour/types.h> -#include <ardour/stateful.h> #include <ardour/plugin_state.h> #include <ardour/cycles.h> @@ -136,10 +137,7 @@ class Plugin : public Stateful, public sigc::trackable sigc::signal<void,uint32_t,float> ParameterChanged; sigc::signal<void,Plugin *> GoingAway; - void reset_midi_control (MIDI::Port*, bool); - void send_all_midi_feedback (); - MIDI::byte* write_midi_feedback (MIDI::byte*, int32_t& bufsize); - MIDI::Controllable *get_nth_midi_control (uint32_t); + PBD::Controllable *get_nth_control (uint32_t); PluginInfo & get_info() { return _info; } void set_info (const PluginInfo &inf) { _info = inf; } @@ -158,16 +156,14 @@ class Plugin : public Stateful, public sigc::trackable map<string,string> presets; bool save_preset(string name, string domain /* vst, ladspa etc. */); - void setup_midi_controls (); - + void setup_controls (); - struct MIDIPortControl : public MIDI::Controllable { - MIDIPortControl (Plugin&, uint32_t abs_port_id, MIDI::Port *, - float lower, float upper, bool toggled, bool logarithmic); + struct PortControllable : public PBD::Controllable { + PortControllable (Plugin&, uint32_t abs_port_id, + float lower, float upper, bool toggled, bool logarithmic); void set_value (float); - void send_feedback (float); - MIDI::byte* write_feedback (MIDI::byte* buf, int32_t& bufsize, float val, bool force = false); + float get_value () const; Plugin& plugin; uint32_t absolute_port; @@ -176,14 +172,9 @@ class Plugin : public Stateful, public sigc::trackable float range; bool toggled; bool logarithmic; - - bool setting; - float last_written; }; - vector<MIDIPortControl*> midi_controls; - - + vector<PortControllable*> controls; }; /* this is actually defined in plugin_manager.cc */ diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 67b5b3d9dd..d58f98adca 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -97,7 +97,7 @@ class Region : public Stateful, public StateManager Region (const XMLNode&); ~Region(); - ARDOUR::id_t id() const { return _id; } + const PBD::ID& id() const { return _id; } /* Note: changing the name of a Region does not constitute an edit */ @@ -222,7 +222,7 @@ class Region : public Stateful, public StateManager mutable RegionEditState _first_edit; int _frozen; Glib::Mutex lock; - ARDOUR::id_t _id; + PBD::ID _id; ARDOUR::Playlist* _playlist; mutable uint32_t _read_data_count; // modified in read() Change pending_changed; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 747dae939c..d30138640a 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -31,10 +31,10 @@ #include <glibmm/thread.h> #include <pbd/xml++.h> #include <pbd/undo.h> -#include <midi++/controllable.h> +#include <pbd/stateful.h> +#include <pbd/controllable.h> #include <ardour/ardour.h> -#include <ardour/stateful.h> #include <ardour/io.h> #include <ardour/session.h> #include <ardour/redirect.h> @@ -215,34 +215,28 @@ class Route : public IO bool feeds (Route *); set<Route *> fed_by; - struct MIDIToggleControl : public MIDI::Controllable { - enum ToggleType { - MuteControl = 0, - SoloControl - }; - - MIDIToggleControl (Route&, ToggleType, MIDI::Port *); - void set_value (float); - void send_feedback (bool); - MIDI::byte* write_feedback (MIDI::byte* buf, int32_t& bufsize, bool val, bool force = false); - - Route& route; - ToggleType type; - bool setting; - bool last_written; + struct ToggleControllable : public PBD::Controllable { + enum ToggleType { + MuteControl = 0, + SoloControl + }; + + ToggleControllable (Route&, ToggleType); + void set_value (float); + float get_value (void) const; + + Route& route; + ToggleType type; }; - MIDI::Controllable& midi_solo_control() { - return _midi_solo_control; + PBD::Controllable& solo_control() { + return _solo_control; } - MIDI::Controllable& midi_mute_control() { - return _midi_mute_control; + + PBD::Controllable& mute_control() { + return _mute_control; } - virtual void reset_midi_control (MIDI::Port*, bool); - virtual void send_all_midi_feedback (); - virtual MIDI::byte* write_midi_feedback (MIDI::byte*, int32_t& bufsize); - void automation_snapshot (jack_nframes_t now); void protect_automation (); @@ -302,8 +296,8 @@ class Route : public IO std::string _comment; bool _have_internal_generator; - MIDIToggleControl _midi_solo_control; - MIDIToggleControl _midi_mute_control; + ToggleControllable _solo_control; + ToggleControllable _mute_control; void passthru (jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter_inputs); diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index c9f966666f..19374b4f65 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -26,7 +26,7 @@ #include <string> #include <stdint.h> #include <sigc++/signal.h> -#include <ardour/stateful.h> +#include <pbd/stateful.h> #include <ardour/types.h> using std::string; diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index a94318f2a5..54d4cbd7a9 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -24,12 +24,12 @@ #include <sigc++/signal.h> #include <string> + +#include <pbd/stateful.h> #include <ardour/ardour.h> #include <ardour/audioengine.h> - -#include "io.h" -#include "stateful.h" -#include "redirect.h" +#include <ardour/io.h> +#include <ardour/redirect.h> namespace ARDOUR { diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 0e1b7627be..6192fe4abd 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -40,10 +40,11 @@ #include <midi++/types.h> #include <midi++/mmc.h> +#include <pbd/stateful.h> + #include <ardour/ardour.h> #include <ardour/configuration.h> #include <ardour/location.h> -#include <ardour/stateful.h> #include <ardour/gain.h> #include <ardour/io.h> @@ -57,6 +58,10 @@ namespace MIDI { class Port; } +namespace PBD { + class Controllable; +} + namespace ARDOUR { class Port; @@ -274,7 +279,7 @@ class Session : public sigc::trackable, public Stateful vector<Sample*>& get_silent_buffers (uint32_t howmany); vector<Sample*>& get_send_buffers () { return _send_buffers; } - Diskstream *diskstream_by_id (id_t id); + Diskstream *diskstream_by_id (const PBD::ID& id); Diskstream *diskstream_by_name (string name); bool have_captured() const { return _have_captured; } @@ -706,7 +711,7 @@ class Session : public sigc::trackable, public Stateful AudioFileSource *create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive); - Source *get_source (ARDOUR::id_t); + Source *source_by_id (const PBD::ID&); /* playlist management */ @@ -967,7 +972,13 @@ class Session : public sigc::trackable, public Stateful static apply_gain_to_buffer_t apply_gain_to_buffer; static mix_buffers_with_gain_t mix_buffers_with_gain; static mix_buffers_no_gain_t mix_buffers_no_gain; - + + static sigc::signal<void> SendFeedback; + + /* Controllables */ + + PBD::Controllable* controllable_by_id (const PBD::ID&); + protected: friend class AudioEngine; void set_block_size (jack_nframes_t nframes); @@ -1502,7 +1513,7 @@ class Session : public sigc::trackable, public Stateful /* REGION MANAGEMENT */ mutable Glib::Mutex region_lock; - typedef map<ARDOUR::id_t,AudioRegion *> AudioRegionList; + typedef map<PBD::ID,AudioRegion *> AudioRegionList; AudioRegionList audio_regions; void region_renamed (Region *); @@ -1515,7 +1526,7 @@ class Session : public sigc::trackable, public Stateful /* SOURCES */ mutable Glib::Mutex audio_source_lock; - typedef std::map<id_t, AudioSource *> AudioSourceList; + typedef std::map<PBD::ID,AudioSource *> AudioSourceList; AudioSourceList audio_sources; @@ -1743,6 +1754,13 @@ class Session : public sigc::trackable, public Stateful LayerModel layer_model; CrossfadeModel xfade_model; + + typedef std::list<PBD::Controllable*> Controllables; + Glib::Mutex controllables_lock; + Controllables controllables; + + void add_controllable (PBD::Controllable*); + void remove_controllable (PBD::Controllable*); }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/session_region.h b/libs/ardour/ardour/session_region.h index 13d88a9aa4..4f0fb92e3b 100644 --- a/libs/ardour/ardour/session_region.h +++ b/libs/ardour/ardour/session_region.h @@ -10,7 +10,7 @@ template<class T> void Session::foreach_audio_region (T *obj, void (T::*func)(Au { Glib::Mutex::Lock lm (region_lock); for (AudioRegionList::iterator i = audio_regions.begin(); i != audio_regions.end(); i++) { - (obj->*func) ((*i).second); + (obj->*func) (i->second); } } diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 5e3c1f621d..55a0e990a0 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -51,7 +51,7 @@ class SndFileSource : public AudioFileSource { int update_header (jack_nframes_t when, struct tm&, time_t); int flush_header (); - void handle_smpte_offset_change (jack_nframes_t offset, bool negative); + jack_nframes_t natural_position () const; protected: void set_header_timeline_position (); diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index f3133c71cd..f57ea79854 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -25,8 +25,9 @@ #include <sigc++/signal.h> +#include <pbd/stateful.h> + #include <ardour/ardour.h> -#include <ardour/stateful.h> namespace ARDOUR { @@ -40,7 +41,7 @@ class Source : public Stateful, public sigc::trackable std::string name() const { return _name; } int set_name (std::string str, bool destructive); - ARDOUR::id_t id() const { return _id; } + const PBD::ID& id() const { return _id; } uint32_t use_cnt() const { return _use_cnt; } void use (); @@ -60,7 +61,7 @@ class Source : public Stateful, public sigc::trackable time_t _timestamp; private: - ARDOUR::id_t _id; + PBD::ID _id; }; } diff --git a/libs/ardour/ardour/stateful.h b/libs/ardour/ardour/stateful.h deleted file mode 100644 index 4f4cb20b39..0000000000 --- a/libs/ardour/ardour/stateful.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2000 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ -*/ - -#ifndef __ardour_stateful_h__ -#define __ardour_stateful_h__ - -#include <string> - -class XMLNode; - -class Stateful { - public: - Stateful(); - virtual ~Stateful(); - - virtual XMLNode& get_state (void) = 0; - - virtual int set_state (const XMLNode&) = 0; - - /* Extra XML nodes */ - - void add_extra_xml (XMLNode&); - XMLNode *extra_xml (const std::string& str); - - virtual void add_instant_xml (XMLNode&, const std::string& dir); - XMLNode *instant_xml (const std::string& str, const std::string& dir); - - protected: - XMLNode *_extra_xml; - XMLNode *_instant_xml; -}; - -#endif /* __ardour_stateful_h__ */ - diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 13e8eb6348..db06894607 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -27,10 +27,10 @@ #include <cmath> #include <glibmm/thread.h> #include <pbd/undo.h> +#include <pbd/stateful.h> #include <sigc++/signal.h> #include <ardour/ardour.h> -#include <ardour/stateful.h> #include <ardour/state_manager.h> class XMLNode; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index e729bbe956..1ae58039d9 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -30,6 +30,8 @@ #include <inttypes.h> #include <jack/types.h> #include <control_protocol/smpte.h> +#include <pbd/id.h> + #include <map> #if __GNUC__ < 3 @@ -45,7 +47,7 @@ namespace ARDOUR { typedef float pan_t; typedef float gain_t; typedef uint32_t layer_t; - typedef uint64_t id_t; + typedef uint64_t microseconds_t; typedef unsigned char RawMidi; diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 3a9905b3ac..ad471085b5 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -50,8 +50,6 @@ int tokenize_fullpath (std::string fullpath, std::string& path, std::string& nam int touch_file(std::string path); -uint32_t long get_uid(); - std::string region_name_from_path (std::string path); std::string path_expand (std::string); diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index ee8e6e986b..3cb10d1779 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -28,11 +28,9 @@ #include <string> #include <dlfcn.h> -#include <midi++/controllable.h> #include <sigc++/signal.h> - +#include <pbd/stateful.h> #include <jack/types.h> -#include <ardour/stateful.h> #include <ardour/plugin_state.h> #include <ardour/plugin.h> |