Csound Csound-dev Csound-tekno Search About

[Csnd-dev] New API function

Date2016-10-02 15:59
FromFrancois PINOT
Subject[Csnd-dev] New API function
Hello Victor,

I tried your new csoundGetOutputFormat function with this code:

#include <csound/csound.h>

int main(int argc, char **argv)
{
  int result;
  char *type = "dummy";
  char *format = "dummy--";
 
  CSOUND *csound = csoundCreate(NULL);
  result = csoundCompile(csound, argc, (const char **)argv);
  if (result == 0) {
    csoundSetOutput(csound, "myfile", "wav", "float");
    csoundGetOutputFormat(csound, type, format);
    printf("%s, %s\n", type, format);
  }
  csoundDestroy(csound);
  return (result >= 0 ? 0 : result);
}

and I got a segmentation fault. Did I miss something?

François

Date2016-10-02 16:12
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
You need to give it some memory:

char type[6];
char format[8];

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 2 Oct 2016, at 15:59, Francois PINOT  wrote:
> 
> Hello Victor,
> 
> I tried your new csoundGetOutputFormat function with this code:
> 
> #include 
> 
> int main(int argc, char **argv)
> {
>   int result;
>   char *type = "dummy";
>   char *format = "dummy--";
>   
>   CSOUND *csound = csoundCreate(NULL);
>   result = csoundCompile(csound, argc, (const char **)argv);
>   if (result == 0) {
>     csoundSetOutput(csound, "myfile", "wav", "float");
>     csoundGetOutputFormat(csound, type, format);
>     printf("%s, %s\n", type, format);
>   }
>   csoundDestroy(csound);
>   return (result >= 0 ? 0 : result);
> }
> 
> and I got a segmentation fault. Did I miss something?
> 

Date2016-10-02 16:20
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
It doesn't change anything: char type = "dummy" or char type[6] yield the same result...

2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
You need to give it some memory:

char type[6];
char format[8];

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
>
> Hello Victor,
>
> I tried your new csoundGetOutputFormat function with this code:
>
> #include <csound/csound.h>
>
> int main(int argc, char **argv)
> {
>   int result;
>   char *type = "dummy";
>   char *format = "dummy--";
>
>   CSOUND *csound = csoundCreate(NULL);
>   result = csoundCompile(csound, argc, (const char **)argv);
>   if (result == 0) {
>     csoundSetOutput(csound, "myfile", "wav", "float");
>     csoundGetOutputFormat(csound, type, format);
>     printf("%s, %s\n", type, format);
>   }
>   csoundDestroy(csound);
>   return (result >= 0 ? 0 : result);
> }
>
> and I got a segmentation fault. Did I miss something?
>
> François


Date2016-10-02 16:31
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...

François

2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
It doesn't change anything: char type = "dummy" or char type[6] yield the same result...

2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
You need to give it some memory:

char type[6];
char format[8];

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
>
> Hello Victor,
>
> I tried your new csoundGetOutputFormat function with this code:
>
> #include <csound/csound.h>
>
> int main(int argc, char **argv)
> {
>   int result;
>   char *type = "dummy";
>   char *format = "dummy--";
>
>   CSOUND *csound = csoundCreate(NULL);
>   result = csoundCompile(csound, argc, (const char **)argv);
>   if (result == 0) {
>     csoundSetOutput(csound, "myfile", "wav", "float");
>     csoundGetOutputFormat(csound, type, format);
>     printf("%s, %s\n", type, format);
>   }
>   csoundDestroy(csound);
>   return (result >= 0 ? 0 : result);
> }
>
> and I got a segmentation fault. Did I miss something?
>
> François



Date2016-10-02 17:52
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone  None  

Date2016-10-02 17:56
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
I get the same segmentation fault with both flavors.

2016-10-02 18:52 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
Should they? "dummy" is a constant and char * is pointing to it, so
I guess in some systems, when you pass the "dummy" pointer to the
function, and the function changes that memory, we have a crash.


Try declaring the char array and see if it works.


----- Original Message -----
From: Francois PINOT <fggpinot@GMAIL.COM>
Date: Sunday, October 2, 2016 4:32 pm
Subject: Re: [Csnd-dev] New API function
To: CSOUND-DEV@LISTSERV.HEANET.IE


> Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...
>
> François
>
> 2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
> It doesn't change anything: char type = "dummy" or char type[6] yield the same result...
>
> 2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> You need to give it some memory:
>
> char type[6];
> char format[8];
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
> > On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> >
> > Hello Victor,
> >
> > I tried your new csoundGetOutputFormat function with this code:
> >
> > #include <csound/csound.h>
> >
> > int main(int argc, char **argv)
> > {
> >   int result;
> >   char *type = "dummy";
> >   char *format = "dummy--";
> >
> >   CSOUND *csound = csoundCreate(NULL);
> >   result = csoundCompile(csound, argc, (const char **)argv);
> >   if (result == 0) {
> >     csoundSetOutput(csound, "myfile", "wav", "float");
> >     csoundGetOutputFormat(csound, type, format);
> >     printf("%s, %s\n", type, format);
> >   }
> >   csoundDestroy(csound);
> >   return (result >= 0 ? 0 : result);
> > }
> >
> > and I got a segmentation fault. Did I miss something?
> >
> > François
>
>


Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth


Date2016-10-02 17:57
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone  None  

Date2016-10-02 18:24
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone  None  

Date2016-10-02 18:56
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
Just rebuilt Csound from github, but still seg fault...

2016-10-02 19:24 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
Fixed. Thanks.

Note that in your program, csoundSetOutput() after compilation is a no-op.


----- Original Message -----
From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Date: Sunday, October 2, 2016 5:58 pm
Subject: Re: [Csnd-dev] New API function
To: CSOUND-DEV@LISTSERV.HEANET.IE

> Ok I will look at it. Thanks
>
> ----- Original Message -----
> From: Francois PINOT <fggpinot@GMAIL.COM>
> Date: Sunday, October 2, 2016 5:56 pm
> Subject: Re: [Csnd-dev] New API function
> To: CSOUND-DEV@LISTSERV.HEANET.IE
>
> > I get the same segmentation fault with both flavors.
> >
> > 2016-10-02 18:52 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > Should they? "dummy" is a constant and char * is pointing to it, so
> > I guess in some systems, when you pass the "dummy" pointer to the
> > function, and the function changes that memory, we have a crash.
> >
> >
> > Try declaring the char array and see if it works.
>
> >
> > ----- Original Message -----
> > From: Francois PINOT <fggpinot@GMAIL.COM>
> > Date: Sunday, October 2, 2016 4:32 pm
> > Subject: Re: [Csnd-dev] New API function
> > To: CSOUND-DEV@LISTSERV.HEANET.IE
> >
> >
> > > Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...
> > >
> > > François
> > >
> > > 2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
> > > It doesn't change anything: char type = "dummy" or char type[6] yield the same result...
> > >
> > > 2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > You need to give it some memory:
> > >
> > > char type[6];
> > > char format[8];
> > >
> > > Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy
> > > Maynooth University
> > > Ireland
> >
>
> > > > On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > > >
> > > > Hello Victor,
> > > >
> > > > I tried your new csoundGetOutputFormat function with this code:
> > > >
> > > > #include <csound/csound.h>
> > > >
> > > > int main(int argc, char **argv)
> > > > {
> > > >   int result;
> > > >   char *type = "dummy";
> > > >   char *format = "dummy--";
> > > >
> > > >   CSOUND *csound = csoundCreate(NULL);
> > > >   result = csoundCompile(csound, argc, (const char **)argv);
> > > >   if (result == 0) {
> > > >     csoundSetOutput(csound, "myfile", "wav", "float");
> > > >     csoundGetOutputFormat(csound, type, format);
> > > >     printf("%s, %s\n", type, format);
> > > >   }
> > > >   csoundDestroy(csound);
> > > >   return (result >= 0 ? 0 : result);
> > > > }
> > > >
> > > > and I got a segmentation fault. Did I miss something?
> > > >
> > > > François
> >
> > >
> >
> > >
> >
> >
> > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > National University of Ireland, Maynooth
>
> >
>
>
> Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> National University of Ireland, Maynooth


Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth


Date2016-10-02 19:05
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
it's working here. I wonder if the commit did not work

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 2 Oct 2016, at 18:56, Francois PINOT <fggpinot@GMAIL.COM> wrote:

Just rebuilt Csound from github, but still seg fault...

2016-10-02 19:24 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
Fixed. Thanks.

Note that in your program, csoundSetOutput() after compilation is a no-op.


