Ejemplo n.º 1
0
static int SessionNotify(lua_State *L)
	{
	int n;
	jack_session_command_t *command;
	cud_t *cud = cud_check(L, 1);
	const char *target = luaL_optstring(L, 2, NULL);
	jack_session_event_type_t type = session_checktype(L, 3);
	const char *path = luaL_optstring(L, 4, NULL);
	command = jack_session_notify(cud->client, target, type, path);
	n = session_pushcommands(L, command);
	luajack_verbose("session_notify ('%s'): target=%s, path=%s -> %d replies\n"
		,lua_tostring(L,3), target ? target : "all", path ? path : "(none)", n);
	jack_session_commands_free(command);	
	return 1;
	}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
	parse_arguments(argc, argv);
	jack_session_command_t *retval;
	int k,i,j;


	/* become a JACK client */
	if ((client = jack_client_open(package, JackNullOption, NULL)) == 0) {
		fprintf(stderr, "JACK server not running?\n");
		exit(1);
	}

	signal(SIGQUIT, signal_handler);
	signal(SIGTERM, signal_handler);
	signal(SIGHUP, signal_handler);
	signal(SIGINT, signal_handler);

	jack_on_shutdown(client, jack_shutdown, 0);

	jack_activate(client);


	retval = jack_session_notify( client, NULL, notify_type, save_path );
	for(i=0; retval[i].uuid; i++ ) {
		printf( "export SESSION_DIR=\"%s%s/\"\n", save_path, retval[i].client_name );
		printf( "%s &\n", retval[i].command );
		add_uuid_mapping(retval[i].uuid); 
	}

	printf( "sleep 10\n" );

	for(k=0; retval[k].uuid; k++ ) {

		char* port_regexp = alloca( jack_client_name_size()+3 );
		char* client_name = jack_get_client_name_by_uuid( client, retval[k].uuid );
		snprintf( port_regexp, jack_client_name_size()+3, "%s:.*", client_name );
		jack_free(client_name);
		const char **ports = jack_get_ports( client, port_regexp, NULL, 0 );
		if( !ports ) {
			continue;
		}
		for (i = 0; ports[i]; ++i) {
			const char **connections;
			if ((connections = jack_port_get_all_connections (client, jack_port_by_name(client, ports[i]))) != 0) {
				for (j = 0; connections[j]; j++) {
					char *src = map_port_name_to_uuid_port( ports[i] ); 
					char *dst = map_port_name_to_uuid_port( connections[j] ); 
					printf( "jack_connect -u \"%s\" \"%s\"\n", src, dst );
				}
				jack_free (connections);
			} 
		}
		jack_free(ports);

	}
	jack_session_commands_free(retval);

	jack_client_close(client);

	return 0;
}