Csound Csound-dev Csound-tekno Search About

csoundAddSpinSample() question...

Date2017-06-12 12:30
FromRory Walsh
SubjectcsoundAddSpinSample() question...
AttachmentsGetSpoutExample2.cpp  test8.csd  
I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.  

Thanks. 
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-06-12 13:45
FromVictor Lazzarini
SubjectRe: csoundAddSpinSample() question...
I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 12 Jun 2017, at 12:30, Rory Walsh  wrote:
> 
> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.  
> 
> Thanks. 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-06-12 13:49
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
Just looked at the implementation:

PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
                                int channel, MYFLT sample)
{

    int index = (frame * csound->inchnls) + channel;
    csound->spin[index] += sample;
}

it appears you would need to clear spin before using it, otherwise it will blow up.

(moved this to developers so not too scare any users)
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 12 Jun 2017, at 13:45, Victor Lazzarini  wrote:
> 
> I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952 
> 
>> On 12 Jun 2017, at 12:30, Rory Walsh  wrote:
>> 
>> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.  
>> 
>> Thanks. 
>> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 
> 
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussi

Date2017-06-12 13:54
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?  

On 12 June 2017 at 13:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Just looked at the implementation:

PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
                                int channel, MYFLT sample)
{

    int index = (frame * csound->inchnls) + channel;
    csound->spin[index] += sample;
}

it appears you would need to clear spin before using it, otherwise it will blow up.

(moved this to developers so not too scare any users)
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 12 Jun 2017, at 13:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
>
> I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 12 Jun 2017, at 12:30, Rory Walsh <rorywalsh@ear.ie> wrote:
>>
>> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
>>
>> Thanks.
>> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here <GetSpoutExample2.cpp><test8.csd>
>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here



Date2017-06-12 13:59
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
but isn’t it easier just to get the pointer and write to the buffer directly?
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 12 Jun 2017, at 13:54, Rory Walsh  wrote:
> 
> Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?  
> 
> On 12 June 2017 at 13:49, Victor Lazzarini  wrote:
> Just looked at the implementation:
> 
> PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
>                                 int channel, MYFLT sample)
> {
> 
>     int index = (frame * csound->inchnls) + channel;
>     csound->spin[index] += sample;
> }
> 
> it appears you would need to clear spin before using it, otherwise it will blow up.
> 
> (moved this to developers so not too scare any users)
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> > On 12 Jun 2017, at 13:45, Victor Lazzarini  wrote:
> >
> > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> >> On 12 Jun 2017, at 12:30, Rory Walsh  wrote:
> >>
> >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> >>
> >> Thanks.
> >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 
> >
> >
> > Csound mailing list
> > Csound@listserv.heanet.ie
> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussio

Date2017-06-12 14:17
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
but isn’t it easier just to get the pointer and write to the buffer directly?

Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?   


 
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 12 Jun 2017, at 13:54, Rory Walsh <rorywalsh@ear.ie> wrote:
>
> Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
>
> On 12 June 2017 at 13:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> Just looked at the implementation:
>
> PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
>                                 int channel, MYFLT sample)
> {
>
>     int index = (frame * csound->inchnls) + channel;
>     csound->spin[index] += sample;
> }
>
> it appears you would need to clear spin before using it, otherwise it will blow up.
>
> (moved this to developers so not too scare any users)
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
> > On 12 Jun 2017, at 13:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
> >
> > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> >> On 12 Jun 2017, at 12:30, Rory Walsh <rorywalsh@ear.ie> wrote:
> >>
> >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> >>
> >> Thanks.
> >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here <GetSpoutExample2.cpp><test8.csd>
> >
> >
> > Csound mailing list
> > Csound@listserv.heanet.ie
> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
>
>



Date2017-06-12 14:24
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
Couldn’t you add a simple C file to your build, where you have a single function that does this:

#include 

void clearSpin(void *p) {
  MYFLT *s = csoundGetSpin((CSOUND *) p);
  memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
}

then export the clearSpin() symbol as you did with the rest of the Csound library.
====================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 12 Jun 2017, at 14:17, Rory Walsh  wrote:
> 
> I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> but isn’t it easier just to get the pointer and write to the buffer directly?
> 
> Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?   
> 
> 
>  
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> > On 12 Jun 2017, at 13:54, Rory Walsh  wrote:
> >
> > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> >
> > On 12 June 2017 at 13:49, Victor Lazzarini  wrote:
> > Just looked at the implementation:
> >
> > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> >                                 int channel, MYFLT sample)
> > {
> >
> >     int index = (frame * csound->inchnls) + channel;
> >     csound->spin[index] += sample;
> > }
> >
> > it appears you would need to clear spin before using it, otherwise it will blow up.
> >
> > (moved this to developers so not too scare any users)
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 13:45, Victor Lazzarini  wrote:
> > >
> > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > >> On 12 Jun 2017, at 12:30, Rory Walsh  wrote:
> > >>
> > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > >>
> > >> Thanks.
> > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 
> > >
> > >
> > > Csound mailing list
> > > Csound@listserv.heanet.ie
> > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > Send bugs reports to
> > >        https://github.com/csound/csound/issues
> > > Discussions of bugs and featu

Date2017-06-12 14:35
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library. 
Are you suggesting writing another dll to look after clearing up spin? 

On 12 June 2017 at 14:24, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Couldn’t you add a simple C file to your build, where you have a single function that does this:

#include <csound.h>

void clearSpin(void *p) {
  MYFLT *s = csoundGetSpin((CSOUND *) p);
  memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
}