----- Original Message -----
From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Date: Sunday, October 2, 2016 5:58 pm
Subject: Re: [Csnd-dev] New API function
To: CSOUND-DEV@LISTSERV.HEANET.IE

> Ok I will look at it. Thanks
>
> ----- Original Message -----
> From: Francois PINOT <fggpinot@GMAIL.COM>
> Date: Sunday, October 2, 2016 5:56 pm
> Subject: Re: [Csnd-dev] New API function
> To: CSOUND-DEV@LISTSERV.HEANET.IE
>
> > I get the same segmentation fault with both flavors.
> >
> > 2016-10-02 18:52 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > Should they? "dummy" is a constant and char * is pointing to it, so
> > I guess in some systems, when you pass the "dummy" pointer to the
> > function, and the function changes that memory, we have a crash.
> >
> >
> > Try declaring the char array and see if it works.
>
> >
> > ----- Original Message -----
> > From: Francois PINOT <fggpinot@GMAIL.COM>
> > Date: Sunday, October 2, 2016 4:32 pm
> > Subject: Re: [Csnd-dev] New API function
> > To: CSOUND-DEV@LISTSERV.HEANET.IE
> >
> >
> > > Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...
> > >
> > > François
> > >
> > > 2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
> > > It doesn't change anything: char type = "dummy" or char type[6] yield the same result...
> > >
> > > 2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > You need to give it some memory:
> > >
> > > char type[6];
> > > char format[8];
> > >
> > > Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy
> > > Maynooth University
> > > Ireland
> >
>
> > > > On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > > >
> > > > Hello Victor,
> > > >
> > > > I tried your new csoundGetOutputFormat function with this code:
> > > >
> > > > #include <csound/csound.h>
> > > >
> > > > int main(int argc, char **argv)
> > > > {
> > > >   int result;
> > > >   char *type = "dummy";
> > > >   char *format = "dummy--";
> > > >
> > > >   CSOUND *csound = csoundCreate(NULL);
> > > >   result = csoundCompile(csound, argc, (const char **)argv);
> > > >   if (result == 0) {
> > > >     csoundSetOutput(csound, "myfile", "wav", "float");
> > > >     csoundGetOutputFormat(csound, type, format);
> > > >     printf("%s, %s\n", type, format);
> > > >   }
> > > >   csoundDestroy(csound);
> > > >   return (result >= 0 ? 0 : result);
> > > > }
> > > >
> > > > and I got a segmentation fault. Did I miss something?
> > > >
> > > > François
> >
> > >
> >
> > >
> >
> >
> > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > National University of Ireland, Maynooth
>
> >
>
>
> Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> National University of Ireland, Maynooth


Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth


Date2016-10-02 19:09
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone  None  

Date2016-10-02 19:12
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone  None  

Date2016-10-02 19:54
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
Here I still get a seg fault even with your version...

2016-10-02 20:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
but using



  char *type = "dummy";
  char *format = "dummy---";


segfaults as expected.
----- Original Message -----
From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Date: Sunday, October 2, 2016 7:09 pm
Subject: Re: [Csnd-dev] New API function
To: CSOUND-DEV@LISTSERV.HEANET.IE

> No, the commit went through. This program is 
>
>
>
> int main(int argc, char **argv)
> {
>   int result;
>   char type[6];
>   char format[8];
>   
>   CSOUND *csound = csoundCreate(NULL);
>   result = csoundCompile(csound, argc, (const char **)argv);
>   if (result == 0) {
>     csoundSetOutput(csound, "myfile", "wav", "float");
>     csoundGetOutputFormat(csound, type, format);
>     printf("%s, %s\n", type, format);
>   }
>   csoundDestroy(csound);
>   return (result >= 0 ? 0 : result);
> }
>
>
> and prints
>

> aiff, short

as expected.
> ----- Original Message -----
> From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> Date: Sunday, October 2, 2016 7:05 pm
> Subject: Re: [Csnd-dev] New API function
> To: CSOUND-DEV@LISTSERV.HEANET.IE
>

>
> > it's working here. I wonder if the commit did not work
> >
> > Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> > Maynooth University
> > Ireland
> >
> > On 2 Oct 2016, at 18:56, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> >
>
> > Just rebuilt Csound from github, but still seg fault...
> >
> > 2016-10-02 19:24 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > Fixed. Thanks.
> >
> > Note that in your program, csoundSetOutput() after compilation is a no-op.

