Re: [GnomeMeeting-devel-list] Problems in the ALSA plugin



On lun, 2004-05-10 at 14:12, PUYDT Julien wrote:

> 2) when it doesn't get the list of devices first, but directly opens the
> device (it already knows the device name), it cannot open the device:
> the plugin didn't realize it hadn't setup the list of devices-names, and
> returned NULL. This I think this one is a bug.
> 
> The sources of my test program are attached, with instructions on what
> to comment, and how to compile.

The following patch should fix this problem.

Snark
diff -ur pwlib-cvs-20040514.CVS/plugins/sound_alsa/sound_alsa.cxx pwlib-cvs-20040514.CVS.patched/plugins/sound_alsa/sound_alsa.cxx
--- pwlib-cvs-20040514.CVS/plugins/sound_alsa/sound_alsa.cxx	2004-04-03 12:33:45.000000000 +0200
+++ pwlib-cvs-20040514.CVS.patched/plugins/sound_alsa/sound_alsa.cxx	2004-05-14 11:18:48.000000000 +0200
@@ -122,9 +122,8 @@
 }
 
 
-PStringArray PSoundChannelALSA::GetDeviceNames (Directions dir)
+void PSoundChannelALSA::UpdateDictionary (Directions dir)
 {
-  PStringArray devices;
   
   int card = -1, dev = -1;
   
@@ -153,7 +152,7 @@
   /* No sound card found */
   if (snd_card_next (&card) < 0 || card < 0) {
 
-    return PStringArray ();
+    return;
   }
 
 
@@ -196,12 +195,19 @@
     snd_ctl_close(handle);
     snd_card_next (&card);
   }
+}
 
+PStringArray PSoundChannelALSA::GetDeviceNames (Directions dir)
+{
+  PStringArray devices;
   PStringToOrdinal devices_dict;
+ 
   if (dir == Recorder)
     devices_dict = capture_devices;
   else
     devices_dict = playback_devices;
+
+  UpdateDictionary (dir);
   
   for (PINDEX j = 0 ; j < devices_dict.GetSize () ; j++) 
     devices += devices_dict.GetKeyAt (j);
@@ -249,6 +255,10 @@
   }
   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);
 
     if (i) {
diff -ur pwlib-cvs-20040514.CVS/plugins/sound_alsa/sound_alsa.h pwlib-cvs-20040514.CVS.patched/plugins/sound_alsa/sound_alsa.h
--- pwlib-cvs-20040514.CVS/plugins/sound_alsa/sound_alsa.h	2003-12-28 16:10:35.000000000 +0100
+++ pwlib-cvs-20040514.CVS.patched/plugins/sound_alsa/sound_alsa.h	2004-05-14 11:18:17.000000000 +0200
@@ -90,6 +90,7 @@
 
  private:
 
+  static void UpdateDictionary(PSoundChannel::Directions);
   BOOL Volume (BOOL, unsigned, unsigned &);
   PSoundChannel::Directions direction;
   PString device;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]