Exemple #1
0
void 
LADSPAPluginSearch(LADSPAPluginSearchCallbackFunction fCallbackFunction) {

  char * pcBuffer;
  const char * pcEnd;
  const char * pcLADSPAPath;
  const char * pcStart;

  pcLADSPAPath = getenv("LADSPA_PATH");
  if (!pcLADSPAPath) {
    fprintf(stderr,
	    "Warning: You do not have a LADSPA_PATH "
	    "environment variable set. Using \"/usr/lib/ladspa:/usr/local/lib/ladspa\"\n");
    pcLADSPAPath = "/usr/lib/ladspa:/usr/local/lib/ladspa";
  }
  
  pcStart = pcLADSPAPath;
  while (*pcStart != '\0') {
    pcEnd = pcStart;
    while (*pcEnd != ':' && *pcEnd != '\0')
      pcEnd++;
    
    pcBuffer = malloc(1 + pcEnd - pcStart);
    if (pcEnd > pcStart)
      strncpy(pcBuffer, pcStart, pcEnd - pcStart);
    pcBuffer[pcEnd - pcStart] = '\0';
    
    LADSPADirectoryPluginSearch(pcBuffer, fCallbackFunction);
    free(pcBuffer);

    pcStart = pcEnd;
    if (*pcStart == ':')
      pcStart++;
  }
}
Exemple #2
0
    void 
LADSPAPluginSearch(LADSPAPluginSearchCallbackFunction fCallbackFunction,
        void* user_data)
{

    char * pcBuffer;
    const char * pcEnd;
    const char * pcLADSPAPath;
    char *pluginPath;
    const char * pcStart;


    pcLADSPAPath = NULL;

    if(getenv("LADSPA_PATH") && getenv("DSSI_PATH")){ 
        pluginPath = malloc(sizeof(char) * 
                (strlen(getenv("LADSPA_PATH")) + 1) + 
                sizeof(char) * strlen(getenv("DSSI_PATH")));
        sprintf(pluginPath, "%s:%s", 
                getenv("LADSPA_PATH"), getenv("DSSI_PATH"));
        pcLADSPAPath = pluginPath;
        free(pluginPath);
    }
    if (pcLADSPAPath == NULL) {
        fprintf(stderr, "Warning: no LADSPA_PATH and DSSI_PATH, assuming /usr/lib/ladspa:/usr/local/lib/ladspa:/usr/lib/dssi:/usr/local/lib/dssi\n");
        pcLADSPAPath = 
            "/usr/lib/ladspa:/usr/local/lib/ladspa:/usr/lib/dssi:/usr/local/lib/dssi";
    }

    pcStart = pcLADSPAPath;
    while (*pcStart != '\0') {
        pcEnd = pcStart;
        while (*pcEnd != ':' && *pcEnd != '\0')
            pcEnd++;

        pcBuffer = malloc(1 + pcEnd - pcStart);
        if (pcEnd > pcStart)
            strncpy(pcBuffer, pcStart, pcEnd - pcStart);
        pcBuffer[pcEnd - pcStart] = '\0';

        LADSPADirectoryPluginSearch(pcBuffer, fCallbackFunction, user_data);

        pcStart = pcEnd;
        if (*pcStart == ':')
            pcStart++;
    }
}