> >
> > ----- Original Message -----
> > From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> > Date: Sunday, October 2, 2016 5:58 pm
> > Subject: Re: [Csnd-dev] New API function
> > To: CSOUND-DEV@LISTSERV.HEANET.IE
> >
> > > Ok I will look at it. Thanks
> > >
> > > ----- Original Message -----
> > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > Date: Sunday, October 2, 2016 5:56 pm
> > > Subject: Re: [Csnd-dev] New API function
> > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > >
> > > > I get the same segmentation fault with both flavors.
> > > >
> > > > 2016-10-02 18:52 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > Should they? "dummy" is a constant and char * is pointing to it, so
> > > > I guess in some systems, when you pass the "dummy" pointer to the
> > > > function, and the function changes that memory, we have a crash.
> > > >
> > > >
> > > > Try declaring the char array and see if it works.
> > >
> > > >
> > > > ----- Original Message -----
> > > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > > Date: Sunday, October 2, 2016 4:32 pm
> > > > Subject: Re: [Csnd-dev] New API function
> > > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > > >
> > > >
> > > > > Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...
> > > > >
> > > > > François
> > > > >
> > > > > 2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
> > > > > It doesn't change anything: char type = "dummy" or char type[6] yield the same result...
> > > > >
> > > > > 2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > > You need to give it some memory:
> > > > >
> > > > > char type[6];
> > > > > char format[8];
> > > > >
> > > > > Victor Lazzarini
> > > > > Dean of Arts, Celtic Studies, and Philosophy
> > > > > Maynooth University
> > > > > Ireland
> > > >
>
> > > > > > On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > > > > >
> > > > > > Hello Victor,
> > > > > >
> > > > > > I tried your new csoundGetOutputFormat function with this code:
> > > > > >
> > > > > > #include <csound/csound.h>
> > > > > >
> > > > > > int main(int argc, char **argv)
> > > > > > {
> > > > > >   int result;
> > > > > >   char *type = "dummy";
> > > > > >   char *format = "dummy--";
> > > > > >
> > > > > >   CSOUND *csound = csoundCreate(NULL);
> > > > > >   result = csoundCompile(csound, argc, (const char **)argv);
> > > > > >   if (result == 0) {
> > > > > >     csoundSetOutput(csound, "myfile", "wav", "float");
> > > > > >     csoundGetOutputFormat(csound, type, format);
> > > > > >     printf("%s, %s\n", type, format);
> > > > > >   }
> > > > > >   csoundDestroy(csound);
> > > > > >   return (result >= 0 ? 0 : result);
> > > > > > }
> > > > > >
> > > > > > and I got a segmentation fault. Did I miss something?
> > > > > >
> > > > > > François
> > > >
> > > > >
> > > >
> > > > >
> > > >
> > > >
> > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > > National University of Ireland, Maynooth
> > >
> > > >
> > >
> > >
> > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > National University of Ireland, Maynooth
> >
> >
> > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > National University of Ireland, Maynooth
>
> >
>


>
> Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> National University of Ireland, Maynooth


Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth


Date2016-10-02 20:01
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
Repulled and now it's working. Thank you Victor.

François

2016-10-02 20:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
but using



  char *type = "dummy";
  char *format = "dummy---";


segfaults as expected.
----- Original Message -----
From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Date: Sunday, October 2, 2016 7:09 pm
Subject: Re: [Csnd-dev] New API function
To: CSOUND-DEV@LISTSERV.HEANET.IE

> No, the commit went through. This program is 
>
>
>
> int main(int argc, char **argv)
> {
>   int result;
>   char type[6];
>   char format[8];
>   
>   CSOUND *csound = csoundCreate(NULL);
>   result = csoundCompile(csound, argc, (const char **)argv);
>   if (result == 0) {
>     csoundSetOutput(csound, "myfile", "wav", "float");
>     csoundGetOutputFormat(csound, type, format);
>     printf("%s, %s\n", type, format);
>   }
>   csoundDestroy(csound);
>   return (result >= 0 ? 0 : result);
> }
>
>
> and prints
>

> aiff, short

as expected.
> ----- Original Message -----
> From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> Date: Sunday, October 2, 2016 7:05 pm
> Subject: Re: [Csnd-dev] New API function
> To: CSOUND-DEV@LISTSERV.HEANET.IE
>

