Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?

Date2008-05-11 01:46
FromMichael Gogins
Subject[Csnd] Re: Re: Re: Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?
To clarify this:

cppSound = new csnd.CppSound()
csoundFile = cppSound.getCsoundFile()
csoundfile.setCSD('my csd')
csoundFile.exportForPerformance()
cppSound.compile()
cppSound.perform()

Hope this helps,
Mike

-----Original Message-----
>From: Michael Gogins 
>Sent: May 10, 2008 8:40 PM
>To: csound@lists.bath.ac.uk
>Subject: [Csnd] Re: Re: Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?
>
>You are correct about multiple inheritance. I believe that I had coded some helper functions to get around this. As I recall I created a CppSound.getCsoundfile() or something like that, which should expose this method. I'm looking at the generated Java code now... there it still is, yes!
>
>Hope this helps,
>Mike
>
>
>-----Original Message-----
>>From: Steven Yi 
>>Sent: May 10, 2008 8:16 PM
>>To: csound@lists.bath.ac.uk
>>Subject: [Csnd] Re: Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?
>>
>>I tried looking at the CppSound class in Java and it is missing the
>>setCSD method.  After a little look, my guess what is going on is that
>>CppSound in C++ uses multiple inheritance, which is not supported in
>>Java, and that SWIG doesn't know what to do.  I don't know much more
>>than that but would suggest that might be something to look into to
>>figure out this problem.
>>
>>steven
>>
>>On Sat, May 10, 2008 at 4:01 PM, Rory Walsh  wrote:
>>> I don't do Java but here is an untested c++ example which uses the cppsound
>>> class and it's 'setCSD()' method. I hope you can work out the java code from
>>> it. I can answer any questions you have about the c++ code.
>>>
>>> Rory.
>>>
>>>
>>> #include "CppSound.hpp"
>>> #include "csPerfThread.hpp"
>>> #include 
>>> #include 
>>>
>>> using namespace std;
>>>
>>> int main()
>>> {
>>> /* create string that holds an entire csd file */
>>> std::string csdText = " \n\
>>>  \n\
>>> csound -odevaudio -b10 -idevaudio  temp.orc temp.sco \n\
>>>   \n\
>>>   \n\
>>> sr = 44100  \n\
>>> kr = 44100  \n\
>>> ksmps = 1  \n\
>>> nchnls = 1  \n\
>>> instr 1  \n\
>>> k1 chnget \"freq\" \n\
>>> a1 oscil 10000, k1+100, 1  \n\
>>> out a1  \n\
>>> endin   \n\
>>>    \n\
>>>   \n\
>>> f1 0 1024 10 1  \n\
>>> i1 0 100    \n\
>>>  \n\
>>> ";
>>>
>>> int hold;
>>> /*create CppCsound class */
>>> CppSound csound;
>>> /* set the csd text */
>>> csound.setCSD(csdText);
>>> /* export csd text for performance */
>>> csound.exportForPerformance();
>>> /* compile csd text */
>>> csound.compile();
>>>
>>> /*create performance thread */
>>> CsoundPerformanceThread thread(csound.GetCsound());
>>> cout << "Press 1 to play, 2 to pause and 0 to quit\n";
>>> while(1){
>>> cin >> hold;
>>> if(hold==1){
>>>        thread.Play();
>>>        hold = 0;
>>>        }
>>> else if(hold==2){
>>>        thread.Pause();
>>>        hold=0;
>>>        }
>>> }
>>> }
>>>
>>> Jacob Joaquin wrote:
>>>>
>>>> I guess the biggest problem I'm having is the lack of documentation.  I've
>>>> downloaded the Csound API Reference pdf at sourceforge, and it appears
>>>> that
>>>> the listed CppSound.hpp class reference doesn't quite jive with the
>>>> methods
>>>> of the csnd.jar.  For example, I'm not finding any methods that can set
>>>> the
>>>> orchestra.
>>>>
>>>>>
>>>>
>>>
>>>
>>> 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"
>
>
>
>
>
>Send bugs reports to this list.
>To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2008-05-11 06:00
From"Steven Yi"
Subject[Csnd] Re: Re: Re: Re: Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?
AttachmentsNone  

Date2008-05-13 14:07
FromJacob Joaquin
Subject[Csnd] Re: Re: Re: Re: Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?
Thanks to everyone who looked into this.  I finally had a chance yesterday to
implement the suggestions, and I doubt I would have ever been able to get
this to work without these examples, especially Michael's java specific
code.

Best,
Jake



Steven Yi wrote:
> 
> Thanks Michael for clearing that up!
> 
> On Sat, May 10, 2008 at 5:46 PM, Michael Gogins 
> wrote:
>> To clarify this:
>>
>> cppSound = new csnd.CppSound()
>> csoundFile = cppSound.getCsoundFile()
>> csoundfile.setCSD('my csd')
>> csoundFile.exportForPerformance()
>> cppSound.compile()
>> cppSound.perform()
> 
> 

-- 
View this message in context: http://www.nabble.com/Csound-API%3A-Can-I-compile-an-orc-from-a-String-instead-of-a-.csd--tp17167042p17207978.html
Sent from the Csound - General mailing list archive at Nabble.com.