then export the clearSpin() symbol as you did with the rest of the Csound library.
====================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 12 Jun 2017, at 14:17, Rory Walsh <rorywalsh@ear.ie> wrote:
>
> I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> but isn’t it easier just to get the pointer and write to the buffer directly?
>
> Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
>
>
>
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
> > On 12 Jun 2017, at 13:54, Rory Walsh <rorywalsh@ear.ie> wrote:
> >
> > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> >
> > On 12 June 2017 at 13:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> > Just looked at the implementation:
> >
> > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> >                                 int channel, MYFLT sample)
> > {
> >
> >     int index = (frame * csound->inchnls) + channel;
> >     csound->spin[index] += sample;
> > }
> >
> > it appears you would need to clear spin before using it, otherwise it will blow up.
> >
> > (moved this to developers so not too scare any users)
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 13:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
> > >
> > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > >> On 12 Jun 2017, at 12:30, Rory Walsh <rorywalsh@ear.ie> wrote:
> > >>
> > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > >>
> > >> Thanks.
> > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here <GetSpoutExample2.cpp><test8.csd>
> > >
> > >
> > > Csound mailing list
> > > Csound@listserv.heanet.ie
> > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > Send bugs reports to
> > >        https://github.com/csound/csound/issues
> > > Discussions of bugs and features can be posted here
> >
> >
>
>



Date2017-06-12 14:39
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
yes, that is what I am suggesting. That DLL could potentially just link to the Csound dll (or static lib) and you can import
only one lib.

In fact, since you are doing that, you could create a customised interface to deal with all the other issues you are having.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 12 Jun 2017, at 14:35, Rory Walsh  wrote:
> 
> I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library. 
> https://github.com/rorywalsh/CsoundUnity/blob/master/CsoundUnityScripts/CsoundCsharp.cs
> Are you suggesting writing another dll to look after clearing up spin? 
> 
> On 12 June 2017 at 14:24, Victor Lazzarini  wrote:
> Couldn’t you add a simple C file to your build, where you have a single function that does this:
> 
> #include 
> 
> void clearSpin(void *p) {
>   MYFLT *s = csoundGetSpin((CSOUND *) p);
>   memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
> }
> 
> then export the clearSpin() symbol as you did with the rest of the Csound library.
> ====================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> > On 12 Jun 2017, at 14:17, Rory Walsh  wrote:
> >
> > I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> > but isn’t it easier just to get the pointer and write to the buffer directly?
> >
> > Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
> >
> >
> >
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 13:54, Rory Walsh  wrote:
> > >
> > > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> > >
> > > On 12 June 2017 at 13:49, Victor Lazzarini  wrote:
> > > Just looked at the implementation:
> > >
> > > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> > >                                 int channel, MYFLT sample)
> > > {
> > >
> > >     int index = (frame * csound->inchnls) + channel;
> > >     csound->spin[index] += sample;
> > > }
> > >
> > > it appears you would need to clear spin before using it, otherwise it will blow up.
> > >
> > > (moved this to developers so not too scare any users)
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > > > On 12 Jun 2017, at 13:45, Victor Lazzarini  wrote:
> > > >
> > > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > > ========================
> > > > Prof. Victor Lazzarini
> > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > Maynooth University,
> > > > Maynooth, Co Kildare, Ireland
> > > > Tel: 00 353 7086936
> > > > Fax: 00 353 1 7086952
> > > >
> > > >> On 12 Jun 2017, at 12:30, Rory Walsh  wrote:
> > > >>
> > > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > > >>
> > > >> Thanks.
> > > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 
> > > >
> > > >
> > > > Csound mailing list
> > > > Csound@listserv.heanet.ie
> > > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > > Send bugs reports to
> > > >        https://github.com/csound/csound/issues
> > > > Discussions of bugs and feature

Date2017-06-12 14:46
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
To be honest, this is the only issue I am currently having with it. Strange as it may seem, but Csound and C# actually make very good bedfellows in Unity. Your solution should work, although it seems like a bit of effort. Right now, CsoundUnity exists entirely as a collection of C# scripts. Users don't have to build anything to get going, and it works with the standard Csound installers. I don't even have to build a plugin dll myself.  Before I go down that route I better crack open the C# book again and see how the flip I can deal with pointers! 

On 12 June 2017 at 14:39, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
yes, that is what I am suggesting. That DLL could potentially just link to the Csound dll (or static lib) and you can import
only one lib.

In fact, since you are doing that, you could create a customised interface to deal with all the other issues you are having.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 12 Jun 2017, at 14:35, Rory Walsh <rorywalsh@ear.ie> wrote:
>
> I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library.
> https://github.com/rorywalsh/CsoundUnity/blob/master/CsoundUnityScripts/CsoundCsharp.cs
> Are you suggesting writing another dll to look after clearing up spin?
>
> On 12 June 2017 at 14:24, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> Couldn’t you add a simple C file to your build, where you have a single function that does this:
>
> #include <csound.h>
>
> void clearSpin(void *p) {
>   MYFLT *s = csoundGetSpin((CSOUND *) p);
>   memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
> }
>
> then export the clearSpin() symbol as you did with the rest of the Csound library.
> ====================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
> > On 12 Jun 2017, at 14:17, Rory Walsh <rorywalsh@ear.ie> wrote:
> >
> > I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> > but isn’t it easier just to get the pointer and write to the buffer directly?
> >
> > Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
> >
> >
> >
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 13:54, Rory Walsh <rorywalsh@ear.ie> wrote:
> > >
> > > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> > >
> > > On 12 June 2017 at 13:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> > > Just looked at the implementation:
> > >
> > > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> > >                                 int channel, MYFLT sample)
> > > {
> > >
> > >     int index = (frame * csound->inchnls) + channel;
> > >     csound->spin[index] += sample;
> > > }
> > >
> > > it appears you would need to clear spin before using it, otherwise it will blow up.
> > >
> > > (moved this to developers so not too scare any users)
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > > > On 12 Jun 2017, at 13:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
> > > >
> > > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > > ========================
> > > > Prof. Victor Lazzarini
> > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > Maynooth University,
> > > > Maynooth, Co Kildare, Ireland
> > > > Tel: 00 353 7086936
> > > > Fax: 00 353 1 7086952
> > > >
> > > >> On 12 Jun 2017, at 12:30, Rory Walsh <rorywalsh@ear.ie> wrote:
> > > >>
> > > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > > >>
> > > >> Thanks.
> > > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here <GetSpoutExample2.cpp><test8.csd>
> > > >
> > > >
> > > > Csound mailing list
> > > > Csound@listserv.heanet.ie
> > > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > > Send bugs reports to
> > > >        https://github.com/csound/csound/issues
> > > > Discussions of bugs and features can be posted here
> > >
> > >
> >
> >
>
>