>
> > it's working here. I wonder if the commit did not work
> >
> > Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> > Maynooth University
> > Ireland
> >
> > On 2 Oct 2016, at 18:56, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> >
>
> > Just rebuilt Csound from github, but still seg fault...
> >
> > 2016-10-02 19:24 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > Fixed. Thanks.
> >
> > Note that in your program, csoundSetOutput() after compilation is a no-op.

> >
> > ----- Original Message -----
> > From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> > Date: Sunday, October 2, 2016 5:58 pm
> > Subject: Re: [Csnd-dev] New API function
> > To: CSOUND-DEV@LISTSERV.HEANET.IE
> >
> > > Ok I will look at it. Thanks
> > >
> > > ----- Original Message -----
> > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > Date: Sunday, October 2, 2016 5:56 pm
> > > Subject: Re: [Csnd-dev] New API function
> > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > >
> > > > I get the same segmentation fault with both flavors.
> > > >
> > > > 2016-10-02 18:52 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > Should they? "dummy" is a constant and char * is pointing to it, so
> > > > I guess in some systems, when you pass the "dummy" pointer to the
> > > > function, and the function changes that memory, we have a crash.
> > > >
> > > >
> > > > Try declaring the char array and see if it works.
> > >
> > > >
> > > > ----- Original Message -----
> > > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > > Date: Sunday, October 2, 2016 4:32 pm
> > > > Subject: Re: [Csnd-dev] New API function
> > > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > > >
> > > >
> > > > > Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...
> > > > >
> > > > > François
> > > > >
> > > > > 2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
> > > > > It doesn't change anything: char type = "dummy" or char type[6] yield the same result...
> > > > >
> > > > > 2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > > You need to give it some memory:
> > > > >
> > > > > char type[6];
> > > > > char format[8];
> > > > >
> > > > > Victor Lazzarini
> > > > > Dean of Arts, Celtic Studies, and Philosophy
> > > > > Maynooth University
> > > > > Ireland
> > > >
>
> > > > > > On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > > > > >
> > > > > > Hello Victor,
> > > > > >
> > > > > > I tried your new csoundGetOutputFormat function with this code:
> > > > > >
> > > > > > #include <csound/csound.h>
> > > > > >
> > > > > > int main(int argc, char **argv)
> > > > > > {
> > > > > >   int result;
> > > > > >   char *type = "dummy";
> > > > > >   char *format = "dummy--";
> > > > > >
> > > > > >   CSOUND *csound = csoundCreate(NULL);
> > > > > >   result = csoundCompile(csound, argc, (const char **)argv);
> > > > > >   if (result == 0) {
> > > > > >     csoundSetOutput(csound, "myfile", "wav", "float");
> > > > > >     csoundGetOutputFormat(csound, type, format);
> > > > > >     printf("%s, %s\n", type, format);
> > > > > >   }
> > > > > >   csoundDestroy(csound);
> > > > > >   return (result >= 0 ? 0 : result);
> > > > > > }
> > > > > >
> > > > > > and I got a segmentation fault. Did I miss something?
> > > > > >
> > > > > > François
> > > >
> > > > >
> > > >
> > > > >
> > > >
> > > >
> > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > > National University of Ireland, Maynooth
> > >
> > > >
> > >
> > >
> > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > National University of Ireland, Maynooth
> >
> >
> > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > National University of Ireland, Maynooth
>
> >
>


>
> Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> National University of Ireland, Maynooth


Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth


Date2016-10-02 20:14
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone  None  

Date2016-10-03 03:09
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
If the output format has been defined either by a call to csoundSetOutput or by the compilation of a csd file, csoundGetOutputFormat works fine. But if the output format has not been set, we get a seg fault like in the following example:

int main(int argc, char **argv)
{
  int result;
  char type[6];
  char format[8];
 
  CSOUND *csound = csoundCreate(NULL);
  //csoundSetOutput(csound, "myfile", "wav", "float");
  csoundGetOutputFormat(csound, type, format);
  printf("%s, %s\n", type, format);
  csoundDestroy(csound);
  return (result >= 0 ? 0 : result);
}

Is it normal behavior or should we have default values?

François

2016-10-02 21:14 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
Thanks for checking it.

