Mixer: Make port autoconnection during startup and shutdown more efficient.

This commit is contained in:
Jonathan Moore Liles 2020-12-12 17:24:48 -08:00
parent f6e3ca8831
commit 793a9c1d4b
6 changed files with 25 additions and 22 deletions

View File

@ -301,9 +301,9 @@ JACK_Module::update_connection_status ( void )
return;
}
/* causes a lot of unnecessary redraws to do this when loading */
if ( Project::is_opening() )
return;
/* /\* causes a lot of unnecessary redraws to do this when loading *\/ */
/* if ( Project::is_opening_closing() ) */
/* return; */
/* FIXME: only do something if port list actually changed! */
std::list<std::string> output_names = get_connections_for_ports( aux_audio_output );

View File

@ -1099,7 +1099,7 @@ int
Mixer::handle ( int m )
{
/* if user presses certain keys when project is loading it can cause a crash. Don't respond to input. */
if ( Project::is_opening() )
if ( Project::is_opening_closing() )
return 0;
if ( Fl_Group::handle( m ) )
@ -1179,7 +1179,7 @@ Mixer::get_auto_connect_targets ( void )
void
Mixer::auto_connect ( void )
{
if ( Project::is_opening() )
if ( Project::is_opening_closing() )
/* it's more efficient to do this once at the end rather than as we go. */
return;
@ -1207,7 +1207,7 @@ Mixer::auto_connect ( void )
void
Mixer::maybe_auto_connect_output ( Module::Port *p )
{
if ( Project::is_opening() )
if ( Project::is_opening_closing() )
/* it's more efficient to do this once at the end rather than as we go. */
return;
@ -1223,7 +1223,7 @@ Mixer::maybe_auto_connect_output ( Module::Port *p )
return;
}
/* now do that catch-alls, first one wins! */
/* now do the catch-alls, first one wins! */
for ( int i = 0; i < mixer_strips->children(); i++ )
{
Mixer_Strip *s = ((Mixer_Strip*)mixer_strips->child(i));

View File

@ -1036,18 +1036,17 @@ Mixer_Strip::maybe_auto_connect_output ( Module::Port *p )
if ( ! _auto_input )
{
/* break any previous connection between this port and this module */
/* not accepting auto inputs, so ensure all previous auto
input connection are broken and ignore this port. */
p->disconnect_from_strip(this);
return false;
}
if ( _auto_input && matches_pattern( _auto_input, p ) )
if ( _auto_input &&
matches_pattern( _auto_input, p ) )
{
/* FIXME: would be faster if we avoided breaking and remaking
* the same connections, while still breaking connections that
* will not be remade */
/* got a match, add this to list of accepted connections */
/* break any prior auto-connection */
p->disconnect();
// FIXME: Find a better way to get the port index.

View File

@ -1314,10 +1314,10 @@ Module::auto_disconnect_outputs ( void )
{
Module::Port *p = &aux_audio_output[i];
if ( p->connected_port() )
while ( p->connected() )
{
p->connected_port()->jack_port()->disconnect( p->jack_port()->jack_name() );
p->disconnect();
p->connected_port()->jack_port()->disconnect( p->jack_port()->jack_name() );
p->disconnect(p->connected_port());
}
}
}

View File

@ -58,7 +58,7 @@ char Project::_name[256];
char Project::_created_on[40];
char Project::_path[512];
bool Project::_is_open = false;
bool Project::_is_opening = false;
bool Project::_is_opening_closing = false;
int Project::_lockfd = 0;
@ -193,6 +193,8 @@ Project::close ( void )
if ( ! save() )
return false;
Project::_is_opening_closing = true;
Loggable::close();
/* // write_info(); */
@ -203,6 +205,8 @@ Project::close ( void )
release_lock( &_lockfd, ".lock" );
Project::_is_opening_closing = false;
return true;
}
@ -262,7 +266,7 @@ Project::open ( const char *name )
if ( version != PROJECT_VERSION )
return E_VERSION;
_is_opening = true;
_is_opening_closing = true;
if ( ! Loggable::replay( "snapshot" ) )
return E_INVALID;
@ -282,7 +286,7 @@ Project::open ( const char *name )
_is_open = true;
_is_opening = false;
_is_opening_closing = false;
// tle->load_timeline_settings();
// timeline->zoom_fit();

View File

@ -27,7 +27,7 @@ class Project
static int _lockfd;
static bool _is_open;
static bool _is_opening;
static bool _is_opening_closing;
static char _name[256];
static char _path[512];
static char _created_on[40];
@ -62,5 +62,5 @@ public:
static const char *path ( void ) { return _path; }
static const char *created_on ( void ) { return _created_on; }
static const bool is_opening ( void ) { return _is_opening; }
static const bool is_opening_closing ( void ) { return _is_opening_closing; }
};