Date2017-06-14 11:27
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
I've had to down the route you suggested, but I've not been able to get your method to work. Instead I just zero out each sample one by one which works fine:

while(csound->PerformKsmps()==0)
{
	for(int i=0;i<csound->GetKsmps();i++)
	{
		spin[0] = 0.f;
		csound->AddSpinSample(i, 0, simpleRamp[sampleCount]);
		sampleCount=sampleCount==44100 ? 0 : sampleCount+1;
	}
}
Trying to clear the entire buffer in one go results in the same problem as before for some reason. Here's what I tried:
while(csound->PerformKsmps()==0)
{
	clearSpin(csound);
	for(int i=0;i<csound->GetKsmps();i++)
	{
		csound->AddSpinSample(i, 0, simpleRamp[sampleCount]);
		sampleCount=sampleCount==44100 ? 0 : sampleCount+1;
	}
}


On 12 June 2017 at 14:46, Rory Walsh <rorywalsh@ear.ie> wrote:
To be honest, this is the only issue I am currently having with it. Strange as it may seem, but Csound and C# actually make very good bedfellows in Unity. Your solution should work, although it seems like a bit of effort. Right now, CsoundUnity exists entirely as a collection of C# scripts. Users don't have to build anything to get going, and it works with the standard Csound installers. I don't even have to build a plugin dll myself.  Before I go down that route I better crack open the C# book again and see how the flip I can deal with pointers! 

On 12 June 2017 at 14:39, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
yes, that is what I am suggesting. That DLL could potentially just link to the Csound dll (or static lib) and you can import
only one lib.

In fact, since you are doing that, you could create a customised interface to deal with all the other issues you are having.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 12 Jun 2017, at 14:35, Rory Walsh <rorywalsh@ear.ie> wrote:
>
> I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library.
> https://github.com/rorywalsh/CsoundUnity/blob/master/CsoundUnityScripts/CsoundCsharp.cs
> Are you suggesting writing another dll to look after clearing up spin?
>
> On 12 June 2017 at 14:24, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> Couldn’t you add a simple C file to your build, where you have a single function that does this:
>
> #include <csound.h>
>
> void clearSpin(void *p) {
>   MYFLT *s = csoundGetSpin((CSOUND *) p);
>   memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
> }
>
> then export the clearSpin() symbol as you did with the rest of the Csound library.
> ====================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
> > On 12 Jun 2017, at 14:17, Rory Walsh <rorywalsh@ear.ie> wrote:
> >
> > I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> > but isn’t it easier just to get the pointer and write to the buffer directly?
> >
> > Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
> >
> >
> >
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 13:54, Rory Walsh <rorywalsh@ear.ie> wrote:
> > >
> > > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> > >
> > > On 12 June 2017 at 13:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> > > Just looked at the implementation:
> > >
> > > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> > >                                 int channel, MYFLT sample)
> > > {
> > >
> > >     int index = (frame * csound->inchnls) + channel;
> > >     csound->spin[index] += sample;
> > > }
> > >
> > > it appears you would need to clear spin before using it, otherwise it will blow up.
> > >
> > > (moved this to developers so not too scare any users)
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > > > On 12 Jun 2017, at 13:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
> > > >
> > > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > > ========================
> > > > Prof. Victor Lazzarini
> > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > Maynooth University,
> > > > Maynooth, Co Kildare, Ireland
> > > > Tel: 00 353 7086936
> > > > Fax: 00 353 1 7086952
> > > >
> > > >> On 12 Jun 2017, at 12:30, Rory Walsh <rorywalsh@ear.ie> wrote:
> > > >>
> > > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > > >>
> > > >> Thanks.
> > > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here <GetSpoutExample2.cpp><test8.csd>
> > > >
> > > >
> > > > Csound mailing list
> > > > Csound@listserv.heanet.ie
> > > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > > Send bugs reports to
> > > >        https://github.com/csound/csound/issues
> > > > Discussions of bugs and features can be posted here
> > >
> > >
> >
> >
>
>