----- Original Message -----
From: Francois PINOT <fggpinot@GMAIL.COM>
Date: Sunday, October 2, 2016 8:01 pm
Subject: Re: [Csnd-dev] New API function
To: CSOUND-DEV@LISTSERV.HEANET.IE


> Repulled and now it's working. Thank you Victor.
>
> François
>
> 2016-10-02 20:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> but using
>
>
>
>   char *type = "dummy";
>   char *format = "dummy---";
>
>
> segfaults as expected.
> ----- Original Message -----
> From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> Date: Sunday, October 2, 2016 7:09 pm
> Subject: Re: [Csnd-dev] New API function
> To: CSOUND-DEV@LISTSERV.HEANET.IE
>
> > No, the commit went through. This program is 
> >
> >
> >
> > int main(int argc, char **argv)
> > {
> >   int result;
> >   char type[6];
> >   char format[8];
> >   
> >   CSOUND *csound = csoundCreate(NULL);
> >   result = csoundCompile(csound, argc, (const char **)argv);
> >   if (result == 0) {
> >     csoundSetOutput(csound, "myfile", "wav", "float");
> >     csoundGetOutputFormat(csound, type, format);
> >     printf("%s, %s\n", type, format);
> >   }
> >   csoundDestroy(csound);
> >   return (result >= 0 ? 0 : result);
> > }
> >
> >
> > and prints
> >

> > aiff, short

as expected.
> > ----- Original Message -----
> > From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> > Date: Sunday, October 2, 2016 7:05 pm
> > Subject: Re: [Csnd-dev] New API function
> > To: CSOUND-DEV@LISTSERV.HEANET.IE
> >

> >
> > > it's working here. I wonder if the commit did not work
> > >
> > > Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy
> > > Maynooth University
> > > Ireland
> > >
> > > On 2 Oct 2016, at 18:56, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > >
> >
> > > Just rebuilt Csound from github, but still seg fault...
> > >
> > > 2016-10-02 19:24 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > Fixed. Thanks.
> > >
> > > Note that in your program, csoundSetOutput() after compilation is a no-op.

> > >
> > > ----- Original Message -----
> > > From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> > > Date: Sunday, October 2, 2016 5:58 pm
> > > Subject: Re: [Csnd-dev] New API function
> > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > >
> > > > Ok I will look at it. Thanks
> > > >
> > > > ----- Original Message -----
> > > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > > Date: Sunday, October 2, 2016 5:56 pm
> > > > Subject: Re: [Csnd-dev] New API function
> > > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > > >
> > > > > I get the same segmentation fault with both flavors.
> > > > >
> > > > > 2016-10-02 18:52 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > > Should they? "dummy" is a constant and char * is pointing to it, so
> > > > > I guess in some systems, when you pass the "dummy" pointer to the
> > > > > function, and the function changes that memory, we have a crash.
> > > > >
> > > > >
> > > > > Try declaring the char array and see if it works.
> > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > > > Date: Sunday, October 2, 2016 4:32 pm
> > > > > Subject: Re: [Csnd-dev] New API function
> > > > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > > > >
> > > > >
> > > > > > Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...
> > > > > >
> > > > > > François
> > > > > >
> > > > > > 2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
> > > > > > It doesn't change anything: char type = "dummy" or char type[6] yield the same result...
> > > > > >
> > > > > > 2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > > > You need to give it some memory:
> > > > > >
> > > > > > char type[6];
> > > > > > char format[8];
> > > > > >
> > > > > > Victor Lazzarini
> > > > > > Dean of Arts, Celtic Studies, and Philosophy
> > > > > > Maynooth University
> > > > > > Ireland
> > > > >
>
> > > > > > > On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > > > > > >
> > > > > > > Hello Victor,
> > > > > > >
> > > > > > > I tried your new csoundGetOutputFormat function with this code:
> > > > > > >
> > > > > > > #include <csound/csound.h>
> > > > > > >
> > > > > > > int main(int argc, char **argv)
> > > > > > > {
> > > > > > >   int result;
> > > > > > >   char *type = "dummy";
> > > > > > >   char *format = "dummy--";
> > > > > > >
> > > > > > >   CSOUND *csound = csoundCreate(NULL);
> > > > > > >   result = csoundCompile(csound, argc, (const char **)argv);
> > > > > > >   if (result == 0) {
> > > > > > >     csoundSetOutput(csound, "myfile", "wav", "float");
> > > > > > >     csoundGetOutputFormat(csound, type, format);
> > > > > > >     printf("%s, %s\n", type, format);
> > > > > > >   }
> > > > > > >   csoundDestroy(csound);
> > > > > > >   return (result >= 0 ? 0 : result);
> > > > > > > }
> > > > > > >
> > > > > > > and I got a segmentation fault. Did I miss something?
> > > > > > >
> > > > > > > François
> > > > >
> > > > > >
> > > > >
> > > > > >
> > > > >
> > > > >
> > > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > > > National University of Ireland, Maynooth
> > > >
> > > > >
> > > >
> > > >
> > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > > National University of Ireland, Maynooth
> > >
> > >
> > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > National University of Ireland, Maynooth
> >
> > >
> >

