Class: MPD::Controller::Player
- Inherits:
-
Object
- Object
- MPD::Controller::Player
- Defined in:
- lib/mpd/controller/player.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #crossfade(seconds) ⇒ Object
-
#initialize(controller) ⇒ Player
constructor
A new instance of Player.
- #mixer(options) ⇒ Object
- #next ⇒ Object
- #pause ⇒ Object
- #play(what = {}) ⇒ Object
- #prev ⇒ Object
- #replay_gain(mode = nil) ⇒ Object
- #seek(second, optional = {}) ⇒ Object
- #stop ⇒ Object
- #unpause ⇒ Object
- #volume(volume) ⇒ Object
Constructor Details
#initialize(controller) ⇒ Player
Returns a new instance of Player.
16 17 18 |
# File 'lib/mpd/controller/player.rb', line 16 def initialize (controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
14 15 16 |
# File 'lib/mpd/controller/player.rb', line 14 def controller @controller end |
Instance Method Details
#crossfade(seconds) ⇒ Object
68 69 70 71 72 |
# File 'lib/mpd/controller/player.rb', line 68 def crossfade (seconds) controller.do_and_raise_if_needed :crossfade, seconds self end |
#mixer(options) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/mpd/controller/player.rb', line 74 def mixer () if [:decibels] controller.do_and_raise_if_needed :mixrampdb, [:decibels] end if [:delay] controller.do_and_raise_if_needed :mixrampdelay, [:delay] end self end |
#next ⇒ Object
50 51 52 53 54 |
# File 'lib/mpd/controller/player.rb', line 50 def next controller.do_and_raise_if_needed :next self end |
#pause ⇒ Object
32 33 34 35 36 |
# File 'lib/mpd/controller/player.rb', line 32 def pause controller.do_and_raise_if_needed :pause, true self end |
#play(what = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mpd/controller/player.rb', line 20 def play (what = {}) if what[:position] controller.do_and_raise_if_needed :play, what[:position] elsif what[:id] controller.do_and_raise_if_needed :playid, what[:id] else controller.do_and_raise_if_needed :play, what.to_sym end self end |
#prev ⇒ Object
56 57 58 59 60 |
# File 'lib/mpd/controller/player.rb', line 56 def prev controller.do_and_raise_if_needed :previous self end |
#replay_gain(mode = nil) ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/mpd/controller/player.rb', line 86 def replay_gain (mode = nil) if mode controller.do_and_raise_if_needed :replay_gain_mode, mode self else controller.do_and_raise_if_needed(:replay_gain_status).first.last end end |
#seek(second, optional = {}) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/mpd/controller/player.rb', line 96 def seek (second, optional = {}) if optional[:position] controller.do_and_raise_if_needed :seek, optional[:position], second elsif optional[:id] controller.do_and_raise_if_needed :seekid, optional[:id], second else controller.do_and_raise_if_needed :seekcur, second end self end |
#stop ⇒ Object
44 45 46 47 48 |
# File 'lib/mpd/controller/player.rb', line 44 def stop controller.do_and_raise_if_needed :stop self end |
#unpause ⇒ Object
38 39 40 41 42 |
# File 'lib/mpd/controller/player.rb', line 38 def unpause controller.do_and_raise_if_needed :pause, false self end |
#volume(volume) ⇒ Object
62 63 64 65 66 |
# File 'lib/mpd/controller/player.rb', line 62 def volume (volume) controller.do_and_raise_if_needed :setvol, volume self end |