Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Fw: Csound API Question?

Date2010-10-24 03:17
From"Art Hunkins"
SubjectRe: [Cs-dev] Fw: Csound API Question?
I've been having a terrible time getting a filename communicated through the 
API to my csd (Python, XO, Sugar 0.84).

The particular method, which works fine otherwise, and uses calls from 
Victor's csndsugui, is as follows:
def choose(self, widget):

  self.chooser = ObjectChooser(parent=self, 
what_filter=mime.GENERIC_TYPE_AUDIO)

  self.result = self.chooser.run()

  if self.result == gtk.RESPONSE_ACCEPT:

    self.jobject = self.chooser.get_selected_object()

    if self.jobject and self.jobject.file_path:

      self.filename1 = self.jobject.file_path

      print 'FileName = ', self.filename1

      self.w.set_filechannel("filename1", self.filename1)



No errors  are logged.

Sname chnget "filename1", and puts Sname, 1

(within an instrument in my csd) simply receives a blank filename. However, 
"FileName =" in the above code prints out correctly, i.e., the file has been 
correctly located.

The same null result occurs when self.filename1 in the last line of above 
code is, instead, "haha" (as illustrated in Victor's example).

I've discovered that I was retrieving the filename before the .csd was 
compiled. Perhaps this is a problem? In any case, I also tried selecting the 
filename (i.e., running the above method, which is triggered by a button 
press) after .csd compilation and before running - same result (no 
communication).

I'd much appreciate any clues, please. My Python skills are so minimal, and 
this issue has been stumping me for months now.

Art Hunkins

----- Original Message ----- 
From: "Victor Lazzarini" 
To: "Art Hunkins" ; "Developer discussions" 

Sent: Tuesday, October 12, 2010 4:58 AM
Subject: Re: [Cs-dev] Fw: Csound API Question?


> No, SetChannel() works properly, the script I placed here showed that  it 
> does. The problem
> is that your program is not giving it the right arguments. You are not 
> giving it two strings, which
> is what it expects. This is what the error message says.
>
> Victor
>
> On 11 Oct 2010, at 17:48, Art Hunkins wrote:
>
>>  don't now believe any of the WARNING messages, including the final  one,
>> are causing the problem; I believe that the SetChannel call is the 
>> culprit.
>> (Is it possible Oeyvind is on the right track?)
>>
>> A final thought: You mentioned the Csound API hadn't been modified  since
>> 5.10. I wonder if there's any chance that SoaS 0.86.3 (the Sugar 
>> Blueberry
>> version I'm testing with) could be using an older API? Or would  there be 
>> any
>> difference? The Csound is 5.10, and all *should* have been updated  at 
>> that
>> time, right?
>>
>> Art Hunkins
> 


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-10-24 09:38
FromVictor Lazzarini
SubjectRe: [Cs-dev] Fw: Csound API Question?
The definition of the method is:

def set_filechannel(self,chan,name):
"""overrides the base method, setting the channel string"""
   if not self.ready:
       self.csound.SetChannel(chan,name)
   else:
       BasicGUI.set_filechannel(self,chan,name)

So, what happens is that if the variable 'ready' is True, this uses  
the base class method (ie. does not call
SetChannel). Maybe that is the problem.

'ready' becomes True after a successful compilation using CsoundGUI.  
compile() or CsoundGUI.csd()
or CsoundGUI.recompile().


Victor



On 24 Oct 2010, at 03:17, Art Hunkins wrote:

> I've been having a terrible time getting a filename communicated  
> through the
> API to my csd (Python, XO, Sugar 0.84).
>
> The particular method, which works fine otherwise, and uses calls from
> Victor's csndsugui, is as follows:
> def choose(self, widget):
>
>  self.chooser = ObjectChooser(parent=self,
> what_filter=mime.GENERIC_TYPE_AUDIO)
>
>  self.result = self.chooser.run()
>
>  if self.result == gtk.RESPONSE_ACCEPT:
>
>    self.jobject = self.chooser.get_selected_object()
>
>    if self.jobject and self.jobject.file_path:
>
>      self.filename1 = self.jobject.file_path
>
>      print 'FileName = ', self.filename1
>
>      self.w.set_filechannel("filename1", self.filename1)
>
>
>
> No errors  are logged.
>
> Sname chnget "filename1", and puts Sname, 1
>
> (within an instrument in my csd) simply receives a blank filename.  
> However,
> "FileName =" in the above code prints out correctly, i.e., the file  
> has been
> correctly located.
>
> The same null result occurs when self.filename1 in the last line of  
> above
> code is, instead, "haha" (as illustrated in Victor's example).
>
> I've discovered that I was retrieving the filename before the .csd was
> compiled. Perhaps this is a problem? In any case, I also tried  
> selecting the
> filename (i.e., running the above method, which is triggered by a  
> button
> press) after .csd compilation and before running - same result (no
> communication).
>
> I'd much appreciate any clues, please. My Python skills are so  
> minimal, and
> this issue has been stumping me for months now.
>
> Art Hunkins
>
> ----- Original Message -----
> From: "Victor Lazzarini" 
> To: "Art Hunkins" ; "Developer discussions"
> 
> Sent: Tuesday, October 12, 2010 4:58 AM
> Subject: Re: [Cs-dev] Fw: Csound API Question?
>
>
>> No, SetChannel() works properly, the script I placed here showed  
>> that  it
>> does. The problem
>> is that your program is not giving it the right arguments. You are  
>> not
>> giving it two strings, which
>> is what it expects. This is what the error message says.
>>
>> Victor
>>
>> On 11 Oct 2010, at 17:48, Art Hunkins wrote:
>>
>>> don't now believe any of the WARNING messages, including the  
>>> final  one,
>>> are causing the problem; I believe that the SetChannel call is the
>>> culprit.
>>> (Is it possible Oeyvind is on the right track?)
>>>
>>> A final thought: You mentioned the Csound API hadn't been  
>>> modified  since
>>> 5.10. I wonder if there's any chance that SoaS 0.86.3 (the Sugar
>>> Blueberry
>>> version I'm testing with) could be using an older API? Or would   
>>> there be
>>> any
>>> difference? The Csound is 5.10, and all *should* have been  
>>> updated  at
>>> that
>>> time, right?
>>>
>>> Art Hunkins
>>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America  
> contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and  
> Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in  
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi  
> Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net