Re: [Cs-dev]
Date | 2012-04-26 13:32 |
From | Felipe Sateler |
Subject | Re: [Cs-dev] cenviron_ and the API |
And why can't opcodes just #include |
Date | 2012-04-26 15:01 |
From | Michael Gogins |
Subject | Re: [Cs-dev] cenviron_ and the API |
Attachments | None None |
On Unix or Linux maybe they could, because the API symbols might have been bound when the opcode was loaded. On Windows, they could not without not only #include-ing csound.h, but also explicitly linking with the Csound library.
In other words, using the virtual function table in the Csound object, you don't need to link to the Csound library to write an opcode that calls the API. You just need to #include the header file.
This is object-oriented C programming. The CSOUND struct is a class and the API function pointers in the struct are its methods. Regards, Mike
On Thu, Apr 26, 2012 at 8:32 AM, Felipe Sateler <fsateler@gmail.com> wrote: And why can't opcodes just #include <csound.h> and call them directly? Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2012-04-26 15:40 |
From | Felipe Sateler |
Subject | Re: [Cs-dev] cenviron_ and the API |
On Thu, Apr 26, 2012 at 11:01, Michael Gogins |
Date | 2012-04-26 16:10 |
From | Michael Gogins |
Subject | Re: [Cs-dev] cenviron_ and the API |
Attachments | None None |
There are several advantages to not linking with the API library. When linking, there are 2 potential sources of incompatibility, the CSOUND type and the library version. When not linking, there is only 1 potential source of incompatibility, the CSOUND type (i.e. API version).
Also there would be some slight time saved in the linking loader, though I doubt this is worth worrying about.
To my mind, as well, this approach just seems more elegant. Regards, Mike
On Thu, Apr 26, 2012 at 10:40 AM, Felipe Sateler <fsateler@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2012-04-26 21:30 |
From | Rory Walsh |
Subject | Re: [Cs-dev] cenviron_ and the API |
With all the re-factoring and what not, will it be possible with Csound 6 for developers to build truly standalone Csound frontends, i.e., frontends that don't need to link to a Csound library at run-time? On 26 April 2012 16:10, Michael Gogins |
Date | 2012-04-26 22:16 |
From | Victor |
Subject | Re: [Cs-dev] cenviron_ and the API |
you can already do this, just build a static libcsound. Set dynamicCsoundLibrary=1 in scons. Victor On 26 Apr 2012, at 21:30, Rory Walsh |
Date | 2012-04-26 22:17 |
From | Michael Gogins |
Subject | Re: [Cs-dev] cenviron_ and the API |
Attachments | None None |
That is a contradiction in terms. To use csound, a program must link with csound. with the existing api, it is possible link with csound only at build time (static linking), partly at build time and partly at run time (dynamic linking), or only at run time (dynamic loading). On Apr 26, 2012 4:31 PM, "Rory Walsh" <rorywalsh@ear.ie> wrote:
With all the re-factoring and what not, will it be possible with |
Date | 2012-04-26 22:23 |
From | Rory Walsh |
Subject | Re: [Cs-dev] cenviron_ and the API |
Ah, I see. Sometimes I have to laugh at how far I've got using the API with such a limited understanding of computer science! ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-04-26 22:47 |
From | Michael Gogins |
Subject | Re: [Cs-dev] cenviron_ and the API |
Attachments | None None |
If you want a truly standalone, monolithic front end, with absolutely no external dependencies, then obtain all the source code for all of the libraries that your app might use, and simply compile all that code into your app. Or you can build all or some of these dependencies as static libraries. In either case you end up with not one call to the linking loader except for the operating system libraries and the runtime library, which are generally shared libraries.
One example of this approach is Grace, the Common Music app.It builds in sndlib for a synthesizer and Scheme for a language runtime. The advantage of this approach is there is no installation or configuration at all. You copy the app somewhere, and you run it. Frankly I think this is a pretty good idea. A lot of the complexity in using Csound is tying together all the parts.
In some cases license terms might forbid static linking. I think libsndfile might be such a case. libsndfile is a great library and I truly love it, but there is other code that would do the job that could be statically linked.
Regards, Mike
On Thu, Apr 26, 2012 at 5:23 PM, Rory Walsh <rorywalsh@ear.ie> wrote: Ah, I see. Sometimes I have to laugh at how far I've got using the API Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2012-04-26 23:06 |
From | Rory Walsh |
Subject | Re: [Cs-dev] cenviron_ and the API |
I'm thinking of the case where a developer writes an instrument and then provides a frontend for it. The instrument doesn't use any file writing opcodes, and the frontend looks after all the audio IO. Would one still have to use libsndfile, I mean, is it possible to use Csound without it, or is libsndfile so tied up in the internals of Csound that it's simply part of Csound now? It makes little difference to me or my work. libsndfile rocks. I'm just curious. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-04-26 23:10 |
From | Victor |
Subject | Re: [Cs-dev] cenviron_ and the API |
you would need to build csound without all the sndfile writing code, a major surgery in the sources. Easier to link against a static libsndfile, which is what we do on ios and android. Victor On 26 Apr 2012, at 23:06, Rory Walsh |
Date | 2012-04-27 10:49 |
From | Richard Dobson |
Subject | Re: [Cs-dev] cenviron_ and the API |
On 26/04/2012 15:40, Felipe Sateler wrote: .. >> >> This is object-oriented C programming. The CSOUND struct is a class and the >> API function pointers in the struct are its methods. > > I can see that. But OOP does not require a particular syntax: > method(object, args) is as much OOP as object->method(args). > But of course they are not equivalent. OOP canonically describes objects in terms of (internal) state and (mostly public) behaviour. In the construct method(object,args) the behaviour is both semantically and conceptually primary, and might be applied to any number of objects, possibly in error (e.g. calling the method on an unintended object instance). In the construct object->method(args) the state is primary, and calling the method is effectively guaranteed to apply to the correct instance of state (in C++ via the all-important internal 'this' pointer). We can even say that the set of methods is itself part of the state of the object. So while both might be regarded as kinds of OOP, the former example is more literally MOP - method-oriented programming, while the latter is SOP - state-oriented programming. Richard Dobson ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-04-27 14:43 |
From | Felipe Sateler |
Subject | Re: [Cs-dev] cenviron_ and the API |
On Fri, Apr 27, 2012 at 06:49, Richard Dobson |
Date | 2012-04-27 15:26 |
From | Richard Dobson |
Subject | Re: [Cs-dev] cenviron_ and the API |
On 27/04/2012 14:43, Felipe Sateler wrote: .. >>> I can see that. But OOP does not require a particular syntax: >>> method(object, args) is as much OOP as object->method(args). >>> >> >> But of course they are not equivalent. OOP canonically describes objects >> in terms of (internal) state and (mostly public) behaviour. In the >> construct method(object,args) the behaviour is both semantically and >> conceptually primary, and might be applied to any number of objects, >> possibly in error (e.g. calling the method on an unintended object >> instance). > > The method is stateless (it keeps the state in the passed structure), > so there are no unintended object instances. Unless you mean calling > methods on uninitialized instances, which would be the same as doing > object->method(args) on a NULL pointer. > No, I don't mean that. I mean when you have more than one active object instance (lets, say, a number of oscillators), and you pass the struct representing the state of an oscillator to the method: val = tick(osc1); which e.g. updates an internal phase held in osc1, it is easy to introduce a bug by (through such a thing as a typo) passing an unintended struct instance, e.g. osc2 when you meant osc1. Whereas, when you call a C++ method on an osc, the language ensures methods are correctly associated with states. All I am saying is that there is a non-trivial difference between the two forms of expression - in the first the programmer holds the relation in their head, in the second the compiler does it for you. This is the sort of thing that is meant when commentators say C "allows" OOP, but C++ "supports" it. Of course, what is "support" for one programmer is "enforcement" to another, so YMMV. > Remember that we are talking about doing OOP in C. This means that the > actual syntax will be: > object->method(object, args). > Sure. It's about as close to C++ as C can get, but semantically is still a bit of a chimera. And if you have both "object" and "object1", the typo situation can in principle still arise. With the liberal reliance on editor auto-completion, if anything such hazards are more rather than less likely. Auto-completion does make the use of long names more comfortable to work with, but it is also a reason why, in choosing names, the price is even more eternal vigilance. Hence, when doing "OOP in C", name selection and distinction is more than usually important. Richard Dobson ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |