Module: MPD::Plugins::PlaybackOptions

Included in:
MPD
Defined in:
lib/ruby-mpd/plugins/playback_options.rb

Overview

Commands related to setting various aspects and modes of playback.

Changes: setvol -> volume.

Instance Method Summary collapse

Instance Method Details

#consume=(toggle) ⇒ Boolean

Enable/disable consume mode. When consume is activated, each song played is removed from playlist after playing.

Returns:

  • (Boolean)

    returns true if successful.

Since:

  • MPD 0.16



13
14
15
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 13

def consume=(toggle)
  send_command :consume, toggle
end

#crossfade=(seconds) ⇒ Boolean

Set the crossfade between songs in seconds.

Returns:

  • (Boolean)

    returns true if successful.



19
20
21
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 19

def crossfade=(seconds)
  send_command :crossfade, seconds
end

#mixrampdb=(decibels) ⇒ Object

Sets the threshold at which songs will be overlapped. Like crossfading but doesn’t fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See sourceforge.net/projects/mixramp

Parameters:

  • decibels (Float)

    Maximum volume level in decibels.



29
30
31
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 29

def mixrampdb=(decibels)
  send_command :mixrampdb, decibels
end

#mixrampdelay=(seconds) ⇒ Object

Additional time subtracted from the overlap calculated by mixrampdb. A value of “nan” or Float::NAN disables MixRamp overlapping and falls back to crossfading.



36
37
38
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 36

def mixrampdelay=(seconds)
  send_command :mixrampdelay, seconds
end

#random=(toggle) ⇒ Boolean

Enable/disable random playback.

Returns:

  • (Boolean)

    returns true if successful.



42
43
44
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 42

def random=(toggle)
  send_command :random, toggle
end

#repeat=(toggle) ⇒ Boolean

Enable/disable repeat mode.

Returns:

  • (Boolean)

    returns true if successful.



48
49
50
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 48

def repeat=(toggle)
  send_command :repeat, toggle
end

#replay_gain_mode=(mode) ⇒ Boolean

Sets the replay gain mode. One of :off, :track, :album, :auto. Changing the mode during playback may take several seconds, because the new settings does not affect the buffered data.

This command triggers the options idle event.

Returns:

  • (Boolean)

    returns true if successful.

Since:

  • MPD 0.16



75
76
77
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 75

def replay_gain_mode=(mode)
  send_command :replay_gain_mode, mode
end

#replay_gain_statusObject

Prints replay gain options. Currently, only the variable :replay_gain_mode is returned.

Since:

  • MPD 0.16



82
83
84
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 82

def replay_gain_status
  send_command :replay_gain_status
end

#single=(toggle) ⇒ Boolean

Enable/disable single mode. When single is activated, playback is stopped after current song, or song is repeated if the ‘repeat’ mode is enabled.

Returns:

  • (Boolean)

    returns true if successful.

Since:

  • MPD 0.15



64
65
66
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 64

def single=(toggle)
  send_command :single, toggle
end

#volume=(vol) ⇒ Boolean

Sets the volume level. (Maps to MPD’s setvol)

Parameters:

  • vol (Integer)

    Volume level between 0 and 100.

Returns:

  • (Boolean)

    returns true if successful.



55
56
57
# File 'lib/ruby-mpd/plugins/playback_options.rb', line 55

def volume=(vol)
  send_command :setvol, vol
end