diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-09-17 16:24:22 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-09-17 16:24:22 +0000 |
commit | 10bdce85a0e7381d1b5db38e3640600c6fd3ec79 (patch) | |
tree | 5e6fd6a2e69e972ada31018cbe6761e5ec5c77a7 /libs | |
parent | e84c3fe5552bc5cf2ed23812c41e7e3b19fbdb84 (diff) |
megaopus commit: (1) add __STD_(LIMIT|FORMAT)_MACROS to command line flags for cc and c++ builds, remove them from source (2) add new Property::midi_data used by MidiRegion to signal that its (MIDI) contents have changed (3) massive switch from nframes_t to framepos_t/framecnt_t including removal of ARDOUR::max_frames (replaced by ARDOUR::max_frame{pos,cnt} (lots more to do but this set was driven by changes to the Diskstream API to use framepos_t
git-svn-id: svn://localhost/ardour2/branches/3.0@7791 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
40 files changed, 285 insertions, 251 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 02dc3ee150..1e94602839 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -46,7 +46,6 @@ namespace ARDOUR { class AudioEngine; - static const nframes_t max_frames = JACK_MAX_FRAMES; extern PBD::Signal1<void,std::string> BootMessage; int init (bool with_vst, bool try_optimization); diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 7b7cdd7e3f..4106602b63 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -162,22 +162,22 @@ class AudioDiskstream : public Diskstream void set_pending_overwrite(bool); int overwrite_existing_buffers (); void set_block_size (nframes_t); - int internal_playback_seek (nframes_t distance); - int can_internal_playback_seek (nframes_t distance); + int internal_playback_seek (framecnt_t distance); + int can_internal_playback_seek (framecnt_t distance); int rename_write_sources (); std::list<boost::shared_ptr<Source> > steal_write_sources(); void reset_write_sources (bool, bool force = false); void non_realtime_input_change (); - void non_realtime_locate (nframes_t location); + void non_realtime_locate (framepos_t location); protected: friend class Auditioner; - int seek (nframes_t which_sample, bool complete_refill = false); + int seek (framepos_t which_sample, bool complete_refill = false); protected: friend class AudioTrack; - int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); + int process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); bool commit (nframes_t nframes); private: @@ -233,12 +233,12 @@ class AudioDiskstream : public Diskstream int do_refill_with_alloc (); int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, - nframes_t& start, nframes_t cnt, - ChannelInfo* channel_info, int channel, bool reversed); + framepos_t& start, nframes_t cnt, + ChannelInfo* channel_info, int channel, bool reversed); void finish_capture (bool rec_monitors_input, boost::shared_ptr<ChannelList>); void transport_stopped_wallclock (struct tm&, time_t, bool abort); - void transport_looped (nframes_t transport_frame); + void transport_looped (framepos_t transport_frame); void init (); @@ -254,7 +254,7 @@ class AudioDiskstream : public Diskstream int use_pending_capture_data (XMLNode& node); void get_input_sources (); - void prepare_record_status(nframes_t capture_start_frame); + void prepare_record_status(framepos_t capture_start_frame); void set_align_style_from_io(); void setup_destructive_playlist (); void use_destructive_playlist (); diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 3aef900630..bd3d223fc1 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -64,7 +64,7 @@ public: virtual void clear_capture_marks() {} virtual bool one_of_several_channels () const { return false; } - virtual int update_header (sframes_t when, struct tm&, time_t) = 0; + virtual int update_header (framepos_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; void mark_streaming_write_completed (); diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 33a493b040..649c57c3ca 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -37,7 +37,7 @@ class CoreAudioSource : public AudioFileSource { void set_path (const std::string& p); float sample_rate() const; - int update_header (sframes_t when, struct tm&, time_t); + int update_header (framepos_t when, struct tm&, time_t); int flush_header () {return 0;}; void set_header_timeline_position () {}; diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 716cc13063..240448a78b 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -101,7 +101,7 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual void punch_out() {} void non_realtime_set_speed (); - virtual void non_realtime_locate (nframes_t /*location*/) {}; + virtual void non_realtime_locate (framepos_t /*location*/) {}; virtual void playlist_modified (); boost::shared_ptr<Playlist> playlist () { return _playlist; } @@ -110,10 +110,10 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual int use_new_playlist () = 0; virtual int use_copy_playlist () = 0; - nframes_t current_capture_start() const { return capture_start_frame; } - nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } - nframes_t get_capture_start_frame (uint32_t n=0); - nframes_t get_captured_frames (uint32_t n=0); + framepos_t current_capture_start() const { return capture_start_frame; } + framepos_t current_capture_end() const { return capture_start_frame + capture_captured; } + framepos_t get_capture_start_frame (uint32_t n=0); + framecnt_t get_captured_frames (uint32_t n=0); ChanCount n_channels() { return _n_channels; } @@ -169,8 +169,8 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual void set_pending_overwrite (bool) = 0; virtual int overwrite_existing_buffers () = 0; - virtual int internal_playback_seek (nframes_t distance) = 0; - virtual int can_internal_playback_seek (nframes_t distance) = 0; + virtual int internal_playback_seek (framecnt_t distance) = 0; + virtual int can_internal_playback_seek (framecnt_t distance) = 0; virtual int rename_write_sources () = 0; virtual void reset_write_sources (bool, bool force = false) = 0; virtual void non_realtime_input_change () = 0; @@ -180,12 +180,12 @@ class Diskstream : public SessionObject, public PublicDiskstream protected: friend class Auditioner; - virtual int seek (nframes_t which_sample, bool complete_refill = false) = 0; + virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0; protected: friend class Track; - virtual int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) = 0; + virtual int process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) = 0; virtual bool commit (nframes_t nframes) = 0; //private: @@ -197,7 +197,7 @@ class Diskstream : public SessionObject, public PublicDiskstream struct CaptureTransition { TransitionType type; - nframes_t capture_val; ///< The start or end file frame position + framepos_t capture_val; ///< The start or end file frame position }; /* The two central butler operations */ @@ -211,11 +211,11 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool); virtual void transport_stopped_wallclock (struct tm&, time_t, bool abort) = 0; - virtual void transport_looped (nframes_t transport_frame) = 0; + virtual void transport_looped (framepos_t transport_frame) = 0; struct CaptureInfo { - uint32_t start; - uint32_t frames; + framepos_t start; + framecnt_t frames; }; virtual int use_new_write_source (uint32_t n=0) = 0; @@ -230,14 +230,14 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual int use_pending_capture_data (XMLNode& node) = 0; - virtual void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record); - virtual void prepare_record_status (nframes_t /*capture_start_frame*/) {} + virtual void check_record_status (framepos_t transport_frame, nframes_t nframes, bool can_record); + virtual void prepare_record_status (framepos_t /*capture_start_frame*/) {} virtual void set_align_style_from_io() {} virtual void setup_destructive_playlist () {} virtual void use_destructive_playlist () {} virtual void prepare_to_stop (framepos_t pos); - void calculate_record_range(OverlapType ot, sframes_t transport_frame, nframes_t nframes, + void calculate_record_range(OverlapType ot, framepos_t transport_frame, framecnt_t nframes, nframes_t& rec_nframes, nframes_t& rec_offset); static nframes_t disk_io_chunk_frames; @@ -260,20 +260,20 @@ class Diskstream : public SessionObject, public PublicDiskstream bool _seek_required; bool force_refill; - nframes_t capture_start_frame; - nframes_t capture_captured; + framepos_t capture_start_frame; + framecnt_t capture_captured; bool was_recording; nframes_t adjust_capture_position; nframes_t _capture_offset; nframes_t _roll_delay; - nframes_t first_recordable_frame; - nframes_t last_recordable_frame; + framepos_t first_recordable_frame; + framepos_t last_recordable_frame; int last_possibly_recording; AlignStyle _alignment_style; bool _scrubbing; bool _slaved; Location* loop_location; - nframes_t overwrite_frame; + framepos_t overwrite_frame; off_t overwrite_offset; bool _pending_overwrite; bool overwrite_queued; @@ -284,9 +284,9 @@ class Diskstream : public SessionObject, public PublicDiskstream double _speed; double _target_speed; - nframes_t file_frame; - nframes_t playback_sample; - nframes_t playback_distance; + framepos_t file_frame; + framepos_t playback_sample; + framecnt_t playback_distance; uint32_t _read_data_count; uint32_t _write_data_count; @@ -297,9 +297,9 @@ class Diskstream : public SessionObject, public PublicDiskstream Glib::Mutex state_lock; - nframes_t scrub_start; - nframes_t scrub_buffer_size; - nframes_t scrub_offset; + framepos_t scrub_start; + nframes_t scrub_buffer_size; + nframes_t scrub_offset; PBD::ScopedConnectionList playlist_connections; diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 69c762823b..49a7525dc7 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -62,7 +62,7 @@ class MidiDiskstream : public Diskstream float playback_buffer_load() const; float capture_buffer_load() const; - void get_playback(MidiBuffer& dst, nframes_t start, nframes_t end); + void get_playback(MidiBuffer& dst, framepos_t start, framepos_t end); void set_record_enabled (bool yn); @@ -119,23 +119,23 @@ class MidiDiskstream : public Diskstream void set_pending_overwrite(bool); int overwrite_existing_buffers (); void set_block_size (nframes_t); - int internal_playback_seek (nframes_t distance); - int can_internal_playback_seek (nframes_t distance); + int internal_playback_seek (framecnt_t distance); + int can_internal_playback_seek (framecnt_t distance); int rename_write_sources (); std::list<boost::shared_ptr<Source> > steal_write_sources(); void reset_write_sources (bool, bool force = false); void non_realtime_input_change (); - void non_realtime_locate (nframes_t location); + void non_realtime_locate (framepos_t location); static void set_readahead_frames(nframes_t frames_ahead) { midi_readahead = frames_ahead; } protected: - int seek (nframes_t which_sample, bool complete_refill = false); + int seek (framepos_t which_sample, bool complete_refill = false); protected: friend class MidiTrack; - int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); + int process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); bool commit (nframes_t nframes); static nframes_t midi_readahead; @@ -147,11 +147,11 @@ class MidiDiskstream : public Diskstream int do_refill_with_alloc(); - int read (nframes_t& start, nframes_t cnt, bool reversed); + int read (framepos_t& start, nframes_t cnt, bool reversed); void finish_capture (bool rec_monitors_input); void transport_stopped_wallclock (struct tm&, time_t, bool abort); - void transport_looped (nframes_t transport_frame); + void transport_looped (framepos_t transport_frame); void init (); diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 0b62809fc3..a7a5fb3a82 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -36,6 +36,16 @@ class XMLNode; namespace ARDOUR { + namespace Properties { + /* this is pseudo-property: nothing has this as an actual + property, but it allows us to signal changes to the + MidiModel used by the MidiRegion + */ + extern PBD::PropertyDescriptor<void*> midi_data; + } +} + +namespace ARDOUR { class Route; class Playlist; @@ -48,6 +58,8 @@ template<typename T> class MidiRingBuffer; class MidiRegion : public Region { public: + static void make_property_quarks (); + ~MidiRegion(); boost::shared_ptr<MidiRegion> clone (); @@ -109,6 +121,8 @@ class MidiRegion : public Region NoteMode mode = Sustained, MidiStateTracker* tracker = 0) const; + void register_properties (); + void recompute_at_start (); void recompute_at_end (); @@ -117,10 +131,12 @@ class MidiRegion : public Region void switch_source(boost::shared_ptr<Source> source); void model_changed (); void model_automation_state_changed (Evoral::Parameter const &); + void model_contents_changed (); std::set<Evoral::Parameter> _filtered_parameters; ///< parameters that we ask our source not to return when reading PBD::ScopedConnection _model_connection; PBD::ScopedConnection _source_connection; + PBD::ScopedConnection _model_contents_connection; }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/public_diskstream.h b/libs/ardour/ardour/public_diskstream.h index e0cf9ef7fa..de6b3dcb55 100755 --- a/libs/ardour/ardour/public_diskstream.h +++ b/libs/ardour/ardour/public_diskstream.h @@ -46,17 +46,17 @@ public: virtual uint32_t read_data_count() const = 0; virtual uint32_t write_data_count() const = 0; virtual void set_pending_overwrite (bool) = 0; - virtual int seek (nframes_t, bool complete_refill = false) = 0; + virtual int seek (framepos_t, bool complete_refill = false) = 0; virtual bool hidden () const = 0; - virtual int can_internal_playback_seek (nframes_t) = 0; - virtual int internal_playback_seek (nframes_t) = 0; + virtual int can_internal_playback_seek (framepos_t) = 0; + virtual int internal_playback_seek (framepos_t) = 0; virtual void non_realtime_input_change () = 0; - virtual void non_realtime_locate (nframes_t) = 0; + virtual void non_realtime_locate (framepos_t) = 0; virtual void non_realtime_set_speed () = 0; virtual int overwrite_existing_buffers () = 0; - virtual nframes_t get_captured_frames (uint32_t n = 0) = 0; + virtual framecnt_t get_captured_frames (uint32_t n = 0) = 0; virtual int set_loop (Location *) = 0; - virtual void transport_looped (nframes_t) = 0; + virtual void transport_looped (framepos_t) = 0; virtual bool realtime_set_speed (double, bool) = 0; virtual void transport_stopped_wallclock (struct tm &, time_t, bool) = 0; virtual bool pending_overwrite () const = 0; @@ -64,10 +64,10 @@ public: virtual void prepare_to_stop (framepos_t) = 0; virtual void set_slaved (bool) = 0; virtual ChanCount n_channels () = 0; - virtual nframes_t get_capture_start_frame (uint32_t n = 0) = 0; + virtual framepos_t get_capture_start_frame (uint32_t n = 0) = 0; virtual AlignStyle alignment_style () const = 0; - virtual nframes_t current_capture_start () const = 0; - virtual nframes_t current_capture_end () const = 0; + virtual framepos_t current_capture_start () const = 0; + virtual framepos_t current_capture_end () const = 0; virtual void playlist_modified () = 0; virtual int use_playlist (boost::shared_ptr<Playlist>) = 0; virtual void set_align_style (AlignStyle) = 0; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index db7a59b76d..315ad887ae 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -311,9 +311,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi int wipe (); - std::pair<nframes_t, nframes_t> get_extent () const; - nframes_t current_end_frame () const; - nframes_t current_start_frame () const; + std::pair<framepos_t, framepos_t> get_extent () const; + framepos_t current_end_frame () const; + framepos_t current_start_frame () const; /// "actual" sample rate of session, set by current audioengine rate, pullup/down etc. nframes_t frame_rate() const { return _current_frame_rate; } /// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc @@ -447,14 +447,14 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void sync_time_vars(); void bbt_time (nframes_t when, BBT_Time&); - void timecode_to_sample(Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_timecode(nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + void timecode_to_sample(Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode(framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; void timecode_time (Timecode::Time &); void timecode_time (nframes_t when, Timecode::Time&); void timecode_time_subframes (nframes_t when, Timecode::Time&); void timecode_duration (nframes_t, Timecode::Time&) const; - void timecode_duration_string (char *, nframes_t) const; + void timecode_duration_string (char *, framecnt_t) const; void set_timecode_offset (nframes_t); nframes_t timecode_offset () const { return _timecode_offset; } @@ -629,7 +629,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi /* s/w "RAID" management */ - nframes_t available_capture_duration(); + framecnt_t available_capture_duration(); /* I/O bundles */ @@ -1048,15 +1048,15 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void enable_record (); - void increment_transport_position (uint32_t val) { - if (max_frames - val < _transport_frame) { - _transport_frame = max_frames; + void increment_transport_position (framecnt_t val) { + if (max_framepos - val < _transport_frame) { + _transport_frame = max_framepos; } else { _transport_frame += val; } } - void decrement_transport_position (uint32_t val) { + void decrement_transport_position (framecnt_t val) { if (val < _transport_frame) { _transport_frame -= val; } else { diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h index 23128c4025..d24aa9d136 100644 --- a/libs/ardour/ardour/silentfilesource.h +++ b/libs/ardour/ardour/silentfilesource.h @@ -27,7 +27,7 @@ namespace ARDOUR { class SilentFileSource : public AudioFileSource { public: - int update_header (sframes_t /*when*/, struct tm&, time_t) { return 0; } + int update_header (framepos_t /*when*/, struct tm&, time_t) { return 0; } int flush_header () { return 0; } float sample_rate () const { return _sample_rate; } diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index d2b0e49c45..111564cc23 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -249,13 +249,13 @@ class MTC_Slave : public Slave { static const int frame_tolerance; SafeTime current; - nframes_t mtc_frame; /* current time */ - nframes_t last_inbound_frame; /* when we got it; audio clocked */ + framepos_t mtc_frame; /* current time */ + framepos_t last_inbound_frame; /* when we got it; audio clocked */ MIDI::byte last_mtc_fps_byte; - nframes64_t window_begin; - nframes64_t window_end; - nframes64_t last_mtc_timestamp; - nframes64_t last_mtc_frame; + framepos_t window_begin; + framepos_t window_end; + framepos_t last_mtc_timestamp; + framepos_t last_mtc_frame; bool did_reset_tc_format; TimecodeFormat saved_tc_format; size_t speed_accumulator_size; diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 59dd603236..06e329a74b 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -44,7 +44,7 @@ class SndFileSource : public AudioFileSource { ~SndFileSource (); float sample_rate () const; - int update_header (sframes_t when, struct tm&, time_t); + int update_header (framepos_t when, struct tm&, time_t); int flush_header (); nframes64_t natural_position () const; diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index c32b96ae97..14d0de5f4d 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -41,7 +41,7 @@ class SourceFactory { static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false); static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, - nframes_t nframes, float sample_rate); + framecnt_t nframes, float sample_rate); static boost::shared_ptr<Source> createReadable (DataType type, Session&, const std::string& path, diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index dfdc409659..38d36ea5d0 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -114,17 +114,17 @@ class Track : public Route, public PublicDiskstream uint32_t read_data_count() const; uint32_t write_data_count() const; void set_pending_overwrite (bool); - int seek (nframes_t, bool complete_refill = false); + int seek (framepos_t, bool complete_refill = false); bool hidden () const; - int can_internal_playback_seek (nframes_t); - int internal_playback_seek (nframes_t); + int can_internal_playback_seek (framepos_t); + int internal_playback_seek (framepos_t); void non_realtime_input_change (); - void non_realtime_locate (nframes_t); + void non_realtime_locate (framepos_t); void non_realtime_set_speed (); int overwrite_existing_buffers (); - nframes_t get_captured_frames (uint32_t n = 0); + framecnt_t get_captured_frames (uint32_t n = 0); int set_loop (Location *); - void transport_looped (nframes_t); + void transport_looped (framepos_t); bool realtime_set_speed (double, bool); void transport_stopped_wallclock (struct tm &, time_t, bool); bool pending_overwrite () const; @@ -132,10 +132,10 @@ class Track : public Route, public PublicDiskstream void prepare_to_stop (framepos_t); void set_slaved (bool); ChanCount n_channels (); - nframes_t get_capture_start_frame (uint32_t n = 0); + framepos_t get_capture_start_frame (uint32_t n = 0); AlignStyle alignment_style () const; - nframes_t current_capture_start () const; - nframes_t current_capture_end () const; + framepos_t current_capture_start () const; + framepos_t current_capture_end () const; void playlist_modified (); int use_playlist (boost::shared_ptr<Playlist>); void set_align_style (AlignStyle); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 435cf8d416..f91b67bb5a 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -20,14 +20,11 @@ #ifndef __ardour_types_h__ #define __ardour_types_h__ -#ifndef __STDC_FORMAT_MACROS -#define __STDC_FORMAT_MACROS /* PRI<foo>; C++ requires explicit requesting of these */ -#endif - #include <istream> #include <vector> #include <boost/shared_ptr.hpp> #include <sys/types.h> +#include <stdint.h> #include <inttypes.h> #include <jack/types.h> @@ -58,12 +55,6 @@ namespace ARDOUR { typedef uint32_t nframes_t; typedef int64_t nframes64_t; - - /** "Session frames", frames relative to the session timeline. - * Everything related to transport position etc. should be of this type. - * We might want to make this a compile time option for 32-bitters who - * don't want to pay for extremely long session times they don't need... - */ typedef int64_t sframes_t; typedef int64_t framepos_t; /* any offset from a framepos_t, measured in audio frames */ @@ -71,6 +62,9 @@ namespace ARDOUR { /* any count of audio frames */ typedef int64_t framecnt_t; + static const framepos_t max_framepos = INT64_MAX; + static const framecnt_t max_framecnt = INT64_MAX; + struct IOChange { enum Type { diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index f4e7ac8e9c..f8bd4f698f 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -204,19 +204,19 @@ AudioDiskstream::non_realtime_input_change () /* now refill channel buffers */ if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (_session.transport_frame() * (double) speed())); + seek ((framepos_t) (_session.transport_frame() * (double) speed())); } else { seek (_session.transport_frame()); } } void -AudioDiskstream::non_realtime_locate (nframes_t location) +AudioDiskstream::non_realtime_locate (framepos_t location) { /* now refill channel buffers */ if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (location * (double) speed())); + seek ((framepos_t) (location * (double) speed())); } else { seek (location); } @@ -347,7 +347,7 @@ AudioDiskstream::setup_destructive_playlist () PropertyList plist; plist.add (Properties::name, _name.val()); plist.add (Properties::start, 0); - plist.add (Properties::length, max_frames - max_frames - srcs.front()->natural_position()); + plist.add (Properties::length, max_framepos - (max_framepos - srcs.front()->natural_position())); boost::shared_ptr<Region> region (RegionFactory::create (srcs, plist)); _playlist->add_region (region, srcs.front()->natural_position()); @@ -377,7 +377,7 @@ AudioDiskstream::use_destructive_playlist () /* be sure to stretch the region out to the maximum length */ - region->set_length (max_frames - region->position(), this); + region->set_length (max_framepos - region->position(), this); uint32_t n; ChannelList::iterator chan; @@ -397,7 +397,7 @@ AudioDiskstream::use_destructive_playlist () } void -AudioDiskstream::prepare_record_status(nframes_t capture_start_frame) +AudioDiskstream::prepare_record_status(framepos_t capture_start_frame) { if (recordable() && destructive()) { boost::shared_ptr<ChannelList> c = channels.reader(); @@ -421,7 +421,7 @@ AudioDiskstream::prepare_record_status(nframes_t capture_start_frame) } int -AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) +AudioDiskstream::process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) { uint32_t n; boost::shared_ptr<ChannelList> c = channels.reader(); @@ -470,7 +470,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can // and last_recordable_frame < first_recordable_frame if (last_recordable_frame < first_recordable_frame) { - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; } OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes); @@ -759,7 +759,7 @@ AudioDiskstream::overwrite_existing_buffers () size--; uint32_t n=0; - nframes_t start; + framepos_t start; for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan, ++n) { @@ -808,7 +808,7 @@ AudioDiskstream::overwrite_existing_buffers () } int -AudioDiskstream::seek (nframes_t frame, bool complete_refill) +AudioDiskstream::seek (framepos_t frame, bool complete_refill) { uint32_t n; int ret = -1; @@ -841,13 +841,13 @@ AudioDiskstream::seek (nframes_t frame, bool complete_refill) } int -AudioDiskstream::can_internal_playback_seek (nframes_t distance) +AudioDiskstream::can_internal_playback_seek (framecnt_t distance) { ChannelList::iterator chan; boost::shared_ptr<ChannelList> c = channels.reader(); for (chan = c->begin(); chan != c->end(); ++chan) { - if ((*chan)->playback_buf->read_space() < distance) { + if ((*chan)->playback_buf->read_space() < (size_t) distance) { return false; } } @@ -855,7 +855,7 @@ AudioDiskstream::can_internal_playback_seek (nframes_t distance) } int -AudioDiskstream::internal_playback_seek (nframes_t distance) +AudioDiskstream::internal_playback_seek (framecnt_t distance) { ChannelList::iterator chan; boost::shared_ptr<ChannelList> c = channels.reader(); @@ -871,13 +871,14 @@ AudioDiskstream::internal_playback_seek (nframes_t distance) } int -AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, nframes_t& start, nframes_t cnt, +AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, + framepos_t& start, nframes_t cnt, ChannelInfo* /*channel_info*/, int channel, bool reversed) { nframes_t this_read = 0; bool reloop = false; - nframes_t loop_end = 0; - nframes_t loop_start = 0; + framepos_t loop_end = 0; + framepos_t loop_start = 0; nframes_t offset = 0; Location *loc = 0; @@ -885,7 +886,7 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, if (!reversed) { - nframes_t loop_length = 0; + framecnt_t loop_length = 0; /* Make the use of a Location atomic for this read operation. @@ -1082,7 +1083,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) } else { - if (file_frame == max_frames) { + if (file_frame == max_framepos) { /* at end: nothing to do but fill with silence */ @@ -1099,19 +1100,19 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) return 0; } - if (file_frame > max_frames - total_space) { + if (file_frame > max_framepos - total_space) { /* to close to the end: read what we can, and zero fill the rest */ - zero_fill = total_space - (max_frames - file_frame); - total_space = max_frames - file_frame; + zero_fill = total_space - (max_framepos - file_frame); + total_space = max_framepos - file_frame; } else { zero_fill = 0; } } - nframes_t file_frame_tmp = 0; + framepos_t file_frame_tmp = 0; for (chan_n = 0, i = c->begin(); i != c->end(); ++i, ++chan_n) { @@ -1527,7 +1528,7 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo } void -AudioDiskstream::transport_looped (nframes_t transport_frame) +AudioDiskstream::transport_looped (framepos_t transport_frame) { if (was_recording) { // all we need to do is finish this capture, with modified capture length @@ -1552,7 +1553,7 @@ AudioDiskstream::transport_looped (nframes_t transport_frame) // no latency adjustment or capture offset needs to be made, as that already happened the first time capture_start_frame = transport_frame; first_recordable_frame = transport_frame; // mild lie - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; was_recording = true; if (recordable() && destructive()) { @@ -1581,8 +1582,8 @@ void AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr<ChannelList> c) { was_recording = false; - first_recordable_frame = max_frames; - last_recordable_frame = max_frames; + first_recordable_frame = max_framepos; + last_recordable_frame = max_framepos; if (capture_captured == 0) { return; @@ -1627,7 +1628,7 @@ AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr< capture_captured = 0; /* now we've finished a capture, reset first_recordable_frame for next time */ - first_recordable_frame = max_frames; + first_recordable_frame = max_framepos; } void @@ -2147,13 +2148,13 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) boost::shared_ptr<AudioFileSource> fs; boost::shared_ptr<AudioFileSource> first_fs; SourceList pending_sources; - nframes_t position; + framepos_t position; if ((prop = node.property (X_("at"))) == 0) { return -1; } - if (sscanf (prop->value().c_str(), "%" PRIu32, &position) != 1) { + if (sscanf (prop->value().c_str(), "%" PRIu64, &position) != 1) { return -1; } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index bfdd9acd26..7a3c279705 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -76,7 +76,7 @@ AudioEngine::AudioEngine (string client_name, string session_uuid) _running = false; _has_run = false; last_monitor_check = 0; - monitor_check_interval = max_frames; + monitor_check_interval = INT32_MAX; _processed_frames = 0; _usecs_per_cycle = 0; _jack = 0; @@ -463,8 +463,8 @@ AudioEngine::process_callback (nframes_t nframes) /* handle wrap around of total frames counter */ - if (max_frames - _processed_frames < nframes) { - next_processed_frames = nframes - (max_frames - _processed_frames); + if (max_framepos - _processed_frames < nframes) { + next_processed_frames = nframes - (max_framepos - _processed_frames); } else { next_processed_frames = _processed_frames + nframes; } diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index 6878069398..6627409bd0 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -218,7 +218,7 @@ CoreAudioSource::sample_rate() const } int -CoreAudioSource::update_header (sframes_t when, struct tm&, time_t) +CoreAudioSource::update_header (framepos_t when, struct tm&, time_t) { return 0; } diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 0a79aec613..179cf2b2a9 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -87,8 +87,8 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag) , adjust_capture_position (0) , _capture_offset (0) , _roll_delay (0) - , first_recordable_frame (max_frames) - , last_recordable_frame (max_frames) + , first_recordable_frame (max_framepos) + , last_recordable_frame (max_framepos) , last_possibly_recording (0) , _alignment_style (ExistingMaterial) , _scrubbing (false) @@ -134,8 +134,8 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/) , adjust_capture_position (0) , _capture_offset (0) , _roll_delay (0) - , first_recordable_frame (max_frames) - , last_recordable_frame (max_frames) + , first_recordable_frame (max_framepos) + , last_recordable_frame (max_framepos) , last_possibly_recording (0) , _alignment_style (ExistingMaterial) , _scrubbing (false) @@ -213,7 +213,7 @@ Diskstream::non_realtime_set_speed () if (_seek_required) { if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (_session.transport_frame() * (double) speed()), true); + seek ((framepos_t) (_session.transport_frame() * (double) speed()), true); } else { seek (_session.transport_frame(), true); @@ -237,7 +237,7 @@ Diskstream::realtime_set_speed (double sp, bool global) if (new_speed != _actual_speed) { nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * - fabs (new_speed)) + 1; + fabs (new_speed)) + 1; if (required_wrap_size > wrap_buffer_size) { _buffer_reallocation_required = true; @@ -297,7 +297,7 @@ Diskstream::set_loop (Location *location) return 0; } -ARDOUR::nframes_t +ARDOUR::framepos_t Diskstream::get_capture_start_frame (uint32_t n) { Glib::Mutex::Lock lm (capture_info_lock); @@ -310,7 +310,7 @@ Diskstream::get_capture_start_frame (uint32_t n) } } -ARDOUR::nframes_t +ARDOUR::framecnt_t Diskstream::get_captured_frames (uint32_t n) { Glib::Mutex::Lock lm (capture_info_lock); @@ -506,7 +506,7 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora } void -Diskstream::check_record_status (nframes_t transport_frame, nframes_t /*nframes*/, bool can_record) +Diskstream::check_record_status (framepos_t transport_frame, nframes_t /*nframes*/, bool can_record) { int possibly_recording; int rolling; @@ -536,7 +536,7 @@ Diskstream::check_record_status (nframes_t transport_frame, nframes_t /*nframes* /* we transitioned to recording. lets see if its transport based or a punch */ first_recordable_frame = transport_frame + _capture_offset; - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; capture_start_frame = transport_frame; if (change & transport_rolling) { @@ -633,7 +633,7 @@ Diskstream::route_going_away () } void -Diskstream::calculate_record_range(OverlapType ot, sframes_t transport_frame, nframes_t nframes, +Diskstream::calculate_record_range(OverlapType ot, framepos_t transport_frame, framecnt_t nframes, nframes_t& rec_nframes, nframes_t& rec_offset) { switch (ot) { diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index ddf95b1649..ad6fd1859d 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -901,13 +901,13 @@ Locations::first_location_after (nframes64_t frame, bool include_special_ranges) * side of a frame. Note that if frame is exactly on a `mark', that mark will not be considered for returning * as before/after. * @param frame Frame to look for. - * @param before Filled in with the position of the last `mark' before `frame' (or max_frames if none exists) - * @param after Filled in with the position of the next `mark' after `frame' (or max_frames if none exists) + * @param before Filled in with the position of the last `mark' before `frame' (or max_framepos if none exists) + * @param after Filled in with the position of the next `mark' after `frame' (or max_framepos if none exists) */ void Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nframes64_t& after) const { - before = after = max_frames; + before = after = max_framepos; LocationList locs; diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 8b7d4a3d4a..e916fef263 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -143,7 +143,7 @@ MidiDiskstream::~MidiDiskstream () void -MidiDiskstream::non_realtime_locate (nframes_t position) +MidiDiskstream::non_realtime_locate (framepos_t position) { if (_write_source) { _write_source->set_timeline_position (position); @@ -192,7 +192,7 @@ MidiDiskstream::non_realtime_input_change () /* now refill channel buffers */ if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (_session.transport_frame() * (double) speed())); + seek ((framepos_t) (_session.transport_frame() * (double) speed())); } else { seek (_session.transport_frame()); @@ -488,7 +488,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) #endif int -MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) +MidiDiskstream::process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) { int ret = -1; nframes_t rec_offset = 0; @@ -619,7 +619,7 @@ MidiDiskstream::set_pending_overwrite (bool yn) int MidiDiskstream::overwrite_existing_buffers () { - //read(overwrite_frame, disk_io_chunk_frames, false); + read (overwrite_frame, disk_io_chunk_frames, false); overwrite_queued = false; _pending_overwrite = false; @@ -627,7 +627,7 @@ MidiDiskstream::overwrite_existing_buffers () } int -MidiDiskstream::seek (nframes_t frame, bool complete_refill) +MidiDiskstream::seek (framepos_t frame, bool complete_refill) { Glib::Mutex::Lock lm (state_lock); int ret = -1; @@ -650,7 +650,7 @@ MidiDiskstream::seek (nframes_t frame, bool complete_refill) } int -MidiDiskstream::can_internal_playback_seek (nframes_t distance) +MidiDiskstream::can_internal_playback_seek (framecnt_t distance) { uint32_t frames_read = g_atomic_int_get(&_frames_read_from_ringbuffer); uint32_t frames_written = g_atomic_int_get(&_frames_written_to_ringbuffer); @@ -658,7 +658,7 @@ MidiDiskstream::can_internal_playback_seek (nframes_t distance) } int -MidiDiskstream::internal_playback_seek (nframes_t distance) +MidiDiskstream::internal_playback_seek (framecnt_t distance) { first_recordable_frame += distance; playback_sample += distance; @@ -668,17 +668,17 @@ MidiDiskstream::internal_playback_seek (nframes_t distance) /** @a start is set to the new frame position (TIME) read up to */ int -MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) +MidiDiskstream::read (framepos_t& start, nframes_t dur, bool reversed) { nframes_t this_read = 0; bool reloop = false; - nframes_t loop_end = 0; - nframes_t loop_start = 0; + framepos_t loop_end = 0; + framepos_t loop_start = 0; Location *loc = 0; if (!reversed) { - nframes_t loop_length = 0; + framecnt_t loop_length = 0; /* Make the use of a Location atomic for this read operation. @@ -749,7 +749,7 @@ MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) if (reloop) { // Synthesize LoopEvent here, because the next events // written will have non-monotonic timestamps. - _playback_buf->write(loop_end - 1, LoopEventType, sizeof (nframes_t), (uint8_t *) &loop_start); + _playback_buf->write(loop_end - 1, LoopEventType, sizeof (framepos_t), (uint8_t *) &loop_start); cout << "Pushing LoopEvent ts=" << loop_end-1 << " start+this_read " << start+this_read << endl; @@ -788,13 +788,13 @@ MidiDiskstream::do_refill () } /* at end: nothing to do */ - if (file_frame == max_frames) { + if (file_frame == max_framepos) { return 0; } // At this point we... assert(_playback_buf->write_space() > 0); // ... have something to write to, and - assert(file_frame <= max_frames); // ... something to write + assert(file_frame <= max_framepos); // ... something to write // now calculate how much time is in the ringbuffer. // and lets write as much as we need to get this to be midi_readahead; @@ -810,7 +810,7 @@ MidiDiskstream::do_refill () //cout << "MDS read for midi_readahead " << to_read << " rb_contains: " // << frames_written - frames_read << endl; - to_read = min(to_read, (max_frames - file_frame)); + to_read = (nframes_t) min ((framecnt_t) to_read, (framecnt_t) (max_framepos - file_frame)); if (read (file_frame, to_read, reversed)) { ret = -1; @@ -1061,7 +1061,7 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen } void -MidiDiskstream::transport_looped (nframes_t transport_frame) +MidiDiskstream::transport_looped (framepos_t transport_frame) { if (was_recording) { @@ -1084,7 +1084,7 @@ MidiDiskstream::transport_looped (nframes_t transport_frame) // no latency adjustment or capture offset needs to be made, as that already happened the first time capture_start_frame = transport_frame; first_recordable_frame = transport_frame; // mild lie - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; was_recording = true; } } @@ -1463,7 +1463,7 @@ MidiDiskstream::use_pending_capture_data (XMLNode& /*node*/) * so that an event at \a start has time = 0 */ void -MidiDiskstream::get_playback (MidiBuffer& dst, nframes_t start, nframes_t end) +MidiDiskstream::get_playback (MidiBuffer& dst, framepos_t start, framepos_t end) { dst.clear(); assert(dst.size() == 0); diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index c93993aef8..e0d451d31b 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -380,8 +380,6 @@ MidiModel::DiffCommand::marshal_note(const NotePtr note) { XMLNode* xml_note = new XMLNode("note"); - cerr << "Marshalling note: " << *note << endl; - { ostringstream id_str(ios::ate); id_str << int(note->id()); diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index 6f5dee979a..0fd32ebddd 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -425,13 +425,10 @@ MidiPlaylist::region_changed (const PBD::PropertyChange& what_changed, boost::sh return false; } - // Feeling rather uninterested today, but thanks for the heads up anyway! - PBD::PropertyChange our_interests; + our_interests.add (Properties::midi_data); - bool parent_wants_notify; - - parent_wants_notify = Playlist::region_changed (what_changed, region); + bool parent_wants_notify = Playlist::region_changed (what_changed, region); if (parent_wants_notify || what_changed.contains (our_interests)) { notify_contents_changed (); diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index ae93a77445..ffb5217137 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -47,10 +47,31 @@ using namespace std; using namespace ARDOUR; using namespace PBD; +namespace ARDOUR { + namespace Properties { + PBD::PropertyDescriptor<void*> midi_data; + } +} + +void +MidiRegion::make_property_quarks () +{ + Properties::midi_data.property_id = g_quark_from_static_string (X_("midi-data")); + DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for midi-data = %1\n", Properties::midi_data.property_id)); +} + +void +MidiRegion::register_properties () +{ + /* none yet, but its only a matter of time */ +} + /* Basic MidiRegion constructor (many channels) */ MidiRegion::MidiRegion (const SourceList& srcs) : Region (srcs) { + register_properties (); + // midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1)); midi_source(0)->ModelChanged.connect_same_thread (_source_connection, boost::bind (&MidiRegion::model_changed, this)); model_changed (); @@ -62,6 +83,8 @@ MidiRegion::MidiRegion (const SourceList& srcs) MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t offset, bool offset_relative) : Region (other, offset, offset_relative) { + register_properties (); + assert(_name.val().find("/") == string::npos); // midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1)); midi_source(0)->ModelChanged.connect_same_thread (_source_connection, boost::bind (&MidiRegion::model_changed, this)); @@ -155,13 +178,14 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, Evoral::EventSink<nframes_t>& boost::shared_ptr<MidiSource> src = midi_source(chan_n); src->set_note_mode(mode); - - /*cerr << "MR read @ " << position << " * " << to_read - << " _position = " << _position - << " _start = " << _start - << " offset = " << output_buffer_position - << " intoffset = " << internal_offset - << endl;*/ + + /* + cerr << "MR read @ " << position << " * " << to_read + << " _position = " << _position + << " _start = " << _start + << " intoffset = " << internal_offset + << endl; + */ /* This call reads events from a source and writes them to `dst' timed in session frames */ @@ -281,6 +305,15 @@ MidiRegion::model_changed () midi_source()->AutomationStateChanged.connect_same_thread ( _model_connection, boost::bind (&MidiRegion::model_automation_state_changed, this, _1) ); + + model()->ContentsChanged.connect_same_thread ( + _model_contents_connection, boost::bind (&MidiRegion::model_contents_changed, this)); +} + +void +MidiRegion::model_contents_changed () +{ + send_change (PropertyChange (Properties::midi_data)); } void diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index a67bb7481d..354341de24 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -123,7 +123,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, nframes_t now) Timecode::Time timecode; TimecodeFormat tc_format; bool reset_tc = true; - nframes64_t window_root = -1; + framepos_t window_root = -1; DEBUG_TRACE (DEBUG::MTC, string_compose ("full mtc time known at %1, full ? %2\n", now, was_full)); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 87ed1ca03b..334b3f163d 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -17,9 +17,7 @@ */ -#define __STDC_LIMIT_MACROS #include <stdint.h> - #include <set> #include <fstream> #include <algorithm> @@ -1501,8 +1499,8 @@ Playlist::core_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Reg framepos_t new_pos = (*i)->position() + distance; if (new_pos < 0) { new_pos = 0; - } else if (new_pos >= max_frames - (*i)->length()) { - new_pos = max_frames - (*i)->length(); + } else if (new_pos >= max_framepos - (*i)->length()) { + new_pos = max_framepos - (*i)->length(); } (*i)->set_position (new_pos, this); @@ -1985,7 +1983,7 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir) { RegionLock rlock (this); boost::shared_ptr<Region> ret; - framepos_t closest = max_frames; + framepos_t closest = max_framepos; bool end_iter = false; @@ -2046,7 +2044,7 @@ Playlist::find_next_region_boundary (framepos_t frame, int dir) { RegionLock rlock (this); - framepos_t closest = max_frames; + framepos_t closest = max_framepos; framepos_t ret = -1; if (dir > 0) { @@ -2320,7 +2318,7 @@ Playlist::get_extent () const pair<framecnt_t, framecnt_t> Playlist::_get_extent () const { - pair<framecnt_t, framecnt_t> ext (max_frames, 0); + pair<framecnt_t, framecnt_t> ext (max_framepos, 0); for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { pair<framecnt_t, framecnt_t> const e ((*i)->position(), (*i)->position() + (*i)->length()); @@ -2670,8 +2668,8 @@ Playlist::nudge_after (framepos_t start, framecnt_t distance, bool forwards) if (forwards) { - if ((*i)->last_frame() > max_frames - distance) { - new_pos = max_frames - (*i)->length(); + if ((*i)->last_frame() > max_framepos - distance) { + new_pos = max_framepos - (*i)->length(); } else { new_pos = (*i)->position() + distance; } diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 9a54139d09..13576ff11a 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -452,7 +452,7 @@ Region::set_length (framecnt_t len, void */*src*/) length impossible. */ - if (max_frames - len < _position) { + if (max_framepos - len < _position) { return; } @@ -602,9 +602,9 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute) XXX is this the right thing to do? */ - if (max_frames - _length < _position) { + if (max_framepos - _length < _position) { _last_length = _length; - _length = max_frames - _position; + _length = max_framepos - _position; } if (allow_bbt_recompute) { @@ -667,8 +667,8 @@ Region::nudge_position (frameoffset_t n, void* /*src*/) _last_position = _position; if (n > 0) { - if (_position > max_frames - n) { - _position = max_frames; + if (_position > max_framepos - n) { + _position = max_framepos; } else { _position += n; } @@ -735,8 +735,8 @@ Region::trim_start (framepos_t new_position, void */*src*/) if (start_shift > 0) { - if (_start > max_frames - start_shift) { - new_start = max_frames; + if (_start > max_framepos - start_shift) { + new_start = max_framepos; } else { new_start = _start + start_shift; } @@ -895,8 +895,8 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/) if (start_shift > 0) { - if (_start > max_frames - start_shift) { - new_start = max_frames; + if (_start > max_framepos - start_shift) { + new_start = max_framepos; } else { new_start = _start + start_shift; } @@ -1077,7 +1077,7 @@ Region::adjust_to_sync (framepos_t pos) const pos = 0; } } else { - if (max_frames - pos > offset) { + if (max_framepos - pos > offset) { pos += offset; } } diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index a8b0d436d6..d8e862573f 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -17,7 +17,6 @@ */ -#define __STDC_FORMAT_MACROS #include <inttypes.h> #include "pbd/error.h" diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index 9dbdad33d4..629216da39 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -17,7 +17,6 @@ */ -#define __STDC_FORMAT_MACROS #include <inttypes.h> #include <algorithm> diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index f68da4adb2..682bb541f5 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -17,7 +17,6 @@ */ -#define __STDC_LIMIT_MACROS #include <stdint.h> #include <algorithm> @@ -2491,11 +2490,11 @@ Session::update_session_range_location_marker () return; } - pair<nframes_t, nframes_t> const ext = get_extent (); + pair<framepos_t, framepos_t> const ext = get_extent (); if (_session_range_location == 0) { /* we don't have a session range yet; use this one (provided it is valid) */ - if (ext.first != max_frames) { + if (ext.first != max_framepos) { add_session_range_location (ext.first, ext.second); } } else { @@ -2514,12 +2513,12 @@ Session::update_session_range_location_marker () } /** @return Extent of the session's contents; if the session is empty, the first value of - * the pair will equal max_frames. + * the pair will equal max_framepos. */ -pair<nframes_t, nframes_t> +pair<framepos_t, framepos_t> Session::get_extent () const { - pair<nframes_t, nframes_t> ext (max_frames, 0); + pair<framepos_t, framepos_t> ext (max_framepos, 0); boost::shared_ptr<RouteList> rl = routes.reader (); for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { @@ -3189,7 +3188,7 @@ Session::graph_reordered () } } -nframes_t +framecnt_t Session::available_capture_duration () { float sample_bytes_on_disk = 4.0; // keep gcc happy @@ -3217,11 +3216,11 @@ Session::available_capture_duration () double scale = 4096.0 / sample_bytes_on_disk; - if (_total_free_4k_blocks * scale > (double) max_frames) { - return max_frames; + if (_total_free_4k_blocks * scale > (double) max_framecnt) { + return max_framecnt; } - - return (nframes_t) floor (_total_free_4k_blocks * scale); + + return (framecnt_t) floor (_total_free_4k_blocks * scale); } void @@ -3974,13 +3973,13 @@ Session::goto_start () } } -nframes_t +framepos_t Session::current_start_frame () const { return _session_range_location ? _session_range_location->start() : 0; } -nframes_t +framepos_t Session::current_end_frame () const { return _session_range_location ? _session_range_location->end() : 0; diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 2ce3310f47..c5efb1f3f8 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -270,7 +270,7 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc) return; } - nframes_t target_frame; + framepos_t target_frame; Timecode::Time timecode; timecode.hours = mmc_tc[0] & 0xf; @@ -283,8 +283,8 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc) // Also takes timecode offset into account: timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ ); - if (target_frame > max_frames) { - target_frame = max_frames; + if (target_frame > max_framepos) { + target_frame = max_framepos; } /* Some (all?) MTC/MMC devices do not send a full MTC frame diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 596f656fbc..342ae5c8a8 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -233,11 +233,11 @@ Session::get_track_statistics () void Session::process_with_events (nframes_t nframes) { - SessionEvent* ev; + SessionEvent* ev; nframes_t this_nframes; - nframes_t end_frame; + framepos_t end_frame; bool session_needs_butler = false; - nframes_t stop_limit; + framepos_t stop_limit; framecnt_t frames_moved; /* make sure the auditioner is silent */ @@ -316,13 +316,13 @@ Session::process_with_events (nframes_t nframes) } if (actively_recording()) { - stop_limit = max_frames; + stop_limit = max_framepos; } else { if (Config->get_stop_at_session_end()) { stop_limit = current_end_frame(); } else { - stop_limit = max_frames; + stop_limit = max_framepos; } } @@ -722,16 +722,16 @@ Session::follow_slave_silently (nframes_t nframes, float slave_speed) } else { increment_transport_position (frames_moved); } - - nframes_t stop_limit; + + framepos_t stop_limit; if (actively_recording()) { - stop_limit = max_frames; + stop_limit = max_framepos; } else { if (Config->get_stop_at_session_end()) { stop_limit = current_end_frame(); } else { - stop_limit = max_frames; + stop_limit = max_framepos; } } @@ -743,7 +743,7 @@ void Session::process_without_events (nframes_t nframes) { bool session_needs_butler = false; - nframes_t stop_limit; + framepos_t stop_limit; framecnt_t frames_moved; if (!process_can_proceed()) { @@ -767,12 +767,12 @@ Session::process_without_events (nframes_t nframes) } if (actively_recording()) { - stop_limit = max_frames; + stop_limit = max_framepos; } else { if (Config->get_stop_at_session_end()) { stop_limit = current_end_frame(); } else { - stop_limit = max_frames; + stop_limit = max_framepos; } } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 9290f673cf..097fd2a116 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1100,7 +1100,7 @@ Session::state(bool full_state) // with the default start and end, and get the state for that. Locations loc (*this); Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange); - range->set (max_frames, 0); + range->set (max_framepos, 0); loc.add (range); node->add_child_nocopy (loc.get_state()); } @@ -1877,7 +1877,7 @@ Session::load_sources (const XMLNode& node) } } catch (MissingSource& err) { warning << _("A sound file is missing. It will be replaced by silence.") << endmsg; - source = SourceFactory::createSilent (*this, **niter, max_frames, _current_frame_rate); + source = SourceFactory::createSilent (*this, **niter, max_framecnt, _current_frame_rate); } } diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index 7fb5b677ea..f7511b398d 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -205,7 +205,7 @@ Session::set_timecode_offset_negative (bool neg) } void -Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes ) const +Session::timecode_to_sample( Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes ) const { if (timecode.drop) { @@ -297,9 +297,9 @@ Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool u void -Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const +Session::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const { - nframes_t offset_sample; + framepos_t offset_sample; if (!use_offset) { offset_sample = sample; @@ -430,7 +430,7 @@ Session::timecode_duration (nframes_t when, Timecode::Time& timecode) const } void -Session::timecode_duration_string (char* buf, nframes_t when) const +Session::timecode_duration_string (char* buf, framepos_t when) const { Timecode::Time timecode; diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 1cc8edd708..a183d26b84 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -487,7 +487,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt) } int -SndFileSource::update_header (sframes_t when, struct tm& now, time_t tnow) +SndFileSource::update_header (framepos_t when, struct tm& now, time_t tnow) { set_timeline_position (when); @@ -818,7 +818,7 @@ SndFileSource::setup_standard_crossfades (Session const & s, nframes_t rate) } void -SndFileSource::set_timeline_position (int64_t pos) +SndFileSource::set_timeline_position (framepos_t pos) { // destructive track timeline postion does not change // except at instantion or when header_position_offset diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 357dbbadf8..d09bf05c6e 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -121,7 +121,7 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async) } boost::shared_ptr<Source> -SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, float sr) +SourceFactory::createSilent (Session& s, const XMLNode& node, framecnt_t nframes, float sr) { Source* src = new SilentFileSource (s, node, nframes, sr); // boost_debug_shared_ptr_mark_interesting (src, "Source"); diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 2e7290b77a..ff1f6f78ed 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -480,9 +480,9 @@ Track::set_pending_overwrite (bool o) } int -Track::seek (nframes_t s, bool complete_refill) +Track::seek (framepos_t p, bool complete_refill) { - return _diskstream->seek (s, complete_refill); + return _diskstream->seek (p, complete_refill); } bool @@ -492,15 +492,15 @@ Track::hidden () const } int -Track::can_internal_playback_seek (nframes_t d) +Track::can_internal_playback_seek (framepos_t p) { - return _diskstream->can_internal_playback_seek (d); + return _diskstream->can_internal_playback_seek (p); } int -Track::internal_playback_seek (nframes_t d) +Track::internal_playback_seek (framepos_t p) { - return _diskstream->internal_playback_seek (d); + return _diskstream->internal_playback_seek (p); } void @@ -510,7 +510,7 @@ Track::non_realtime_input_change () } void -Track::non_realtime_locate (nframes_t p) +Track::non_realtime_locate (framepos_t p) { _diskstream->non_realtime_locate (p); } @@ -527,7 +527,7 @@ Track::overwrite_existing_buffers () return _diskstream->overwrite_existing_buffers (); } -nframes_t +framecnt_t Track::get_captured_frames (uint32_t n) { return _diskstream->get_captured_frames (n); @@ -540,9 +540,9 @@ Track::set_loop (Location* l) } void -Track::transport_looped (nframes_t f) +Track::transport_looped (framepos_t p) { - _diskstream->transport_looped (f); + _diskstream->transport_looped (p); } bool @@ -587,7 +587,7 @@ Track::n_channels () return _diskstream->n_channels (); } -nframes_t +framepos_t Track::get_capture_start_frame (uint32_t n) { return _diskstream->get_capture_start_frame (n); @@ -599,13 +599,13 @@ Track::alignment_style () const return _diskstream->alignment_style (); } -nframes_t +framepos_t Track::current_capture_start () const { return _diskstream->current_capture_start (); } -nframes_t +framepos_t Track::current_capture_end () const { return _diskstream->current_capture_end (); diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 2bea3b529c..3d00b6283f 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -285,13 +285,13 @@ BasicUI::timecode_time (nframes_t where, Timecode::Time& timecode) } void -BasicUI::timecode_to_sample (Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const +BasicUI::timecode_to_sample (Timecode::Time& timecode, int64_t& sample, bool use_offset, bool use_subframes) const { session->timecode_to_sample (*((Timecode::Time*)&timecode), sample, use_offset, use_subframes); } void -BasicUI::sample_to_timecode (nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const +BasicUI::sample_to_timecode (int64_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const { session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes); } diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index f1bfcaa87c..7e25ea8a90 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -22,6 +22,8 @@ #define __ardour_basic_ui_h__ #include <string> +#include <stdint.h> + #include "pbd/signals.h" #include <jack/types.h> @@ -78,8 +80,8 @@ class BasicUI { jack_nframes_t timecode_frames_per_hour (); void timecode_time (jack_nframes_t where, Timecode::Time&); - void timecode_to_sample (Timecode::Time& timecode, jack_nframes_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_timecode (jack_nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + void timecode_to_sample (Timecode::Time& timecode, int64_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode (int64_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; protected: BasicUI (); diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 72827e9fc9..6dda801ad6 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -24,7 +24,6 @@ #include <vector> #include <iomanip> -#define __STDC_FORMAT_MACROS #include <inttypes.h> #include <float.h> #include <sys/time.h> |