Example #1
0
int main(int argc, char **argv, char **env) {

	char command_line[128];

	init_embedded_perl();
										/* Calls Perl to load and construct a new 
										 * Term::ReadLine object.
										 */

	init_term_readline();

	while (1) {
										/*
										 * get_command_line calls Perl to get a scalar from stdin
										 */

		strncpy(command_line, get_command_line(), 128) ;

										/* Perl Term::ReadLine::readline() method chomps the "\n"
										 * from the end of the input.
										 */
		run_plugin(command_line) ;
	}

	deinit_embedded_perl();
}
Example #2
0
PRIVATE gboolean output_generator7(Generator *g, SAMPLE *buf, int buflen) {
  Data *data = g->data;
  int i;

  if( data->lastrun != gen_get_sampletime() )
      run_plugin( g, buflen );

  for( i=0; i<buflen; i++ )
      buf[i] = data->outsignals[7][i];

  return TRUE;
}
Example #3
0
int main(int argc, char* argv[]) {
	char* progname = argv[0];
	char* dbfile = getenv("DARWINXREF_DB_FILE");
	char* build = getenv("DARWINBUILD_BUILD");
	const char* plugins = getenv("DARWINXREF_PLUGIN_PATH");
	
	if (dbfile == NULL) dbfile = DEFAULT_DB_FILE;
	if (plugins == NULL) plugins = DEFAULT_PLUGIN_PATH;

	int ch;
	while ((ch = getopt(argc, argv, "f:b:")) != -1) {
		switch (ch) {
		case 'f':
			dbfile = optarg;
			break;
		case 'b':
			build = optarg;
			break;
		case '?':
		default:
			print_usage(progname, argc, argv);
			exit(1);
		}
	}
	argc -= optind;
	argv += optind;

	if (build == NULL) build = readBuildFile();
	if (build == NULL) build = determineHostBuildVersion();

	// special built-in command
	if (argc == 1 && strcmp(argv[0], "info") == 0) {
		printf("%s\n", basename(progname));
		printf("\tcurrent build: %s\n", build);
		printf("\tsqlite/%s (%s)\n", sqlite3_version, "UTF-8");
		printf("\tCoreFoundation/%g %s\n", kCFCoreFoundationVersionNumber, 
		       dlsym(RTLD_DEFAULT, "CFNotificationCenterGetTypeID") ? "" : "(CF-Lite)");
		exit(1);
	}

	DBDataStoreInitialize(dbfile);
	DBSetCurrentBuild(build);
	if (DBPluginLoadPlugins(plugins) == -1) {
	        fprintf(stderr, "Error: cannot load plugins!\n");
		exit(2);
	}
	if (run_plugin(argc, argv) == -1) {
		print_usage(progname, argc, argv);
		exit(1);
	}
	return 0;
}
Example #4
0
void ladspa_process (float * * data, int * samples)
{
    pthread_mutex_lock (& mutex);

    int count = index_count (loadeds);
    for (int i = 0; i < count; i ++)
    {
        LoadedPlugin * loaded = index_get (loadeds, i);
        start_plugin (loaded);
        run_plugin (loaded, * data, * samples);
    }

    pthread_mutex_unlock (& mutex);
}
Example #5
0
PRIVATE void realtime_handler(Generator *g, AEvent *event) {

    //Data *data = g->data;

    switch (event->kind)
    {
	case AE_REALTIME:
	    {
		run_plugin( g, event->d.integer );
		break;
	    }

	default:
	    g_warning("vst module doesn't care for events of kind %d.", event->kind);
	    break;
    }
}
Example #6
0
/*
#<pydoc>
def run_plugin(plg):
    """
    Runs a plugin
    @param plg: A plugin object (returned by load_plugin())
    @return: Boolean
    """
    pass
#</pydoc>
*/
static bool py_run_plugin(PyObject *plg, int arg)
{
  PYW_GIL_CHECK_LOCKED_SCOPE();
  if ( !PyCObject_Check(plg) )
  {
    return false;
  }
  else
  {
    plugin_t *p = (plugin_t *)PyCObject_AsVoidPtr(plg);
    bool rc;
    Py_BEGIN_ALLOW_THREADS;
    rc = run_plugin(p, arg);
    Py_END_ALLOW_THREADS;
    return rc;
  }
}
Example #7
0
int main(int argc, char **argv, char **env) {

	init_embedded_perl();
										/* Calls Perl to load and construct a new 
										 * Term::ReadLine object.
										 */

	init_term_readline();

	while (1) {
										/*
										 * get_command_line calls Perl to get a scalar from stdin
										 */

										/* Perl Term::ReadLine::readline() method chomps the "\n"
										 * from the end of the input.
										 */
		char *cmd,*end;
		/* Allow any length command line */
		cmd = (get_command_line ()) ;

		// Trim leading whitespace
		while (isspace (*cmd)) cmd++;

		// Trim trailing whitespace
		end = cmd + strlen (cmd) - 1;
		while (end > cmd && isspace (*end)) end--;

		// Write new null terminator
		*(end+1) = 0;

		run_plugin (cmd) ;
	}

	deinit_embedded_perl();
}
Example #8
0
int main(int argc, char** argv) {
    uint32_t block_size = 512;
    uint32_t total_samples = 16384;
    uint32_t num_blocks = total_samples / block_size;
    float* drive_in = (float*)malloc(total_samples * sizeof(float));
    Lv2PortBufData drive_in_buf = {0, (void*)drive_in};
    float* thresh_in = (float*)malloc(num_blocks * sizeof(float));
    Lv2PortBufData thresh_in_buf = {1, (void*)thresh_in};
    float* attack_in = (float*)malloc(num_blocks * sizeof(float));
    Lv2PortBufData attack_in_buf = {2, (void*)attack_in};
    float* decay_in = (float*)malloc(num_blocks * sizeof(float));
    Lv2PortBufData decay_in_buf = {3, (void*)decay_in};
    float* sustain_in = (float*)malloc(num_blocks * sizeof(float));
    Lv2PortBufData sustain_in_buf = {4, (void*)sustain_in};
    float* release_in = (float*)malloc(num_blocks * sizeof(float));
    Lv2PortBufData release_in_buf = {5, (void*)release_in};
    float* env_out = (float*)malloc(total_samples * sizeof(float));
    Lv2PortBufData env_out_buf = {6, (void*)env_out};

    memset(drive_in, 0, block_size * sizeof(float));
    *thresh_in=0.1;
    *attack_in=0.1;
    *decay_in=0.1;
    *sustain_in=0.1;
    *release_in=0.1;

    Lv2PortBufData* bufs[] = {
        &drive_in_buf,
        &thresh_in_buf,
        &attack_in_buf,
        &decay_in_buf,
        &sustain_in_buf,
        &release_in_buf,
        &env_out_buf,
        NULL
    };

    Lv2TestSetup setup = {
        "http://drobilla.net/plugins/blop/adsr",
        block_size,
        total_samples,
        48000,
        (Lv2PortBufData**)&bufs
    };

    // Run the plugin
    assert(run_plugin(setup));

    //for (int i=0;i<setup.block_size;i++) {
    //    printf("%f\n", *(out + i));
   // }
    free(drive_in);
    free(thresh_in);
    free(attack_in);
    free(sustain_in);
    free(decay_in);
    free(release_in);
    free(env_out);

    printf("pass: %s\n", setup.plugin_uri);
    return 0;
}
Example #9
0
int
main(int argc, char **argv)
{
    int i, n;

    printf("hexter fixed-point/floating-point speed test, version " VERSION ".\n");
    printf("testing 32 voices for 20 seconds at %d samples/second.\n", SAMPLE_RATE);

    /* get descriptors */
    descriptor[FIX] = dssi_descriptor_fix(0);
    if (descriptor[FIX] == NULL) {
        printf("dssi_descriptor_fix() failed!\n");
        exit(1);
    }
    descriptor[FLOAT] = dssi_descriptor_float(0);
    if (descriptor[FLOAT] == NULL) {
        printf("dssi_descriptor_float() failed!\n");
        exit(1);
    }

    setup_plugin(FIX,   descriptor[FIX]);
    setup_plugin(FLOAT, descriptor[FLOAT]);

    event.type = SND_SEQ_EVENT_NOTEON;
    event.data.note.channel = 0;
    event.data.note.velocity = 80;
    event.time.tick = 0;

    for (i = 0; i < 2; i++) {
        samples[i] = 0;
        note[i] = 36;
        delay[i] = 0;
        usage[i] = 0.0;
    }

    printf("priming voices and cache...\n");
    for (n = 1; n <= 4; n++) {
        printf("  %d\n", n);
        for (i = 0; i < 2; i++) {
            run_plugin(i, n * SAMPLE_RATE);
        }
    }

    printf("timing run...\n");
    for (n = 6; n <= 24; n += 2) {
        double run[2];
        for (i = 0; i < 2; i++) {
            getrusage(RUSAGE_SELF, &before);
            run_plugin(i, n * SAMPLE_RATE);
            getrusage(RUSAGE_SELF, &after);
            run[i] = ((double)after.ru_utime.tv_sec + (double)after.ru_utime.tv_usec / 1000000.0 +
                      (double)after.ru_stime.tv_sec + (double)after.ru_stime.tv_usec / 1000000.0) -
                     ((double)before.ru_utime.tv_sec + (double)before.ru_utime.tv_usec / 1000000.0 +
                      (double)before.ru_stime.tv_sec + (double)before.ru_stime.tv_usec / 1000000.0);
            usage[i] += run[i];
        }
        printf("  %d: run: %f fix, %f float, %5.1f%%, total: %f fix, %f float\n",
               n, run[FIX], run[FLOAT], 100.0 * run[FIX] / run[FLOAT], usage[FIX], usage[FLOAT]);
    }

    if (usage[FIX] > usage[FLOAT]) {
        printf("On this system, with this compilation, it seems that floating point is faster:\n");
        printf("                 seconds     ratio\n");
        printf("Fixed point:     %7f   %5.1f%%\n", usage[FIX], 100.0);
        printf("Floating point:  %7f   %5.1f%%\n", usage[FLOAT], 100.0 * usage[FLOAT] / usage[FIX]);
    } else {
        printf("On this system, with this compilation, it seems that fixed point is faster:\n");
        printf("                 seconds     ratio\n");
        printf("Fixed point:     %7f   %5.1f%%\n", usage[FIX], 100.0 * usage[FIX] / usage[FLOAT]);
        printf("Floating point:  %7f   %5.1f%%\n", usage[FLOAT], 100.0);
    }

    return 0;
}