>
> >
> > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > National University of Ireland, Maynooth
>
>
> Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> National University of Ireland, Maynooth
>


Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth


Date2016-10-03 08:54
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone  None  

Date2016-10-03 15:34
FromFrancois PINOT
SubjectRe: [Csnd-dev] New API function
Thank you Victor. Now in ctcsound.

François

2016-10-03 9:54 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
The segfault was a bug. I fixed it.

----- Original Message -----
From: Francois PINOT <fggpinot@GMAIL.COM>
Date: Monday, October 3, 2016 3:10 am
Subject: Re: [Csnd-dev] New API function
To: CSOUND-DEV@LISTSERV.HEANET.IE



> If the output format has been defined either by a call to csoundSetOutput or by the compilation of a csd file, csoundGetOutputFormat works fine. But if the output format has not been set, we get a seg fault like in the following example:
>
> int main(int argc, char **argv)
> {
>   int result;
>   char type[6];
>   char format[8];
>  
>   CSOUND *csound = csoundCreate(NULL);
>   //csoundSetOutput(csound, "myfile", "wav", "float");
>   csoundGetOutputFormat(csound, type, format);
>   printf("%s, %s\n", type, format);
>   csoundDestroy(csound);
>   return (result >= 0 ? 0 : result);
> }
>
> Is it normal behavior or should we have default values?
>
> François
>
> 2016-10-02 21:14 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> Thanks for checking it.
>
> ----- Original Message -----
> From: Francois PINOT <fggpinot@GMAIL.COM>
> Date: Sunday, October 2, 2016 8:01 pm
> Subject: Re: [Csnd-dev] New API function
> To: CSOUND-DEV@LISTSERV.HEANET.IE
>
>
> > Repulled and now it's working. Thank you Victor.
> >
> > François
> >
> > 2016-10-02 20:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > but using
> >
> >
> >
> >   char *type = "dummy";
> >   char *format = "dummy---";
> >
> >
> > segfaults as expected.
> > ----- Original Message -----
> > From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> > Date: Sunday, October 2, 2016 7:09 pm
> > Subject: Re: [Csnd-dev] New API function
> > To: CSOUND-DEV@LISTSERV.HEANET.IE
> >
> > > No, the commit went through. This program is 
> > >
> > >
> > >
> > > int main(int argc, char **argv)
> > > {
> > >   int result;
> > >   char type[6];
> > >   char format[8];
> > >   
> > >   CSOUND *csound = csoundCreate(NULL);
> > >   result = csoundCompile(csound, argc, (const char **)argv);
> > >   if (result == 0) {
> > >     csoundSetOutput(csound, "myfile", "wav", "float");
> > >     csoundGetOutputFormat(csound, type, format);
> > >     printf("%s, %s\n", type, format);
> > >   }
> > >   csoundDestroy(csound);
> > >   return (result >= 0 ? 0 : result);
> > > }
> > >
> > >
> > > and prints
> > >

> > > aiff, short

as expected.
> > > ----- Original Message -----
> > > From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> > > Date: Sunday, October 2, 2016 7:05 pm
> > > Subject: Re: [Csnd-dev] New API function
> > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > >

> > >
> > > > it's working here. I wonder if the commit did not work
> > > >
> > > > Victor Lazzarini
> > > Dean of Arts, Celtic Studies, and Philosophy
> > > > Maynooth University
> > > > Ireland
> > > >
> > > > On 2 Oct 2016, at 18:56, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > > >
> > >
> > > > Just rebuilt Csound from github, but still seg fault...
> > > >
> > > > 2016-10-02 19:24 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > Fixed. Thanks.
> > > >
> > > > Note that in your program, csoundSetOutput() after compilation is a no-op.

