On Friday 27 July 2007 00:42, Ludovico Cavedon wrote:
> I noticed that opening plughw devices instead of hw is working for me (no
> mono/stereo issue). I tried both the internal soundcard and a USB headset.
> In this case, it is ALSA taking care of the necessary conversions.
>
> I attached a patch to ticket #1764
> (http://dev.openwengo.com/trac/openwengo/trac.cgi/ticket/1746).
>
> Is it the right way to do it? Could someone try it, please?
>
> Regards,
> Ludovico Cavedon
>

Hi Ludovico,
For me it does solve the mono/stereo issue but unfortunately it breaks audio 
mixing i.e no more dtfm feedback during a call... So I've added to your patch 
the default ALSA device that fit most of the use cases (see the attached 
patch) What do you think?
Looking at the code I've also noticed that the LinuxSound and alsa_sndfile* 
did not use the audio configuration so I've committed a fix (see rev 12081)
Best regards,
-- 
Mathieu Stute <mstute(at)gmail.com>
GPG: http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x3EE62B4D
Index: libs/sound/src/linux/AudioDeviceManager.cpp
===================================================================
--- libs/sound/src/linux/AudioDeviceManager.cpp	(revision 12047)
+++ libs/sound/src/linux/AudioDeviceManager.cpp	(working copy)
@@ -28,39 +28,19 @@
 std::list<AudioDevice> AudioDeviceManager::getInputDeviceList() {
 	RecursiveMutex::ScopedLock scopedLock(_mutex);
 
-	//HACK: always return the default one + plughw
-	std::list<AudioDevice> deviceList;
-	deviceList.push_back(getDefaultInputDevice());
+	std::list<AudioDevice> deviceList = find_alsa_devices(1);
+	deviceList.push_front(getDefaultInputDevice());
 
-	StringList data;
-	data += String("ALSA: plughw");
-	data += String("plughw");
-	data += EnumDeviceType::toString(EnumDeviceType::DeviceTypeWaveIn);
-	deviceList.push_back(AudioDevice(data));
-
 	return deviceList;
-	////
-
-	//return find_alsa_devices(1);
 }
 
 std::list<AudioDevice> AudioDeviceManager::getOutputDeviceList() {
 	RecursiveMutex::ScopedLock scopedLock(_mutex);
 
-	//HACK: always return the default one + plughw
-	std::list<AudioDevice> deviceList;
-	deviceList.push_back(getDefaultOutputDevice());
+	std::list<AudioDevice> deviceList = find_alsa_devices(0);
+	deviceList.push_front(getDefaultOutputDevice());
 
-	StringList data;
-	data += String("ALSA: plughw");
-	data += String("plughw");
-	data += EnumDeviceType::toString(EnumDeviceType::DeviceTypeWaveOut);
-	deviceList.push_back(AudioDevice(data));
-
 	return deviceList;
-	////
-
-	//return find_alsa_devices(0);
 }
 
 AudioDevice AudioDeviceManager::getDefaultOutputDevice() {
@@ -131,7 +111,7 @@
 		////
 
 		// open the sound card
-		if( snd_ctl_open(&snd_ctl, alsa_card_name, 0 ) < 0 )
+		if ( snd_ctl_open(&snd_ctl, alsa_card_name, 0 ) < 0 )
 		{
 			LOG_WARN("unable to open card: " + String(alsa_card_name));
 			break;
@@ -165,8 +145,8 @@
 			int has_playback = 0;
 
 			// compute internal device name
-			snprintf(alsa_device_name, sizeof(alsa_device_name), "%s:%d,%d", "hw",
-			card_index, device_index);
+			snprintf(alsa_device_name, sizeof(alsa_device_name), "%s:%d,%d",
+				"plughw", card_index, device_index);
 			LOG_DEBUG("alsa_device_name: " + String(alsa_device_name));
 			////
 

Attachment: pgpy16PesTRdl.pgp
Description: PGP signature

_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel

Reply via email to