13
0

Fix fade-out at quit.

This commit is contained in:
Robin Gareus 2017-10-30 17:27:13 +01:00
parent d6e96a688d
commit b54db1cab7
3 changed files with 25 additions and 10 deletions

View File

@ -181,7 +181,6 @@ class LIBARDOUR_API PortManager
*/
boost::shared_ptr<Ports> _cycle_ports;
void fade_out (gain_t, gain_t, pframes_t);
void silence (pframes_t nframes, Session *s = 0);
void silence_outputs (pframes_t nframes);
void check_monitoring ();
@ -198,6 +197,8 @@ class LIBARDOUR_API PortManager
*/
void cycle_end (pframes_t nframes, Session* s = 0);
void cycle_end_fade_out (gain_t, gain_t, pframes_t, Session* s = 0);
typedef std::map<std::string,MidiPortInformation> MidiPortInfo;
mutable Glib::Threads::Mutex midi_port_info_mutex;

View File

@ -349,8 +349,7 @@ AudioEngine::process_callback (pframes_t nframes)
if (_session == 0) {
if (!_freewheeling) {
PortManager::cycle_start (nframes);
PortManager::cycle_end (nframes);
PortManager::silence_outputs (nframes);
}
_processed_samples = next_processed_samples;
@ -440,7 +439,7 @@ AudioEngine::process_callback (pframes_t nframes)
if (session_remove_pending && session_removal_countdown) {
PortManager::fade_out (session_removal_gain, session_removal_gain_step, nframes);
PortManager::cycle_end_fade_out (session_removal_gain, session_removal_gain_step, nframes, _session);
if (session_removal_countdown > nframes) {
session_removal_countdown -= nframes;
@ -449,10 +448,10 @@ AudioEngine::process_callback (pframes_t nframes)
}
session_removal_gain -= (nframes * session_removal_gain_step);
} else {
PortManager::cycle_end (nframes, _session);
}
PortManager::cycle_end (nframes, _session);
_processed_samples = next_processed_samples;
PT_TIMING_CHECK (2);

View File

@ -869,13 +869,26 @@ PortManager::check_monitoring ()
}
void
PortManager::fade_out (gain_t base_gain, gain_t gain_step, pframes_t nframes)
PortManager::cycle_end_fade_out (gain_t base_gain, gain_t gain_step, pframes_t nframes, Session* s)
{
for (Ports::iterator i = _cycle_ports->begin(); i != _cycle_ports->end(); ++i) {
if (s && s->rt_tasklist ()) {
RTTaskList::TaskList tl;
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
tl.push_back (boost::bind (&Port::cycle_end, p->second, nframes));
}
s->rt_tasklist()->process (tl);
} else {
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
p->second->cycle_end (nframes);
}
}
if (i->second->sends_output()) {
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
p->second->flush_buffers (nframes);
boost::shared_ptr<AudioPort> ap = boost::dynamic_pointer_cast<AudioPort> (i->second);
if (p->second->sends_output()) {
boost::shared_ptr<AudioPort> ap = boost::dynamic_pointer_cast<AudioPort> (p->second);
if (ap) {
Sample* s = ap->engine_get_whole_audio_buffer ();
gain_t g = base_gain;
@ -887,6 +900,8 @@ PortManager::fade_out (gain_t base_gain, gain_t gain_step, pframes_t nframes)
}
}
}
_cycle_ports.reset ();
/* we are done */
}
PortEngine&