prevent MIDI tracks from ever being in MonitoringSilence state, allows use of piano roll whether rolling or not

git-svn-id: svn://localhost/ardour2/branches/3.0@13679 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-12-19 01:20:37 +00:00
parent 844ce9f359
commit 99c848455a
6 changed files with 42 additions and 5 deletions

View File

@ -102,6 +102,7 @@ public:
boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
void set_monitoring (MonitorChoice);
MonitorState monitoring_state () const;
void set_input_active (bool);
bool input_active () const;

View File

@ -527,6 +527,8 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
boost::shared_ptr<Amp> _amp;
boost::shared_ptr<PeakMeter> _meter;
boost::shared_ptr<Processor> the_instrument_unlocked() const;
private:
int set_state_2X (const XMLNode&, int);
void set_processor_state_2X (XMLNodeList const &, int);

View File

@ -51,7 +51,7 @@ class Track : public Route, public PublicDiskstream
virtual void set_monitoring (MonitorChoice);
MonitorChoice monitoring_choice() const { return _monitoring; }
MonitorState monitoring_state () const;
MonitorState monitoring_state () const;
PBD::Signal0<void> MonitoringChanged;
MeterState metering_state () const;

View File

@ -352,7 +352,9 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
BufferSet& bufs = _session.get_scratch_buffers (n_process_buffers());
MidiBuffer& mbuf (bufs.get_midi (0));
/* we are a MIDI track, so we always start the chain with a single-channel diskstream */
/* we are a MIDI track, so we always start the chain with a
* single-MIDI-channel diskstream
*/
ChanCount c;
c.set_audio (0);
c.set_midi (1);
@ -772,3 +774,12 @@ MidiTrack::set_monitoring (MonitorChoice mc)
}
}
MonitorState
MidiTrack::monitoring_state () const
{
MonitorState ms = Track::monitoring_state();
if (ms == MonitoringSilence) {
return MonitoringInput;
}
return ms;
}

View File

@ -4114,6 +4114,12 @@ boost::shared_ptr<Processor>
Route::the_instrument () const
{
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
return the_instrument_unlocked ();
}
boost::shared_ptr<Processor>
Route::the_instrument_unlocked () const
{
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
if (boost::dynamic_pointer_cast<PluginInsert>(*i)) {
if ((*i)->input_streams().n_midi() > 0 &&
@ -4125,6 +4131,8 @@ Route::the_instrument () const
return boost::shared_ptr<Processor>();
}
void
Route::non_realtime_locate (framepos_t pos)
{

View File

@ -370,19 +370,34 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
into the route.
*/
be_silent = true;
} else {
MonitorState const s = monitoring_state ();
/* we are not rolling, so be silent even if we are monitoring disk, as there
will be no disk data coming in.
*/
be_silent = (s == MonitoringSilence || s == MonitoringDisk);
switch (s) {
case MonitoringSilence:
/* if there is an instrument, be_silent should always
be false
*/
be_silent = (the_instrument_unlocked() == 0);
break;
case MonitoringDisk:
be_silent = true;
break;
case MonitoringInput:
be_silent = false;
break;
}
}
if (!_have_internal_generator && metering_state() == MeteringInput) {
_input->process_input (_meter, start_frame, end_frame, nframes);
}
_amp->apply_gain_automation(false);
_amp->apply_gain_automation (false);
/* if have_internal_generator, or .. */
//_input->process_input (_meter, start_frame, end_frame, nframes);