Yoshiki Ohshima wrote: > Arjun, > > >> 1) eToys: >> It would be very nice to have support for Analog Input in eToys. >> >> You could use my code - >> >> See >> http://dev.laptop.org/git?p=projects/measure;a=blob_plain;f=audioGrab.py;hb=HEAD >> (getting samples) >> >> and >> http://dev.laptop.org/git?p=projects/measure;a=blob_plain;f=buttons.py;hb=HEAD >> (toggling between AC/DC modes and controlling bias voltage etc.) >> >> Or I could easily provide you with a class that you could use. I could make >> functions in that class that could simply >> return to you the required values. For example there could be a function >> that you could call to return avg voltage or >> rms voltage, select between ac/dc modes, set bias_on, set >> bias_off..... >> > > >> Let me know if I can help in any way. >> > > Thank you. As I wrote on http://dev.laptop.org/ticket/2800, what we > would like to have is C functions. Then, I can wrap them as Squeak > primitives. Probably I can just rip these functions from amixer, but > if you can tell me which, that would be good! > This is the relevant excerpt from the reference cited above. The correspondence between this and C code should be obvious (os.system() -> system()), and it also implicitly answers the second question too.
def ac_dc(self, data=None): if(self.Acdc==ac): self.Acdc=dc self.button1.set_label("Measure AC") os.system("amixer set 'Analog Input' unmute") os.system("amixer set 'Mic' 20%, 0% unmute captur") os.system("amixer set 'Capture' 0%, 0% unmute captur") os.system("amixer set 'Mic Boost (+20dB)' mute") else: self.Acdc=ac self.button1.set_label("Measure DC") os.system("amixer set 'Analog Input' mute") os.system("amixer set 'Mic' 20%, 100% unmute captur") os.system("amixer set 'Capture' 100%, 100% unmute captur") os.system("amixer set 'Mic Boost (+20dB)' unmute") def bias(self, data=None): if(self.Bias==bias_on): self.Bias=bias_off self.button2.set_label("Set bias on ") os.system("amixer set 'V_REFOUT Enable' mute") else: self.Bias=bias_on self.button2.set_label("Set Bias off") os.system("amixer set 'V_REFOUT Enable' unmute") _______________________________________________ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel