do not fetch status after succesful setvol command, set it locally

This commit is contained in:
Andrzej Rybczak
2009-03-23 16:30:12 +01:00
parent 8e350292ad
commit f78e88e6aa
3 changed files with 10 additions and 10 deletions

View File

@@ -482,13 +482,19 @@ void Connection::SetRandom(bool mode) const
} }
} }
void Connection::SetVolume(int vol) const void Connection::SetVolume(int vol)
{ {
if (isConnected) if (isConnected)
{ {
mpd_sendSetvolCommand(itsConnection, vol); mpd_sendSetvolCommand(itsConnection, vol);
if (!isCommandsListEnabled) mpd_finishCommand(itsConnection);
mpd_finishCommand(itsConnection); if (!itsConnection->error && itsUpdater)
{
itsCurrentStatus->volume = vol;
StatusChanges ch;
ch.Volume = 1;
itsUpdater(this, ch, itsStatusUpdaterUserdata);
}
} }
} }

View File

@@ -137,8 +137,8 @@ namespace MPD
void SetRepeat(bool) const; void SetRepeat(bool) const;
void SetRandom(bool) const; void SetRandom(bool) const;
void SetVolume(int) const;
void SetCrossfade(int) const; void SetCrossfade(int) const;
void SetVolume(int);
int AddSong(const std::string &); // returns id of added song int AddSong(const std::string &); // returns id of added song
int AddSong(const Song &); // returns id of added song int AddSong(const Song &); // returns id of added song

View File

@@ -414,10 +414,7 @@ int main(int argc, char *argv[])
} }
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
else else
{
Mpd->SetVolume(Mpd->GetVolume()+1); Mpd->SetVolume(Mpd->GetVolume()+1);
Mpd->UpdateStatus();
}
} }
else if (Keypressed(input, Key.VolumeDown)) else if (Keypressed(input, Key.VolumeDown))
{ {
@@ -436,10 +433,7 @@ int main(int argc, char *argv[])
} }
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
else else
{
Mpd->SetVolume(Mpd->GetVolume()-1); Mpd->SetVolume(Mpd->GetVolume()-1);
Mpd->UpdateStatus();
}
} }
else if (Keypressed(input, Key.Delete)) else if (Keypressed(input, Key.Delete))
{ {