Ejemplo n.º 1
0
    void 
    Port::deactivate ( void )
    {
        if ( _port )
				{
#ifdef HAVE_JACK_METADATA
            if ( _type == CV )
						{
                     jack_uuid_t uuid = jack_port_uuid(_port);
										 jack_remove_property(_client->jack_client(), uuid, "http://jackaudio.org/metadata/signal-type");
						}
#endif
            jack_port_unregister( _client->jack_client(), _port );
				}

        _port = 0;
    }
Ejemplo n.º 2
0
static void
_system_port_del(void *data, void *sys_port)
{
	bin_t *bin = data;
	prog_t *handle = (void *)bin - offsetof(prog_t, bin);

	jack_port_t *jack_port = sys_port;

	if(!jack_port || !handle->client)
		return;

#if defined(JACK_HAS_METADATA_API)
	jack_uuid_t uuid = jack_port_uuid(jack_port);
	if(!jack_uuid_empty(uuid))
		jack_remove_properties(handle->client, uuid);
#endif
			
	jack_port_unregister(handle->client, jack_port);
}
Ejemplo n.º 3
0
static gboolean cbox_jack_io_get_jack_uuid_from_name(struct cbox_jack_io_impl *jii, const char *name, jack_uuid_t *uuid, GError **error)
{
    jack_port_t *port = NULL;
    port = jack_port_by_name(jii->client, name);
    if (!port)
    {
        g_set_error(error, CBOX_MODULE_ERROR, CBOX_MODULE_ERROR_FAILED, "Port '%s' not found", name);
        return FALSE;
    }
    assert(uuid);
    jack_uuid_t temp_uuid = jack_port_uuid(port);
    if (!temp_uuid)
    {
        g_set_error(error, CBOX_MODULE_ERROR, CBOX_MODULE_ERROR_FAILED, "JACK uuid for port '%s' not found", name);
        return FALSE;
    }
    *uuid = temp_uuid;
    return TRUE;
}
Ejemplo n.º 4
0
    bool
    Port::activate ( void )
    {
        /* assert( !_port ); */

        int flags = 0;
        
        if ( _direction == Output )
            flags |= JackPortIsOutput;
        else
            flags |= JackPortIsInput;

        if ( _terminal )
            flags |= JackPortIsTerminal;

        char jackname[max_name()];

        snprintf( jackname, sizeof(jackname), "%s%s%s", _trackname ? _trackname : "", _trackname ? "/" : "", _name );

        DMESSAGE( "Activating port name %s", jackname );
        _port = jack_port_register( _client->jack_client(), jackname,
                                    ( _type == Audio ) || ( _type == CV ) ? JACK_DEFAULT_AUDIO_TYPE : JACK_DEFAULT_MIDI_TYPE,
                                    flags,
                                    0 );

#ifdef HAVE_JACK_METADATA
        if ( _type == CV )
        {
                jack_uuid_t uuid = jack_port_uuid( _port );
                jack_set_property( _client->jack_client(), uuid, "http://jackaudio.org/metadata/signal-type", "CV", "text/plain" );
        }
#endif

        DMESSAGE( "Port = %p", _port );

        if ( ! _port )
            return false;

        _client->port_added( this );
 
        return true;
    }
Ejemplo n.º 5
0
static void *
_system_port_add(void *data, system_port_t type, const char *short_name,
	const char *pretty_name, int input)
{
	bin_t *bin = data;
	prog_t *handle = (void *)bin - offsetof(prog_t, bin);
	
	//printf("_system_port_add: %s\n", short_name);

	jack_port_t *jack_port = NULL;

	unsigned long flags = input ? JackPortIsInput : JackPortIsOutput;

	switch(type)
	{
		case SYSTEM_PORT_NONE:
		{
			// skip
			break;
		}

		case SYSTEM_PORT_CONTROL:
		{
			// unsupported, skip
			break;
		}

		case SYSTEM_PORT_AUDIO:
		{
			jack_port = jack_port_register(handle->client, short_name,
				JACK_DEFAULT_AUDIO_TYPE, flags, 0);
			break;
		}
		case SYSTEM_PORT_CV:
		{
			jack_port = jack_port_register(handle->client, short_name,
				JACK_DEFAULT_AUDIO_TYPE, flags, 0);

#if defined(JACK_HAS_METADATA_API)
			if(jack_port)
			{
				jack_uuid_t uuid = jack_port_uuid(jack_port);
				if(!jack_uuid_empty(uuid))
				{
					jack_set_property(handle->client, uuid,
						"http://jackaudio.org/metadata/signal-type", "CV", "text/plain");
				}
			}
#endif
			break;
		}

		case SYSTEM_PORT_MIDI:
		{
			jack_port = jack_port_register(handle->client, short_name,
				JACK_DEFAULT_MIDI_TYPE, flags, 0);
			break;
		}
		case SYSTEM_PORT_OSC:
		{
			jack_port = jack_port_register(handle->client, short_name,
				JACK_DEFAULT_MIDI_TYPE, flags, 0);

#if defined(JACK_HAS_METADATA_API)
			if(jack_port)
			{
				jack_uuid_t uuid = jack_port_uuid(jack_port);
				if(!jack_uuid_empty(uuid))
				{
					jack_set_property(handle->client, uuid,
						"http://jackaudio.org/metadata/event-types", "OSC", "text/plain");
				}
			}
#endif
			break;
		}

		case SYSTEM_PORT_COM:
		{
			// unsupported, skip
			break;
		}
	}

#if defined(JACK_HAS_METADATA_API)
	if(jack_port && pretty_name)
	{
		jack_uuid_t uuid = jack_port_uuid(jack_port);
		if(!jack_uuid_empty(uuid))
		{
			jack_set_property(handle->client, uuid,
				JACK_METADATA_PRETTY_NAME, pretty_name, "text/plain");
		}
	}
#endif

	return jack_port;
}