| Victor et al.,
The python ObjectChooser code in question is run before even the user
selects which of four .csd files to run; so that is not the issue.
I think I've isolated where the problem occurs. I've run my program exiting
immediately after the Journal selection is made, i.e., immediately after
this code, and before any .csd files are run:
def choose(self, widget):
chooser = ObjectChooser(self, what_filter=mime.GENERIC_TYPE_AUDIO)
result = chooser.run()
if result == gtk.RESPONSE_ACCEPT:
jobject = chooser.get_selected_object()
if jobject and jobject.file_path:
filename1 = jobject.file_path
print 'FileName = ', filename1
cs.SetChannel("filename1", filename1)
Omitting the SetChannel line, the code seems to run as expected, printing
the desired file name.
Adding in the final line appears to cause the problem - giving the following
error log:
1286812859.753228 WARNING root: Invocation of ObjectChooser() has deprecated
parameters.
/usr/lib/python2.6/site-packages/dbus/connection.py:242: DeprecationWarning:
object.__init__()
takes no parameters
super(Connection, self).__init__(*args, **kwargs)
FileName =
/home/liveuser/.sugar/default/data/9b3f3023-58f1-44ad-87c3-c19d2a7561ae.ogg
Traceback (most recent call last):
File "/home/liveuser/Activities/FileMix.activity/filemix.py", line 216, in
choose
cs.SetChannel("filename1", filename1)
File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in SetChannel
return _csnd.Csound_SetChannel(self, *args)
NotImplementedError: Wrong number of arguments for overloaded function
'Csound_SetChannel'.
Possible C/C++ prototypes are:
SetChannel(Csound *,char const *,double)
SetChannel(Csound *,char const *,char const *)
1286812872.036785 WARNING root: No gtk.AccelGroup in the top level window.
1286812872.065190 WARNING root: No gtk.AccelGroup in the top level window.
1286812872.109065 WARNING root: DSObject was deleted without cleaning up
first. Call
DSObject.destroy() before disposing it.
Activity died: pid 1612 condition 0 data (None, ', mode
'w' at 0xa5816b0>)
I 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
----- Original Message -----
From: "Victor Lazzarini"
To: "Developer discussions"
Sent: Monday, October 11, 2010 5:11 AM
Subject: Re: [Cs-dev] Fw: Csound API Question?
>I have tested the string channels in the latest Csound and there is
> nothing wrong with them. There has been
> no change from 5.10 to 5.12+ in this regard. One thing that might be
> happening is that you are setting
> the channel after the instrument in question has started. I don't
> think that will work because the code
> you require might be running in i-time. Try and make sure the
> instrument runs after the channel has been
> set.
>
> Victor
>
>
> On 11 Oct 2010, at 08:16, Oeyvind Brandtsegg wrote:
>
>> I think there is something wrong with string chn channels,
>> so that you're unable to set the value of a string chn channel from
>> the API.
>> Oeyvind
>>
>> 2010/10/10 Art Hunkins :
>>> Victor,
>>>
>>> I tried one further test:
>>>
>>> I copied a sound file, KayIntro.ogg, to the root directory of my
>>> Activity,
>>> and changed the appropriate line below to:
>>> cs.SetChannel("filename1", "KayIntro.ogg")
>>> I also tried:
>>> cs.SetChannel("filename1", KayIntro.ogg)
>>>
>>> The filename still didn't get through to chnget in Csound.
>>>
>>> Art Hunkins
>>>
>>> ----- Original Message -----
>>> From: "Art Hunkins"
>>> To: "Developer discussions"
>>> Sent: Sunday, October 10, 2010 5:30 PM
>>> Subject: Re: [Cs-dev] Csound API Question?
>>>
>>>
>>>> Victor,
>>>>
>>>> With this change (at your suggestion):
>>>> def choose(self, widget):
>>>> chooser = ObjectChooser(self, what_filter=mime.GENERIC_TYPE_AUDIO)
>>>> result = chooser.run()
>>>> if result == gtk.RESPONSE_ACCEPT:
>>>> jobject = chooser.get_selected_object()
>>>> if jobject and jobject.file_path:
>>>> filename1 = jobject.file_path
>>>> print 'FileName = ', filename1
>>>> cs.SetChannel("filename1", "abba")
>>>>
>>>> The "FileName =" line prints a correct (ogg) filename. Obviously the
>>>> correct filename/path has been located.
>>>>
>>>> In my Csound instrument:
>>>> Sname chnget "filename1"
>>>> puts Sname, 1
>>>>
>>>> puts still prints a blank, and my program continues to treat the
>>>> returned
>>>> string as "0".
>>>>
>>>> Meanwhile, there error messages have disappeared:
>>>>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>>>>> SetChannel
>>>>>> return _csnd.Csound_SetChannel(self, *args)
>>>>>> NotImplementedError: Wrong number of arguments for overloaded
>>>>>> function
>>>>>> 'Csound_SetChannel'.
>>>>>> Possible C/C++ prototypes are:
>>>>>> SetChannel(Csound *,char const *,double)
>>>>>> SetChannel(Csound *,char const *,char const *)
>>>>
>>>> Thanks again -
>>>>
>>>> Art Hunkins
>>>>
>>>> ----- Original Message -----
>>>> From: "Victor Lazzarini"
>>>> To: "Art Hunkins" ; "Developer discussions"
>>>>
>>>> Sent: Sunday, October 10, 2010 5:08 AM
>>>> Subject: Re: [Cs-dev] Csound API Question?
>>>>
>>>>
>>>>> I think this means that one of the arguments is of the wrong type,
>>>>> which means.
>>>>> jobject.file_path. This line in your printed messages
>>>>>
>>>>> FileName =
>>>>>
>>>>> seems to indicate that it is not a string and the line
>>>>>
>>>>> print 'FileName = ', filename1
>>>>>
>>>>> is not printing it.
>>>>>
>>>>> Try, just to test it, placing a string (any) instead of that
>>>>> argument
>>>>> and see if you get
>>>>> a result.
>>>>>
>>>>> Victor
>>>>>
>>>>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>>>>> SetChannel
>>>>>> return _csnd.Csound_SetChannel(self, *args)
>>>>>> NotImplementedError: Wrong number of arguments for overloaded
>>>>>> function
>>>>>> 'Csound_SetChannel'.
>>>>>> Possible C/C++ prototypes are:
>>>>>> SetChannel(Csound *,char const *,double)
>>>>>> SetChannel(Csound *,char const *,char const *)
>>>>>>
>>>>>> I feel I've taken a step backwards. At the same time, I'm very
>>>>>> grateful for
>>>>>> your enlightenment (or for that of any other more technically
>>>>>> astute
>>>>>> Csounder than I).
>>>>>>
>>>>>> (I wonder if the filename is of the wrong type or some such,
>>>>>> needing
>>>>>> a cast
>>>>>> of some sort?)
>>>>>>
>>>>>> Ever appreciative -
>>>>>>
>>>>>> Art Hunkins
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: "Victor Lazzarini"
>>>>>> To: "Developer discussions"
>>>>>> Sent: Friday, October 08, 2010 7:15 PM
>>>>>> Subject: Re: [Cs-dev] Csound API Question?
>>>>>>
>>>>>>
>>>>>>> For instance the following Python code:
>>>>>>>
>>>>>>> import csnd
>>>>>>> cs = csnd.Csound()
>>>>>>> cs.Compile("string.csd", "-n")
>>>>>>> cs.SetChannel("filename1", "haha")
>>>>>>> cs.Perform()
>>>>>>>
>>>>>>> ============ string.csd: =========
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> instr 1
>>>>>>> Sname chnget "filename1"
>>>>>>> puts Sname, 1
>>>>>>> endin
>>>>>>>
>>>>>>>
>>>>>>> i1 0 1
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ============= interactive run =======
>>>>>>> Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
>>>>>>> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
>>>>>>> Type "help", "copyright", "credits" or "license" for more
>>>>>>> information.
>>>>>>>>>> import csnd
>>>>>>>>>> cs = csnd.Csound()
>>>>>>>>>> cs.Compile("string.csd", "-n")
>>>>>>> PortMIDI real time MIDI plugin for Csound
>>>>>>> PortAudio real-time audio module for Csound
>>>>>>> virtual_keyboard real time MIDI plugin for Csound
>>>>>>> 0dBFS level = 32768.0
>>>>>>> Csound version 5.12 (double samples) Jun 9 2010
>>>>>>> libsndfile-1.0.21
>>>>>>> UnifiedCSD: string.csd
>>>>>>> STARTING FILE
>>>>>>> Creating options
>>>>>>> Creating orchestra
>>>>>>> Creating score
>>>>>>> orchname: /var/folders/5P/5PSrqM3mGnCIxRlBhio0cE+++TM/-Tmp-//
>>>>>>> csound-
>>>>>>> gtttlC.orc
>>>>>>> scorename: /var/folders/5P/5PSrqM3mGnCIxRlBhio0cE+++TM/-Tmp-//
>>>>>>> csound-
>>>>>>> hz4vNl.sco
>>>>>>> rtaudio: PortAudio module enabled ... using callback interface
>>>>>>> rtmidi: PortMIDI module enabled
>>>>>>> orch compiler:
>>>>>>> instr 1
>>>>>>> Elapsed time at end of orchestra compile: real: 0.070s, CPU:
>>>>>>> 0.004s
>>>>>>> sorting score ...
>>>>>>> ... done
>>>>>>> Elapsed time at end of score sort: real: 0.152s, CPU: 0.023s
>>>>>>> Csound version 5.12 (double samples) Jun 9 2010
>>>>>>> 0dBFS level = 32768.0
>>>>>>> orch now loaded
>>>>>>> audio buffered in 1024 sample-frame blocks
>>>>>>> not writing to sound disk
>>>>>>> SECTION 1:
>>>>>>> 0
>>>>>>>>>> cs.SetChannel("filename1", "haha")
>>>>>>>>>> cs.Perform()
>>>>>>> new alloc for instr 1:
>>>>>>> haha
>>>>>>> B 0.000 ..100.000 T100.000 TT100.000 M: 0.0
>>>>>>> Score finished in csoundPerform().
>>>>>>> 2
>>>>>>>>>> exit()
>>>>>>> inactive allocs returned to freespace
>>>>>>> end of score. overall amps: 0.0
>>>>>>> overall samples out of range: 0
>>>>>>> 0 errors in performance
>>>>>>> Elapsed time at end of performance: real: 61.690s, CPU: 0.362s
>>>>>>> no sound written to disk
>>>>>>>
>>>>>>> ==================
>>>>>>> NB: there is nothing wrong with the API.
>>>>>>>
>>>>>>> Victor
>>>>>>>
>>>>>>> On 9 Oct 2010, at 00:05, Victor Lazzarini wrote:
>>>>>>>
>>>>>>>> Where is the call to pass the filename to Csound?
>>>>>>>>
>>>>>>>> Victor
>>>>>>>>
>>>>>>>> On 8 Oct 2010, at 22:12, Art Hunkins wrote:
>>>>>>>>
>>>>>>>>> At least I *think* it's an API/communication problem, rather
>>>>>>>>> than a
>>>>>>>>> Python/pygtk problem.
>>>>>>>>>
>>>>>>>>> Here's the situation: I'm getting users to click on a Journal
>>>>>>>>> entry
>>>>>>>>> in Sugar
>>>>>>>>> (python 2.6 - Sugar 0.84, FWIW), to identify a user-supplied
>>>>>>>>> soundfile to
>>>>>>>>> load into diskin2. It's close to working.
>>>>>>>>>
>>>>>>>>> The Python side:
>>>>>>>>> This statement is in the main loop:
>>>>>>>>> self.filename1 = "0" (or "" - they both work the same)
>>>>>>>>>
>>>>>>>>> In the method in question, the Journal selection process
>>>>>>>>> seems to
>>>>>>>>> be
>>>>>>>>> working; the code ends with:
>>>>>>>>> self.filename1 = jobject.file_path
>>>>>>>>> print 'FileName = ', self.filename1
>>>>>>>>> return self.filename1
>>>>>>>>>
>>>>>>>>> Through the print line, things seem to work; the following
>>>>>>>>> line is
>>>>>>>>> printed
>>>>>>>>> (in the log), with data (filename/path) one would expect:
>>>>>>>>> FileName =
>>>>>>>>> /home/liveuser/.sugar/default/data/9b3f3023-58f1-44ad-87c3-
>>>>>>>>> c19d2a7561ae.ogg
>>>>>>>>>
>>>>>>>>> (BTW, this is Csound 5.10 with a recent libsndfile that
>>>>>>>>> accepts Ogg
>>>>>>>>> Vorbis
>>>>>>>>> files - of which the above is one.)
>>>>>>>>>
>>>>>>>>> At this point the filename does not appear to transfer via the
>>>>>>>>> API to
>>>>>>>>> Csound. The Csound side (within an instrument definition):
>>>>>>>>> Sname chnget "filename1"
>>>>>>>>> puts Sname, 1
>>>>>>>>> i1 strcmp Sname, "0"
>>>>>>>>> if i1 == 0 goto cont2
>>>>>>>>> Sname = "soundin.1"
>>>>>>>>> goto cont2
>>>>>>>>>
>>>>>>>>> Problem result:
>>>>>>>>> 1) puts prints a blank line.
>>>>>>>>> 2) strcmp evaluates to "0", which is the "no file name to
>>>>>>>>> communicate"
>>>>>>>>> value.
>>>>>>>>> 3) as a result, the default file, soundin1, is substituted.
>>>>>>>>> Here
>>>>>>>>> there is
>>>>>>>>> always a substitution.
>>>>>>>>>
>>>>>>>>> Bottom line: the (very long/complicated) filename seems not
>>>>>>>>> to be
>>>>>>>>> passed.
>>>>>>>>> Does anyone know why? (IOW, what am I doing wrong?)
>>>>>>>>>
>>>>>>>>> TIA for insight -
>>>>>>>>>
>>>>>>>>> Art Hunkins
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> Beautiful is writing same markup. Internet Explorer 9 supports
>>>>>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2
>>>>>>>>> & L3.
>>>>>>>>> Spend less time writing and rewriting code and more time
>>>>>>>>> creating
>>>>>>>>> great
>>>>>>>>> experiences on the web. Be a part of the beta today.
>>>>>>>>> http://p.sf.net/sfu/beautyoftheweb
>>>>>>>>> _______________________________________________
>>>>>>>>> Csound-devel mailing list
>>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> Beautiful is writing same markup. Internet Explorer 9 supports
>>>>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 &
>>>>>>>> L3.
>>>>>>>> Spend less time writing and rewriting code and more time
>>>>>>>> creating
>>>>>>>> great
>>>>>>>> experiences on the web. Be a part of the beta today.
>>>>>>>> http://p.sf.net/sfu/beautyoftheweb
>>>>>>>> _______________________________________________
>>>>>>>> Csound-devel mailing list
>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Beautiful is writing same markup. Internet Explorer 9 supports
>>>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 &
>>>>>>> L3.
>>>>>>> Spend less time writing and rewriting code and more time
>>>>>>> creating
>>>>>>> great
>>>>>>> experiences on the web. Be a part of the beta today.
>>>>>>> http://p.sf.net/sfu/beautyoftheweb
>>>>>>> _______________________________________________
>>>>>>> Csound-devel mailing list
>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Beautiful is writing same markup. Internet Explorer 9 supports
>>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>>>>>> Spend less time writing and rewriting code and more time creating
>>>>>> great
>>>>>> experiences on the web. Be a part of the beta today.
>>>>>> http://p.sf.net/sfu/beautyoftheweb
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Beautiful is writing same markup. Internet Explorer 9 supports
>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>>>>> Spend less time writing and rewriting code and more time
>>>>> creating great
>>>>> experiences on the web. Be a part of the beta today.
>>>>> http://p.sf.net/sfu/beautyoftheweb
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Beautiful is writing same markup. Internet Explorer 9 supports
>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>>> Spend less time writing and rewriting code and more time creating
>>> great
>>> experiences on the web. Be a part of the beta today.
>>> http://p.sf.net/sfu/beautyoftheweb
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and rewriting code and more time creating
>> great
>> experiences on the web. Be a part of the beta today.
>> http://p.sf.net/sfu/beautyoftheweb
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |