Skip to content

Commit

Permalink
[eDVBVolumecontrol]
Browse files Browse the repository at this point in the history
* force mute on vol = 0
  • Loading branch information
jbleyel committed Sep 11, 2024
1 parent 540d7ca commit b27d125
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/dvb/volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ int eDVBVolumecontrol::setVolume(int left, int right)
{
eDebug("[eDVBVolumecontrol] Error: Set volume failed! (%m)");
}
// Force mute if vol = 0 because some boxes will not be complete silent.
if (leftVol == 0)
{
mute_zero = true;
ioctl(fd, AUDIO_SET_MUTE, true);
}
else if (mute_zero)
{
mute_zero = false;
if(!muted)
ioctl(fd, AUDIO_SET_MUTE, false);
}
#endif
closeMixer(fd);
}
Expand All @@ -180,6 +192,19 @@ int eDVBVolumecontrol::setVolume(int left, int right)
eTrace("[eDVBVolumecontrol] Error: Unable to open mixer! (%m)");
// Workaround because the mixer is opened exclusive in the driver
CFile::writeInt("/proc/stb/avs/0/volume", left); /* in -1dB */

// Force mute if vol = 0 because some boxes will not be complete silent.
if (leftVol == 0)
{
mute_zero = true;
CFile::writeInt("/proc/stb/audio/j1_mute", 1);
}
else if (mute_zero)
{
mute_zero = false;
if(!muted)
CFile::writeInt("/proc/stb/audio/j1_mute", 0);
}
}
#endif
return leftVol;
Expand Down
1 change: 1 addition & 0 deletions lib/dvb/volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class eDVBVolumecontrol
int openMixer();
void closeMixer(int fd);

bool mute_zero;
bool muted;
int leftVol, rightVol;
int m_volsteps;
Expand Down

0 comments on commit b27d125

Please sign in to comment.