Class: Moc::Controller::Player
- Inherits:
-
Object
- Object
- Moc::Controller::Player
- Defined in:
- lib/moc/controller/player.rb
Defined Under Namespace
Classes: Queue
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
-
#initialize(controller) ⇒ Player
constructor
A new instance of Player.
-
#jump_to(second) ⇒ Object
jump to the passed seconds.
-
#next ⇒ Object
go to the next song in the playlist.
-
#pause ⇒ Object
pause the current song.
- #play ⇒ Object
-
#prev ⇒ Object
go to the previous song in the playlist.
-
#queue ⇒ Object
return the queue.
-
#seek(second) ⇒ Object
seek of the passed seconds.
-
#stop ⇒ Object
stop the current song.
-
#unpause ⇒ Object
unpause the current song.
-
#volume(volume) ⇒ Object
change the volume.
Constructor Details
#initialize(controller) ⇒ Player
Returns a new instance of Player.
66 67 68 |
# File 'lib/moc/controller/player.rb', line 66 def initialize (controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
64 65 66 |
# File 'lib/moc/controller/player.rb', line 64 def controller @controller end |
Instance Method Details
#jump_to(second) ⇒ Object
jump to the passed seconds
128 129 130 131 132 133 |
# File 'lib/moc/controller/player.rb', line 128 def jump_to (second) controller.send_command :jump_to controller.send_integer second self end |
#next ⇒ Object
go to the next song in the playlist
98 99 100 101 102 |
# File 'lib/moc/controller/player.rb', line 98 def next controller.send_command :next self end |
#pause ⇒ Object
pause the current song
77 78 79 80 81 |
# File 'lib/moc/controller/player.rb', line 77 def pause controller.send_command :pause self end |
#play ⇒ Object
70 71 72 73 74 |
# File 'lib/moc/controller/player.rb', line 70 def play controller.send_command :unpause self end |
#prev ⇒ Object
go to the previous song in the playlist
105 106 107 108 109 |
# File 'lib/moc/controller/player.rb', line 105 def prev controller.send_command :prev self end |
#queue ⇒ Object
return the queue
136 137 138 |
# File 'lib/moc/controller/player.rb', line 136 def queue @queue ||= Queue.new(controller) end |
#seek(second) ⇒ Object
seek of the passed seconds
120 121 122 123 124 125 |
# File 'lib/moc/controller/player.rb', line 120 def seek (second) controller.send_command :seek controller.send_integer second self end |
#stop ⇒ Object
stop the current song
91 92 93 94 95 |
# File 'lib/moc/controller/player.rb', line 91 def stop controller.send_command :stop self end |
#unpause ⇒ Object
unpause the current song
84 85 86 87 88 |
# File 'lib/moc/controller/player.rb', line 84 def unpause controller.send_command :unpause self end |
#volume(volume) ⇒ Object
change the volume
112 113 114 115 116 117 |
# File 'lib/moc/controller/player.rb', line 112 def volume (volume) controller.send_command :set_mixer controller.send_integer volume self end |