Module: Volumerb::LinuxVolume
- Defined in:
- lib/volumerb/linux_volume.rb
Class Method Summary collapse
- .down(value = 3) ⇒ Object
- .mute ⇒ Object
- .up(value = 3) ⇒ Object
- .value=(value) ⇒ Object
- .vol ⇒ Object
Class Method Details
.down(value = 3) ⇒ Object
9 10 11 12 |
# File 'lib/volumerb/linux_volume.rb', line 9 def self.down(value = 3) `amixer -q sset Master #{value}%-` vol end |
.mute ⇒ Object
14 15 16 17 |
# File 'lib/volumerb/linux_volume.rb', line 14 def self.mute `amixer sset Master toggle` vol end |
.up(value = 3) ⇒ Object
4 5 6 7 |
# File 'lib/volumerb/linux_volume.rb', line 4 def self.up(value = 3) `amixer -q sset Master #{value}%+` vol end |
.value=(value) ⇒ Object
19 20 21 22 |
# File 'lib/volumerb/linux_volume.rb', line 19 def self.value=(value) `amixer set Master #{value}%` vol end |
.vol ⇒ Object
24 25 26 27 28 29 |
# File 'lib/volumerb/linux_volume.rb', line 24 def self.vol vol = `amixer get Master | grep "\[[0-9]*%\]\ \[o[n|f]"` number = vol.match(/([0-9]+)%/)[1] state = vol.match(/\[([a-z]+)\]/)[1] { value: number.to_i, state: state.to_s } end |