|
a/upmpd/renderctl.cxx |
|
b/upmpd/renderctl.cxx |
|
... |
|
... |
42 |
|
42 |
|
43 |
static const string
|
43 |
static const string
|
44 |
sTpRender("urn:schemas-upnp-org:service:RenderingControl:1");
|
44 |
sTpRender("urn:schemas-upnp-org:service:RenderingControl:1");
|
45 |
static const string sIdRender("urn:upnp-org:serviceId:RenderingControl");
|
45 |
static const string sIdRender("urn:upnp-org:serviceId:RenderingControl");
|
46 |
|
46 |
|
|
|
47 |
static const int minVolumeDelta = 5;
|
|
|
48 |
|
47 |
UpMpdRenderCtl::UpMpdRenderCtl(UpMpd *dev)
|
49 |
UpMpdRenderCtl::UpMpdRenderCtl(UpMpd *dev)
|
48 |
: UpnpService(sTpRender, sIdRender, dev), m_dev(dev), m_desiredvolume(-1)
|
50 |
: UpnpService(sTpRender, sIdRender, dev), m_dev(dev), m_desiredvolume(-1)
|
49 |
{
|
51 |
{
|
50 |
m_dev->addActionMapping(this, "SetMute",
|
52 |
m_dev->addActionMapping(this, "SetMute",
|
51 |
bind(&UpMpdRenderCtl::setMute, this, _1, _2));
|
53 |
bind(&UpMpdRenderCtl::setMute, this, _1, _2));
|
|
... |
|
... |
184 |
int delta = previous_volume - volume;
|
186 |
int delta = previous_volume - volume;
|
185 |
if (delta < 0)
|
187 |
if (delta < 0)
|
186 |
delta = -delta;
|
188 |
delta = -delta;
|
187 |
LOGDEB("UpMpdRenderCtl::setVolume: volume " << volume << " delta " <<
|
189 |
LOGDEB("UpMpdRenderCtl::setVolume: volume " << volume << " delta " <<
|
188 |
delta << endl);
|
190 |
delta << endl);
|
189 |
if (delta >= 5) {
|
191 |
if (delta >= minVolumeDelta) {
|
190 |
m_dev->m_mpdcli->setVolume(volume);
|
192 |
m_dev->m_mpdcli->setVolume(volume);
|
191 |
m_desiredvolume = -1;
|
193 |
m_desiredvolume = -1;
|
192 |
} else {
|
194 |
} else {
|
193 |
m_desiredvolume = volume;
|
195 |
m_desiredvolume = volume;
|
194 |
}
|
196 |
}
|