More style-only changes.

git-svn-id: svn://localhost/ardour2/branches/3.0@13939 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2013-01-21 02:35:53 +00:00
parent b40464e67c
commit 76547b5c4b
4 changed files with 59 additions and 48 deletions

View File

@ -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 */

View File

@ -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<framepos_t>& dst,
framepos_t source_start,
framepos_t start, framecnt_t cnt,
MidiStateTracker*,
std::set<Evoral::Parameter> const &) const;
framepos_t source_start,
framepos_t start,
framecnt_t cnt,
MidiStateTracker* tracker,
std::set<Evoral::Parameter> 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<framepos_t>& src,
framepos_t source_start,
framecnt_t cnt);
framepos_t source_start,
framecnt_t cnt);
virtual void append_event_unlocked_beats(const Evoral::Event<Evoral::MusicalTime>& ev) = 0;
virtual void append_event_unlocked_frames(const Evoral::Event<framepos_t>& 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<Evoral::MusicalTime>::StuckNoteOption, Evoral::MusicalTime when = 0);
virtual void mark_midi_streaming_write_completed (
Evoral::Sequence<Evoral::MusicalTime>::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<framepos_t>& 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<framepos_t>& dst,
framepos_t position,
framecnt_t cnt) = 0;
framepos_t position,
framecnt_t cnt) = 0;
std::string _captured_for;

View File

@ -254,21 +254,19 @@ MidiSource::midi_read (Evoral::EventSink<framepos_t>& 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<framepos_t>& source, framepos_t source_start, framecnt_t duration)
MidiSource::midi_write (MidiRingBuffer<framepos_t>& 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;

View File

@ -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<framepos_t>& destination, framepos_t const source_start,
framepos_t start, framecnt_t duration,
MidiStateTracker* tracker) const
SMFSource::read_unlocked (Evoral::EventSink<framepos_t>& 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<framepos_t>& destination, framepos_t
* @param position This source's start position in session frames.
*/
framecnt_t
SMFSource::write_unlocked (MidiRingBuffer<framepos_t>& source, framepos_t position, framecnt_t duration)
SMFSource::write_unlocked (MidiRingBuffer<framepos_t>& 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();