Ejemplo n.º 1
0
void Core::updateControls(int cardId)
{
	settingsStr_->clear(MIXERS);
	settingsStr_->clearSwitches();
	const int soundCardId = (alsaWork_->cardExists(cardId)) ? cardId : alsaWork_->getFirstCardWithMixers();
	alsaWork_->setCurrentCard(soundCardId);
	settingsStr_->setCardId(soundCardId);
	settingsStr_->setList(MIXERS, alsaWork_->getVolumeMixers());
	settingsStr_->addMixerSwitch(alsaWork_->getSwitchList());
	const std::string newName = alsaWork_->getMixerName(settingsStr_->mixerId());
	if (mixerName_ != newName) {
		mixerName_ = newName;
		alsaWork_->setCurrentMixer(mixerName_);
	}
	if (!isPulse_) {
		volumeValue_ = alsaWork_->getAlsaVolume();
	}
#ifdef HAVE_PULSE
	else if (pulse_) {
		volumeValue_ = pulse_->getVolume();
	}
#endif
	m_signal_volume_changed(volumeValue_);
	updateTrayIcon(volumeValue_);
	m_signal_mixer_muted(getMuted());
	if(settingsDialog_) {
		blockAllSignals(true);
		settingsDialog_->updateMixers(settingsStr_->mixerList());
		settingsDialog_->updateSwitches(settingsStr_->switchList());
		blockAllSignals(false);
	}
}
Ejemplo n.º 2
0
bool Core::onTimeout()
{
	if (settingsStr_->usePolling()) {
		if (!isPulse_) {
#ifdef IS_DEBUG
			std::cout << "mixerName= " << mixerName_ << std::endl;
			std::cout << "CurrentMixerName= " << alsaWork_->getCurrentMixerName() << std::endl;
#endif
			if (mixerName_ != alsaWork_->getCurrentMixerName()) {
				return true;
			}
			const double volume = alsaWork_->getAlsaVolume();
			bool ismute = !alsaWork_->getMute();
			if (pollVolume_ != volume) {
				pollVolume_ = volume;
				m_signal_volume_changed(pollVolume_);
			}
			if (ismute != isMuted_) {
				isMuted_ = ismute;
				m_signal_mixer_muted(isMuted_);
			}
		}
#ifdef HAVE_PULSE
		if (isPulse_ && pulse_) {
			const int index = pulse_->getCurrentDeviceIndex();
			if (pulseDevice_ != pulse_->getDeviceNameByIndex(index)) {
				return true;
			}
			const int volume = pulse_->getVolume();
			bool ismute = pulse_->getMute();
			if (pollVolume_ != volume) {
				pollVolume_ = volume;
				m_signal_volume_changed(pollVolume_);
			}
			if (ismute != isMuted_) {
				isMuted_ = ismute;
				m_signal_mixer_muted(isMuted_);
			}
		}

#endif
	}
	return true;
}
Ejemplo n.º 3
0
void Core::onTrayIconScroll(double value)
{
	volumeValue_ += value;
	if (volumeValue_ >= 100) {
		volumeValue_ = 100;
	}
	else if (volumeValue_ <= 0){
		volumeValue_ = 0;
	}
	m_signal_volume_changed(volumeValue_); //send signal to sliderwindow
}
Ejemplo n.º 4
0
void SliderWindow::on_volume_slider()
{
	volumeValue_ = volumeSlider_->get_value();
	m_signal_volume_changed(volumeValue_);
}