Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Setting options/orc/sco using csound.h

Date2009-04-11 16:58
Frommichael.gogins@gmail.com
Subject[Csnd] Re: Re: Re: Setting options/orc/sco using csound.h
Attachmentshubbard_test.cpp  SConstruct  
I've taken the liberty of rewriting your example pretty completely. I wanted 
the example to produce a real sound, I wanted it to link with just a regular 
installation of Csound (not a build setup), and I wanted the code to be as 
simple and clear as possible.

I have included an SConstruct file that builds the example on my MinGW/MSys 
setup using only the headers and libraries installed by the Windows Csound 
installer. And, I have added comments to both the SConstruct file and the 
source code file. My build of the example compiles without errors, produces 
a real-time sound, and exits without any errors or backtraces.

I don't know specifically why you were getting a backtrace. Possibly because 
you have two instances of CppSound in your program, when only one is 
required. Or possibly because you specify -+rtaudio without the name of an 
rtaudio module.

Thanks for the stimulus to produce a working example of how to use C++ in a 
very simple way with Csound.

Hope this helps,
Mike

----- Original Message ----- 
From: "Chuckk Hubbard" 
To: 
Sent: Saturday, April 11, 2009 9:31 AM
Subject: [Csnd] Re: Re: Setting options/orc/sco using csound.h


Hi Mike.
Thanks a lot for the info (and the class).  I just signed on to report
that I had found the answer in your refman.pdf, to include CppSound.h
and link to libcsound and lib_csnd.

I'm getting a pretty big backtrace, though, and Csound is aborting
from the attached test2.cpp compiled with the attached g++ command.  I
don't think I did anything wrong with the CppSound part.  I cobbled
together the string manipulations from several folks' suggestions, but
everything runs fine if I comment out cs.compile().
The program is meant to be run simply with an argument of the name of
a real-time module, e.g. portaudio.

Can anyone spot what I'm doing wrong?  (in this program specifically,
not in my life in general)

-Chuckk

On Sat, Apr 11, 2009 at 3:30 PM,   wrote:
> Nope.
>
> The CsoundFile class, which is one of the classes from which CppSound
> derives, contains in memory the Csound orchestra, score, and command line
> (hence the need for the exportForPerformance() call before rendering). The
> Csound class declared in csound.hpp, on the other hand, only deals with
> Csound files on the disk.
>
> The CsoundFile class was developed by me for use in CsoundVST. VST songs 
> are
> required to contain all data for plugin patches in memory, hence I needed 
> to
> store the Csound orchestra or csd file in memory, hence CsoundFile.
>
> If, for some reason, you do not wish to, or cannot, use CppSound, then you
> can maintain your own copy of the Csound csd file or its parts in memory
> using your own code, and save them to the disk before using the Csound 
> class
> to render them.
>
> But why not just use CppSound? This is exactly what it is designed for, 
> and
> as far as I can see it works just fine.
>
> The CppSound class also derives from the Csound class, so anything you can
> do with the Csound class you can also do with CppSound.
>
> Hope this helps,
> Mike
>
> ----- Original Message ----- From: "Chuckk Hubbard"
> 
> To: "Csound List" 
> Sent: Saturday, April 11, 2009 6:40 AM
> Subject: [Csnd] Setting options/orc/sco using csound.h
>
>
>> Hello.
>> I want to pass a string to a Csound instance using C++, either to
>> "setCSD" or to individually set Command, Orchestra, and Score. It
>> appears the standard input arguments for the functions in csound.h and
>> csound.hpp expect filenames. csnd.h, on the other hand, has the
>> CppSound class, which is derived from CsoundFile, which has the
>> 'setCSD', etc. functions. Is there a way to emulate the .setCSD()
>> method with the classes in csound.h/csound.hpp?
>>
>> -Chuckk
>>
>> --
>> http://www.badmuthahubbard.com
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>



-- 
http://www.badmuthahubbard.com

Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
csound" 

Date2009-04-11 19:22
FromChuckk Hubbard
Subject[Csnd] Re: Re: Re: Re: Setting options/orc/sco using csound.h
It helps a great deal, especially the comments.  I wasn't trying to
make sound, myself, I just want to get a list of available -odac
values, by specifying one that doesn't work.  I can do this using
Python for Windows and Linux, but not Mac.  I still have to make the
part that captures and parses the output; probably just send the whole
output back to Python, since I already have the code to parse it.

