Class: Moc::Controller::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/moc/controller/player.rb

Defined Under Namespace

Classes: Queue

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#controllerObject (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

#nextObject

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

#pauseObject

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

#playObject



70
71
72
73
74
# File 'lib/moc/controller/player.rb', line 70

def play
	controller.send_command :unpause

	self
end

#prevObject

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

#queueObject

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

#stopObject

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

#unpauseObject

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