Esempio n. 1
0
void eDVBVolumecontrol::volumeUnMute()
{
#ifdef HAVE_ALSA
	if (mainVolume) snd_mixer_selem_set_playback_volume_all(mainVolume, leftVol);
	muted = false;
#else
	int fd = openMixer();
#ifdef HAVE_DVB_API_VERSION
	ioctl(fd, AUDIO_SET_MUTE, false);
#endif
	closeMixer(fd);
	muted = false;

	//HACK?
	FILE *f;
	if((f = fopen("/proc/stb/audio/j1_mute", "wb")) == NULL) {
		eDebug("cannot open /proc/stb/audio/j1_mute(%m)");
		return;
	}
	
	fprintf(f, "%d", 0);

	fclose(f);
#endif
}
Esempio n. 2
0
eDVBVolumecontrol::eDVBVolumecontrol()
{
#ifdef HAVE_ALSA
	mainVolume = NULL;
	openMixer();
#endif
	volumeUnMute();
	setVolume(100, 100);
}
Esempio n. 3
0
void eDVBVolumecontrol::setVolume(int left, int right)
{
		/* left, right is 0..100 */
	leftVol = checkVolume(left);
	rightVol = checkVolume(right);

#ifdef HAVE_ALSA
	if (mainVolume) snd_mixer_selem_set_playback_volume_all(mainVolume, muted ? 0 : leftVol);
#else
		/* convert to -1dB steps */
	left = 63 - leftVol * 63 / 100;
	right = 63 - rightVol * 63 / 100;
		/* now range is 63..0, where 0 is loudest */

#if HAVE_DVB_API_VERSION < 3
	audioMixer_t mixer;
#else
	audio_mixer_t mixer;
#endif

#if HAVE_DVB_API_VERSION < 3
		/* convert to linear scale. 0 = loudest, ..63 */
	mixer.volume_left = 63.0-pow(1.068241, 63-left);
	mixer.volume_right = 63.0-pow(1.068241, 63-right);
#else
	mixer.volume_left = left;
	mixer.volume_right = right;
#endif

	eDebug("Setvolume: %d %d (raw)", leftVol, rightVol);
	eDebug("Setvolume: %d %d (-1db)", left, right);
#if HAVE_DVB_API_VERSION < 3
	eDebug("Setvolume: %d %d (lin)", mixer.volume_left, mixer.volume_right);
#endif

	int fd = openMixer();
	if (fd >= 0)
	{
#ifdef HAVE_DVB_API_VERSION
		ioctl(fd, AUDIO_SET_MIXER, &mixer);
#endif
		closeMixer(fd);
		return;
	}

	//HACK?
	FILE *f;
	if((f = fopen("/proc/stb/avs/0/volume", "wb")) == NULL) {
		eDebug("cannot open /proc/stb/avs/0/volume(%m)");
		return;
	}

	fprintf(f, "%d", left); /* in -1dB */

	fclose(f);
#endif
}
Esempio n. 4
0
/***** MIXER *****/
VolumeOSS::VolumeOSS()
{
    m_master = true;
    m_mixer_fd = -1;
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    m_mixer_device = settings.value("OSS/mixer_device","/dev/mixer").toString();
    openMixer();

}
Esempio n. 5
0
eDVBVolumecontrol::eDVBVolumecontrol()
{
#ifdef HAVE_ALSA
	mainVolume = NULL;
	openMixer();
#endif
	volumeUnMute();
#if not defined (__sh__) // dont reset volume on start
	setVolume(100, 100);
#endif
}
Esempio n. 6
0
void eDVBVolumecontrol::openMixerOnMute()
{
	int fd = openMixer();
	if (fd >= 0)
	{
#ifdef DVB_API_VERSION
		ioctl(fd, AUDIO_SET_MUTE, false);
#endif
		closeMixer(fd);
	}
	else {
		eDebug("[eDVBVolumecontrol] openMixerOnMute failed to open mixer: %m");
	}
}
Esempio n. 7
0
void eDVBVolumecontrol::setVolume(int left, int right)
{
		/* left, right is 0..100 */
	leftVol = checkVolume(left);
	rightVol = checkVolume(right);

#ifdef HAVE_ALSA
	eDebug("[eDVBVolumecontrol] Setvolume: ALSA leftVol=%d", leftVol);
	if (mainVolume)
		snd_mixer_selem_set_playback_volume_all(mainVolume, muted ? 0 : leftVol);
#else
		/* convert to -1dB steps */
	left = 63 - leftVol * 63 / 100;
	right = 63 - rightVol * 63 / 100;
		/* now range is 63..0, where 0 is loudest */

#if 0
	audio_mixer_t mixer;

	mixer.volume_left = left;
	mixer.volume_right = right;

	eDebug("[eDVBVolumecontrol] Setvolume: raw: %d %d, -1db: %d %d", leftVol, rightVol, left, right);

	int fd = openMixer();
	if (fd >= 0)
	{
#ifdef DVB_API_VERSION
		if (ioctl(fd, AUDIO_SET_MIXER, &mixer) < 0) {
			eDebug("[eDVBVolumecontrol] Setvolume failed: %m");
		}
#endif
		closeMixer(fd);
		return;
	}
	else {
		eDebug("[eDVBVolumecontrol] SetVolume failed to open mixer: %m");
	}
#endif

	//HACK?
	CFile::writeInt("/proc/stb/avs/0/volume", left); /* in -1dB */
#endif
}
Esempio n. 8
0
void eDVBVolumecontrol::volumeUnMute()
{
#ifdef HAVE_ALSA
	if (mainVolume) snd_mixer_selem_set_playback_volume_all(mainVolume, leftVol);
	muted = false;
#else
	int fd = openMixer();
	if (fd >= 0)
	{
#ifdef HAVE_DVB_API_VERSION
		ioctl(fd, AUDIO_SET_MUTE, false);
#endif
		closeMixer(fd);
	}
	muted = false;

	//HACK?
	CFile::writeInt("/proc/stb/audio/j1_mute", 0);
#endif
}
Esempio n. 9
0
void eDVBVolumecontrol::volumeMute()
{
#ifdef HAVE_ALSA
	eDebug("[eDVBVolumecontrol] Setvolume: ALSA Mute");
	if (mainVolume)
		snd_mixer_selem_set_playback_volume_all(mainVolume, 0);
	muted = true;
#else
	int fd = openMixer();
	if (fd >= 0)
	{
#ifdef DVB_API_VERSION
		ioctl(fd, AUDIO_SET_MUTE, true);
#endif
		closeMixer(fd);
	}
	muted = true;

	//HACK?
	CFile::writeInt("/proc/stb/audio/j1_mute", 1);
#endif
}
void MicMute::SetMicrophone()
{

	log.Open("micmute.txt",CFile::modeCreate | CFile::modeWrite);

	if(openMixer())
	{
		if(getMicControl())
		{
			log.WriteString("\n Got the micmute control");
			selectMic(1);
		
		}
		else
		log.WriteString("\nGet mic control failed");

		closeMixer();
	}
	else
	log.WriteString("\nOpen mixer failed");

log.Close();
}