+2008-03-27 Tim-Philipp Müller <tim at centricular dot net>
+
+ Patch by: Brian Cameron <brian.cameron at sun dot com>
+
+ * sys/sunaudio/gstsunaudiomixerctrl.c:
+ (gst_sunaudiomixer_ctrl_get_volume),
+ (gst_sunaudiomixer_ctrl_set_volume):
+ * sys/sunaudio/gstsunaudiomixertrack.c: (gst_sunaudiomixer_track_new):
+ Fix up the mixer tracks to use a volume range of 0-255, which is what
+ the sun audio API uses. This simplifies the code and avoids rounding
+ errors. Fixes #524593.
+
2008-03-26 Edgard Lima <edgard.lima@indt.org.br>
* sys/v4l2/gstv4l2object.c:
GST_DEBUG_CATEGORY_EXTERN (sunaudio_debug);
#define GST_CAT_DEFAULT sunaudio_debug
-#define SCALE_FACTOR 2.55 /* 255/100 */
-
static gboolean
gst_sunaudiomixer_ctrl_open (GstSunAudioMixerCtrl * mixer)
{
switch (sunaudiotrack->track_num) {
case GST_SUNAUDIO_TRACK_OUTPUT:
- gain = (int) ((float) audioinfo.play.gain / (float) SCALE_FACTOR + 0.5);
+ gain = (int) audioinfo.play.gain;
balance = audioinfo.play.balance;
break;
case GST_SUNAUDIO_TRACK_LINE_IN:
- gain = (int) ((float) audioinfo.record.gain / (float) SCALE_FACTOR + 0.5);
+ gain = (int) audioinfo.record.gain;
balance = audioinfo.record.balance;
break;
case GST_SUNAUDIO_TRACK_MONITOR:
- gain =
- (int) ((float) audioinfo.monitor_gain / (float) SCALE_FACTOR + 0.5);
+ gain = (int) audioinfo.monitor_gain;
balance = audioinfo.record.balance;
break;
}
r_real_gain = volumes[1];
if (l_real_gain == r_real_gain) {
- gain = (int) ((float) l_real_gain * (float) SCALE_FACTOR + 0.5);
+ gain = l_real_gain;
balance = AUDIO_MID_BALANCE;
} else if (l_real_gain < r_real_gain) {
- gain = (int) ((float) r_real_gain * (float) SCALE_FACTOR + 0.5);
+ gain = r_real_gain;
ratio = (float) l_real_gain / (float) r_real_gain;
balance =
AUDIO_RIGHT_BALANCE - (int) (ratio * (float) AUDIO_MID_BALANCE + 0.5);
} else {
- gain = (int) ((float) l_real_gain * (float) SCALE_FACTOR + 0.5);
+ gain = l_real_gain;
ratio = (float) r_real_gain / (float) l_real_gain;
balance =
AUDIO_LEFT_BALANCE + (int) (ratio * (float) AUDIO_MID_BALANCE + 0.5);
track->num_channels = max_chans;
track->flags = flags;
track->min_volume = 0;
- track->max_volume = 100;
+ track->max_volume = 255;
sunaudiotrack->track_num = track_num;
sunaudiotrack->gain = (0 & 0xff);
sunaudiotrack->balance = AUDIO_MID_BALANCE;