[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-dev] Re: [patch] Improve gst handling of microphone gain - fix te
From: |
Petter Reinholdtsen |
Subject: |
[Gnash-dev] Re: [patch] Improve gst handling of microphone gain - fix testsuite failure |
Date: |
Mon, 22 Nov 2010 13:54:57 +0100 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
[strk]
> Good for me if it passes sane (tested) tests.
I can confirm that this made the microphone test pass on my test
machine. Here is an updated and slightly cleaner patch, hopefully
without any whitespace problems this time. I introduced a new private
function gstgain(), to use the same code every time the interface gain
is converted to gst gain.
diff --git a/libmedia/gst/AudioInputGst.cpp b/libmedia/gst/AudioInputGst.cpp
index d3bbadb..284e809 100644
--- a/libmedia/gst/AudioInputGst.cpp
+++ b/libmedia/gst/AudioInputGst.cpp
@@ -61,7 +61,7 @@ GnashAudioPrivate::GnashAudioPrivate() {
AudioInputGst::AudioInputGst()
:
_activityLevel(-1),
- _gain(0),
+ _gain(50),
_index(0),
_muted(true),
_rate(8000),
@@ -309,7 +309,7 @@ AudioInputGst::audioChangeSourceBin(GnashAudioPrivate
*audio)
command = g_strdup_printf ("%s name=audioSource device=%s ! capsfilter
name=capsfilter
caps=audio/x-raw-int,signed=true,channels=2,rate=%i;audio/x-raw-float,channels=2,rate=%i
! rgvolume pre-amp=%f",
audio->_audioDevice->getGstreamerSrc(),
audio->_audioDevice->getDevLocation(),
- _rate, _rate, _gain);
+ _rate, _rate, gstgain());
log_debug ("GstPipeline command is: %s\n", command);
@@ -365,7 +365,7 @@ AudioInputGst::audioCreateSourceBin(GnashAudioPrivate
*audio)
command = g_strdup_printf ("%s name=audioSource device=%s ! capsfilter
name=capsfilter
caps=audio/x-raw-int,signed=true,channels=2,rate=%i;audio/x-raw-float,channels=2,rate=%i
! rgvolume pre-amp=%f",
audio->_audioDevice->getGstreamerSrc(),
audio->_audioDevice->getDevLocation(),
- _rate, _rate, _gain);
+ _rate, _rate, gstgain());
log_debug ("GstPipeline command is: %s", command);
diff --git a/libmedia/gst/AudioInputGst.h b/libmedia/gst/AudioInputGst.h
index 12485fc..b511912 100644
--- a/libmedia/gst/AudioInputGst.h
+++ b/libmedia/gst/AudioInputGst.h
@@ -265,7 +265,7 @@ public:
/// it here?
virtual void setGain(double g) {
assert (g >= 0 && g <= 100);
- _gain = (g - 50) * 1.2;
+ _gain = g;
audioChangeSourceBin(getGlobalAudio());
}
@@ -275,7 +275,7 @@ public:
/// TODO: shouldn't we query the value from the input rather than storing
/// it here?
virtual double gain() const {
- return (_gain / 1.2) + 50;
+ return _gain;
}
virtual void setIndex(int i) {
@@ -512,7 +512,9 @@ private:
/// structure currently being worked with.
GnashAudioPrivate* getGlobalAudio() {return _globalAudio;}
-
+ /// Interface range is 0..100, gst range is -60 to 60
+ double gstgain() { return (gain() - 50) * 1.2; }
+
private:
/// \var _numdevs
/// \brief Contains an integer value representing the number of devices
found
Happy hacking,
--
Petter Reinholdtsen