Jump to content


Photo

Device Volume control by Alsa Mixer (Dreambox DM8000)


  • Please log in to reply
2 replies to this topic

#1 Dreambox_user

  • Member
  • 22 posts

0
Neutral

Posted 27 March 2012 - 13:55

I'm trying to write an application in C++ (seperate application from Enigma2) which will be able to increase/decrease the volume of the system.
I have found source in Enigma2 for this in enigma2/lib/dvb/volume.h and enigma2/lib/dvb/volume.cpp and I based my application on this code but I noticed that there is used constant ALSA_VOLUME_MIXER which has been removed from configure.ac and I don't know what mixer name I should use in my code.
I will paste the snippet of my code here:

// card = "default", mixer_name = "Master", mixer_index = 0
int AlsaAudioSink::AlsaMasterVolume(AudioVolumeAction volume_action, const char *card, const char *mixer_name, const int mixer_index, long *volume) {
  // TODO: Exception/error handling should be improved in this method
  snd_mixer_t *handle;
  snd_mixer_elem_t *elem;
  snd_mixer_selem_id_t *sid;
 
  int ret;
 
  snd_mixer_selem_id_alloca(&sid);
 
  //sets simple-mixer index and name
  snd_mixer_selem_id_set_index(sid, mixer_index);
  snd_mixer_selem_id_set_name(sid, mixer_name);
 
  if ((snd_mixer_open(&handle, 0)) < 0) {
	return -1;
  }
 
  if ((snd_mixer_attach(handle, card)) < 0) {
	snd_mixer_close(handle);
	return -2;
  }
 
  if ((snd_mixer_selem_register(handle, NULL, NULL)) < 0) {
	snd_mixer_close(handle);
	return -3;
  }
 
  ret = snd_mixer_load(handle);
  if (ret < 0) {
	snd_mixer_close(handle);
	return -4;
  }
 
  elem = snd_mixer_find_selem(handle, sid); // THIS FAILS
  if (!elem) {
	snd_mixer_close(handle);
	return -5;
  }
  
  // ...
}

Currently, I receive the error on "snd_mixer_find_selem" instruction: "This sound device does not have any controls.".

My another question is: is it possible from Enigma2 to increase/decrease the volume of only Enigma2 (not the system)?

I would appreciate any help on this.

Best regards,

Dreambox_user

Re: Device Volume control by Alsa Mixer (Dreambox DM8000) #2 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 27 March 2012 - 18:14

I believe only the et has alsa mixer controls to control the volume. Looking at your nick, you have a dreambox?

Perhaps you could try to write to /proc/stb/audio/* ?

Re: Device Volume control by Alsa Mixer (Dreambox DM8000) #3 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 27 March 2012 - 18:31

houpe you will find a way how extend volume contoll amplitude
DMM can't:
http://www.dream-mul...81153#post81153


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users