Date2017-06-14 11:42
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
It’s probable that my code was wrong. Since you’re doing this, I’d suggest to just get rid of the function call
and set spin[i] = simpleRand[i]. If you have access to spin, just use it.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 14 Jun 2017, at 11:27, Rory Walsh  wrote:
> 
> I've had to down the route you suggested, but I've not been able to get your method to work. Instead I just zero out each sample one by one which works fine:
> 
> while(csound->PerformKsmps()==0)
> {
> 
> 	
> for(int i=0;iGetKsmps();i++)
> 
> 	
> {
> 
> 		spin
> [0] = 0.f;
> 
> 		csound
> ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
> 
> 		sampleCount
> =sampleCount==44100 ? 0 : sampleCount+1;
> 
> 	
> }
> }
> Trying to clear the entire buffer in one go results in the same problem as before for some reason. Here's what I tried:
> while(csound->PerformKsmps()==0)
> {
> 
> 	clearSpin
> (csound);
> 
> 	
> for(int i=0;iGetKsmps();i++)
> 
> 	
> {
> 
> 		csound
> ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
> 
> 		sampleCount
> =sampleCount==44100 ? 0 : sampleCount+1;
> 
> 	
> }
> }
> 
> 
> On 12 June 2017 at 14:46, Rory Walsh  wrote:
> To be honest, this is the only issue I am currently having with it. Strange as it may seem, but Csound and C# actually make very good bedfellows in Unity. Your solution should work, although it seems like a bit of effort. Right now, CsoundUnity exists entirely as a collection of C# scripts. Users don't have to build anything to get going, and it works with the standard Csound installers. I don't even have to build a plugin dll myself.  Before I go down that route I better crack open the C# book again and see how the flip I can deal with pointers! 
> 
> On 12 June 2017 at 14:39, Victor Lazzarini  wrote:
> yes, that is what I am suggesting. That DLL could potentially just link to the Csound dll (or static lib) and you can import
> only one lib.
> 
> In fact, since you are doing that, you could create a customised interface to deal with all the other issues you are having.
> 
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> > On 12 Jun 2017, at 14:35, Rory Walsh  wrote:
> >
> > I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library.
> > https://github.com/rorywalsh/CsoundUnity/blob/master/CsoundUnityScripts/CsoundCsharp.cs
> > Are you suggesting writing another dll to look after clearing up spin?
> >
> > On 12 June 2017 at 14:24, Victor Lazzarini  wrote:
> > Couldn’t you add a simple C file to your build, where you have a single function that does this:
> >
> > #include 
> >
> > void clearSpin(void *p) {
> >   MYFLT *s = csoundGetSpin((CSOUND *) p);
> >   memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
> > }
> >
> > then export the clearSpin() symbol as you did with the rest of the Csound library.
> > ====================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 14:17, Rory Walsh  wrote:
> > >
> > > I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> > > but isn’t it easier just to get the pointer and write to the buffer directly?
> > >
> > > Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
> > >
> > >
> > >
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > > > On 12 Jun 2017, at 13:54, Rory Walsh  wrote:
> > > >
> > > > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> > > >
> > > > On 12 June 2017 at 13:49, Victor Lazzarini  wrote:
> > > > Just looked at the implementation:
> > > >
> > > > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> > > >                                 int channel, MYFLT sample)
> > > > {
> > > >
> > > >     int index = (frame * csound->inchnls) + channel;
> > > >     csound->spin[index] += sample;
> > > > }
> > > >
> > > > it appears you would need to clear spin before using it, otherwise it will blow up.
> > > >
> > > > (moved this to developers so not too scare any users)
> > > > ========================
> > > > Prof. Victor Lazzarini
> > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > Maynooth University,
> > > > Maynooth, Co Kildare, Ireland
> > > > Tel: 00 353 7086936
> > > > Fax: 00 353 1 7086952
> > > >
> > > > > On 12 Jun 2017, at 13:45, Victor Lazzarini  wrote:
> > > > >
> > > > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > > > ========================
> > > > > Prof. Victor Lazzarini
> > > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > > Maynooth University,
> > > > > Maynooth, Co Kildare, Ireland
> > > > > Tel: 00 353 7086936
> > > > > Fax: 00 353 1 7086952
> > > > >
> > > > >> On 12 Jun 2017, at 12:30, Rory Walsh  wrote:
> > > > >>
> > > > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > > > >>
> > > > >> Thanks.
> > > > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 
> > > > >
> > > > >
> > > > > Csound mailing list
> > > > > Csound@listserv.heanet.ie
> > > > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > > > Send bugs reports to
> > > > >        https://github.com/csound/csound/issues
> > > > > Discussions of bugs and features can be posted here
> > > >
> > > >
> 

Date2017-06-14 11:47
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
That's what I'll do.

On 14 June 2017 at 11:42, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
It’s probable that my code was wrong. Since you’re doing this, I’d suggest to just get rid of the function call
and set spin[i] = simpleRand[i]. If you have access to spin, just use it.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 14 Jun 2017, at 11:27, Rory Walsh <rorywalsh@ear.ie> wrote:
>
> I've had to down the route you suggested, but I've not been able to get your method to work. Instead I just zero out each sample one by one which works fine:
>
> while(csound->PerformKsmps()==0)
> {
>
>
> for(int i=0;i<csound->GetKsmps();i++)
>
>
> {
>
>               spin
> [0] = 0.f;
>
>               csound
> ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
>
>               sampleCount
> =sampleCount==44100 ? 0 : sampleCount+1;
>
>
> }
> }
> Trying to clear the entire buffer in one go results in the same problem as before for some reason. Here's what I tried:
> while(csound->PerformKsmps()==0)
> {
>
>       clearSpin
> (csound);
>
>
> for(int i=0;i<csound->GetKsmps();i++)
>
>
> {
>
>               csound
> ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
>
>               sampleCount
> =sampleCount==44100 ? 0 : sampleCount+1;
>
>
> }
> }
>
>
> On 12 June 2017 at 14:46, Rory Walsh <rorywalsh@ear.ie> wrote:
> To be honest, this is the only issue I am currently having with it. Strange as it may seem, but Csound and C# actually make very good bedfellows in Unity. Your solution should work, although it seems like a bit of effort. Right now, CsoundUnity exists entirely as a collection of C# scripts. Users don't have to build anything to get going, and it works with the standard Csound installers. I don't even have to build a plugin dll myself.  Before I go down that route I better crack open the C# book again and see how the flip I can deal with pointers!
>
> On 12 June 2017 at 14:39, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> yes, that is what I am suggesting. That DLL could potentially just link to the Csound dll (or static lib) and you can import
> only one lib.
>
> In fact, since you are doing that, you could create a customised interface to deal with all the other issues you are having.
>
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
> > On 12 Jun 2017, at 14:35, Rory Walsh <rorywalsh@ear.ie> wrote:
> >
> > I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library.
> > https://github.com/rorywalsh/CsoundUnity/blob/master/CsoundUnityScripts/CsoundCsharp.cs
> > Are you suggesting writing another dll to look after clearing up spin?
> >
> > On 12 June 2017 at 14:24, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> > Couldn’t you add a simple C file to your build, where you have a single function that does this:
> >
> > #include <csound.h>
> >
> > void clearSpin(void *p) {
> >   MYFLT *s = csoundGetSpin((CSOUND *) p);
> >   memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
> > }
> >
> > then export the clearSpin() symbol as you did with the rest of the Csound library.
> > ====================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 14:17, Rory Walsh <rorywalsh@ear.ie> wrote:
> > >
> > > I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> > > but isn’t it easier just to get the pointer and write to the buffer directly?
> > >
> > > Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
> > >
> > >
> > >
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > > > On 12 Jun 2017, at 13:54, Rory Walsh <rorywalsh@ear.ie> wrote:
> > > >
> > > > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> > > >
> > > > On 12 June 2017 at 13:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> > > > Just looked at the implementation:
> > > >
> > > > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> > > >                                 int channel, MYFLT sample)
> > > > {
> > > >
> > > >     int index = (frame * csound->inchnls) + channel;
> > > >     csound->spin[index] += sample;
> > > > }
> > > >
> > > > it appears you would need to clear spin before using it, otherwise it will blow up.
> > > >
> > > > (moved this to developers so not too scare any users)
> > > > ========================
> > > > Prof. Victor Lazzarini
> > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > Maynooth University,
> > > > Maynooth, Co Kildare, Ireland
> > > > Tel: 00 353 7086936
> > > > Fax: 00 353 1 7086952
> > > >
> > > > > On 12 Jun 2017, at 13:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
> > > > >
> > > > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > > > ========================
> > > > > Prof. Victor Lazzarini
> > > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > > Maynooth University,
> > > > > Maynooth, Co Kildare, Ireland
> > > > > Tel: 00 353 7086936
> > > > > Fax: 00 353 1 7086952
> > > > >
> > > > >> On 12 Jun 2017, at 12:30, Rory Walsh <rorywalsh@ear.ie> wrote:
> > > > >>
> > > > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > > > >>
> > > > >> Thanks.
> > > > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here <GetSpoutExample2.cpp><test8.csd>
> > > > >
> > > > >
> > > > > Csound mailing list
> > > > > Csound@listserv.heanet.ie
> > > > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > > > Send bugs reports to
> > > > >        https://github.com/csound/csound/issues
> > > > > Discussions of bugs and features can be posted here
> > > >
> > > >
> > >
> > >
> >
> >
>
>
>



