mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
Use defines and not hard coded values for volume levels. Caused incorrect
volume levels for all esound clients that changed the volume. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@473 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
bbc6dd68e2
commit
d431e0094b
1 changed files with 7 additions and 7 deletions
|
|
@ -474,7 +474,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
|
|||
assert(k);
|
||||
|
||||
for (conn = pa_idxset_first(c->protocol->connections, &idx); conn; conn = pa_idxset_next(c->protocol->connections, &idx)) {
|
||||
int format = ESD_BITS16 | ESD_STEREO, rate = 44100, lvolume = 0xFF, rvolume = 0xFF;
|
||||
int format = ESD_BITS16 | ESD_STEREO, rate = 44100, lvolume = ESD_VOLUME_BASE, rvolume = ESD_VOLUME_BASE;
|
||||
|
||||
if (conn->state != ESD_STREAMING_DATA)
|
||||
continue;
|
||||
|
|
@ -483,8 +483,8 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
|
|||
|
||||
if (conn->sink_input) {
|
||||
rate = conn->sink_input->sample_spec.rate;
|
||||
lvolume = (conn->sink_input->volume.values[0]*0xFF)/0x100;
|
||||
rvolume = (conn->sink_input->volume.values[1]*0xFF)/0x100;
|
||||
lvolume = (conn->sink_input->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM;
|
||||
rvolume = (conn->sink_input->volume.values[1]*ESD_VOLUME_BASE)/PA_VOLUME_NORM;
|
||||
format = format_native2esd(&conn->sink_input->sample_spec);
|
||||
}
|
||||
|
||||
|
|
@ -544,11 +544,11 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
|
|||
response += sizeof(int);
|
||||
|
||||
/* left */
|
||||
*((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*0xFF)/0x100);
|
||||
*((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
|
||||
response += sizeof(int);
|
||||
|
||||
/*right*/
|
||||
*((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*0xFF)/0x100);
|
||||
*((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
|
||||
response += sizeof(int);
|
||||
|
||||
/*format*/
|
||||
|
|
@ -578,9 +578,9 @@ static int esd_proto_stream_pan(struct connection *c, PA_GCC_UNUSED esd_proto_t
|
|||
|
||||
idx = (uint32_t) maybe_swap_endian_32(c->swap_byte_order, *(const int*)data)-1;
|
||||
lvolume = (uint32_t) maybe_swap_endian_32(c->swap_byte_order, *((const int*)data + 1));
|
||||
lvolume = (lvolume*0x100)/0xFF;
|
||||
lvolume = (lvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
|
||||
rvolume = (uint32_t) maybe_swap_endian_32(c->swap_byte_order, *((const int*)data + 2));
|
||||
rvolume = (rvolume*0x100)/0xFF;
|
||||
rvolume = (rvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
|
||||
|
||||
ok = connection_write(c, sizeof(int));
|
||||
assert(ok);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue