@@ -186,6 +186,11 @@ namespace JACK | |||||
void | void | ||||
Client::thaw_ports ( 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(); | for ( std::list < JACK::Port * >::iterator i = _active_ports.begin(); | ||||
i != _active_ports.end(); | i != _active_ports.end(); | ||||
++i ) | ++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 * | static const char * | ||||
@@ -224,6 +233,15 @@ namespace JACK | |||||
return jack_port_get_connections( _port ); | 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() */ | /** Restore the connections returned by connections() */ | ||||
bool | bool | ||||
Port::connections ( const char **port_names ) | Port::connections ( const char **port_names ) | ||||
@@ -39,6 +39,8 @@ namespace JACK | |||||
public: | public: | ||||
bool operator < ( const Port & rhs ) const; | |||||
enum type_e { Output, Input }; | enum type_e { Output, Input }; | ||||
static int max_name ( void ); | static int max_name ( void ); | ||||
@@ -56,10 +58,7 @@ namespace JACK | |||||
bool valid ( void ) const { return _port; } | bool valid ( void ) const { return _port; } | ||||
bool connected ( void ) const { return jack_port_connected( _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; } | const char * name ( void ) const { return _name; } | ||||
bool name ( const char *name ); | bool name ( const char *name ); | ||||
bool name ( const char *base, int n, const char *type=0 ); | bool name ( const char *base, int n, const char *type=0 ); | ||||