Logo Search packages:      
Sourcecode: csound version File versions  Download package

PUBLIC void csoundSetEnv ( void *  csound,
const char *  environmentVariableName,
const char *  path 
)

Sets an evironment path for a getenv() call in Csound. you can also use this method as a way to have different csound instances have different default directories, change the default dirs during performance, etc..

Currently, Csound uses these 'envi' names only: "SSDIR", "SFDIR", "SADIR", "SFOUTYP", "INCDIR", "CSSTRNGS", "MIDIOUTDEV", and "HOME"

Definition at line 962 of file csound.c.

  {
    int i = 0;
    if (!environmentVariableName || !path)
      return;

    if (csoundEnv_ == NULL)
      {
        csoundEnv_ = (Environs *) mcalloc(MAX_ENVIRONS * sizeof(Environs));
        if (!csoundEnv_)
          {
            return;
          }
      }
    for (i = 0; i < csoundNumEnvs_; i++)
      {
        if (strcmp(csoundEnv_[i].environmentVariableName, environmentVariableName) == 0)
          {
            mrealloc(csoundEnv_[i].path, strlen(path)+1);
            strcpy(csoundEnv_[i].path, path);
            return;
          }
      }
    if (csoundNumEnvs_ >= MAX_ENVIRONS)
      {
        warning("Exceeded maximum number of environment paths");
        return;
      }

    csoundNumEnvs_++;
    csoundEnv_[csoundNumEnvs_].environmentVariableName =  mmalloc(strlen(environmentVariableName)+1);
    strcpy(csoundEnv_[csoundNumEnvs_].environmentVariableName, environmentVariableName);
    csoundEnv_[csoundNumEnvs_].path = mmalloc(strlen(path) + 1);
    strcpy(csoundEnv_[csoundNumEnvs_].path, path);
  }


Generated by  Doxygen 1.6.0   Back to index