Module: Sonos::Endpoint::Rendering
- Included in:
- Device::Speaker
- Defined in:
- lib/sonos/endpoint/rendering.rb
Constant Summary collapse
- RENDERING_ENDPOINT =
'/MediaRenderer/RenderingControl/Control'
- RENDERING_XMLNS =
'urn:schemas-upnp-org:service:RenderingControl:1'
Instance Method Summary collapse
-
#bass ⇒ Fixnum
Get the current bass EQ.
-
#bass=(value) ⇒ Object
Set the bass EQ from -10 to 10.
-
#loudness ⇒ Boolean
Get the loudness compenstation setting.
-
#loudness=(value) ⇒ Object
Set the loudness compenstation setting.
-
#mute ⇒ Object
Mute the speaker.
-
#muted? ⇒ Boolean
Is the speaker muted?.
-
#treble ⇒ Fixnum
Get the current treble EQ.
-
#treble=(value) ⇒ Object
Set the treble EQ from -10 to 10.
-
#unmute ⇒ Object
Unmute the speaker.
-
#volume ⇒ Fixnum
Get the current volume.
-
#volume=(value) ⇒ Object
Set the volume from 0 to 100.
Instance Method Details
#bass ⇒ Fixnum
Get the current bass EQ.
22 23 24 25 |
# File 'lib/sonos/endpoint/rendering.rb', line 22 def bass response = ('GetBass') response.body[:get_bass_response][:current_bass].to_i end |
#bass=(value) ⇒ Object
Set the bass EQ from -10 to 10.
29 30 31 |
# File 'lib/sonos/endpoint/rendering.rb', line 29 def bass=(value) parse_response ('SetBass', value) end |
#loudness ⇒ Boolean
Get the loudness compenstation setting
65 66 67 68 |
# File 'lib/sonos/endpoint/rendering.rb', line 65 def loudness response = ('GetLoudness') response.body[:get_loudness_response][:current_loudness] == '1' end |
#loudness=(value) ⇒ Object
Set the loudness compenstation setting
72 73 74 |
# File 'lib/sonos/endpoint/rendering.rb', line 72 def loudness=(value) parse_response ('SetLoudness', value ? 1 : 0) end |
#mute ⇒ Object
Mute the speaker
47 48 49 |
# File 'lib/sonos/endpoint/rendering.rb', line 47 def mute parse_response set_mute(true) end |
#muted? ⇒ Boolean
Is the speaker muted?
58 59 60 61 |
# File 'lib/sonos/endpoint/rendering.rb', line 58 def muted? response = ('GetMute') response.body[:get_mute_response][:current_mute] == '1' end |
#treble ⇒ Fixnum
Get the current treble EQ.
35 36 37 38 |
# File 'lib/sonos/endpoint/rendering.rb', line 35 def treble response = ('GetTreble') response.body[:get_treble_response][:current_treble].to_i end |
#treble=(value) ⇒ Object
Set the treble EQ from -10 to 10.
42 43 44 |
# File 'lib/sonos/endpoint/rendering.rb', line 42 def treble=(value) parse_response ('SetTreble', value) end |
#unmute ⇒ Object
Unmute the speaker
52 53 54 |
# File 'lib/sonos/endpoint/rendering.rb', line 52 def unmute parse_response set_mute(false) end |
#volume ⇒ Fixnum
Get the current volume. Fixed volume speakers will always return 100.
8 9 10 11 |
# File 'lib/sonos/endpoint/rendering.rb', line 8 def volume response = ('GetVolume') response.body[:get_volume_response][:current_volume].to_i end |
#volume=(value) ⇒ Object
Set the volume from 0 to 100. Trying to set the volume of a fixed volume speaker will fail.
16 17 18 |
# File 'lib/sonos/endpoint/rendering.rb', line 16 def volume=(value) parse_response ('SetVolume', value) end |