From: Pierre Ossman <ossman@cendio.se>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, mzcbylcnhqvb@0pointer.de
Subject: Re: [RFC][PATCH] Transparent network support through polypaudio
Date: Mon, 27 Feb 2006 09:09:20 +0100 [thread overview]
Message-ID: <4402B3B0.8000508@cendio.se> (raw)
In-Reply-To: <s5hwtfmb0ts.wl%tiwai@suse.de>
[-- Attachment #1: Type: text/plain, Size: 283 bytes --]
Just one more. :)
Seems I fumbled the control event code a bit. Only one event at a time
got through. Here is a fix so that all four elements can change in one go.
--
Pierre Ossman Telephone: +46-13-21 46 00
Cendio AB Web: http://www.cendio.com
[-- Attachment #2: polyp-update.patch --]
[-- Type: text/x-patch, Size: 3926 bytes --]
? polyp-update.patch
Index: polyp/ctl_polyp.c
===================================================================
RCS file: /cvsroot/alsa/alsa-plugins/polyp/ctl_polyp.c,v
retrieving revision 1.2
diff -u -r1.2 ctl_polyp.c
--- polyp/ctl_polyp.c 23 Feb 2006 14:31:13 -0000 1.2
+++ polyp/ctl_polyp.c 26 Feb 2006 21:48:32 -0000
@@ -48,6 +48,11 @@
#define SINK_VOL_NAME "Master Playback Volume"
#define SINK_MUTE_NAME "Master Playback Switch"
+#define UPDATE_SINK_VOL 0x01
+#define UPDATE_SINK_MUTE 0x02
+#define UPDATE_SOURCE_VOL 0x04
+#define UPDATE_SOURCE_MUTE 0x08
+
static void sink_info_cb(pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
{
snd_ctl_polyp_t *ctl = (snd_ctl_polyp_t*)userdata;
@@ -58,6 +63,11 @@
assert(ctl && i);
+ if (!!ctl->sink_muted != !!i->mute) {
+ ctl->sink_muted = i->mute;
+ ctl->updated |= UPDATE_SINK_MUTE;
+ }
+
if (ctl->sink_volume.channels == i->volume.channels) {
for (chan = 0;chan < ctl->sink_volume.channels;chan++)
if (i->volume.values[chan] != ctl->sink_volume.values[chan])
@@ -66,15 +76,10 @@
if (chan == ctl->sink_volume.channels)
return;
- ctl->updated = 1;
+ ctl->updated |= UPDATE_SINK_VOL;
}
memcpy(&ctl->sink_volume, &i->volume, sizeof(pa_cvolume));
-
- if (!!ctl->sink_muted != !!i->mute) {
- ctl->sink_muted = i->mute;
- ctl->updated = 1;
- }
}
static void source_info_cb(pa_context *c, const pa_source_info *i, int is_last, void *userdata)
@@ -87,6 +92,11 @@
assert(ctl && i);
+ if (!!ctl->source_muted != !!i->mute) {
+ ctl->source_muted = i->mute;
+ ctl->updated |= UPDATE_SOURCE_MUTE;
+ }
+
if (ctl->source_volume.channels == i->volume.channels) {
for (chan = 0;chan < ctl->source_volume.channels;chan++)
if (i->volume.values[chan] != ctl->source_volume.values[chan])
@@ -95,15 +105,10 @@
if (chan == ctl->source_volume.channels)
return;
- ctl->updated = 1;
+ ctl->updated |= UPDATE_SOURCE_VOL;
}
memcpy(&ctl->source_volume, &i->volume, sizeof(pa_cvolume));
-
- if (!!ctl->source_muted != !!i->mute) {
- ctl->source_muted = i->mute;
- ctl->updated = 1;
- }
}
static void event_cb(pa_context *c, pa_subscription_event_type_t t,
@@ -392,15 +397,33 @@
unsigned int *event_mask)
{
snd_ctl_polyp_t *ctl = ext->private_data;
+ int offset;
assert(ctl);
if (!ctl->updated || !ctl->subscribed)
return -EAGAIN;
- polyp_elem_list(ext, 0, id);
+ if (ctl->source)
+ offset = 2;
+ else
+ offset = 0;
+
+ if (ctl->updated & UPDATE_SOURCE_VOL) {
+ polyp_elem_list(ext, 0, id);
+ ctl->updated &= ~UPDATE_SOURCE_VOL;
+ } else if (ctl->updated & UPDATE_SOURCE_MUTE) {
+ polyp_elem_list(ext, 1, id);
+ ctl->updated &= ~UPDATE_SOURCE_MUTE;
+ } else if (ctl->updated & UPDATE_SINK_VOL) {
+ polyp_elem_list(ext, offset + 0, id);
+ ctl->updated &= ~UPDATE_SINK_VOL;
+ } else if (ctl->updated & UPDATE_SINK_MUTE) {
+ polyp_elem_list(ext, offset + 1, id);
+ ctl->updated &= ~UPDATE_SINK_MUTE;
+ }
+
*event_mask = SND_CTL_EVENT_MASK_VALUE;
- ctl->updated = 0;
return 1;
}
@@ -416,11 +439,20 @@
static int polyp_ctl_poll_descriptors(snd_ctl_ext_t *ext, struct pollfd *pfd, unsigned int space)
{
+ int num;
+
snd_ctl_polyp_t *ctl = ext->private_data;
assert(ctl && ctl->p);
- return polyp_poll_descriptors(ctl->p, pfd, space);
+ num = polyp_poll_descriptors(ctl->p, pfd, space);
+ if (num < 0)
+ return num;
+
+ if (ctl->updated)
+ pa_mainloop_wakeup(ctl->p->mainloop);
+
+ return num;
}
static int polyp_ctl_poll_revents(snd_ctl_ext_t *ext, struct pollfd *pfd, unsigned int nfds, unsigned short *revents)
next prev parent reply other threads:[~2006-02-27 8:09 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-13 14:53 [RFC][PATCH] Transparent network support through polypaudio Pierre Ossman
2006-02-14 9:47 ` Clemens Ladisch
2006-02-14 10:35 ` Pierre Ossman
2006-02-14 14:35 ` Clemens Ladisch
2006-02-14 15:48 ` Pierre Ossman
2006-02-14 20:24 ` latency issue with mplayer ALSA plugin Thierry Vignaud
2006-02-15 9:30 ` Clemens Ladisch
2006-03-01 4:09 ` [RFC][PATCH] Transparent network support through polypaudio Lee Revell
2006-03-01 8:32 ` Clemens Ladisch
2006-03-01 17:00 ` Lee Revell
2006-03-07 14:01 ` Pierre Ossman
2006-02-15 9:44 ` Pierre Ossman
2006-02-17 19:05 ` Pierre Ossman
2006-02-21 16:15 ` Takashi Iwai
2006-02-21 16:38 ` Pierre Ossman
2006-02-21 16:41 ` Takashi Iwai
2006-02-22 9:48 ` Pierre Ossman
2006-02-22 15:41 ` Takashi Iwai
2006-02-23 13:02 ` Pierre Ossman
2006-02-23 14:34 ` Takashi Iwai
2006-02-24 13:22 ` Pierre Ossman
2006-02-24 13:57 ` Takashi Iwai
2006-02-24 14:03 ` Pierre Ossman
2006-02-27 8:09 ` Pierre Ossman [this message]
2006-02-27 19:22 ` Takashi Iwai
2006-02-28 8:11 ` Pierre Ossman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4402B3B0.8000508@cendio.se \
--to=ossman@cendio.se \
--cc=alsa-devel@alsa-project.org \
--cc=mzcbylcnhqvb@0pointer.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.