Date2017-06-14 14:13
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).

csoundGetSpinSample(..) 

maybe?

On 14 June 2017 at 11:47, Rory Walsh <rorywalsh@ear.ie> wrote:
That's what I'll do.

On 14 June 2017 at 11:42, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
It’s probable that my code was wrong. Since you’re doing this, I’d suggest to just get rid of the function call
and set spin[i] = simpleRand[i]. If you have access to spin, just use it.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 14 Jun 2017, at 11:27, Rory Walsh <rorywalsh@ear.ie> wrote:
>
> I've had to down the route you suggested, but I've not been able to get your method to work. Instead I just zero out each sample one by one which works fine:
>
> while(csound->PerformKsmps()==0)
> {
>
>
> for(int i=0;i<csound->GetKsmps();i++)
>
>
> {
>
>               spin
> [0] = 0.f;
>
>               csound
> ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
>
>               sampleCount
> =sampleCount==44100 ? 0 : sampleCount+1;
>
>
> }
> }
> Trying to clear the entire buffer in one go results in the same problem as before for some reason. Here's what I tried:
> while(csound->PerformKsmps()==0)
> {
>
>       clearSpin
> (csound);
>
>
> for(int i=0;i<csound->GetKsmps();i++)
>
>
> {
>
>               csound
> ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
>
>               sampleCount
> =sampleCount==44100 ? 0 : sampleCount+1;
>
>
> }
> }
>
>
> On 12 June 2017 at 14:46, Rory Walsh <rorywalsh@ear.ie> wrote:
> To be honest, this is the only issue I am currently having with it. Strange as it may seem, but Csound and C# actually make very good bedfellows in Unity. Your solution should work, although it seems like a bit of effort. Right now, CsoundUnity exists entirely as a collection of C# scripts. Users don't have to build anything to get going, and it works with the standard Csound installers. I don't even have to build a plugin dll myself.  Before I go down that route I better crack open the C# book again and see how the flip I can deal with pointers!
>
> On 12 June 2017 at 14:39, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> yes, that is what I am suggesting. That DLL could potentially just link to the Csound dll (or static lib) and you can import
> only one lib.
>
> In fact, since you are doing that, you could create a customised interface to deal with all the other issues you are having.
>
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
> > On 12 Jun 2017, at 14:35, Rory Walsh <rorywalsh@ear.ie> wrote:
> >
> > I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library.
> > https://github.com/rorywalsh/CsoundUnity/blob/master/CsoundUnityScripts/CsoundCsharp.cs
> > Are you suggesting writing another dll to look after clearing up spin?
> >
> > On 12 June 2017 at 14:24, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> > Couldn’t you add a simple C file to your build, where you have a single function that does this:
> >
> > #include <csound.h>
> >
> > void clearSpin(void *p) {
> >   MYFLT *s = csoundGetSpin((CSOUND *) p);
> >   memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
> > }
> >
> > then export the clearSpin() symbol as you did with the rest of the Csound library.
> > ====================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 14:17, Rory Walsh <rorywalsh@ear.ie> wrote:
> > >
> > > I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> > > but isn’t it easier just to get the pointer and write to the buffer directly?
> > >
> > > Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
> > >
> > >
> > >
> > > ========================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > > > On 12 Jun 2017, at 13:54, Rory Walsh <rorywalsh@ear.ie> wrote:
> > > >
> > > > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> > > >
> > > > On 12 June 2017 at 13:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> > > > Just looked at the implementation:
> > > >
> > > > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> > > >                                 int channel, MYFLT sample)
> > > > {
> > > >
> > > >     int index = (frame * csound->inchnls) + channel;
> > > >     csound->spin[index] += sample;
> > > > }
> > > >
> > > > it appears you would need to clear spin before using it, otherwise it will blow up.
> > > >
> > > > (moved this to developers so not too scare any users)
> > > > ========================
> > > > Prof. Victor Lazzarini
> > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > Maynooth University,
> > > > Maynooth, Co Kildare, Ireland
> > > > Tel: 00 353 7086936
> > > > Fax: 00 353 1 7086952
> > > >
> > > > > On 12 Jun 2017, at 13:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
> > > > >
> > > > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > > > ========================
> > > > > Prof. Victor Lazzarini
> > > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > > Maynooth University,
> > > > > Maynooth, Co Kildare, Ireland
> > > > > Tel: 00 353 7086936
> > > > > Fax: 00 353 1 7086952
> > > > >
> > > > >> On 12 Jun 2017, at 12:30, Rory Walsh <rorywalsh@ear.ie> wrote:
> > > > >>
> > > > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > > > >>
> > > > >> Thanks.
> > > > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here <GetSpoutExample2.cpp><test8.csd>
> > > > >
> > > > >
> > > > > Csound mailing list
> > > > > Csound@listserv.heanet.ie
> > > > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > > > Send bugs reports to
> > > > >        https://github.com/csound/csound/issues
> > > > > Discussions of bugs and features can be posted here
> > > >
> > > >
> > >
> > >
> >
> >
>
>
>




