You suggested in another thread that I use csnd.CppSound() instead of csnd.csoundCreate(args*), and I don't have any examples using csnd.CppSound() with .SetPythonMessageCallback(func) or .SetMessageCallback(func). What I need is to find what audio devices are available for any given module. It seems a callback that logs Csound's output is the simplest way to do that. None of the examples I can find do this. -Chuckk On Mon, Oct 27, 2008 at 5:51 PM, Michael Gogins wrote: > Can you change your code to work the way the examples work, then? If not, what specifically do you need? > > Regards, > Mike > > -----Original Message----- >>From: Chuckk Hubbard >>Sent: Oct 27, 2008 11:24 AM >>To: csound@lists.bath.ac.uk >>Subject: [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Querying available audio devices >> >>Hi Mike. >> >>The CppSound examples don't crash, and they don't have callback >>functions. I also don't see anywhere that they use methods inherited >>from class Csound, although help(csnd.CppSound) lists them, but I may >>have missed some. >> >>-Chuckk >> >>On Mon, Oct 27, 2008 at 4:57 PM, Michael Gogins wrote: >>> Do the examples that use CppSound crash? If not, do things as they do them. If the examples do crash, let me know. >>> >>> Regards, >>> Mike >>> >>> -----Original Message----- >>>>From: Chuckk Hubbard >>>>Sent: Oct 27, 2008 10:45 AM >>>>To: csound@lists.bath.ac.uk >>>>Subject: [Csnd] Re: Re: Re: Re: Re: Re: Querying available audio devices >>>> >>>>Using CppSound instead of Csound, the cs.Compile() line gives me a >>>>segmentation fault and crashes the interpreter. >>>>For me, Csound messages print to the interpreter terminal by default; >>>>I haven't yet been able to stop them. >>>>I used this: >>>> >>>>import csnd >>>>csdlog = '' >>>>def csdsave(s): >>>> global csdlog >>>> csdlog += s >>>> >>>>cs = csnd.CppSound() >>>>cs.PreCompile() >>>>cs.SetMessageCallback(csdsave) >>>>cs.Compile("test.csd") >>>> >>>>Python exits. >>>>-Chuckk >>>> >>>>On Mon, Oct 27, 2008 at 3:39 PM, victor wrote: >>>>> Works here: >>>>> >>>>> import csnd >>>>> cs = csnd.Csound() >>>>> >>>>> cs.PreCompile() >>>>> >>>>> def somefunc(s): >>>>> print s >>>>> >>>>> cs.SetMessageCallback(somefunc) >>>>> >>>>> cs.Compile("test.csd") >>>>> >>>>> ... messages get printed to the interpreter terminal >>>>> >>>>> >>>>> Victor >>>>> >>>>> >>>>> >>>>> >>>>> ----- Original Message ----- From: "Chuckk Hubbard" >>>>> >>>>> To: >>>>> Sent: Monday, October 27, 2008 1:18 PM >>>>> Subject: [Csnd] Re: Re: Re: Re: Querying available audio devices >>>>> >>>>> >>>>>> More precisely, I get: >>>>>> >>>>>>>>> cs.SetPythonMessageCallback(csdlog) >>>>>> >>>>>> Traceback (most recent call last): >>>>>> File "", line 1, in >>>>>> File "/usr/lib/python2.5/csnd.py", line 1737, in SetPythonMessageCallback >>>>>> return _csnd.Csound_SetPythonMessageCallback(*args) >>>>>> AttributeError: 'module' object has no attribute >>>>>> 'Csound_SetPythonMessageCallback' >>>>>> >>>>>> >>>>>> Looking a little closer it looks like that's actually a problem, not >>>>>> just me doing the wrong thing. I'll try replacing my csnd.py and >>>>>> _csnd.so files. >>>>>> -Chuckk >>>>>> >>>>>> On Mon, Oct 27, 2008 at 3:08 PM, Chuckk Hubbard >>>>>> wrote: >>>>>>> >>>>>>> The closest I have available is .setPythonMessageCallback() for >>>>>>> CppSound, and .SetPythonMessageCallback() for Csound class. >>>>>>> .SetPythonMessageCallback() somehow can't find the attribute, although >>>>>>> it is listed with dir(CppSound) and help(CppSound), and >>>>>>> .setPythonMessageCallback() takes 1 argument (self), won't take a >>>>>>> function as argument. >>>>>>> >>>>>>> -Chuckk >>>>>>> >>>>>>> On Mon, Oct 27, 2008 at 2:53 PM, victor wrote: >>>>>>>> >>>>>>>> Use the Csound() (or derived) class and the Csound::SetMessageCallback() >>>>>>>> method. >>>>>>>> >>>>>>>> the callback should be something like >>>>>>>> >>>>>>>> def mcallback(s): >>>>>>>> # s is a string >>>>>>>> # e.g. you can print it >>>>>>>> print s >>>>>>>> >>>>>>>> >>>>>>>> cs.SetMessageCallback(mcallback) >>>>>>>> >>>>>>>> >>>>>>>> Victor >>>>>>>> ----- Original Message ----- From: "Chuckk Hubbard" >>>>>>>> >>>>>>>> To: >>>>>>>> Sent: Monday, October 27, 2008 12:04 PM >>>>>>>> Subject: [Csnd] Re: Re: Querying available audio devices >>>>>>>> >>>>>>>> >>>>>>>>> Sounds like a plan. I'll let people choose from whichever modules are >>>>>>>>> available for their platform and then see the devices for whatever >>>>>>>>> they choose. >>>>>>>>> >>>>>>>>> I tried directing both stderr and stdout to file objects, and didn't >>>>>>>>> pick up the Csound output from cs.compile(). Anyone know how I do >>>>>>>>> that in Python? >>>>>>>>> >>>>>>>>> -Chuckk >>>>>>>>> >>>>>>>>> On Mon, Oct 27, 2008 at 11:12 AM, victor >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> For -+rtaudio you can just check the platform OS and the >>>>>>>>>> modules for each are well-defined (ie portaudio and alsa for linux, >>>>>>>>>> etc). >>>>>>>>>> >>>>>>>>>> The only way I think is to run csound with -odac99, then parse >>>>>>>>>> the message output. >>>>>>>>>> >>>>>>>>>> Perhaps an API function to do this might be possible, but it >>>>>>>>>> will need to be implemented by the IO modules. >>>>>>>>>> >>>>>>>>>> Regards >>>>>>>>>> >>>>>>>>>> Victor >>>>>>>>>> >>>>>>>>>> ----- Original Message ----- From: "Chuckk Hubbard" >>>>>>>>>> >>>>>>>>>> To: "Csound List" >>>>>>>>>> Sent: Monday, October 27, 2008 7:54 AM >>>>>>>>>> Subject: [Csnd] Querying available audio devices >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> Is there a way to do this with the API? To build a list of available >>>>>>>>>>> devices to show in my app? >>>>>>>>>>> I think it would have to know possible values for both -+rtaudio and >>>>>>>>>>> -odac, no? >>>>>>>>>>> >>>>>>>>>>> -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 >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> 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 >> >> >>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