Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Important API & OPCODEDIR problems

Date2005-10-03 08:46
FromVictor Lazzarini
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
I have been working lately on a Tcl/Tk frontend and the API
has not given me any problems.

As for OPCODEDIR setting, is it possible to provide an API
function in csound.h for doing it (similar to the ones in
envvar.h?). I'm using the stdlib setenv() to do it in the
frontend,
as in the Mac, environment vars only work from the terminal.

Perhaps that would be a neat way of setting all csound env
vars
from a host application on all platforms.

Victor
>
> Ok, so the question is, does the api work for anyone from
> a host right  now? And if so, could I see the code and
> csound settings so I can test  it out here?
>
> Thanks
> Iain
>
> Istvan Varga wrote:
> > OPCODEDIR cannot be more than one directory.
> >
> > Michael Gogins wrote:
> >
> >> In your case it sounds like it should be
> >>
> >> export OPCODEDIR=/csound5:/csound5/opcodes
> >>
> >> You are on Linux or Mac, right? On windows that would
> be >>
> >> set OPCODEDIR=c:\csound5\;c:\csound5\opcodes
> >>
> >> probably.
> >>
> >> In other words, you need both directories in OPCODEDIR.
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by:
> > Power Architecture Resource Center: Free content,
> > downloads, discussions, and more.
> > http://solutions.newsforge.com/ibmarch.tmpl
> > _______________________________________________
> > Csound-devel mailing list
> > Csound-devel@lists.sourceforge.net
> >
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content,
> downloads, discussions, and more.
> http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-03 08:59
Frommatt
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
at one point i added a setenv/getenv mechanism that last i looked was
#ifdefed out in the api, presumably because i override the clib
functions, but that could easily be changed.

     typedef struct Environs
     {
         char *environmentVariableName;
         char *path;
     } Environs;

    #define  MAX_ENVIRONS = 10;
     Environs csoundEnv_[10];   // needs to be put in globals struct
     int csoundNumEnvs_ = 0;  // needs to be put in globals struct

     void csoundSetEnv(void *csound, const char  
*environmentVariableName, const char *path)
     {
         int i = 0;

         if (!environmentVariableName || !path)
             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;
         }

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

     char *csoundGetEnv(const char *environmentVariableName)
     {
         int i;
         for (i = 0; i < csoundNumEnvs_; i++)
         {
             if (strcmp(csoundEnv_[i].environmentVariableName,  
environmentVariableName) == 0)
             {
                 return (csoundEnv_[i].path);
             }
         }
         return 0;
     }

     void csoundClearEnv()
     {
         int i;

         for (i = 0; i < csoundNumEnvs_; i++)
         {
             mfree(csoundEnv_[i].environmentVariableName);
             mfree(csoundEnv_[i].path);
         }

         csoundNumEnvs_ = 0;
     }


/* override gentenv */
char *getenv(const char *envi)
{
     return csoundGetEnv(envi);
}




On Oct 3, 2005, at 12:46 AM, Victor Lazzarini wrote:

> I have been working lately on a Tcl/Tk frontend and the API
> has not given me any problems.
>
> As for OPCODEDIR setting, is it possible to provide an API
> function in csound.h for doing it (similar to the ones in
> envvar.h?). I'm using the stdlib setenv() to do it in the
> frontend,
> as in the Mac, environment vars only work from the terminal.
>
> Perhaps that would be a neat way of setting all csound env
> vars
> from a host application on all platforms.
>
> Victor
>
>>
>> Ok, so the question is, does the api work for anyone from
>> a host right  now? And if so, could I see the code and
>> csound settings so I can test  it out here?
>>
>> Thanks
>> Iain
>>
>> Istvan Varga wrote:
>>
>>> OPCODEDIR cannot be more than one directory.
>>>
>>> Michael Gogins wrote:
>>>
>>>
>>>> In your case it sounds like it should be
>>>>
>>>> export OPCODEDIR=/csound5:/csound5/opcodes
>>>>
>>>> You are on Linux or Mac, right? On windows that would
>>>>
>> be >>
>>
>>>> set OPCODEDIR=c:\csound5\;c:\csound5\opcodes
>>>>
>>>> probably.
>>>>
>>>> In other words, you need both directories in OPCODEDIR.
>>>>
>>>
>>>
>>>
>>> -------------------------------------------------------
>>> This SF.Net email is sponsored by:
>>> Power Architecture Resource Center: Free content,
>>> downloads, discussions, and more.
>>> http://solutions.newsforge.com/ibmarch.tmpl
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>>
>>>
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by:
>> Power Architecture Resource Center: Free content,
>> downloads, discussions, and more.
>> http://solutions.newsforge.com/ibmarch.tmpl
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,  
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>

-m@
________________________
           matt  ingalls
http://sfsound.org/matt.html



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-03 09:11
FromIain Duncan
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
> I have been working lately on a Tcl/Tk frontend and the API
> has not given me any problems.

Which operating system Victor? Do you mind trying my example and seeing 
if it will work for you? ( or anyone else? )

Thanks
Iain


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-03 09:22
FromDavid Akbari
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
On Oct 3, 2005, at 3:46 AM, Victor Lazzarini wrote:

