This sound device does not have any controls

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This sound device does not have any controls

Jump to solution
702 Views
MicMoba
Contributor V

Hi,

I have connect a MAX98357A over SAI3 to an i.MX8. I use the simple-card driver. Everything works. I get sound when I use aplay or gplay. But I wonder when I open alsamixer BEFORE using aplay or gplay I got the message "This sound device does not have any controls"

If I start alsamixer AFTER I used aplay or gplay I can see the Master volume control.

I don't understand why!

My .asoundrc

 

cat .asoundrc
pcm.!default {
  type plug
  slave.pcm   "softvol"
}

ctl.!default {
  type hw
  card MAX98357A
}

pcm.mycard {
   type hw
   card MAX98357A
}

pcm.softvol {
  type  softvol
  slave {
      pcm "mycard"
  }
  control {
     name "Master"
     card  MAX98357A
  }
  max_dB 20.0
  min_dB -51.0
}

 

Is there a mistake in my .asoundrc?

Tags (3)
0 Kudos
1 Solution
659 Views
MicMoba
Contributor V

It found out that is enough to call the function snd_pcm_open(). So I wrote a small program to "activate" the softvol mixer.

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

#include <alsa/asoundlib.h>

static char              *device      = "default";       /* playback device */

int main(int argc, char *argv[]) {
  snd_pcm_t            *handle;
  int err;
  printf("Enable sofvol plugin\n");

  if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
    printf("Playback open error: %d,%s\n", err,snd_strerror(err));
    exit(EXIT_FAILURE);
  }
  snd_pcm_close(handle);

  exit(EXIT_SUCCESS);
}

 

After calling you request the current volume level.

View solution in original post

0 Kudos
2 Replies
671 Views
MicMoba
Contributor V

I found the answer in another forum.

The mixer will not show up until it is used for the first time. Per alsa.opensrc.org:

Note: The new volume control won't appear immediately! Only after the first usage of the newly defined device (e.g. with the command above), should amixer controls | grep <control name> display your new control. Mixers that were already started before the first usage (like KMix) have to be restarted to adopt the changes. If you still don't see the new control, try restarting ALSA or your PC.

Since your config sets the default to the softvol device, running speaker-test or using aplay to play a .wav file should be sufficient to make the volume control appear.

 

It's a pitty because I can't get the current volume value until I run speaker-test or aplay.

0 Kudos
660 Views
MicMoba
Contributor V

It found out that is enough to call the function snd_pcm_open(). So I wrote a small program to "activate" the softvol mixer.

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

#include <alsa/asoundlib.h>

static char              *device      = "default";       /* playback device */

int main(int argc, char *argv[]) {
  snd_pcm_t            *handle;
  int err;
  printf("Enable sofvol plugin\n");

  if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
    printf("Playback open error: %d,%s\n", err,snd_strerror(err));
    exit(EXIT_FAILURE);
  }
  snd_pcm_close(handle);

  exit(EXIT_SUCCESS);
}

 

After calling you request the current volume level.

0 Kudos