Anti-buzz application

2009-03-22 Thread Valery Febvre
('alsactl -f %s restore' % state_file)

if __name__ == __main__:
f = open(ALSA_STATE_PATH, 'r')
lines = f.readlines()

num = None

# store lines of all controls
for line in lines:
if RE_CONTROL.match(line):
num = int(RE_CONTROL.findall(line)[0])
blocks[num] = []
if num:
blocks[num].append(line)

# get data of selected controls
for id in CONTROLS[:]:
is_valid = True
count = None
type_ = None
for line in blocks[id]:
# type
if RE_TYPE.match(line):
type_ = RE_TYPE.findall(line)[0]
if type_ and type_ != 'INTEGER':
print 'WARNING: ignore control %d of type %s' % (id, type_)
del CONTROLS[CONTROLS.index(id)]
is_valid = False
break

# name
if RE_NAME.match(line):
name = RE_NAME.findall(line)[0]
# count
if RE_COUNT.match(line):
count = int(RE_COUNT.findall(line)[0])
# range
if RE_RANGE.match(line):
range = RE_RANGE.findall(line)[0]
# value or value0
if count == 1:
if RE_VALUE.match(line):
value = RE_VALUE.findall(line)[0]
elif count == 2:
if RE_VALUE0.match(line):
value = RE_VALUE0.findall(line)[0]

if is_valid:
controls_data[id] = {
'name':  name,
'type':  type_,
'count': count,
'range': range,
'value': value,
}

# build GUI
elementary.init()
win = elementary.Window(test, elementary.ELM_WIN_BASIC)
win.title_set(anti-buzz application)
win.destroy = destroy

bg = elementary.Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(1.0, 1.0)
bg.show()

box0 = elementary.Box(win)
box0.size_hint_weight_set(1.0, 1.0)
win.resize_object_add(box0)
box0.show()

sc = elementary.Scroller(win)
sc.size_hint_weight_set(1.0, 1.0)
sc.size_hint_align_set(-1.0, -1.0)
box0.pack_end(sc)
sc.show()

box1 = elementary.Box(win)
box1.size_hint_weight_set(1.0, 1.0)
sc.content_set(box1)
box1.show()

for id in CONTROLS:
if id not in controls_data.keys():
continue

control = controls_data[id]

label = elementary.Label(win)
label.label_set(' b%s/b (%d)' % (control['name'], id))
label.size_hint_align_set(0, 0.5)
label.scale_set(1.5)
box1.pack_end(label)
label.show()

slider = elementary.Slider(win)
slider.label_set('')
slider.span_size_set(160)
slider.size_hint_align_set(0, 0.5)
slider.size_hint_weight_set(0, 1)
slider.unit_format_set(   %3.0f + ' / %d' % float(control['range'][1]))
slider.indicator_format_set(%3.0f)
slider.min_max_set(float(control['range'][0]), float(control['range'][1]))
slider.value = float(control['value'])
slider.scale_set(2)
box1.pack_end(slider)
slider.show()
sliders[id] = slider

label_info = elementary.Label(win)
label_info.label_set(' ')
label_info.size_hint_align_set(0.5, 0.5)
box0.pack_end(label_info)
label_info.show()

table = elementary.Table(win)
table.size_hint_weight_set(1, -1)
box0.pack_end(table)
table.show()

btn_default = elementary.Button(win)
btn_default.label_set('Restore Default')
table.pack(btn_default, 0, 0, 1, 1)
btn_default.show()
btn_default.clicked = restore_default

btn_apply = elementary.Button(win)
btn_apply.label_set(' Apply ')
table.pack(btn_apply, 1, 0, 1, 1)
btn_apply.show()
btn_apply.clicked = apply_changes

btn_quit = elementary.Button(win)
btn_quit.label_set('  Quit  ')
table.pack(btn_quit, 2, 0, 1, 1)
btn_quit.show()
btn_quit.clicked = destroy

win.resize(480, 640)
win.show()
elementary.run()
elementary.shutdown()
inline: Screenshot-1.jpg___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Anti-buzz application

2009-03-22 Thread arne anka
did you ever check in a statistically valid way, if your approach works?
as i understand from the long-term discusions, consensus is, that the only  
way to remedy the buzz are hardware fixes.
no fiddling with mixers in what dimension ever is going to solve that  
basic issue.

since the buzz is, iirc, related to the tx power of the fr, depending on  
your situation you might reach a compromise between sound quality and buzz  
suppression, that satisfies your needs -- but that does not help, if your  
situation worsens, soon the call quality declines to a level inacceptable  
even for the most hardened.

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Anti-buzz application

2009-03-22 Thread Angus Ainslie
Hi Valery,

Did you mean to release this under the GPL ? If so you should probably
change the references from neon to anti-buzz.

There is already a similar gtk application to this called fso-mixer, you
could look at it if you wanted to add gtk functionality to your app.

Angus


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community