Class: Rockbox::Api::Sound
- Inherits:
-
Object
- Object
- Rockbox::Api::Sound
- Defined in:
- lib/rockbox/api/sound.rb
Instance Method Summary collapse
-
#adjust(steps) ⇒ Integer
Adjust volume by N steps (positive = louder, negative = quieter).
- #down ⇒ Object
-
#initialize(http) ⇒ Sound
constructor
A new instance of Sound.
- #up ⇒ Object
- #volume ⇒ Rockbox::VolumeInfo
Constructor Details
#initialize(http) ⇒ Sound
Returns a new instance of Sound.
8 9 10 |
# File 'lib/rockbox/api/sound.rb', line 8 def initialize(http) @http = http end |
Instance Method Details
#adjust(steps) ⇒ Integer
Adjust volume by N steps (positive = louder, negative = quieter).
20 21 22 23 24 25 |
# File 'lib/rockbox/api/sound.rb', line 20 def adjust(steps) @http.execute( "mutation AdjustVolume($steps: Int!) { adjustVolume(steps: $steps) }", { steps: steps } )[:adjust_volume] end |
#down ⇒ Object
28 |
# File 'lib/rockbox/api/sound.rb', line 28 def down; adjust(-1); end |
#up ⇒ Object
27 |
# File 'lib/rockbox/api/sound.rb', line 27 def up; adjust(1); end |
#volume ⇒ Rockbox::VolumeInfo
13 14 15 16 |
# File 'lib/rockbox/api/sound.rb', line 13 def volume data = @http.execute("query Volume { volume { volume min max } }") VolumeInfo.from_hash(data[:volume]) end |