When recreating ports after 'renaming' a jack client, sort by mode, then alpha.
This commit is contained in:
parent
5b8040b165
commit
d0af570a36
|
@ -186,6 +186,11 @@ namespace JACK
|
|||
void
|
||||
Client::thaw_ports ( void )
|
||||
{
|
||||
/* Sort ports for the sake of clients (e.g. patchage), for
|
||||
* whom the order of creation may matter (for display) */
|
||||
|
||||
_active_ports.sort();
|
||||
|
||||
for ( std::list < JACK::Port * >::iterator i = _active_ports.begin();
|
||||
i != _active_ports.end();
|
||||
++i )
|
||||
|
|
|
@ -100,6 +100,15 @@ namespace JACK
|
|||
|
||||
}
|
||||
|
||||
/* sort input before output and then by alpha */
|
||||
bool
|
||||
Port::operator < ( const Port & rhs ) const
|
||||
{
|
||||
if ( type() == rhs.type() )
|
||||
return strcmp( name(), rhs.name() );
|
||||
else
|
||||
return type() == Port::Input;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
|
@ -224,6 +233,15 @@ namespace JACK
|
|||
return jack_port_get_connections( _port );
|
||||
}
|
||||
|
||||
Port::type_e
|
||||
Port::type ( void ) const
|
||||
{
|
||||
if ( _freezer )
|
||||
return _freezer->direction;
|
||||
else
|
||||
return jack_port_flags( _port ) == JackPortIsOutput ? Output : Input;
|
||||
}
|
||||
|
||||
/** Restore the connections returned by connections() */
|
||||
bool
|
||||
Port::connections ( const char **port_names )
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace JACK
|
|||
|
||||
public:
|
||||
|
||||
bool operator < ( const Port & rhs ) const;
|
||||
|
||||
enum type_e { Output, Input };
|
||||
|
||||
static int max_name ( void );
|
||||
|
@ -56,10 +58,7 @@ namespace JACK
|
|||
|
||||
bool valid ( void ) const { return _port; }
|
||||
bool connected ( void ) const { return jack_port_connected( _port ); }
|
||||
type_e type ( void ) const
|
||||
{
|
||||
return jack_port_flags( _port ) == JackPortIsOutput ? Output : Input;
|
||||
}
|
||||
type_e type ( void ) const;
|
||||
const char * name ( void ) const { return _name; }
|
||||
bool name ( const char *name );
|
||||
bool name ( const char *base, int n, const char *type=0 );
|
||||
|
|
Loading…
Reference in New Issue