I didn't realize I had two CppSound instances, and I saw on looking
again that I used both the C++ and Python initializing commands:
CppSound cs;
and later
cs = CppSound();
taking out the Python one fixes that traceback.  I guess I was
thinking of declaring and later initializing.  I really do know better
than that, it just slipped past me.

The reason for -+rtaudio without a module is that argv[1] is going to
be the module to check for DACs, called from Python when the user
selects a module.

> Thanks for the stimulus to produce a working example of how to use C++ in a
> very simple way with Csound.

Glad I could contribute, in my own oblivious way.

-Chuckk

On Sat, Apr 11, 2009 at 6:58 PM,   wrote:
> I've taken the liberty of rewriting your example pretty completely. I wanted
> the example to produce a real sound, I wanted it to link with just a regular
> installation of Csound (not a build setup), and I wanted the code to be as
> simple and clear as possible.
>
> I have included an SConstruct file that builds the example on my MinGW/MSys
> setup using only the headers and libraries installed by the Windows Csound
> installer. And, I have added comments to both the SConstruct file and the
> source code file. My build of the example compiles without errors, produces
> a real-time sound, and exits without any errors or backtraces.
>
> I don't know specifically why you were getting a backtrace. Possibly because
> you have two instances of CppSound in your program, when only one is
> required. Or possibly because you specify -+rtaudio without the name of an
> rtaudio module.
>
> Thanks for the stimulus to produce a working example of how to use C++ in a
> very simple way with Csound.
>
> Hope this helps,
> Mike
>
> ----- Original Message ----- From: "Chuckk Hubbard"
> 
> To: 
> Sent: Saturday, April 11, 2009 9:31 AM
> Subject: [Csnd] Re: Re: Setting options/orc/sco using csound.h
>
>
> Hi Mike.
> Thanks a lot for the info (and the class).  I just signed on to report
> that I had found the answer in your refman.pdf, to include CppSound.h
> and link to libcsound and lib_csnd.
>
> I'm getting a pretty big backtrace, though, and Csound is aborting
> from the attached test2.cpp compiled with the attached g++ command.  I
> don't think I did anything wrong with the CppSound part.  I cobbled
> together the string manipulations from several folks' suggestions, but
> everything runs fine if I comment out cs.compile().
> The program is meant to be run simply with an argument of the name of
> a real-time module, e.g. portaudio.
>
> Can anyone spot what I'm doing wrong?  (in this program specifically,
> not in my life in general)
>
> -Chuckk
>
> On Sat, Apr 11, 2009 at 3:30 PM,   wrote:
>>
>> Nope.
>>
>> The CsoundFile class, which is one of the classes from which CppSound
>> derives, contains in memory the Csound orchestra, score, and command line
>> (hence the need for the exportForPerformance() call before rendering). The
>> Csound class declared in csound.hpp, on the other hand, only deals with
>> Csound files on the disk.
>>
>> The CsoundFile class was developed by me for use in CsoundVST. VST songs
>> are
>> required to contain all data for plugin patches in memory, hence I needed
>> to
>> store the Csound orchestra or csd file in memory, hence CsoundFile.
>>
>> If, for some reason, you do not wish to, or cannot, use CppSound, then you
>> can maintain your own copy of the Csound csd file or its parts in memory
>> using your own code, and save them to the disk before using the Csound
>> class
>> to render them.
>>
>> But why not just use CppSound? This is exactly what it is designed for,
>> and
>> as far as I can see it works just fine.
>>
>> The CppSound class also derives from the Csound class, so anything you can
>> do with the Csound class you can also do with CppSound.
>>
>> Hope this helps,
>> Mike
>>
>> ----- Original Message ----- From: "Chuckk Hubbard"
>> 
>> To: "Csound List" 
>> Sent: Saturday, April 11, 2009 6:40 AM
>> Subject: [Csnd] Setting options/orc/sco using csound.h
>>
>>
>>> Hello.
>>> I want to pass a string to a Csound instance using C++, either to
>>> "setCSD" or to individually set Command, Orchestra, and Score. It
>>> appears the standard input arguments for the functions in csound.h and
>>> csound.hpp expect filenames. csnd.h, on the other hand, has the
>>> CppSound class, which is derived from CsoundFile, which has the
>>> 'setCSD', etc. functions. Is there a way to emulate the .setCSD()
>>> method with the classes in csound.h/csound.hpp?
>>>
>>> -Chuckk
>>>
>>> --
>>> http://www.badmuthahubbard.com
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
>
> --
> http://www.badmuthahubbard.com
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"



-- 
http://www.badmuthahubbard.com