diff options
author | Stefan Knoblich <stkn@gentoo.org> | 2004-12-04 23:05:11 +0000 |
---|---|---|
committer | Stefan Knoblich <stkn@gentoo.org> | 2004-12-04 23:05:11 +0000 |
commit | deb6460fdbdf65a17583363f089be4f06d41a772 (patch) | |
tree | 5e053dbe08515b87626390fab94df07b34b2f38a /dev-libs/pwlib | |
parent | cvs b0rked the patch, re-adding with -kb (diff) | |
download | gentoo-2-deb6460fdbdf65a17583363f089be4f06d41a772.tar.gz gentoo-2-deb6460fdbdf65a17583363f089be4f06d41a772.tar.bz2 gentoo-2-deb6460fdbdf65a17583363f089be4f06d41a772.zip |
cvs broke the patch, removed and re-added with -kb, fixes #73008
Diffstat (limited to 'dev-libs/pwlib')
-rw-r--r-- | dev-libs/pwlib/ChangeLog | 10 | ||||
-rw-r--r-- | dev-libs/pwlib/files/pwlib-1.6.6-alsa_dmix.diff | 259 |
2 files changed, 268 insertions, 1 deletions
diff --git a/dev-libs/pwlib/ChangeLog b/dev-libs/pwlib/ChangeLog index bdfdd9f7f444..7c492f80711d 100644 --- a/dev-libs/pwlib/ChangeLog +++ b/dev-libs/pwlib/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for dev-libs/pwlib # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/pwlib/ChangeLog,v 1.66 2004/11/30 22:59:27 stkn Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/pwlib/ChangeLog,v 1.67 2004/12/04 23:05:11 stkn Exp $ + + 05 Dec 2004; Stefan Knoblich <stkn@gentoo.org> + +files/pwlib-1.6.6-alsa_dmix.diff: + cvs broke the patch, removed and re-added with -kb, closes #73008 *pwlib-1.6.6-r1 (30 Nov 2004) @@ -30,6 +34,10 @@ 01 Sep 2004; <stkn@gentoo.org> files/pwlib-1.6.6-ieee1394dc-fix.diff: fix the patch one more time... + 01 Sep 2004; Stefan Knoblich <stkn@gentoo.org> + files/pwlib-1.6.6-ieee1394dc-fix.diff: + fix the patch once again + 31 Aug 2004; <stkn@gentoo.org> files/pwlib-1.6.6-ieee1394dc-fix.diff: cvs killed the patch... (closing #62192) diff --git a/dev-libs/pwlib/files/pwlib-1.6.6-alsa_dmix.diff b/dev-libs/pwlib/files/pwlib-1.6.6-alsa_dmix.diff new file mode 100644 index 000000000000..2d1ded99770d --- /dev/null +++ b/dev-libs/pwlib/files/pwlib-1.6.6-alsa_dmix.diff @@ -0,0 +1,259 @@ +diff -ru pwlib-orig/plugins/sound_alsa/sound_alsa.cxx pwlib/plugins/sound_alsa/sound_alsa.cxx +--- pwlib-orig/plugins/sound_alsa/sound_alsa.cxx 2004-03-13 13:36:14.000000000 +0100 ++++ pwlib/plugins/sound_alsa/sound_alsa.cxx 2004-10-21 18:33:38.562610536 +0200 +@@ -28,6 +28,21 @@ + * Contributor(s): / + * + * $Log: sound_alsa.cxx,v $ ++ * Revision 1.21 2004/10/18 11:43:39 dsandras ++ * Use Capture instead of Mic when changing the volume. Use the correct mixer when using the Default device. ++ * ++ * Revision 1.20 2004/10/14 19:30:16 dsandras ++ * Removed DMIX and DSNOOP plugins and added support for DEFAULT as it is the correcti way to do things. ++ * ++ * Revision 1.19 2004/08/30 21:09:41 dsandras ++ * Added DSNOOP plugin support. ++ * ++ * Revision 1.18 2004/05/14 10:15:26 dominance ++ * Fixes direct opening of sound output devices. The list of devices does no longer return NULL in that case. Patch provided by Julien Puydt <julien.puydt@laposte.net>. ++ * ++ * Revision 1.17 2004/04/03 10:33:45 dsandras ++ * Use PStringToOrdinal to store the detected devices, that fixes problems if there is a discontinuity in the succession of soundcard ID's. For example the user has card ID 1 and 3, but not 2. ++ * + * Revision 1.16 2004/03/13 12:36:14 dsandras + * Added support for DMIX plugin output. + * +@@ -81,8 +96,8 @@ + PCREATE_SOUND_PLUGIN(ALSA, PSoundChannelALSA) + + +-static PStringArray playback_devices; +-static PStringArray capture_devices; ++static PStringToOrdinal playback_devices; ++static PStringToOrdinal capture_devices; + + /////////////////////////////////////////////////////////////////////////////// + +@@ -119,8 +134,9 @@ + } + + +-PStringArray PSoundChannelALSA::GetDeviceNames (Directions dir) ++void PSoundChannelALSA::UpdateDictionary (Directions dir) + { ++ + int card = -1, dev = -1; + + snd_ctl_t *handle = NULL; +@@ -134,12 +150,12 @@ + if (dir == Recorder) { + + stream = SND_PCM_STREAM_CAPTURE; +- capture_devices = PStringArray (); ++ capture_devices = PStringToOrdinal (); + } + else { + + stream = SND_PCM_STREAM_PLAYBACK; +- playback_devices = PStringArray (); ++ playback_devices = PStringToOrdinal (); + } + + snd_ctl_card_info_alloca (&info); +@@ -148,7 +164,7 @@ + /* No sound card found */ + if (snd_card_next (&card) < 0 || card < 0) { + +- return PStringArray (); ++ return; + } + + +@@ -176,13 +192,11 @@ + snd_card_get_name (card, &name); + if (dir == Recorder) { + +- if (capture_devices.GetStringsIndex (name) == P_MAX_INDEX) +- capture_devices.AppendString (name); ++ capture_devices.SetAt (name, card); + } + else { + +- if (playback_devices.GetStringsIndex (name) == P_MAX_INDEX) +- playback_devices.AppendString (name); ++ playback_devices.SetAt (name, card); + } + + free (name); +@@ -193,17 +207,27 @@ + snd_ctl_close(handle); + snd_card_next (&card); + } ++} + +- +- if (dir == Recorder) +- return capture_devices; +- else { ++PStringArray PSoundChannelALSA::GetDeviceNames (Directions dir) ++{ ++ PStringArray devices; ++ PStringToOrdinal devices_dict; + +- if (playback_devices.GetSize () > 0) +- playback_devices += "DMIX Plugin"; ++ if (dir == Recorder) ++ devices_dict = capture_devices; ++ else ++ devices_dict = playback_devices; ++ ++ UpdateDictionary (dir); ++ ++ if (devices_dict.GetSize () > 0) ++ devices += "Default"; ++ ++ for (PINDEX j = 0 ; j < devices_dict.GetSize () ; j++) ++ devices += devices_dict.GetKeyAt (j); + +- return playback_devices; +- } ++ return devices; + } + + +@@ -223,7 +247,7 @@ + unsigned _bitsPerSample) + { + PString real_device_name; +- PINDEX i = 0; ++ POrdinalKey *i = NULL; + snd_pcm_stream_t stream; + + Close(); +@@ -236,21 +260,31 @@ + stream = SND_PCM_STREAM_PLAYBACK; + + /* Open in NONBLOCK mode */ +- if (_dir != Recorder && _device == "DMIX Plugin") { ++ if (_device == "Default") { + +- real_device_name = "plug:dmix"; ++ real_device_name = "default"; ++ card_nr = -2; + } +- else if ((i = (_dir == Recorder) ? capture_devices.GetStringsIndex (_device) : playback_devices.GetStringsIndex (_device)) != P_MAX_INDEX) { ++ else { ++ ++ if ((_dir == Recorder && capture_devices.IsEmpty ()) ++ || (_dir == Player && playback_devices.IsEmpty ())) ++ UpdateDictionary (_dir); ++ ++ i = (_dir == Recorder) ? capture_devices.GetAt (_device) : playback_devices.GetAt (_device); + +- real_device_name = "plughw:" + PString (i); +- card_nr = i; ++ if (i) { ++ ++ real_device_name = "plughw:" + PString (*i); ++ card_nr = *i; ++ } ++ else { ++ ++ PTRACE (1, "ALSA\tDevice not found"); ++ return FALSE; ++ } + } +- else { + +- PTRACE (1, "ALSA\tDevice unavailable"); +- return FALSE; +- } +- + if (snd_pcm_open (&os_handle, real_device_name, stream, SND_PCM_NONBLOCK) < 0) { + + PTRACE (1, "ALSA\tOpen Failed"); +@@ -735,7 +769,7 @@ + snd_mixer_elem_t *elem; + snd_mixer_selem_id_t *sid; + +- const char *play_mix_name = (direction == Player) ? "PCM": "Mic"; ++ const char *play_mix_name = (direction == Player) ? "PCM": "Capture"; + PString card_name; + + long pmin = 0, pmax = 0; +@@ -744,7 +778,10 @@ + if (!os_handle) + return FALSE; + +- card_name = "hw:" + PString (card_nr); ++ if (card_nr == -2) ++ card_name = "default"; ++ else ++ card_name = "hw:" + PString (card_nr); + + //allocate simple id + snd_mixer_selem_id_alloca (&sid); +@@ -796,23 +833,39 @@ + return FALSE; + } + +- snd_mixer_selem_get_playback_volume_range (elem, &pmin, &pmax); + + if (set) { +- +- vol = (set_vol * (pmax?pmax:31)) / 100; +- snd_mixer_selem_set_playback_volume (elem, +- SND_MIXER_SCHN_FRONT_LEFT, vol); +- snd_mixer_selem_set_playback_volume (elem, +- SND_MIXER_SCHN_FRONT_RIGHT, vol); + ++ if (direction == Player) { ++ ++ snd_mixer_selem_get_playback_volume_range (elem, &pmin, &pmax); ++ vol = (set_vol * (pmax?pmax:31)) / 100; ++ snd_mixer_selem_set_playback_volume_all (elem, vol); ++ } ++ else { ++ ++ snd_mixer_selem_get_capture_volume_range (elem, &pmin, &pmax); ++ vol = (set_vol * (pmax?pmax:31)) / 100; ++ snd_mixer_selem_set_capture_volume_all (elem, vol); ++ } + PTRACE (4, "Set volume to " << vol); + } + else { + +- snd_mixer_selem_get_playback_volume (elem, +- SND_MIXER_SCHN_FRONT_LEFT, &vol); ++ if (direction == Player) { ++ ++ snd_mixer_selem_get_playback_volume_range (elem, &pmin, &pmax); ++ snd_mixer_selem_get_playback_volume (elem, SND_MIXER_SCHN_FRONT_LEFT, ++ &vol); ++ } ++ else { ++ ++ snd_mixer_selem_get_capture_volume_range (elem, &pmin, &pmax); ++ snd_mixer_selem_get_capture_volume (elem, SND_MIXER_SCHN_FRONT_LEFT, ++ &vol); ++ } + get_vol = (vol * 100) / (pmax?pmax:31); ++ + PTRACE (4, "Got volume " << vol); + } + +Only in pwlib/plugins/sound_alsa: .sound_alsa.cxx-patch.swp +diff -ru pwlib-orig/plugins/sound_alsa/sound_alsa.h pwlib/plugins/sound_alsa/sound_alsa.h +--- pwlib-orig/plugins/sound_alsa/sound_alsa.h 2003-12-28 16:10:35.000000000 +0100 ++++ pwlib/plugins/sound_alsa/sound_alsa.h 2004-10-21 18:35:51.559391952 +0200 +@@ -89,7 +89,8 @@ + BOOL IsOpen() const; + + private: +- ++ ++ static void UpdateDictionary(PSoundChannel::Directions); + BOOL Volume (BOOL, unsigned, unsigned &); + PSoundChannel::Directions direction; + PString device; + |