[pulseaudio-discuss] [PATCH 2/2] alsa-mixer: Refactoring: merge element_mute_volume(), element_zero_volume() and element_apply_constant_volume() into a single function.

2011-03-17 Thread Tanu Kaskinen
---
 src/modules/alsa/alsa-mixer.c |  102 ++---
 1 files changed, 35 insertions(+), 67 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 2893b47..aa3422a 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1084,10 +1084,14 @@ int pa_alsa_path_set_mute(pa_alsa_path *p, snd_mixer_t 
*m, pa_bool_t muted) {
 return 0;
 }
 
-static int element_mute_volume(pa_alsa_element *e, snd_mixer_t *m) {
-snd_mixer_elem_t *me;
-snd_mixer_selem_id_t *sid;
-int r;
+/* Depending on whether e-volume_use is _OFF, _ZERO or _CONSTANT, this
+ * function sets all channels of the volume element to e-min_volume, 0 dB or
+ * e-constant_volume. */
+static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) {
+snd_mixer_elem_t *me = NULL;
+snd_mixer_selem_id_t *sid = NULL;
+int r = 0;
+long volume = -1;
 
 pa_assert(m);
 pa_assert(e);
@@ -1098,74 +1102,44 @@ static int element_mute_volume(pa_alsa_element *e, 
snd_mixer_t *m) {
 return -1;
 }
 
-if (e-direction == PA_ALSA_DIRECTION_OUTPUT)
-r = snd_mixer_selem_set_playback_volume_all(me, e-min_volume);
-else
-r = snd_mixer_selem_set_capture_volume_all(me, e-min_volume);
-
-if (r  0)
-pa_log_warn(Failed to set volume to muted of %s: %s, e-alsa_name, 
pa_alsa_strerror(errno));
+switch (e-volume_use) {
+case PA_ALSA_VOLUME_OFF:
+volume = e-min_volume;
+break;
 
-return r;
-}
+case PA_ALSA_VOLUME_ZERO:
+if (e-db_fix) {
+long dB = 0;
 
-/* The volume to 0dB */
-static int element_zero_volume(pa_alsa_element *e, snd_mixer_t *m) {
-snd_mixer_elem_t *me;
-snd_mixer_selem_id_t *sid;
-int r;
+volume = decibel_fix_get_step(e-db_fix, dB, +1);
+}
+break;
 
-pa_assert(m);
-pa_assert(e);
+case PA_ALSA_VOLUME_CONSTANT:
+volume = e-constant_volume;
+break;
 
-SELEM_INIT(sid, e-alsa_name);
-if (!(me = snd_mixer_find_selem(m, sid))) {
-pa_log_warn(Element %s seems to have disappeared., e-alsa_name);
-return -1;
+default:
+pa_assert_not_reached();
 }
 
-if (e-direction == PA_ALSA_DIRECTION_OUTPUT)
-if (e-db_fix) {
-long value = 0;
+if (volume = 0) {
+if (e-direction == PA_ALSA_DIRECTION_OUTPUT)
+r = snd_mixer_selem_set_playback_volume_all(me, volume);
+else
+r = snd_mixer_selem_set_capture_volume_all(me, volume);
+} else {
+pa_assert(e-volume_use == PA_ALSA_VOLUME_ZERO);
+pa_assert(!e-db_fix);
 
-r = snd_mixer_selem_set_playback_volume_all(me, 
decibel_fix_get_step(e-db_fix, value, +1));
-} else
+if (e-direction == PA_ALSA_DIRECTION_OUTPUT)
 r = snd_mixer_selem_set_playback_dB_all(me, 0, +1);
-else
-if (e-db_fix) {
-long value = 0;
-
-r = snd_mixer_selem_set_capture_volume_all(me, 
decibel_fix_get_step(e-db_fix, value, +1));
-} else
+else
 r = snd_mixer_selem_set_capture_dB_all(me, 0, +1);
-
-if (r  0)
-pa_log_warn(Failed to set volume to 0dB of %s: %s, e-alsa_name, 
pa_alsa_strerror(errno));
-
-return r;
-}
-
-static int element_apply_constant_volume(pa_alsa_element *e, snd_mixer_t *m) {
-snd_mixer_elem_t *me;
-snd_mixer_selem_id_t *sid;
-int r;
-
-pa_assert(m);
-pa_assert(e);
-
-SELEM_INIT(sid, e-alsa_name);
-if (!(me = snd_mixer_find_selem(m, sid))) {
-pa_log_warn(Element %s seems to have disappeared., e-alsa_name);
-return -1;
 }
 
-if (e-direction == PA_ALSA_DIRECTION_OUTPUT)
-r = snd_mixer_selem_set_playback_volume_all(me, e-constant_volume);
-else
-r = snd_mixer_selem_set_capture_volume_all(me, e-constant_volume);
-
 if (r  0)
-pa_log_warn(Failed to set volume to %li of %s: %s, 
e-constant_volume, e-alsa_name, pa_alsa_strerror(errno));
+pa_log_warn(Failed to set volume of %s: %s, e-alsa_name, 
pa_alsa_strerror(errno));
 
 return r;
 }
@@ -1203,15 +1177,9 @@ int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m) 
{
 
 switch (e-volume_use) {
 case PA_ALSA_VOLUME_OFF:
-r = element_mute_volume(e, m);
-break;
-
 case PA_ALSA_VOLUME_ZERO:
-r = element_zero_volume(e, m);
-break;
-
 case PA_ALSA_VOLUME_CONSTANT:
-r = element_apply_constant_volume(e, m);
+r = element_set_constant_volume(e, m);
 break;
 
 case PA_ALSA_VOLUME_MERGE:
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Assertion failure: Assertion 'b' failed at pulsecore/memblock.c:451, function pa_memblock_acquire(). Aborting.

2011-03-17 Thread Dan Kegel
The error
Assertion 'b' failed at pulsecore/memblock.c:451, function
pa_memblock_acquire(). Aborting.
is happening about every other run of a particular
app (Dragon Age Origins) for me now.  I am running ubuntu 10.10 on an i7, and
dpkg-query says pulseaudio is version
1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu21.1

But this isn't just an ubuntu problem, and it's not specific to the
app I'm running, or even to wine; see also
http://bugs.winehq.org/show_bug.cgi?id=23163
https://bugzilla.redhat.com/show_bug.cgi?id=630895
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/492136

There seem to be two workarounds:
1) run the app in question under taskset 1
-or-
2) put enable-shm = no
in ~/.pulse/daemon.conf

After doing the enable-shm=no workaround, and then removing it,
the problem seems to have gone, too.  So it seems to be flaky.

Does any of this ring a bell?

Thanks,
Dan
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/9] Find modules and config files relative to the installed libraries.

