Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Channels

Date2009-02-05 22:06
FromPinball
SubjectRe: [Cs-dev] Channels
AttachmentsNone  None  
jpff wrote:
As we edge towards multiprocessor Csound we need to look at places in the code that need protection. I have protected memory allocation. Now looking at the channels; each channel needs a lock, but the GetChannelPtr function yields the data but not the structure that includes any lock. So either we need a largely redundant GetChannelLock or need to change GetChannelPtr to give the lock location as well as the data. Or have I missed some alternative? Any thoughts or ideas? ==John ffitch

I don't think it's up to the "user" to handle the lock.
I wouldn't make a Channel Ptr available either.
I would export a function called

res_type csoundSetParameter (param_name_type, param_value_type);
The locking will be handled internally, like this...
... csoundSetParameter...
{
    LOCK();

    //...

    UNLOCK();
}
SOME SAMPLE USAGE:
1)
int ret = csoundSetParameter("delay", 20);
or
2)
#define PARAM_TYPE_VAL	1
#define PARAM_TYPE_REF	2

typedef struct _param
{
    int type,
    MYFLT val,
    MYFLT *ref,
    int count

} PARAM;


PARAM param;

param.type = PARAM_TYPE_VAL;
param.val = 20;

int ret = csoundSetParameter("delay", ¶m);


View this message in context: Re: Channels
Sent from the Csound - Dev mailing list archive at Nabble.com.

Date2009-02-05 22:34
FromFons Adriaensen
SubjectRe: [Cs-dev] Channels
AttachmentsNone  

Date2009-02-06 00:11
FromPinball
SubjectRe: [Cs-dev] Channels


Fons Adriaensen-2 wrote:
> 
> On Thu, Feb 05, 2009 at 02:02:43PM -0800, Pinball wrote:
> 
> Which would mean a lot of back-to-back UNLOCK();LOCK() pairs
> if a users want to modifiy not one but a set of parameters,
> each pair potentially being two system calls.
> 


For bulk operations you can pass data by the "ref" pointer. 
That's why i provided the PARAM_TYPE_REF option. The 
Orchestra code should be able to define the parameters 
contiguously.

Ciao





-- 
View this message in context: http://www.nabble.com/Channels-tp21852607p21864136.html
Sent from the Csound - Dev mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2009-02-11 15:58
FromPinball
SubjectRe: [Cs-dev] Channels
AttachmentsNone  None  
Anyway since an api like csoundSetParameter would be called while performing, i wouldn't address the parameter by name, directly, like this:
int ret = csoundSetParameter("delay", 20);
Resolving the name might take precious time. A resolution function, to be called before starting the performance, would be a solution.
int param_index_delay = getParameterByName("Delay");
int param_index_gain = getParameterByName("Gain");

// start the performance
// ...

csoundSetParameter(param_index_delay, 20);
csoundSetParameter(param_index_gain, 0.7);
This assumes that, internally, there's an array of channel pointers.

View this message in context: Re: Channels
Sent from the Csound - Dev mailing list archive at Nabble.com.