mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
sys/sunaudio/: Fix up the mixer tracks to use a volume range of 0-255, which is what the sun audio API uses. This sim...
Original commit message from CVS: 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.
This commit is contained in:
parent
70ee2ee5e0
commit
01c237e91d
3 changed files with 19 additions and 10 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
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:
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
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)
|
||||
{
|
||||
|
@ -187,16 +185,15 @@ gst_sunaudiomixer_ctrl_get_volume (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;
|
||||
}
|
||||
|
@ -272,15 +269,15 @@ gst_sunaudiomixer_ctrl_set_volume (GstSunAudioMixerCtrl * mixer,
|
|||
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);
|
||||
|
|
|
@ -89,7 +89,7 @@ gst_sunaudiomixer_track_new (GstSunAudioTrackType track_num,
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue