13
0

Add Process Graph API for Route::silence() processing

This commit is contained in:
Robin Gareus 2022-06-03 22:45:17 +02:00
parent 57a1dbb375
commit 3e1e0d94c5
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 41 additions and 7 deletions

View File

@ -75,6 +75,7 @@ public:
/* public API for use by session-process */
int process_routes (boost::shared_ptr<GraphChain> chain, pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler);
int routes_no_roll (boost::shared_ptr<GraphChain> chain, pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool non_rt_pending);
int silence_routes (boost::shared_ptr<GraphChain> chain, pframes_t nframes);
int process_io_plugs (boost::shared_ptr<GraphChain> chain, pframes_t nframes, samplepos_t start_sample);
bool in_process_thread () const;
@ -134,6 +135,10 @@ private:
bool _process_can_record;
bool _process_non_rt_pending;
enum ProcessMode {
Roll, NoRoll, Silence
} _process_mode;
bool _process_noroll;
int _process_retval;
bool _process_need_butler;

View File

@ -441,7 +441,7 @@ Graph::process_routes (boost::shared_ptr<GraphChain> chain, pframes_t nframes, s
_process_start_sample = start_sample;
_process_end_sample = end_sample;
_process_noroll = false;
_process_mode = Roll;
_process_retval = 0;
_process_need_butler = false;
@ -468,9 +468,8 @@ Graph::routes_no_roll (boost::shared_ptr<GraphChain> chain, pframes_t nframes, s
_process_nframes = nframes;
_process_start_sample = start_sample;
_process_end_sample = end_sample;
_process_non_rt_pending = non_rt_pending;
_process_noroll = true;
_process_mode = NoRoll;
_process_retval = 0;
_process_need_butler = false;
@ -482,6 +481,29 @@ Graph::routes_no_roll (boost::shared_ptr<GraphChain> chain, pframes_t nframes, s
return _process_retval;
}
int
Graph::silence_routes (boost::shared_ptr<GraphChain> chain, pframes_t nframes)
{
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("silence graph execution from %1 for = %2\n", nframes));
if (g_atomic_int_get (&_terminate)) {
return 0;
}
_graph_chain = chain.get ();
_process_nframes = nframes;
_process_mode = Silence;
_process_retval = 0;
_process_need_butler = false;
DEBUG_TRACE (DEBUG::ProcessThreads, "wake graph for silence process\n");
_callback_start_sem.signal ();
_callback_done_sem.wait ();
DEBUG_TRACE (DEBUG::ProcessThreads, "graph execution complete\n");
return _process_retval;
}
int
Graph::process_io_plugs (boost::shared_ptr<GraphChain> chain, pframes_t nframes, samplepos_t start_sample)
{
@ -513,10 +535,17 @@ Graph::process_one_route (Route* route)
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_name (), route->name ()));
if (_process_noroll) {
retval = route->no_roll (_process_nframes, _process_start_sample, _process_end_sample, _process_non_rt_pending);
} else {
retval = route->roll (_process_nframes, _process_start_sample, _process_end_sample, need_butler);
switch (_process_mode) {
case Roll:
retval = route->roll (_process_nframes, _process_start_sample, _process_end_sample, need_butler);
break;
case NoRoll:
retval = route->no_roll (_process_nframes, _process_start_sample, _process_end_sample, _process_non_rt_pending);
break;
case Silence:
retval = 0;
route->silence (_process_nframes);
break;
}
if (retval) {