Class: MPD::Controller::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#controllerObject (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 (options)
	if options[:decibels]
		controller.do_and_raise_if_needed :mixrampdb, options[:decibels]
	end

	if options[:delay]
		controller.do_and_raise_if_needed :mixrampdelay, options[:delay]
	end

	self
end

#nextObject



50
51
52
53
54
# File 'lib/mpd/controller/player.rb', line 50

def next
	controller.do_and_raise_if_needed :next

	self
end

#pauseObject



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

#prevObject



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

#stopObject



44
45
46
47
48
# File 'lib/mpd/controller/player.rb', line 44

def stop
	controller.do_and_raise_if_needed :stop

	self
end

#unpauseObject



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