> > > >
> > > > ----- Original Message -----
> > > > From: Victor Lazzarini <Victor.Lazzarini@nuim.ie>
> > > > Date: Sunday, October 2, 2016 5:58 pm
> > > > Subject: Re: [Csnd-dev] New API function
> > > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > > >
> > > > > Ok I will look at it. Thanks
> > > > >
> > > > > ----- Original Message -----
> > > > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > > > Date: Sunday, October 2, 2016 5:56 pm
> > > > > Subject: Re: [Csnd-dev] New API function
> > > > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > > > >
> > > > > > I get the same segmentation fault with both flavors.
> > > > > >
> > > > > > 2016-10-02 18:52 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > > > Should they? "dummy" is a constant and char * is pointing to it, so
> > > > > > I guess in some systems, when you pass the "dummy" pointer to the
> > > > > > function, and the function changes that memory, we have a crash.
> > > > > >
> > > > > >
> > > > > > Try declaring the char array and see if it works.
> > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: Francois PINOT <fggpinot@GMAIL.COM>
> > > > > > Date: Sunday, October 2, 2016 4:32 pm
> > > > > > Subject: Re: [Csnd-dev] New API function
> > > > > > To: CSOUND-DEV@LISTSERV.HEANET.IE
> > > > > >
> > > > > >
> > > > > > > Could you try my code on your system: char *type = "dummy" and char type[6] should be equivalent...
> > > > > > >
> > > > > > > François
> > > > > > >
> > > > > > > 2016-10-02 17:20 GMT+02:00 Francois PINOT <fggpinot@gmail.com>:
> > > > > > > It doesn't change anything: char type = "dummy" or char type[6] yield the same result...
> > > > > > >
> > > > > > > 2016-10-02 17:12 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
> > > > > > > You need to give it some memory:
> > > > > > >
> > > > > > > char type[6];
> > > > > > > char format[8];
> > > > > > >
> > > > > > > Victor Lazzarini
> > > > > > > Dean of Arts, Celtic Studies, and Philosophy
> > > > > > > Maynooth University
> > > > > > > Ireland
> > > > > >
>
> > > > > > > > On 2 Oct 2016, at 15:59, Francois PINOT <fggpinot@GMAIL.COM> wrote:
> > > > > > > >
> > > > > > > > Hello Victor,
> > > > > > > >
> > > > > > > > I tried your new csoundGetOutputFormat function with this code:
> > > > > > > >
> > > > > > > > #include <csound/csound.h>
> > > > > > > >
> > > > > > > > int main(int argc, char **argv)
> > > > > > > > {
> > > > > > > >   int result;
> > > > > > > >   char *type = "dummy";
> > > > > > > >   char *format = "dummy--";
> > > > > > > >
> > > > > > > >   CSOUND *csound = csoundCreate(NULL);
> > > > > > > >   result = csoundCompile(csound, argc, (const char **)argv);
> > > > > > > >   if (result == 0) {
> > > > > > > >     csoundSetOutput(csound, "myfile", "wav", "float");
> > > > > > > >     csoundGetOutputFormat(csound, type, format);
> > > > > > > >     printf("%s, %s\n", type, format);
> > > > > > > >   }
> > > > > > > >   csoundDestroy(csound);
> > > > > > > >   return (result >= 0 ? 0 : result);
> > > > > > > > }
> > > > > > > >
> > > > > > > > and I got a segmentation fault. Did I miss something?
> > > > > > > >
> > > > > > > > François
> > > > > >
> > > > > > >
> > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > > > > National University of Ireland, Maynooth
> > > > >
> > > > > >
> > > > >
> > > > >
> > > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > > > National University of Ireland, Maynooth
> > > >
> > > >
> > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > > National University of Ireland, Maynooth
> > >
> > > >
> > >

> >
> > >
> > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > > National University of Ireland, Maynooth
> >
> >
> > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> > National University of Ireland, Maynooth
>
> >
>
>
> Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> National University of Ireland, Maynooth
>


Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth


Date2016-10-03 15:37
FromVictor Lazzarini
SubjectRe: [Csnd-dev] New API function
AttachmentsNone