Date2017-06-14 14:19
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
That would get the sample, rather than write to it ;)
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 14 Jun 2017, at 14:13, Rory Walsh  wrote:
> 
> In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).
> 
> csoundGetSpinSample(..) 
> 
> maybe?
> 
> On 14 June 2017 at 11:47, Rory Walsh  wrote:
> That's what I'll do. 
> 
> On 14 June 2017 at 11:42, Victor Lazzarini  wrote:
> It’s probable that my code was wrong. Since you’re doing this, I’d suggest to just get rid of the function call
> and set spin[i] = simpleRand[i]. If you have access to spin, just use it.
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> > On 14 Jun 2017, at 11:27, Rory Walsh  wrote:
> >
> > I've had to down the route you suggested, but I've not been able to get your method to work. Instead I just zero out each sample one by one which works fine:
> >
> > while(csound->PerformKsmps()==0)
> > {
> >
> >
> > for(int i=0;iGetKsmps();i++)
> >
> >
> > {
> >
> >               spin
> > [0] = 0.f;
> >
> >               csound
> > ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
> >
> >               sampleCount
> > =sampleCount==44100 ? 0 : sampleCount+1;
> >
> >
> > }
> > }
> > Trying to clear the entire buffer in one go results in the same problem as before for some reason. Here's what I tried:
> > while(csound->PerformKsmps()==0)
> > {
> >
> >       clearSpin
> > (csound);
> >
> >
> > for(int i=0;iGetKsmps();i++)
> >
> >
> > {
> >
> >               csound
> > ->AddSpinSample(i, 0, simpleRamp[sampleCount]);
> >
> >               sampleCount
> > =sampleCount==44100 ? 0 : sampleCount+1;
> >
> >
> > }
> > }
> >
> >
> > On 12 June 2017 at 14:46, Rory Walsh  wrote:
> > To be honest, this is the only issue I am currently having with it. Strange as it may seem, but Csound and C# actually make very good bedfellows in Unity. Your solution should work, although it seems like a bit of effort. Right now, CsoundUnity exists entirely as a collection of C# scripts. Users don't have to build anything to get going, and it works with the standard Csound installers. I don't even have to build a plugin dll myself.  Before I go down that route I better crack open the C# book again and see how the flip I can deal with pointers!
> >
> > On 12 June 2017 at 14:39, Victor Lazzarini  wrote:
> > yes, that is what I am suggesting. That DLL could potentially just link to the Csound dll (or static lib) and you can import
> > only one lib.
> >
> > In fact, since you are doing that, you could create a customised interface to deal with all the other issues you are having.
> >
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> > > On 12 Jun 2017, at 14:35, Rory Walsh  wrote:
> > >
> > > I'm loading the Csound .dll directly into Unity using DLLImport(). I then manage each of the functions I need from the library.
> > > https://github.com/rorywalsh/CsoundUnity/blob/master/CsoundUnityScripts/CsoundCsharp.cs
> > > Are you suggesting writing another dll to look after clearing up spin?
> > >
> > > On 12 June 2017 at 14:24, Victor Lazzarini  wrote:
> > > Couldn’t you add a simple C file to your build, where you have a single function that does this:
> > >
> > > #include 
> > >
> > > void clearSpin(void *p) {
> > >   MYFLT *s = csoundGetSpin((CSOUND *) p);
> > >   memset(s, 0, sizeof(MYFLT)*csoundGetKsmps((CSOUND *) p)*csoundGetNchnls((CSOUND *) p);
> > > }
> > >
> > > then export the clearSpin() symbol as you did with the rest of the Csound library.
> > > ====================
> > > Prof. Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy,
> > > Maynooth University,
> > > Maynooth, Co Kildare, Ireland
> > > Tel: 00 353 7086936
> > > Fax: 00 353 1 7086952
> > >
> > > > On 12 Jun 2017, at 14:17, Rory Walsh  wrote:
> > > >
> > > > I don’t think we can without changing behaviour, it does what it says on the tin. OTOH we could have a csoundReplaceSpinSample(),
> > > > but isn’t it easier just to get the pointer and write to the buffer directly?
> > > >
> > > > Not when you're trying to move data between the C library and the C# interface. I've not been able to mange pointers between the two. Strings were hairy enough. So the question is, if I don't have access to the spin pointer how am I going to be able to zero it? A csoundReplaceSpinSample() method would be useful, but if I can use what's there already it would be better as I wouldn't have to wait for a new release. What's the recommended way of clearing spin?
> > > >
> > > >
> > > >
> > > > ========================
> > > > Prof. Victor Lazzarini
> > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > Maynooth University,
> > > > Maynooth, Co Kildare, Ireland
> > > > Tel: 00 353 7086936
> > > > Fax: 00 353 1 7086952
> > > >
> > > > > On 12 Jun 2017, at 13:54, Rory Walsh  wrote:
> > > > >
> > > > > Thanks Victor. Can the csoundAddSpinSample() function be updated to do this automatically, or is there a reason why it needs to be done manually?
> > > > >
> > > > > On 12 June 2017 at 13:49, Victor Lazzarini  wrote:
> > > > > Just looked at the implementation:
> > > > >
> > > > > PUBLIC void csoundAddSpinSample(CSOUND *csound, int frame,
> > > > >                                 int channel, MYFLT sample)
> > > > > {
> > > > >
> > > > >     int index = (frame * csound->inchnls) + channel;
> > > > >     csound->spin[index] += sample;
> > > > > }
> > > > >
> > > > > it appears you would need to clear spin before using it, otherwise it will blow up.
> > > > >
> > > > > (moved this to developers so not too scare any users)
> > > > > ========================
> > > > > Prof. Victor Lazzarini
> > > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > > Maynooth University,
> > > > > Maynooth, Co Kildare, Ireland
> > > > > Tel: 00 353 7086936
> > > > > Fax: 00 353 1 7086952
> > > > >
> > > > > > On 12 Jun 2017, at 13:45, Victor Lazzarini  wrote:
> > > > > >
> > > > > > I’ve never used it myself. Does the problem go away if you use GetSpin() and a pointer?
> > > > > > ========================
> > > > > > Prof. Victor Lazzarini
> > > > > > Dean of Arts, Celtic Studies, and Philosophy,
> > > > > > Maynooth University,
> > > > > > Maynooth, Co Kildare, Ireland
> > > > > > Tel: 00 353 7086936
> > > > > > Fax: 00 353 1 7086952
> > > > > >
> > > > > >> On 12 Jun 2017, at 12:30, Rory Walsh  wrote:
> > > > > >>
> > > > > >> I'm having some issues using csoundAddSpinSample. It seems to blow up in my face. I may be using it wrong, but the following file and .csd illustrate the problem. I've always used GetSpout/In, but I have to do things on a sample by sample basis in Unity. The csoundGetSpoutSample() method works fine.
> > > > > >>
> > > > > >> Thanks.
> > > > > >> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 
> > > > > >
> > > > > >
> > > > > > Csound mailing list
> > > > > > Csound@listserv.heanet.ie
> > > > > > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > > > > > Send bugs reports to
> > > > > >        https://github.com/csound/csound/issues
> > > > > > Discussions of bugs and features can be posted here
> > > > >
> > > > >
> > > >
> > 

Date2017-06-14 14:28
Fromjpff
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
csoundSetSpiSample ?

On Wed, 14 Jun 2017, Victor Lazzarini wrote:

> That would get the sample, rather than write to it ;)
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 14 Jun 2017, at 14:13, Rory Walsh  wrote:
>>
>> In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).
>>
>> csoundGetSpinSample(..)
>>
>> maybe?

