예제 #1
0
파일: jack.c 프로젝트: huuh/huuwax
int jack_init(struct device *dv, const char *name)
{
    struct jack *jack;

    /* If this is the first JACK deck, initialise the global JACK services */

    if (client == NULL) {
        if (start_jack_client() == -1)
            return -1;
    }

    jack = malloc(sizeof(struct jack));
    if (jack == NULL) {
        perror("malloc");
        return -1;
    }

    jack->started = false;
    if (register_ports(jack, name) == -1)
        goto fail;

    dv->local = jack;
    dv->ops = &jack_ops;

    assert(ndeck < sizeof device);
    device[ndeck] = dv;
    ndeck++;

    return 0;

 fail:
    free(jack);
    return -1;
}
예제 #2
0
파일: jack.c 프로젝트: doublerebel/s-xwax
int jack_init(struct device_t *dv, const char *name)
{
    struct jack_t *jack;

    /* If this is the first JACK deck, initialise the global JACK services */

    if (client == NULL) {
        if (start_jack_client() == -1)
            return -1;
    }

    jack = malloc(sizeof(struct jack_t));
    if (!jack) {
        perror("malloc");
        return -1;
    }

    jack->started = 0;
    if (register_ports(jack, name) == -1)
        goto fail;

    dv->local = jack;
    dv->type = &jack_type;

    assert(decks < MAX_DECKS);
    device[decks] = dv;
    decks++;

    return 0;

 fail:
    free(jack);
    return -1;
}