2011-03-17 Thread Colin Guthrie
'Twas brillig, and Maarten Bosmans at 16/03/11 09:55 did gyre and gimble:
 +#ifdef OS_IS_WIN32
 +{
 +char *toplevel = pa_win32_get_toplevel(NULL);
 +c-dl_search_path = pa_sprintf_malloc(%s PA_PATH_SEP lib 
 PA_PATH_SEP pulse-1.0 PA_PATH_SEP modules, toplevel);
 +}
 +#else

Is there no nicer way to get this path than hard-coding pulse-1.0 here?

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 3/9] build: copy instead of link pacat to other utils on win32

2011-03-17 Thread Colin Guthrie
'Twas brillig, and Maarten Bosmans at 16/03/11 09:55 did gyre and gimble:
 This is necessary as symlinks are not supported on Windows.  Also use the 
 $(EXEEXT) variable.
 
 As a side effect on POSIX, an absolute symbolic link is now created instead 
 of a relative one.

NAK. The absolute link cannot include DESTDIR I believe as most
RPMs/packages use DESTDIR to create install routes that ultimately end
up in /. DESTDIR cannot appear in any symbolic links.

Also relative symlinks are preferred for relocated installs an for
seeing working links when installing in chroots etc.

Also, (as I've got other issues with this particular patch) can you call
the variable something other than LINK_PROGRAM to avoid any confusion
with library linking? SYMLINK_PROGRAM or something (even if it's invalid
on win32) would IMO be less confusing.

Col.


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss