Re: [Csnd-dev] New API progress report

Tarmo Johannes <[email protected]>
Newsgroups gmane.comp.audio.csound.devel
Message-ID <CAPvdOzDQro2xRrAUEd6wnAbgM2gt8xvFS0i00i+CE=OsOdAXDA@mail.gmail.com>
Hi!

I tried out the new API from feature/newapi branch.

Building csound7 went fine, I installed it to $HOME/.local (Linux) and
added  $HOME/.local/lib to ldconfig libraries' path.

First I tried it with a relatively simple Qt project using Csound C++ API
(csound.hpp). After some changes everything worked fine. One question:

when before there was Csound::stop() / csoundStop() , how is it now the
proper way to end Csound's work? Also csoundCleanup() is gone. is
csoundReset() it that does it all?

Then I went to CsoundQt and of course that is much, much more complex  case.

First -  I guess libcsnd7 is not  is built by default? Is it still
existing, how should I configure it?  CsoundQt uses that for recording.
Maybe there is now a better way to rewrite the recording part.

CsoundQt used the following functions that are not to be there any more:

csoundGetModule
csoundSetMIDIModule
csoundSetRTAudioModule

I commented these lines out for now to move on. What covers their
functionality?

There is no more circular buffer functions:
csoundCreateCircularBuffer
csoundReadCircularBuffer
etc

CsoundQt leaned heavily on them for internal MIDI handling. What is the
correct way to handle it now?
For example reading MIDI data one should set the callback like:
        csoundSetExternalMidiReadCallback(ud->csound, &midiReadCb);

CsoundQt used to have such a function for the callback:

int CsoundEngine::midiReadCb(CSOUND *csound, void *ud_, unsigned char *buf,
int nBytes)
{
    CsoundUserData *ud = (CsoundUserData *) ud_;
    Q_UNUSED(csound);
    int count, countVirtual;
    count =  csoundReadCircularBuffer(ud->csound, ud->midiBuffer, buf,
nBytes);
    countVirtual =  csoundReadCircularBuffer(ud->csound,
ud->virtualMidiBuffer, buf + count, nBytes - count);
    return count + countVirtual;
}

Should the host implement writing to the buffer and handling the index
itself?

Is it so that csoundSetHostImplementedMIDIIO is replaced now with
PUBLIC void csoundSetHostMIDIIO(CSOUND *csound);

How to deal with global variables?
csoundQueryGlobalVariable
csoundCreateGlobalVariable
are gone,

csoundGetEnv is there but no csoundSetEnv, csoundSetGlobalEnv or similar?

at the moment I replaced them with Qt specific functions to deal with
environment variables.

What is the correct environment variable for the plugins directory,
OPCODE7DIR64?

I got CsoundQt building but it crashes when I run a file. I did not have
time yet to dig into it,  there are many possible reasons.  I hope to
continue tomorrow.

Exciting!
tarmo

Kontakt Victor Lazzarini (<[email protected]>)
kirjutas kuupäeval N, 25. juuli 2024 kell 18:27:

>
> Just another progress report for the feature/newapi branch
>
> - I have now mainlined the new API in csound.h
> - Updated the csound.hpp wrapper
> - Updated the csPerformanceThread code
> - Modified frontends to use it
> - Modified the C++ test suite
>
> It is all working, I guess frontend developers can take a look and see
> what they
> think.
>
> François: could you take a look at the Python wrapper? It is out of sync
> now.
>
> Victor
>
>
>
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.