:: [DNG] amixer-gtk (was: Re: mixer fo…
Top Page
Delete this message
Reply to this message
Author: aitor
Date:  
To: dng
Subject: [DNG] amixer-gtk (was: Re: mixer for alsa)
Hi,

A new version of amixer-gtk has been released with various bug fixes. The
most important of them are related to the following issues:

1) The arising of a new audio controller PCM at the first audio streaming.
You can verify this issue restarting your session and comparing the audio
controllers before and after playing an audio for the first time. New audio
controllers arising are now added to the gui of amixer-gtk on the flight.

2) When launching the mixer without specifying the audio device, it'll try
to auto-detect the one capable for playback streaming via:

   snd_pcm_open (&pcm_handle, interface, SND_PCM_STREAM_PLAYBACK, 0);

This function creates a handle and opens a connection to the audio interface.
It also checks if the protocol is compatible to prevent the use of old APIs
with modern drivers. But it may happen that the device is busy at that moment,
throwing an error. In the absence of a better idea, the workaround of last resort
consists of replacing the error with a warning, and then go ahead assuming the
device capable for playback streaming due to the fact of being occupied when
trying to open the connection. Look at the lines 384 - 408 in main.cpp:

https://git.devuan.org/aitor_czr/amixer-gtk/src/branch/master/ui/main.cpp

Bear in mind that you can always pass the device and the card number as arguments
in the command line. For instance:

    amixer-gtk -D hw -c 0 --systray


3) Segfaults caused by asynchronous tasks trying to access the same audio data
at the same time. This issue has been solved by using a weak pointer instead of a
strong shared pointer. As opposed to the latter, which keeps the object alive as
long as any shared pointer refers to it, the earlier doesn't keep the object alive
and, if you want to access it you call 'lock' that returns a regular strong pointer
whenever the object is still alive. That is:

  if (auto tempSharedPtr = weakPtr.lock()) {

      // do something with 'tempSharedPtr'

} else {

      // weak pointer is expired. Handle the issue as you wish.
  }

Weak pointers are used in the lines 62 - 68 of 'snd_monitor.cpp':

https://git.devuan.org/aitor_czr/amixer-gtk/src/branch/master/ui/snd_monitor.cpp

and also in the function|void AMixer_Ui::get_info_from_snd_monitor() of 'amixer_ui.cpp':
https://git.devuan.org/aitor_czr/amixer-gtk/src/branch/master/ui/amixer_ui.cpp
|||After these improvements, |||||the result appear to be|| quite stable. Feedback is welcome. Cheers,
Aitor. |