mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Hardware source volume support in OSS.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@578 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
c2290c52a4
commit
ce9b035b7b
4 changed files with 85 additions and 10 deletions
|
|
@ -224,7 +224,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
|
|||
static int sink_get_hw_volume(pa_sink *s) {
|
||||
struct userdata *u = s->userdata;
|
||||
|
||||
if (pa_oss_get_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
|
||||
if (pa_oss_get_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
|
||||
pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
|
||||
s->get_hw_volume = NULL;
|
||||
return -1;
|
||||
|
|
@ -236,7 +236,31 @@ static int sink_get_hw_volume(pa_sink *s) {
|
|||
static int sink_set_hw_volume(pa_sink *s) {
|
||||
struct userdata *u = s->userdata;
|
||||
|
||||
if (pa_oss_set_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
|
||||
if (pa_oss_set_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
|
||||
pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
|
||||
s->set_hw_volume = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int source_get_hw_volume(pa_source *s) {
|
||||
struct userdata *u = s->userdata;
|
||||
|
||||
if (pa_oss_get_imix_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
|
||||
pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
|
||||
s->get_hw_volume = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int source_set_hw_volume(pa_source *s) {
|
||||
struct userdata *u = s->userdata;
|
||||
|
||||
if (pa_oss_set_imix_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
|
||||
pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
|
||||
s->set_hw_volume = NULL;
|
||||
return -1;
|
||||
|
|
@ -337,6 +361,8 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
|
||||
u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &u->sample_spec, NULL);
|
||||
assert(u->source);
|
||||
u->source->get_hw_volume = source_get_hw_volume;
|
||||
u->source->set_hw_volume = source_set_hw_volume;
|
||||
u->source->userdata = u;
|
||||
pa_source_set_owner(u->source, m);
|
||||
u->source->description = pa_sprintf_malloc("Open Sound System PCM/mmap() on '%s'%s%s%s",
|
||||
|
|
@ -409,6 +435,8 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
pa_modargs_free(ma);
|
||||
|
||||
/* Read mixer settings */
|
||||
if (u->source)
|
||||
source_get_hw_volume(u->source);
|
||||
if (u->sink)
|
||||
sink_get_hw_volume(u->sink);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue