Csound Csound-dev Csound-tekno Search About

RE: [Csnd] API usage best practices questions

Date2012-08-11 18:29
FromRichard Henninger
SubjectRE: [Csnd] API usage best practices questions
I'm working with the csound API and have two questions about best practices
that I cannot resolve with the documentation:

	1) There seem to be two mechanisms for receiving csound messages: a
callback and a message buffer.  Do they serve different purposes or is one
old and the other preferred or just use whichever is easier for a host
program?  Also, there is a note about the hostdata object being used by the
buffer.  Does that mean that one should not set/get hostdata when is one is
also using the message buffer mechanism?

	2) For accessing FILE* and vfprintf structures from a c library for
presentation from a host program to csound, does it matter which runtime dll
(I'm on Windows7/8 - USE_DOUBLE running win32 on a 64 bit machine) I link
to? My first instinct is to use the msvcrt.dll provided in csound\bin.
Should I be linking instead to one of the libg*.dll's?  The answer matters
because I'm actually using pInvoke from .Net rather than a lib*.a/+dll from
a compiled c program, so the actual dll needs to be declared to pInvoke and
findable at runtime.

	Thanks for any help in this.

	Richard Henninger

Richard Henninger
2712 Pembsly Drive
Vienna, VA 22181

richard@rghmusic.com
703 255-7201



Date2012-08-11 20:38
FromVictor Lazzarini
SubjectRe: [Csnd] API usage best practices questions
On 11 Aug 2012, at 14:29, Richard Henninger wrote:

> I'm working with the csound API and have two questions about best practices
> that I cannot resolve with the documentation:
> 
> 	1) There seem to be two mechanisms for receiving csound messages: a
> callback and a message buffer.  Do they serve different purposes or is one
> old and the other preferred or just use whichever is easier for a host
> program?  Also, there is a note about the hostdata object being used by the
> buffer.  Does that mean that one should not set/get hostdata when is one is
> also using the message buffer mechanism?

In my opinion, the named bus channel mechanism is the best way to deal with
send csound control and audio data to/from host. With the callback mechanism, the host needs to take care of
channel names and callbacks, so it's more involved.

> 	2) For accessing FILE* and vfprintf structures from a c library for
> presentation from a host program to csound, does it matter which runtime dll
> (I'm on Windows7/8 - USE_DOUBLE running win32 on a 64 bit machine) I link
> to? My first instinct is to use the msvcrt.dll provided in csound\bin.
> Should I be linking instead to one of the libg*.dll's?  The answer matters
> because I'm actually using pInvoke from .Net rather than a lib*.a/+dll from
> a compiled c program, so the actual dll needs to be declared to pInvoke and
> findable at runtime.

Not sure I understand the question. The choice of standard C library is not a matter that really concerns the API. You
should use whatever lib your build system recommends. I am not sure why there is a msvcrt.dll being distributed with Csound,
but I have the impression it has to do with the host programs supplied. The csound library should dynamically link to whichever
is supplied.

Victor

> 
> 	Thanks for any help in this.
> 
> 	Richard Henninger
> 
> Richard Henninger
> 2712 Pembsly Drive
> Vienna, VA 22181
> 
> richard@rghmusic.com
> 703 255-7201
> 
> 
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie