Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report
Victor Lazzarini <[email protected]>
| Newsgroups | gmane.comp.audio.csound.devel |
|---|---|
| Message-ID | <[email protected]> |
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://github.com/csound/csound/pull/1982
========================
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
>> > > >
>> > > >
>> > >
>> >
>>