Date2017-06-14 14:29
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
yep, doing it now
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 14 Jun 2017, at 14:28, jpff  wrote:
> 
> csoundSetSpiSample ?
> 
> On Wed, 14 Jun 2017, Victor Lazzarini wrote:
> 
>> That would get the sample, rather than write to it ;)
>> ========================
>> Prof. Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>> 
>>> On 14 Jun 2017, at 14:13, Rory Walsh  wrote:
>>> 
>>> In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).
>>> 
>>> csoundGetSpinSample(..)
>>> 
>>> maybe?

Date2017-06-14 14:31
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
In git now

/**
   * Clears the input buffer (spin).
   */
  PUBLIC void csoundClearSpin(CSOUND *);
 
   /**
   * Sets the audio input working buffer (spin) to the indicated sample
   * this only ever makes sense before calling csoundPerformKsmps().
   * The frame and channel must be in bounds relative to ksmps and nchnls.
   */
  PUBLIC void csoundSetSpinSample(CSOUND *csound,
                                  int frame, int channel, MYFLT sample);

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 14 Jun 2017, at 14:29, Victor Lazzarini  wrote:
> 
> yep, doing it now
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952 
> 
>> On 14 Jun 2017, at 14:28, jpff  wrote:
>> 
>> csoundSetSpiSample ?
>> 
>> On Wed, 14 Jun 2017, Victor Lazzarini wrote:
>> 
>>> That would get the sample, rather than write to it ;)
>>> ========================
>>> Prof. Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>> 
>>>> On 14 Jun 2017, at 14:13, Rory Walsh  wrote:
>>>> 
>>>> In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).
>>>> 
>>>> csoundGetSpinSample(..)
>>>> 
>>>> maybe?

Date2017-06-14 15:24
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
Thanks Victor. These are definitely useful, and will save me from having to build a .dll for each release. But for now I'll need the .dll. I create a very simple function, but I'm concerned about the cost of calling csoundGetSpin() on each sample? Here's my function:

void setCsoundInputSample(void *p, int pos, double sample) {
MYFLT *spin = csoundGetSpin((CSOUND*) p);
spin[pos] = sample;
}

If you think it might incur some overhead I would need to embed my instance of Csound into my own dll rather than creating a utility lib of my own. 

On 14 June 2017 at 14:31, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
In git now

