Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-04-08 13:21:20 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-04-08 13:21:20 (GMT)
commitc658e476122d5be042cb4528eb6356999278e53d (patch)
tree49c9a0e2b8b98883f25c86c95aaf1ee81d10d6d1 /plugins
parentaa5a20599321c5cc6c55b36ef61da6f1b168667d (diff)
fixed regression in XO sensor code; value blocks update properly first (and every) time; first sensor sample correct
Diffstat (limited to 'plugins')
-rw-r--r--plugins/audio_sensors/audio_sensors.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/audio_sensors/audio_sensors.py b/plugins/audio_sensors/audio_sensors.py
index 39bad17..580d12f 100644
--- a/plugins/audio_sensors/audio_sensors.py
+++ b/plugins/audio_sensors/audio_sensors.py
@@ -56,9 +56,10 @@ class Audio_sensors(Plugin):
def __init__(self, parent):
self._parent = parent
+ self._status = True # TODO: test for audio device
+ # These flags are referenced by audiograb
self.hw = self._parent.hw
self.running_sugar = self._parent.running_sugar
- self._status = True # TODO: test for audio device
def setup(self):
# set up audio-sensor-specific blocks
@@ -169,27 +170,26 @@ class Audio_sensors(Plugin):
def _update_audio_mode(self):
""" If there are sensor blocks, set the appropriate audio mode """
- if not hasattr(self._parent.lc, 'value_blocks'):
+ if not hasattr(self._parent.lc, 'value_blocks_to_update'):
return
for name in ['sound', 'volume', 'pitch']:
- if name in self._parent.lc.value_blocks:
- if len(self._parent.lc.value_blocks[name]) > 0:
+ if name in self._parent.lc.value_blocks_to_update:
+ if len(self._parent.lc.value_blocks_to_update[name]) > 0:
self.audiograb.set_sensor_type()
return
- if 'resistance' in self._parent.lc.value_blocks:
- if len(self._parent.lc.value_blocks['resistance']) > 0:
+ if 'resistance' in self._parent.lc.value_blocks_to_update:
+ if len(self._parent.lc.value_blocks_to_update['resistance']) > 0:
self.audiograb.set_sensor_type(SENSOR_DC_BIAS)
return
- if 'voltage' in self._parent.lc.value_blocks:
- if len(self._parent.lc.value_blocks['voltage']) > 0:
+ if 'voltage' in self._parent.lc.value_blocks_to_update:
+ if len(self._parent.lc.value_blocks_to_update['voltage']) > 0:
self.audiograb.set_sensor_type(SENSOR_DC_NO_BIAS)
return
def stop(self):
# This gets called by the stop button
- if self._status:
- if self.audio_started:
- self.audiograb.pause_grabbing()
+ if self._status and self.audio_started:
+ self.audiograb.pause_grabbing()
def goto_background(self):
# This gets called when your process is sent to the background
@@ -203,7 +203,8 @@ class Audio_sensors(Plugin):
def quit(self):
# This gets called by the quit button
- self.stop()
+ if self._status and self.audio_started:
+ self.audiograb.stop_grabbing()
def _status_report(self):
debug_output('Reporting audio sensor status: %s' % (str(self._status)))