hunk ./Network/MPD/Commands.hs 33 - seek, setVolume, volume, stop, + seek, setVolume, stop, hunk ./Network/MPD/Commands.hs 41 - listArtists, listAlbums, listAlbum, getPlaylist, toggle, updateId + listArtists, listAlbums, listAlbum, getPlaylist, toggle, updateId, volume hunk ./Network/MPD/Commands.hs 325 --- | Increase or decrease volume by a given percent, e.g. --- 'volume 10' will increase the volume by 10 percent, while --- 'volume (-10)' will decrease it by the same amount. --- Note that this command is only included for completeness sake ; it's --- deprecated and may disappear at any time, please use 'setVolume' instead. -volume :: MonadMPD m => Int -> m () -volume = getResponse_ . ("volume" <$>) -{-# DEPRECATED volume "This command is deprecated, please use setVolume instead." #-} - hunk ./Network/MPD/Commands.hs 489 +-- | Increase or decrease volume by a given percent, e.g. +-- 'volume 10' will increase the volume by 10 percent, while +-- 'volume (-10)' will decrease it by the same amount. +volume :: MonadMPD m => Int -> m () +volume n = do + current <- (fromIntegral . stVolume) `liftM` status + setVolume . round $ (fromIntegral n / 100) * current + current + hunk ./tests/Commands.hs 433 -testVolume = test_ [("volume 10", Right "OK")] (volume 10) - hunk ./tests/Commands.hs 528 + +testVolume = test_ [("status", Right st), ("setvol 90", Right "OK")] (volume (-10)) + where st = display empty { stVolume = 100 }