Csound Csound-dev Csound-tekno Search About

[Csnd] left/right from csoundGetOutputBuffer

Date2014-01-09 10:36
Fromimaia
Subject[Csnd] left/right from csoundGetOutputBuffer
Hello,

In my code I handle my own IO, so I manage buffers directly:
csoundGetInputBuffer/ csoundPerformBuffer / csoundGetOutputBuffer
I turned off csound´s IO:
    csoundSetRTAudioModule(cs,"null");  
    csoundSetHostImplementedAudioIO(cs,1,bufsz);

I use jack to route outbuffer to/from several CS instances(each one
nchnls=1), the jack´s "process" code is:
...
    jack_default_audio_sample_t *in;
    jack_default_audio_sample_t *out;
    MYFLT * cs_i;
    MYFLT * cs_o;
        
    in  = jack_port_get_buffer (ch->in, nframes);
    out = jack_port_get_buffer (ch->out, nframes);
     
    cs_i = csoundGetInputBuffer(ch->cs);    
    
    //feeds csound's input buffer
    memcpy (cs_i, in,
             sizeof (jack_default_audio_sample_t) * nframes);
        
    //process a buffer
    csoundPerformBuffer(ch->cs);
        
    cs_o = csoundGetOutputBuffer(ch->cs);    
    //copy csound's output buffer to the channel's output  
    memcpy (out, cs_o,
              sizeof (jack_default_audio_sample_t) * nframes);

It works just fine with a mono channel  (nchnls=1)

Now I would like to use pan2 opcode in my .csd and I turned nchnls=2

The problem is how can I get left/right parts of cs outputbuffer ? Is there
an offset in the buffer for left/right?





--
View this message in context: http://csound.1045644.n5.nabble.com/left-right-from-csoundGetOutputBuffer-tp5731400.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2014-01-09 10:43
FromSigurd Saue
SubjectRE: [Csnd] left/right from csoundGetOutputBuffer
The samples from each channel are interleaved (first sample left, first sample right, second sample left, second sample right, ...).

Sigurd 

-----Original Message-----
From: imaia [mailto:ismapsa@gmail.com] 
Sent: Thursday, January 09, 2014 11:36 AM
To: csound@lists.bath.ac.uk
Subject: [Csnd] left/right from csoundGetOutputBuffer

Hello,

In my code I handle my own IO, so I manage buffers directly:
csoundGetInputBuffer/ csoundPerformBuffer / csoundGetOutputBuffer I turned off csound´s IO:
    csoundSetRTAudioModule(cs,"null");  
    csoundSetHostImplementedAudioIO(cs,1,bufsz);

I use jack to route outbuffer to/from several CS instances(each one nchnls=1), the jack´s "process" code is:
...
    jack_default_audio_sample_t *in;
    jack_default_audio_sample_t *out;
    MYFLT * cs_i;
    MYFLT * cs_o;
        
    in  = jack_port_get_buffer (ch->in, nframes);
    out = jack_port_get_buffer (ch->out, nframes);
     
    cs_i = csoundGetInputBuffer(ch->cs);    
    
    //feeds csound's input buffer
    memcpy (cs_i, in,
             sizeof (jack_default_audio_sample_t) * nframes);
        
    //process a buffer
    csoundPerformBuffer(ch->cs);
        
    cs_o = csoundGetOutputBuffer(ch->cs);    
    //copy csound's output buffer to the channel's output  
    memcpy (out, cs_o,
              sizeof (jack_default_audio_sample_t) * nframes);

It works just fine with a mono channel  (nchnls=1)

Now I would like to use pan2 opcode in my .csd and I turned nchnls=2

The problem is how can I get left/right parts of cs outputbuffer ? Is there an offset in the buffer for left/right?





--
View this message in context: http://csound.1045644.n5.nabble.com/left-right-from-csoundGetOutputBuffer-tp5731400.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-01-09 14:21
Fromimaia
Subject[Csnd] RE: left/right from csoundGetOutputBuffer
Thanks.

If I use:
nchnls = 2 ; #outputs
nchnls_i = 1 ; #inputs

The input and output buffers remains the same size?



--
View this message in context: http://csound.1045644.n5.nabble.com/left-right-from-csoundGetOutputBuffer-tp5731400p5731403.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-01-09 14:32
FromVictor Lazzarini
SubjectRe: [Csnd] left/right from csoundGetOutputBuffer
I don’t think so.

Victor
On 9 Jan 2014, at 14:21, imaia  wrote:

> Thanks.
> 
> If I use:
> nchnls = 2 ; #outputs
> nchnls_i = 1 ; #inputs
> 
> The input and output buffers remains the same size?
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/left-right-from-csoundGetOutputBuffer-tp5731400p5731403.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>            https://sourceforge.net/p/csound/tickets/
> csound5:
>            https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
>