mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
move external volume control to internal volume/mute handler
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <system/debug.h>
|
||||
/* compat header from zapit/include */
|
||||
#include <audio.h>
|
||||
#include <video.h>
|
||||
#include <system/settings.h>
|
||||
#include <system/helpers.h>
|
||||
#include <daemonc/remotecontrol.h>
|
||||
@@ -113,6 +114,10 @@ void CVolume::setVolume(const neutrino_msg_t key)
|
||||
|
||||
neutrino_msg_data_t data = 0;
|
||||
uint64_t timeoutEnd = 0;
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
g_settings.current_volume = hdmi_cec::getInstance()->GetVolume();
|
||||
#endif
|
||||
int vol = g_settings.current_volume;
|
||||
|
||||
do {
|
||||
@@ -132,6 +137,15 @@ void CVolume::setVolume(const neutrino_msg_t key)
|
||||
g_RCInput->getMsg(&tmp, &data, 0);
|
||||
if (tmp != CRCInput::RC_timeout)
|
||||
g_RCInput->postMsg(tmp, data);
|
||||
#if HAVE_ARM_HARDWARE
|
||||
}
|
||||
else if (g_settings.hdmi_cec_volume)
|
||||
{
|
||||
(dir > 0) ? hdmi_cec::getInstance()->vol_up() : hdmi_cec::getInstance()->vol_down();
|
||||
do_vol = false;
|
||||
g_settings.current_volume = hdmi_cec::getInstance()->GetVolume();
|
||||
printf("Volume: %d\n", g_settings.current_volume);
|
||||
#endif
|
||||
} else
|
||||
do_vol = true;
|
||||
if (CNeutrinoApp::getInstance()->isMuted() && (dir > 0 || g_settings.current_volume > 0)) {
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#endif
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <video.h>
|
||||
#include <driver/display.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/volumebar.h>
|
||||
@@ -37,6 +38,8 @@
|
||||
|
||||
#include <driver/display.h>
|
||||
|
||||
#include <system/helpers.h>
|
||||
|
||||
CAudioMute::CAudioMute():CComponentsPicture(0, 0, NEUTRINO_ICON_MUTED)
|
||||
{
|
||||
y_old = -1;
|
||||
@@ -61,6 +64,11 @@ void CAudioMute::AudioMute(int newValue, bool isEvent)
|
||||
|
||||
CVFD::getInstance()->setMuted(newValue);
|
||||
neutrino->setCurrentMuted(newValue);
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
hdmi_cec::getInstance()->toggle_mute();
|
||||
else
|
||||
#endif
|
||||
g_Zapit->muteAudio(newValue);
|
||||
|
||||
if( isEvent && ( neutrino->getMode() != NeutrinoModes::mode_scart ) && ( neutrino->getMode() != NeutrinoModes::mode_pic))
|
||||
|
@@ -1219,6 +1219,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
|
||||
configfile.setInt32( "hdmi_cec_standby", g_settings.hdmi_cec_standby );
|
||||
configfile.setInt32( "hdmi_cec_volume", g_settings.hdmi_cec_volume );
|
||||
|
||||
if (!g_settings.hdmi_cec_volume)
|
||||
configfile.setInt32( "current_volume", g_settings.current_volume );
|
||||
configfile.setInt32( "current_volume_step", g_settings.current_volume_step );
|
||||
configfile.setInt32( "start_volume", g_settings.start_volume );
|
||||
@@ -2845,13 +2846,6 @@ void CNeutrinoApp::RealRun()
|
||||
showInfo();
|
||||
break;
|
||||
case SNeutrinoSettings::VOLUME:
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
{
|
||||
(msg == (neutrino_msg_t) g_settings.key_volumeup || msg == CRCInput::RC_right) ? hdmi_cec::getInstance()->vol_up() : hdmi_cec::getInstance()->vol_down();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
g_volume->setVolume(msg);
|
||||
break;
|
||||
default: /* SNeutrinoSettings::ZAP */
|
||||
@@ -2959,13 +2953,6 @@ void CNeutrinoApp::RealRun()
|
||||
showInfo();
|
||||
break;
|
||||
case SNeutrinoSettings::VOLUME:
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
{
|
||||
(msg == (neutrino_msg_t) g_settings.key_volumeup || msg == CRCInput::RC_right) ? hdmi_cec::getInstance()->vol_up() : hdmi_cec::getInstance()->vol_down();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
g_volume->setVolume(msg);
|
||||
break;
|
||||
default: /* SNeutrinoSettings::ZAP */
|
||||
@@ -3466,13 +3453,6 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
|
||||
}
|
||||
else if ((msg == CRCInput::RC_plus) || (msg == CRCInput::RC_minus))
|
||||
{
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
{
|
||||
(msg == (neutrino_msg_t) g_settings.key_volumeup || msg == CRCInput::RC_right) ? hdmi_cec::getInstance()->vol_up() : hdmi_cec::getInstance()->vol_down();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
g_volume->setVolume(msg);
|
||||
|
||||
return messages_return::handled;
|
||||
@@ -3484,37 +3464,16 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
|
||||
}
|
||||
else {
|
||||
//mute
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
{
|
||||
hdmi_cec::getInstance()->toggle_mute();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
g_audioMute->AudioMute(!current_muted, true);
|
||||
}
|
||||
return messages_return::handled;
|
||||
}
|
||||
else if( msg == CRCInput::RC_mute_on ) {
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
{
|
||||
hdmi_cec::getInstance()->toggle_mute();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
g_audioMute->AudioMute(true, true);
|
||||
|
||||
return messages_return::handled;
|
||||
}
|
||||
else if( msg == CRCInput::RC_mute_off ) {
|
||||
#if HAVE_ARM_HARDWARE
|
||||
if (g_settings.hdmi_cec_volume)
|
||||
{
|
||||
hdmi_cec::getInstance()->toggle_mute();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
g_audioMute->AudioMute(false, true);
|
||||
|
||||
return messages_return::handled;
|
||||
|
Reference in New Issue
Block a user