Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report
Rory Walsh <[email protected]>
| Newsgroups | gmane.comp.audio.csound.devel |
|---|---|
| Message-ID | <CAMJR=HNMR4+D4Rux-Eyes78KMBFyFWNSeau_hwnEPgtTbSx3_w@mail.gmail.com> |
https://github.com/csound/csound/blob/develop/include/plugin.h On Sat 27 Jul 2024, 14:13 Michael Gogins, <[email protected]> wrote: > what is CPOF? > > On Sat, Jul 27, 2024, 07:10 vlz <[email protected]> wrote: > >> yes, that's right. >> Btw you can access any functions from the CSOUND structure by taking the >> CSOUND pointer with the relevant method in CPOF. >> >> Prof. Victor Lazzarini >> Maynooth University >> Ireland >> >> On 27 Jul 2024, at 12:04, Rory Walsh <[email protected]> wrote: >> >> >> I see it now in plugin.h, that's great. I'll give it a go for Cabbage 3. >> Actually, I can start using it now with Csound 6 right? >> >> On Sat 27 Jul 2024, 12:58 Rory Walsh, <[email protected]> wrote: >> >>> I can access host data using the CPOF? I never thought of this. >>> >>> On Sat, 27 Jul 2024 at 12:51, vlz <[email protected]> wrote: >>> >>>> I think you should use hostdata for passing anything from host to >>>> Csound and vice-versa. >>>> >>>> It is probably more straightforward as you just pass the pointers >>>> directly. Would that be a problem? >>>> >>>> Prof. Victor Lazzarini >>>> Maynooth University >>>> Ireland >>>> >>>> On 27 Jul 2024, at 11:12, Rory Walsh <[email protected]> wrote: >>>> >>>> >>>> With regards to: >>>> >>>> > csoundQueryGlobalVariable >>>> > csoundCreateGlobalVariable >>>> >>>> I have been using these methods to pass custom data structs between my >>>> opcodes and my host. I should have mentioned this earlier, but they slipped >>>> my attention. For example, some of my Csound opcodes can access widget >>>> classes owned by Cabbage. Perhaps it was never meant to be used in this >>>> way, but it's super powerful. I'm not sure how I can do this without them? >>>> >>>> On Sat, 27 Jul 2024 at 11:20, Victor Lazzarini < >>>> [email protected]> wrote: >>>> >>>>> Hi Tarmo, >>>>> >>>>> that’s great, this is one of the reasons we needed your input, so the >>>>> API can be tailored to the >>>>> needs of users. >>>>> >>>>> Regarding your issue, make sure the call is always after >>>>> csoundStart(), otherwise the spout will >>>>> not have been created. Here’s a simple test to show it >>>>> >>>>> csoundStart(Csound); >>>>> MYFLT *spout = csoundGetSpout(Csound); >>>>> printf("spout = %p \n", spout) >>>>> >>>>> best >>>>> ======================== >>>>> Prof. Victor Lazzarini >>>>> Maynooth University >>>>> Ireland >>>>> >>>>> > On 27 Jul 2024, at 09:31, Tarmo Johannes <[email protected]> wrote: >>>>> > >>>>> > Hi Victor! >>>>> > >>>>> > Thank you for the changes, it helps a lot. >>>>> > >>>>> > > csoundGetModule >>>>> > > csoundSetMIDIModule >>>>> > > csoundSetRTAudioModule >>>>> > >>>>> > Are used in config dialog to populate a menu to list the available >>>>> modules. Now it works fine again. >>>>> > I reverted some of my changes, left libcsnd out of libraries (this >>>>> is good news that it is not needed any more!) and CsoundQt build fine. >>>>> > >>>>> > I still get crash when running a csd. >>>>> > MYFLT *outputBuffer = csoundGetSpout(udata->csound); >>>>> > returns 0 in some reason, I will see if I can figure out the reason >>>>> later. >>>>> > >>>>> > Thanks! >>>>> > tarmo >>>>> > >>>>> > Kontakt Victor Lazzarini (< >>>>> [email protected]>) kirjutas >>>>> kuupäeval L, 27. juuli 2024 kell 00:55: >>>>> > Hi Tarmo, >>>>> > >>>>> > I put back >>>>> > >>>>> > > csoundGetModule >>>>> > > csoundSetMIDIModule >>>>> > > csoundSetRTAudioModule >>>>> > >>>>> > plus the set global env and the circular buffer functions. It’s in >>>>> the repo now. >>>>> > >>>>> > Best >>>>> > >>>>> > Victor >>>>> > >>>>> > > On 26 Jul 2024, at 20:29, Tarmo Johannes <[email protected]> >>>>> wrote: >>>>> > > >>>>> > > *Warning* >>>>> > > This email originated from outside of Maynooth University's Mail >>>>> System. Do not reply, click links or open attachments unless you recognise >>>>> the sender and know the content is safe. >>>>> > > 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 >>>>> > > >>>>> > > >>>>> > >>>>> >>>>>