Re: [Csnd-dev] Csound 7: csoundListChannels returns always 0

Tarmo Johannes <[email protected]>
Newsgroups gmane.comp.audio.csound.devel
Message-ID <CAPvdOzAqQSWkJM=2PMs5jP1AtAY74Z4V-2prQaA-PuLVTy5rTg@mail.gmail.com>
Hm,

in CsoundQt with the latest pull from Csound feature/newapi still the same
result:

controlChannelInfo_t *channelList;
int numChannels = csoundListChannels(ud->csound, &channelList);

the second lines sets channelList to 0x0 and returns 0 as numChannels.

When I build CsoundQt (the non modified code) agains Csound6, it returns
correct number of channels.

I need to go now but will think have closer look later. Maybe it is when
is  csoundStart() called.

tarmo





Kontakt vlz (<[email protected]>) kirjutas kuupäeval N, 5. september
2024 kell 10:59:

> I tested it here and it is working. See the test program
>
> const char *code =
>   "0dbfs = 1              \n"
>   "chn_k \"pitch\",3  \n"
>   "instr 1                \n"
>   "kp chnget \"pitch\"    \n"
>   "a1 expon p4,p3,0.001   \n"
>   "a2 oscil a1,cpsmidinn(p5)*kp\n"
>   "    out a2             \n"
>   "endin                  \n";
>
> int main(int argc, const char *argv[]) {
>   /* Create the Csound engine instance */
>   CSOUND *csound = csoundCreate(NULL, NULL);
>
>   if(csound != NULL) {
>     int res = CSOUND_SUCCESS, i;
>     /* Set options checking for any errors */
>     for(i = 1; i < argc; i++)
>       res += csoundSetOption(csound, argv[i]);
>     if(res == CSOUND_SUCCESS) {
>       /* Compile code from string, synchronously */
>       res = csoundCompileOrc(csound, code, 0);
>       if(res == CSOUND_SUCCESS) {
>         char evt[64];
>         MYFLT dur = 5.;
>         MYFLT pitch = 1., incr = 1./(dur*csoundGetKr(csound));
>         /* Start engine */
>         res = csoundStart(csound);
>         controlChannelInfo_t *list;
>         int chn = csoundListChannels(csound, &list);
>         csoundMessage(csound, "%d channels\n", chn);
>         /* send realtine event, synchronously */
>         snprintf(evt, 64, "i1 0 %f 0.1 60\n", dur);
>         csoundEventString(csound, evt, 0);
>        /* compute audio blocks */
>         csoundPerformKsmps(csound);
>         while(res == CSOUND_SUCCESS) {
>           csoundSetControlChannel(csound, "pitch", pitch);
>           res = csoundPerformKsmps(csound);
>           pitch += incr;
>           if(pitch > 2)
>            csoundEventString(csound, "e 0", 0);
>         }
>       }
>     }
>     /* Destroy the engine instance */
>     csoundDestroy(csound);
>     return 0;
>   }
>   return -1;
> }
>
> It prints
>
> SECTION 1:
> 1 channels
> new alloc for instr 1:
>   T  5.000 TT  5.000 M:  0.09989
> End of Performance inactive allocs returned to freespace
>   overall amps:  0.09989
>   overall samples out of range:        0
> 0 errors in performance
>
>
> > On 5 Sep 2024, at 08:06, Tarmo Johannes <[email protected]> wrote:
> >
> > Hi,
> >
> > This is mostly meant for Victor:
> >
> > Testing CsoundQt with Csound7 I discovered that the inital values are
> not read any more from the widgets, chnget returns 0 until the the widget
> is moved.
> >
> > CsoudnQt goes through the channels declared with chn_k/chn_S and puts a
> value read from according widgets into the channels.
> > see
> https://github.com/CsoundQt/CsoundQt/blob/5ca6f63a11a470575bc53fcdc3629cd8079df2b4/src/csoundengine.cpp#L1062
> >
> > The problem is that with Csound 7 (built from feature/newapi Augus 30)
> >
> > csoundListChannels()
> >
> > returns always 0, although there are declared channels:
> >
> > controlChannelInfo_t *channelList;
> > int numChannels = csoundListChannels(ud->csound, &channelList);
> >
> > What has changed? Might be that I need to implement it differently on
> CsoundQt side.
> >
> > Should I file a bug report?
> >
> > tarmo
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.