From 76547b5c4b7fb2d4fbb7db9f12427b439da34a43 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 21 Jan 2013 02:35:53 +0000 Subject: More style-only changes. git-svn-id: svn://localhost/ardour2/branches/3.0@13939 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/midi_diskstream.h | 2 +- libs/ardour/ardour/midi_source.h | 37 +++++++++++++++--------- libs/ardour/midi_source.cc | 14 ++++----- libs/ardour/smf_source.cc | 56 +++++++++++++++++++----------------- 4 files changed, 60 insertions(+), 49 deletions(-) diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 26a27a87e4..45ea975ea9 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -200,7 +200,7 @@ class MidiDiskstream : public Diskstream the GUI to read (so that it can update itself). */ MidiBuffer _gui_feed_buffer; - mutable Glib::Threads::Mutex _gui_feed_buffer_mutex; + mutable Glib::Threads::Mutex _gui_feed_buffer_mutex; }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 1a7f3b07c5..ed2950e9e5 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -61,19 +61,25 @@ class MidiSource : virtual public Source, public boost::enable_shared_from_this< * \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking */ virtual framecnt_t midi_read (Evoral::EventSink& dst, - framepos_t source_start, - framepos_t start, framecnt_t cnt, - MidiStateTracker*, - std::set const &) const; - + framepos_t source_start, + framepos_t start, + framecnt_t cnt, + MidiStateTracker* tracker, + std::set const &) const; + + /** Write data from a MidiRingBuffer to this source. + * @param source Source to read from. + * @param source_start This source's start position in session frames. + * @param cnt The length of time to write. + */ virtual framecnt_t midi_write (MidiRingBuffer& src, - framepos_t source_start, - framecnt_t cnt); + framepos_t source_start, + framecnt_t cnt); virtual void append_event_unlocked_beats(const Evoral::Event& ev) = 0; virtual void append_event_unlocked_frames(const Evoral::Event& ev, - framepos_t source_start) = 0; + framepos_t source_start) = 0; virtual bool empty () const; virtual framecnt_t length (framepos_t pos) const; @@ -89,7 +95,9 @@ class MidiSource : virtual public Source, public boost::enable_shared_from_this< * when recording actual MIDI input, rather then when importing files * etc. */ - virtual void mark_midi_streaming_write_completed (Evoral::Sequence::StuckNoteOption, Evoral::MusicalTime when = 0); + virtual void mark_midi_streaming_write_completed ( + Evoral::Sequence::StuckNoteOption stuck_option, + Evoral::MusicalTime when = 0); virtual void session_saved(); @@ -144,13 +152,14 @@ class MidiSource : virtual public Source, public boost::enable_shared_from_this< virtual void flush_midi() = 0; virtual framecnt_t read_unlocked (Evoral::EventSink& dst, - framepos_t position, - framepos_t start, framecnt_t cnt, - MidiStateTracker* tracker) const = 0; + framepos_t position, + framepos_t start, + framecnt_t cnt, + MidiStateTracker* tracker) const = 0; virtual framecnt_t write_unlocked (MidiRingBuffer& dst, - framepos_t position, - framecnt_t cnt) = 0; + framepos_t position, + framecnt_t cnt) = 0; std::string _captured_for; diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index ff3ff55ced..7ec82ed4e6 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -254,21 +254,19 @@ MidiSource::midi_read (Evoral::EventSink& dst, framepos_t source_sta } } -/** Write data from a MidiRingBuffer to this source. - * @param source Source to read from. - * @param source_start This source's start position in session frames. - */ framecnt_t -MidiSource::midi_write (MidiRingBuffer& source, framepos_t source_start, framecnt_t duration) +MidiSource::midi_write (MidiRingBuffer& source, + framepos_t source_start, + framecnt_t cnt) { Glib::Threads::Mutex::Lock lm (_lock); - const framecnt_t ret = write_unlocked (source, source_start, duration); + const framecnt_t ret = write_unlocked (source, source_start, cnt); - if (duration == max_framecnt) { + if (cnt == max_framecnt) { _last_read_end = 0; } else { - _last_write_end += duration; + _last_write_end += cnt; } return ret; diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 626676ea83..2b4c7ef7c9 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -65,7 +65,7 @@ SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags) throw failed_constructor (); } - /* file is not opened until write */ + /* file is not opened until write */ } /** Constructor used for existing internal-to-session files. */ @@ -90,7 +90,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist) throw failed_constructor (); } - _open = true; + _open = true; } SMFSource::~SMFSource () @@ -104,25 +104,27 @@ int SMFSource::open_for_write () { if (create (_path)) { - return -1; - } - _open = true; - return 0; + return -1; + } + _open = true; + return 0; } /** All stamps in audio frames */ framecnt_t -SMFSource::read_unlocked (Evoral::EventSink& destination, framepos_t const source_start, - framepos_t start, framecnt_t duration, - MidiStateTracker* tracker) const +SMFSource::read_unlocked (Evoral::EventSink& destination, + framepos_t const source_start, + framepos_t start, + framecnt_t duration, + MidiStateTracker* tracker) const { int ret = 0; uint64_t time = 0; // in SMF ticks, 1 tick per _ppqn - if (writable() && !_open) { - /* nothing to read since nothing has ben written */ - return duration; - } + if (writable() && !_open) { + /* nothing to read since nothing has ben written */ + return duration; + } DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("SMF read_unlocked: start %1 duration %2\n", start, duration)); @@ -214,11 +216,13 @@ SMFSource::read_unlocked (Evoral::EventSink& destination, framepos_t * @param position This source's start position in session frames. */ framecnt_t -SMFSource::write_unlocked (MidiRingBuffer& source, framepos_t position, framecnt_t duration) +SMFSource::write_unlocked (MidiRingBuffer& source, + framepos_t position, + framecnt_t duration) { - if (!_writing) { - mark_streaming_write_started (); - } + if (!_writing) { + mark_streaming_write_started (); + } framepos_t time; Evoral::EventType type; @@ -405,13 +409,13 @@ SMFSource::set_state (const XMLNode& node, int version) void SMFSource::mark_streaming_midi_write_started (NoteMode mode) { - /* CALLER MUST HOLD LOCK */ + /* CALLER MUST HOLD LOCK */ - if (!_open && open_for_write()) { - error << string_compose (_("cannot open MIDI file %1 for write"), _path) << endmsg; - /* XXX should probably throw or return something */ - return; - } + if (!_open && open_for_write()) { + error << string_compose (_("cannot open MIDI file %1 for write"), _path) << endmsg; + /* XXX should probably throw or return something */ + return; + } MidiSource::mark_streaming_midi_write_started (mode); Evoral::SMF::begin_write (); @@ -489,9 +493,9 @@ SMFSource::load_model (bool lock, bool force_reload) _model->clear(); } - if (writable() && !_open) { - return; - } + if (writable() && !_open) { + return; + } _model->start_write(); Evoral::SMF::seek_to_start(); -- cgit v1.2.3