/**
   * Clears the input buffer (spin).
   */
  PUBLIC void csoundClearSpin(CSOUND *);

   /**
   * Sets the audio input working buffer (spin) to the indicated sample
   * this only ever makes sense before calling csoundPerformKsmps().
   * The frame and channel must be in bounds relative to ksmps and nchnls.
   */
  PUBLIC void csoundSetSpinSample(CSOUND *csound,
                                  int frame, int channel, MYFLT sample);

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 14 Jun 2017, at 14:29, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
>
> yep, doing it now
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 14 Jun 2017, at 14:28, jpff <jpff@CODEMIST.CO.UK> wrote:
>>
>> csoundSetSpiSample ?
>>
>> On Wed, 14 Jun 2017, Victor Lazzarini wrote:
>>
>>> That would get the sample, rather than write to it ;)
>>> ========================
>>> Prof. Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>>
>>>> On 14 Jun 2017, at 14:13, Rory Walsh <rorywalsh@ear.ie> wrote:
>>>>
>>>> In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).
>>>>
>>>> csoundGetSpinSample(..)
>>>>
>>>> maybe?
>>>>


Date2017-06-14 15:26
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
Can’t you pass the MYFLT * to it instead or is it awkward? 
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 14 Jun 2017, at 15:24, Rory Walsh  wrote:
> 
> Thanks Victor. These are definitely useful, and will save me from having to build a .dll for each release. But for now I'll need the .dll. I create a very simple function, but I'm concerned about the cost of calling csoundGetSpin() on each sample? Here's my function:
> 
> 	void setCsoundInputSample(void *p, int pos, double sample) {
> 		MYFLT *spin = csoundGetSpin((CSOUND*) p);
> 		spin[pos] = sample;
> 	}
> 
> If you think it might incur some overhead I would need to embed my instance of Csound into my own dll rather than creating a utility lib of my own. 
> 
> On 14 June 2017 at 14:31, Victor Lazzarini  wrote:
> In git now
> 
> /**
>    * Clears the input buffer (spin).
>    */
>   PUBLIC void csoundClearSpin(CSOUND *);
> 
>    /**
>    * Sets the audio input working buffer (spin) to the indicated sample
>    * this only ever makes sense before calling csoundPerformKsmps().
>    * The frame and channel must be in bounds relative to ksmps and nchnls.
>    */
>   PUBLIC void csoundSetSpinSample(CSOUND *csound,
>                                   int frame, int channel, MYFLT sample);
> 
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> > On 14 Jun 2017, at 14:29, Victor Lazzarini  wrote:
> >
> > yep, doing it now
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> >> On 14 Jun 2017, at 14:28, jpff  wrote:
> >>
> >> csoundSetSpiSample ?
> >>
> >> On Wed, 14 Jun 2017, Victor Lazzarini wrote:
> >>
> >>> That would get the sample, rather than write to it ;)
> >>> ========================
> >>> Prof. Victor Lazzarini
> >>> Dean of Arts, Celtic Studies, and Philosophy,
> >>> Maynooth University,
> >>> Maynooth, Co Kildare, Ireland
> >>> Tel: 00 353 7086936
> >>> Fax: 00 353 1 7086952
> >>>
> >>>> On 14 Jun 2017, at 14:13, Rory Walsh  wrote:
> >>>>
> >>>> In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).
> >>>>
> >>>> csoundGetSpinSample(..)
> >>>>
> >>>> 

Date2017-06-14 15:32
FromRory Walsh
SubjectRe: [Csnd-dev] [Csnd] csoundAddSpinSample() question...
I'll try that. I can get access to it in my interface, but I just can't seem to manipulate it without all sorts of OTT nonsense. But passing it back and forth between the native interface might work. 

On 14 June 2017 at 15:26, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Can’t you pass the MYFLT * to it instead or is it awkward?
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 14 Jun 2017, at 15:24, Rory Walsh <rorywalsh@EAR.IE> wrote:
>
> Thanks Victor. These are definitely useful, and will save me from having to build a .dll for each release. But for now I'll need the .dll. I create a very simple function, but I'm concerned about the cost of calling csoundGetSpin() on each sample? Here's my function:
>
>       void setCsoundInputSample(void *p, int pos, double sample) {
>               MYFLT *spin = csoundGetSpin((CSOUND*) p);
>               spin[pos] = sample;
>       }
>
> If you think it might incur some overhead I would need to embed my instance of Csound into my own dll rather than creating a utility lib of my own.
>
> On 14 June 2017 at 14:31, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> In git now
>
> /**
>    * Clears the input buffer (spin).
>    */
>   PUBLIC void csoundClearSpin(CSOUND *);
>
>    /**
>    * Sets the audio input working buffer (spin) to the indicated sample
>    * this only ever makes sense before calling csoundPerformKsmps().
>    * The frame and channel must be in bounds relative to ksmps and nchnls.
>    */
>   PUBLIC void csoundSetSpinSample(CSOUND *csound,
>                                   int frame, int channel, MYFLT sample);
>
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
> > On 14 Jun 2017, at 14:29, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
> >
> > yep, doing it now
> > ========================
> > Prof. Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy,
> > Maynooth University,
> > Maynooth, Co Kildare, Ireland
> > Tel: 00 353 7086936
> > Fax: 00 353 1 7086952
> >
> >> On 14 Jun 2017, at 14:28, jpff <jpff@CODEMIST.CO.UK> wrote:
> >>
> >> csoundSetSpiSample ?
> >>
> >> On Wed, 14 Jun 2017, Victor Lazzarini wrote:
> >>
> >>> That would get the sample, rather than write to it ;)
> >>> ========================
> >>> Prof. Victor Lazzarini
> >>> Dean of Arts, Celtic Studies, and Philosophy,
> >>> Maynooth University,
> >>> Maynooth, Co Kildare, Ireland
> >>> Tel: 00 353 7086936
> >>> Fax: 00 353 1 7086952
> >>>
> >>>> On 14 Jun 2017, at 14:13, Rory Walsh <rorywalsh@ear.ie> wrote:
> >>>>
> >>>> In hindsight I can see why this method is called csoundAddSpinSample ;) It would be nice if we can also directly write samples to the intput buffers. A complementary function to  csoundGetSpoutSample(...).
> >>>>
> >>>> csoundGetSpinSample(..)
> >>>>
> >>>> maybe?
> >>>>
>