Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report
Blake Mitchell <[email protected]>
| Newsgroups | gmane.comp.audio.csound.devel |
|---|---|
| Message-ID | <CAPxUcnHDjFKa8t5tjVr8-VMZh55DOPemkOh0wTm8K3F=OX+dsA@mail.gmail.com> |
At least for Windows, there is already an uninstaller for Csound 6. So, it turns out that my bindings were finding the csound64.dll for Csound 6 in my path. (I thought I was passing in a path to the new Csound 7 DLL, but that's on my side to figure out.) It just so happens that my bindings, despite being built for the Csound 7 API, were working with the Csound 6 API. A few notes: - csoundGetVersion now returns a version 7 - But csoundGetAPIVersion still returns "400" - I noticed that the function `csoundCompileCSD` is referred to as `csoundCompileCsd` in some of the documentation in `csound.h` Sorry about the confusion here. I'll keep plugging away now that I know I'm dealing with the right DLL. And thank you for the heads up on the DLL and EXE relationship. Just to double-check: csound64.dll require no other dependencies, correct? Thank you! On Fri, Oct 4, 2024 at 12:09 PM Dr. Richard Boulanger < [email protected]> wrote: > For Csound7 and beyond... > > Would it be worth creating some sort of script/makefile/brew/??? that > could/would completely uninstall Csound and all its dependencies? > > Dr. Richard Boulanger > Professor > Electronic Production and Design > Berklee College of Music > > > On Oct 4, 2024, at 11:52 AM, Victor Lazzarini < > [email protected]> wrote: > > > > It’s the other way round, csound.exe is linked to Csound64.dll. The > csound.exe is only a frontend. > > ======================== > > Prof. Victor Lazzarini > > Maynooth University > > Ireland > > > >> On 4 Oct 2024, at 16:32, Blake Mitchell <[email protected]> wrote: > >> > >> Whoops. I ran that `csound --version` command local to the Csound 7 > download directory, but for some reason, it still picked up the csound in > my path. Sorry about that. Here is the correct output from the csound.exe I > downloaded. > >> > >>> > C:\Users\<username>\Downloads\csound-7.0.0-2839-windows-x64-binaries\build\Release\csound.exe > --version > >> --Csound version 7.0 (double samples) Oct 1 2024 > >> > >> For the API, though, is the csound64.dll completely self-contained? I > had assumed it was, but given that the version of Csound in my path is > 6.18.1 and the API returned version 6181, I'm guessing that the > csound64.dll still relies on csound.exe? If so, that would explain the > version returned by the API. > >> > >> On Fri, Oct 4, 2024 at 11:26 AM Victor Lazzarini < > [email protected]> wrote: > >> That’s a very old version, looking by the commit > >> > >> victor@firebird debug % git log > a1580f9cdf331c35dceb486f4231871ce0b00266 > >> commit a1580f9cdf331c35dceb486f4231871ce0b00266 (tag: 6.18.1, > origin/master, master) > >> Merge: be2520225 f9f44bada > >> Author: John ffitch <[email protected]> > >> Date: Wed Nov 23 19:53:55 2022 +0000 > >> > >> Merge branch 'csound6' of github.com:csound/csound into csound6 > >> > >> and also the date of the build confirms it. > >> > >> I don’t think you are picking up the latest build when running that > command. > >> ======================== > >> Prof. Victor Lazzarini > >> Maynooth University > >> Ireland > >> > >>>> On 4 Oct 2024, at 16:14, Blake Mitchell <[email protected]> > wrote: > >>> > >>> Here's the output: > >>> > >>>> csound --version > >>> --Csound version 6.18 (double samples) Nov 23 2022 > >>> [commit: a1580f9cdf331c35dceb486f4231871ce0b00266] > >>> > >>>> On Fri, Oct 4, 2024 at 11:12 AM vlz <[email protected]> wrote: > >>> Ok, so there's something wrong with the build, but the version set in > the codebase is correct. > >>> > >>> When you run csound in the command line what version is reported? > >>> > >>> Prof. Victor Lazzarini > >>> Maynooth University > >>> Ireland > >>> > >>>> On 4 Oct 2024, at 15:58, Blake Mitchell <[email protected]> > wrote: > >>>> > >>>> Hi Victor, > >>>> > >>>> I got the builds from the GitHub Actions. I just scrolled down to the > most recent `develop` build and downloaded the .zip file for Windows. If it > helps, here's the exact name of the .zip file: > "csound-7.0.0-2839-windows-x64-binaries.zip". > >>>> > >>>> Thanks for taking a look at and fixing the documentation! > >>>> > >>>> On Fri, Oct 4, 2024 at 3:52 AM Victor Lazzarini < > [email protected]> wrote: > >>>> Not sure why you are getting these versions. These are defined in the > CMakeLists.txt > >>>> > >>>> # Project definitions > >>>> set(APIVERSION "7.0") > >>>> set(CS_VERSION "7") > >>>> set(CS_SUBVER "0") > >>>> set(CS_PATCHLEVEL "0”) > >>>> > >>>> and are written to header files. > >>>> > >>>> Testing with this program on my system > >>>> > >>>> #include <CsoundLib64/csound.h> > >>>> #include <iostream> > >>>> > >>>> int main() { > >>>> int version = csoundGetVersion()/1000; > >>>> int subversion = (csoundGetVersion() - version * 1000)/10; > >>>> int patchlevel = csoundGetVersion() - version * 1000 - > subversion*10; > >>>> std::cout << version << "." << subversion << "." << patchlevel << > std::endl; > >>>> return 0; > >>>> } > >>>> > >>>> I get > >>>> > >>>> 7.0.0 > >>>> > >>>> > >>>> Maybe there is more than one version and your build is > >>>> picking up the wrong header files. > >>>> > >>>> The comments have been removed in this PR > >>>> > >>>> > https://www.google.com/url?q=https://github.com/csound/csound/pull/1982&source=gmail-imap&ust=1728661966000000&usg=AOvVaw0QV_ueBBHY6quQ9KLpc9Tl > >>>> > >>>> ======================== > >>>> Prof. Victor Lazzarini > >>>> Maynooth University > >>>> Ireland > >>>> > >>>>> On 4 Oct 2024, at 07:00, Blake Mitchell <[email protected]> > wrote: > >>>>> > >>>>> I finally got around to testing out the new Csound 7 API with my > .NET wrappers and updating what I had partially done for Csound 6. Things > are working okay so far. > >>>>> > >>>>> A few follow-ups: > >>>>> • > >>>>> The `csound.h` header file documentation references removed > functions such as `csoundPerformBuffer`, `csoundStop`, `csoundCleanup`. > There might be others. > >>>>> • `csoundGetVersion` still returns version 6. The exact value on > Windows is `6181`. > >>>>> • `csoundGetAPIVersion` returns a major version 4. Is this > correct? What is the Csound API version? As far as I understand, the API > tracks the Csound version, so I'm not sure how `csoundGetAPIVersion` and > `csoundGetVersion` are supposed to differ. > >>>>> > >>>>> > >>>>> On Sat, Jul 27, 2024 at 4:03 PM Victor Lazzarini < > [email protected]> wrote: > >>>>> Thanks. That part hasn't changed, so hopefully it won't be a problem. > >>>>> > >>>>> best > >>>>> Victor > >>>>> > >>>>>> On 27 Jul 2024, at 20:06, Tarmo Johannes <[email protected]> > wrote: > >>>>>> > >>>>>> Hi, > >>>>>> > >>>>>> Yes, now it works as expected. I made now the most simple build of > CsoundQt, later I will test with rtmidi and html support that might bring > out more questions. At least in very initial variant of CsoundQt+Csound 7 > works. It need much testing and might be unstable, of course. > >>>>>> > >>>>>> Best! > >>>>>> tarmo > >>>>>> > >>>>>> Kontakt Victor Lazzarini (< > [email protected]>) kirjutas kuupäeval L, > 27. juuli 2024 kell 19:17: > >>>>>> Make sure the csound instance is still in existence before you call > that function. > >>>>>> In fact, if you destroy Csound before calling that, the circular > buffer memory will > >>>>>> be released as well, so you probably don’t even need to do it. > >>>>>> ======================== > >>>>>> Prof. Victor Lazzarini > >>>>>> Maynooth University > >>>>>> Ireland > >>>>>> > >>>>>>> On 27 Jul 2024, at 16:37, Tarmo Johannes <[email protected]> > wrote: > >>>>>>> > >>>>>>> Hi Victor, > >>>>>>> > >>>>>>> Regarding your issue, make sure the call is always after > csoundStart() > >>>>>>> Yes, that was it! I added it before starting the perfromance > thread. Now sound works, only thing is that is exit > >>>>>>> CsoundQt crashes when destroying the circular buffer. > >>>>>>> > >>>>>>> csoundDestroyCircularBuffer(ud->csound, ud->midiBuffer); > >>>>>>> > >>>>>>> I tried to build Csound in debug mode to look into it (unchecked > BUILD_RELEASE) but somehow CsoundQt did not find the plugins any more after > that. > >>>>>>> > >>>>>>> Most likely the problem is in CsoundQt code and I guess now the > Csound object gets destroyed before. I will test more later. > >>>>>>> > >>>>>>> Anyway - it is a step forward! > >>>>>>> > >>>>>>> tarmo > >>>>>>> > >>>>>>> Kontakt Victor Lazzarini (< > [email protected]>) kirjutas kuupäeval L, > 27. juuli 2024 kell 12:20: > >>>>>>> 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 > >>>>>>>>> > >>>>>>>>> > >>>>>>>> > >>>>>>> > >>>>>> > >>>> > >> > > >