>
> as in the Mac, environment vars only work from the terminal.
>

Actually I stumbled on a poorly documented bit of information on the 
Apple website that mentions the ability to set environment variables 
which will then be loaded by any Aqua app. This could be useful for say 
a MacCsound5.app or a Cecilia.app for Csound5.

The trick is that there is a hidden directory in your $HOME which is 
called .MacOSX;

Inside this directory there needs to be a file (not created by any app 
so you will have to make it) called "environment.plist" and that file 
contains XML flags encapsulating the various environment variables.

For example, for a user to use canonical [csoundapi~] in Pd, you could 
put this as the contents of your ~/.MacOSX/environment.plist :






     OPCODEDIR
     /Users/You/CVS/csound5

     OPCODEDIR64
     /Users/You/CVS/csound5

etc etc ...





-David



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-03 10:20
FromIstvan Varga
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
Not based on your code, but nevertheless there is this function:

   /**
    * Set the default value of environment variable 'name' to 'value'.
    * It is not safe to call this function while any Csound instances
    * are active.
    * Returns zero on success.
    */
   PUBLIC int csoundSetDefaultEnv(const char *name, const char *value);

As it uses a static array that is shared by all instances of Csound,
this function is only safe to call before any API functions that may
possibly use environment variables. The environment set this way
overrides system environment variables (including those set with
setenv()). value=NULL means deleting the variable, and as a result
making the system variable, if any, available again.
So, this simple host example should work:

     CSOUND *csound;
     csoundSetDefaultEnv("OPCODEDIR", "/csound5/plugins");
     csound = csoundCreate(NULL);
     if (csoundCompile(csound, argc, argv) == 0) {
       while (!csoundPerformKsmps(csound));
     }
     csoundDestroy(csound);

matt wrote:

> at one point i added a setenv/getenv mechanism that last i looked was
> #ifdefed out in the api, presumably because i override the clib
> functions, but that could easily be changed.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-03 13:07
FromVictor Lazzarini
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
OSX, but hopefully will test on Linux and Windows soon.
I can have a look at your example, but it will have to be more
towards the end of the week. Perhaps Istvan can test it sooner.

Victor

At 09:11 03/10/2005, you wrote:
>>I have been working lately on a Tcl/Tk frontend and the API
>>has not given me any problems.
>
>Which operating system Victor? Do you mind trying my example and seeing if 
>it will work for you? ( or anyone else? )
>
>Thanks
>Iain
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by:
>Power Architecture Resource Center: Free content, downloads, discussions,
>and more. http://solutions.newsforge.com/ibmarch.tmpl
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-03 13:09
FromVictor Lazzarini
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
That's great thanks for the tip!

Victor

At 09:22 03/10/2005, you wrote:

>On Oct 3, 2005, at 3:46 AM, Victor Lazzarini wrote:
>
>>
>>as in the Mac, environment vars only work from the terminal.
>
>Actually I stumbled on a poorly documented bit of information on the Apple 
>website that mentions the ability to set environment variables which will 
>then be loaded by any Aqua app. This could be useful for say a 
>MacCsound5.app or a Cecilia.app for Csound5.
>
>The trick is that there is a hidden directory in your $HOME which is 
>called .MacOSX;
>
>Inside this directory there needs to be a file (not created by any app so 
>you will have to make it) called "environment.plist" and that file 
>contains XML flags encapsulating the various environment variables.
>
>For example, for a user to use canonical [csoundapi~] in Pd, you could put 
>this as the contents of your ~/.MacOSX/environment.plist :
>
>
>"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>
>
>
>     OPCODEDIR
>     /Users/You/CVS/csound5
>
>     OPCODEDIR64
>     /Users/You/CVS/csound5
>
>etc etc ...
>
>
>
>
>
>-David
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by:
>Power Architecture Resource Center: Free content, downloads, discussions,
>and more. http://solutions.newsforge.com/ibmarch.tmpl
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-04 20:34
FromIain Duncan
SubjectRe: [Cs-dev] Important API & OPCODEDIR problems
So yeah, don't sweat the testing, got it fixed up again. I am curious as 
to why you chose Tcl/TK to do yours, is that because PD uses it?

Eventually I think it would be great to have examples available in a 
number of languages, I will be doing mine in C and Python.

Thanks
Iain

Victor Lazzarini wrote:
> OSX, but hopefully will test on Linux and Windows soon.
> I can have a look at your example, but it will have to be more
> towards the end of the week. Perhaps Istvan can test it sooner.
> 
> Victor
> 
> At 09:11 03/10/2005, you wrote:
> 
>>> I have been working lately on a Tcl/Tk frontend and the API
>>> has not given me any problems.
>>
>>
>> Which operating system Victor? Do you mind trying my example and 
>> seeing if it will work for you? ( or anyone else? )
>>
>> Thanks
>> Iain
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by:
>> Power Architecture Resource Center: Free content, downloads, discussions,
>> and more. http://solutions.newsforge.com/ibmarch.tmpl
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 
> Victor Lazzarini
> Music Technology Laboratory
> Music Department
> National University of Ireland, Maynooth
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net