Beispiel #1
0
    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
    {
        const JSList * node;
        const jack_driver_param_t * param;
        int channels = 2;

        for (node = params; node; node = jack_slist_next (node)) {
            param = (const jack_driver_param_t *) node->data;

            switch (param->character) {

                case 'c':
                    channels = param->value.ui;
                    break;
                }
        }

        Jack::JackDriverClientInterface* driver = new Jack::JackLoopbackDriver(engine, table);
        if (driver->Open(1, 1, channels, channels, false, "loopback", "loopback", 0, 0) == 0) {
            return driver;
        } else {
            delete driver;
            return NULL;
        }
    }
Beispiel #2
0
    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
    {
        /*
        unsigned int capture_ports = 2;
        unsigned int playback_ports = 2;
        unsigned long wait_time = 0;
        const JSList * node;
        const jack_driver_param_t * param;
        bool monitor = false;

        for (node = params; node; node = jack_slist_next (node)) {
            param = (const jack_driver_param_t *) node->data;

            switch (param->character) {

                case 'C':
                    capture_ports = param->value.ui;
                    break;

                case 'P':
                    playback_ports = param->value.ui;
                    break;

                case 'r':
                    sample_rate = param->value.ui;
                    break;

                case 'p':
                    period_size = param->value.ui;
                    break;

                case 'w':
                    wait_time = param->value.ui;
                    break;

                case 'm':
                    monitor = param->value.i;
                    break;
            }
        }
        */

        Jack::JackDriverClientInterface* driver = new Jack::JackWinMMEDriver("system_midi", "winmme", engine, table);
        if (driver->Open(1, 1, 0, 0, false, "in", "out", 0, 0) == 0) {
            return driver;
        } else {
            delete driver;
            return NULL;
        }
    }
Beispiel #3
0
        SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
        {
            char upstream[JACK_CLIENT_NAME_SIZE + 1];
            char promiscuous[JACK_CLIENT_NAME_SIZE + 1] = {0};
            char client_name[JACK_CLIENT_NAME_SIZE + 1];
            jack_nframes_t period_size = 1024;  // to be used while waiting for master period_size
            jack_nframes_t sample_rate = 48000; // to be used while waiting for master sample_rate
            int capture_ports = -1;
            int playback_ports = -1;
            const JSList* node;
            const jack_driver_param_t* param;
            bool auto_connect = false;
            bool auto_save = false;
            bool use_promiscuous = false;

            // Possibly use env variable for upstream name
            const char* default_upstream = getenv("JACK_PROXY_UPSTREAM");
            strcpy(upstream, (default_upstream) ? default_upstream : DEFAULT_UPSTREAM);

            // Possibly use env variable for upstream promiscuous
            const char* default_promiscuous = getenv("JACK_PROXY_PROMISCUOUS");
            strcpy(promiscuous, (default_promiscuous) ? default_promiscuous : "");

            // Possibly use env variable for client name
            const char* default_client_name = getenv("JACK_PROXY_CLIENT_NAME");
            strcpy(client_name, (default_client_name) ? default_client_name : DEFAULT_CLIENT_NAME);

#ifdef WIN32
            const char* username = getenv("USERNAME");
#else
            const char* username = getenv("LOGNAME");
#endif

            for (node = params; node; node = jack_slist_next(node)) {
                param = (const jack_driver_param_t*) node->data;
                switch (param->character)
                {
                    case 'u' :
                        assert(strlen(param->value.str) < JACK_CLIENT_NAME_SIZE);
                        strcpy(upstream, param->value.str);
                        break;
                    case 'p':
                        assert(strlen(param->value.str) < JACK_CLIENT_NAME_SIZE);
                        use_promiscuous = true;
                        strcpy(promiscuous, param->value.str);
                        break;
                    case 'C':
                        capture_ports = param->value.i;
                        break;
                    case 'P':
                        playback_ports = param->value.i;
                        break;
                    case 'n' :
                        assert(strlen(param->value.str) < JACK_CLIENT_NAME_SIZE);
                        strncpy(client_name, param->value.str, JACK_CLIENT_NAME_SIZE);
                        break;
                    case 'U' :
                        if (username && *username) {
                            assert(strlen(username) < JACK_CLIENT_NAME_SIZE);
                            strncpy(client_name, username, JACK_CLIENT_NAME_SIZE);
                        }
                    case 'c':
                        auto_connect = true;
                        break;
                    case 's':
                        auto_save = true;
                        break;
                }
            }

            try {

                Jack::JackDriverClientInterface* driver = new Jack::JackWaitCallbackDriver(
                        new Jack::JackProxyDriver("system", "proxy_pcm", engine, table, upstream, use_promiscuous ? promiscuous : NULL, client_name, auto_connect, auto_save));
                if (driver->Open(period_size, sample_rate, 1, 1, capture_ports, playback_ports, false, "capture_", "playback_", 0, 0) == 0) {
                    return driver;
                } else {
                    delete driver;
                    return NULL;
                }

            } catch (...) {
                return NULL;
            }
        }
Beispiel #4
0
    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
    {
        jack_nframes_t srate = 44100;
        jack_nframes_t frames_per_interrupt = 512;
        const char* capture_pcm_name = "";
        const char* playback_pcm_name = "";
        bool capture = false;
        bool playback = false;
        int chan_in = 0;
        int chan_out = 0;
        bool monitor = false;
        const JSList *node;
        const jack_driver_param_t *param;
        jack_nframes_t systemic_input_latency = 0;
        jack_nframes_t systemic_output_latency = 0;
        PortAudioDevices* pa_devices = new PortAudioDevices();

        for (node = params; node; node = jack_slist_next(node))
        {
            param = (const jack_driver_param_t *) node->data;

            switch (param->character) {

            case 'd':
                capture_pcm_name = param->value.str;
                playback_pcm_name = param->value.str;
                break;

            case 'D':
                capture = true;
                playback = true;
                break;

            case 'c':
                chan_in = chan_out = (int)param->value.ui;
                break;

            case 'i':
                chan_in = (int)param->value.ui;
                break;

            case 'o':
                chan_out = (int)param->value.ui;
                break;

            case 'C':
                capture = true;
                if (strcmp(param->value.str, "none") != 0) {
                    capture_pcm_name = param->value.str;
                }
                break;

            case 'P':
                playback = TRUE;
                if (strcmp(param->value.str, "none") != 0) {
                    playback_pcm_name = param->value.str;
                }
                break;

            case 'm':
                monitor = param->value.i;
                break;

            case 'r':
                srate = param->value.ui;
                break;

            case 'p':
                frames_per_interrupt = (unsigned int)param->value.ui;
                break;

            case 'I':
                systemic_input_latency = param->value.ui;
                break;

            case 'O':
                systemic_output_latency = param->value.ui;
                break;

            case 'l':
                pa_devices->DisplayDevicesNames();
                // Stops the server in this case
                return NULL;
            }
        }

        // duplex is the default
        if (!capture && !playback) {
            capture = true;
            playback = true;
        }

        Jack::JackDriverClientInterface* driver = new Jack::JackPortAudioDriver("system", "portaudio", engine, table, pa_devices);
        if (driver->Open(frames_per_interrupt, srate, capture, playback,
            chan_in, chan_out, monitor, capture_pcm_name,
            playback_pcm_name, systemic_input_latency,
            systemic_output_latency) == 0) {
            return driver;
        } else {
            delete driver;
            return NULL;
        }
    }