Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSayamindu Dasgupta <sayamindu@gmail.com>2009-11-16 10:11:55 (GMT)
committer Sayamindu Dasgupta <sayamindu@gmail.com>2009-11-16 10:11:55 (GMT)
commit4b66632eabd7e341fd83c253dd850455158b61cc (patch)
tree500397e2c079d54fb5b8abbaec9eacdf7a5f8801
parent6f65309dad5f42c3e0bdd024dd2ca593a4ec428b (diff)
Try to use set_sensor_type()HEADmaster
-rw-r--r--audiograb.py99
-rw-r--r--sound_toolbar.py9
2 files changed, 70 insertions, 38 deletions
diff --git a/audiograb.py b/audiograb.py
index a75fab2..b3fe027 100644
--- a/audiograb.py
+++ b/audiograb.py
@@ -204,40 +204,6 @@ class AudioGrab:
data at the end of idle-add"""
self.callable1 = callable1
-
- def set_sensor_type(self, sensor_type=1):
- """Set the type of sensor you want to use. Set sensor_type according
- to the following
- 0 - AC coupling with Bias Off --> Very rarely used.
- Use when connecting a dynamic microphone externally
- 1 - AC coupling with Bias On --> The default settings.
- The internal MIC uses these
- 2 - DC coupling with Bias Off --> Used when using a voltage
- output sensor. For example LM35 which gives output proportional
- to temperature
- 3 - DC coupling with Bias On --> Used with resistive sensors.
- For example"""
- if sensor_type==0:
- self.set_dc_mode(False)
- self.set_bias(False)
- self.set_capture_gain(50)
- self.set_mic_boost(True)
- elif sensor_type==1:
- self.set_dc_mode(False)
- self.set_bias(True)
- self.set_capture_gain(40)
- self.set_mic_boost(True)
- elif sensor_type==2:
- self.set_dc_mode(True)
- self.set_bias(False)
- self.set_capture_gain(0)
- self.set_mic_boost(False)
- elif sensor_type==3:
- self.set_dc_mode(True)
- self.set_bias(True)
- self.set_capture_gain(0)
- self.set_mic_boost(False)
-
def start_grabbing(self):
"""Called right at the start of the Activity"""
self.start_sound_device()
@@ -488,6 +454,39 @@ class AudioGrab_XO_1(AudioGrab):
# in case alsamixer doesn't report a percentage
return 0
+ def set_sensor_type(self, sensor_type=1):
+ """Set the type of sensor you want to use. Set sensor_type according
+ to the following
+ 0 - AC coupling with Bias Off --> Very rarely used.
+ Use when connecting a dynamic microphone externally
+ 1 - AC coupling with Bias On --> The default settings.
+ The internal MIC uses these
+ 2 - DC coupling with Bias Off --> Used when using a voltage
+ output sensor. For example LM35 which gives output proportional
+ to temperature
+ 3 - DC coupling with Bias On --> Used with resistive sensors.
+ For example"""
+ if sensor_type==0:
+ self.set_dc_mode(False)
+ self.set_bias(False)
+ self.set_capture_gain(50)
+ self.set_mic_boost(True)
+ elif sensor_type==1:
+ self.set_dc_mode(False)
+ self.set_bias(True)
+ self.set_capture_gain(40)
+ self.set_mic_boost(True)
+ elif sensor_type==2:
+ self.set_dc_mode(True)
+ self.set_bias(False)
+ self.set_capture_gain(0)
+ self.set_mic_boost(False)
+ elif sensor_type==3:
+ self.set_dc_mode(True)
+ self.set_bias(True)
+ self.set_capture_gain(0)
+ self.set_mic_boost(False)
+
def on_activity_quit(self):
"""When Activity quits"""
self.set_mic_boost(config.QUIT_MIC_BOOST)
@@ -641,6 +640,38 @@ class AudioGrab_XO_1_5(AudioGrab):
p = p[:find(p,"%]")]
return int(p)
+ def set_sensor_type(self, sensor_type=1):
+ """Set the type of sensor you want to use. Set sensor_type according
+ to the following
+ 0 - AC coupling with Bias Off --> Very rarely used.
+ Use when connecting a dynamic microphone externally
+ 1 - AC coupling with Bias On --> The default settings.
+ The internal MIC uses these
+ 2 - DC coupling with Bias Off --> Used when using a voltage
+ output sensor. For example LM35 which gives output proportional
+ to temperature
+ 3 - DC coupling with Bias On --> Used with resistive sensors.
+ For example"""
+ if sensor_type==0:
+ self.set_dc_mode(False)
+ self.set_bias(False)
+ self.set_capture_gain(80)
+ self.set_mic_boost(True)
+ elif sensor_type==1:
+ self.set_dc_mode(False)
+ self.set_bias(True)
+ self.set_capture_gain(80)
+ self.set_mic_boost(True)
+ elif sensor_type==2:
+ self.set_dc_mode(True)
+ self.set_bias(False)
+ self.set_capture_gain(0)
+ self.set_mic_boost(False)
+ elif sensor_type==3:
+ self.set_dc_mode(True)
+ self.set_bias(True)
+ self.set_capture_gain(0)
+ self.set_mic_boost(False)
def on_activity_quit(self):
"""When Activity quits"""
diff --git a/sound_toolbar.py b/sound_toolbar.py
index ef679d5..a17b117 100644
--- a/sound_toolbar.py
+++ b/sound_toolbar.py
@@ -331,10 +331,11 @@ class SoundToolbar(gtk.Toolbar):
def context_on(self):
"""When the sound context is switched on"""
self.ag.start_sound_device()
- self.ag.set_dc_mode(False)
- self.ag.set_bias(True)
- self.ag.set_capture_gain(self.capture_gain)
- self.ag.set_mic_boost(self.mic_boost)
+ #self.ag.set_dc_mode(False)
+ #self.ag.set_bias(True)
+ #self.ag.set_capture_gain(self.capture_gain)
+ #self.ag.set_mic_boost(self.mic_boost)
+ self.ag.set_sensor_type(1)
self.wave.set_fft_mode(False)
self.wave.set_mag_params(self.g, self.y_mag)
self._update_string_for_textbox()