12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- --[[
-
- Version 1.3
-
- Cycle audio equalizer presets.
-
- Hotkeys: alt+e (cycle forwards), alt+shift+e (cycle backwards)
-
- Equalizer presets found here:
- <http://advantage-bash.blogspot.in/2013/05/mplayer-presets.html>
-
- Modified 08/06/2015: v1.1 by Anonymous
- - added option to cycle backwards
- Modified 08/08/2015: v1.2 by Anonymous
- - code formatting, added EQPs "Boost" and "Double Boost"
- Modified 08/10/2015: v1.3 by Anonymous
- - changed binds to alt+e/alt+shift+e to avoid conflicts with
- shell key combinations in audio only mode
-
- Copyright (C) 2015 Anonymous
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- --]]
- local eq_values = {
- "af set equalizer=6:4:2:1:0:0:0:1:3:7 ; show_text \"Equalizer: Pekman\"",
- "af set equalizer=0.0:0.0:0.0:0.0:0.0:0.0:0.0:0.0:0.0:0.0 ; show_text \"Equalizer: Flat (Default)\"",
- "af set equalizer=4.8:5.7:5.7:3.3:1.0:-2.4:-4.8:-6.3:-6.7:-6.7 ; show_text \"Equalizer: Full Bass\"",
- "af set equalizer=5.8:-5.8:-5.8:-2.4:1.4:6.7:9.6:9.6:9.6:10.1 ; show_text \"Equalizer: Full Treble\"",
- "af set equalizer=4.3:3.3:0.0:-4.4:-2.9:1.0:4.8:6.7:7.2:7.2 ; show_text \"Equalizer: Full Bass & Treble\"",
- "af set equalizer=2.8:6.7:3.3:-2.0:-1.4:1.0:2.8:5.7:7.7:8.6 ; show_text \"Equalizer: Headphones\"",
- "af set equalizer=6.2:6.2:3.3:3.3:0.0:-2.9:-2.9:-2.9:0.0:0.0 ; show_text \"Equalizer: Large Hall\"",
- "af set equalizer=2.9:0.0:2.4:3.3:3.3:3.3:2.4:1.4:1.4:1.4 ; show_text \"Equalizer: Live\"",
- "af set equalizer=4.3:4.3:0.0:0.0:0.0:0.0:0.0:0.0:4.3:4.3 ; show_text \"Equalizer: Party\"",
- "af set equalizer=2.8:1.0:0.0:-1.4:0.0:2.4:4.8:5.7:6.7:7.2 ; show_text \"Equalizer: Soft\"",
- "af set equalizer=0.0:0.0:0.0:0.0:0.0:-4.4:-4.4:-4.4:-5.8 ; show_text \"Equalizer: Classical\"",
- "af set equalizer=0.0:0.0:4.8:3.3:3.3:3.3:1.9:0.0:0.0 ; show_text \"Equalizer: Club\"",
- "af set equalizer=5.7:4.3:1.4:0.0:0.0:-3.4:-4.4:-4.3:0.0:0.0 ; show_text \"Equalizer: Dance\"",
- "af set equalizer=1.0:2.8:4.3:4.8:3.3:0.0:-1.4:-1.4:-1.0:-1.0 ; show_text \"Equalizer: Pop\"",
- "af set equalizer=0.0:0.0:0.0:-3.4:0.0:3.8:3.8:0.0:0.0:0.0 ; show_text \"Equalizer: Reggae\"",
- "af set equalizer=1.4:-2.9:-2.4:0.0:2.4:3.3:5.3:5.7:6.7:5.8 ; show_text \"Equalizer: Ska\"",
- "af set equalizer=2.4:2.4:1.4:0.0:-2.4:-3.4:-2.0:0.0:1.4:5.3 ; show_text \"Equalizer: Soft Rock\"",
- "af set equalizer=4.8:2.8:-3.4:-4.8:-2.0:2.4:5.3:6.7:6.7:6.7 ; show_text \"Equalizer: Rock\"",
- "af set equalizer=4.8:3.3:0.0:-3.4:-2.9:0.0:4.8:5.7:5.8:5.3 ; show_text \"Equalizer: Techno\"",
- "af set equalizer=2.5:2.5:0.0:0.0:0.0:0.0:0.0:0.0:2.5:2.5 ; show_text \"Equalizer: Boost (Anonymous)\"",
- "af set equalizer=5.0:5.0:0.0:0.0:0.0:0.0:0.0:0.0:5.0:5.0 ; show_text \"Equalizer: Double Boost (Anonymous)\""
- }
-
- local current_index = 1
-
- local function cycle_eq()
- local last_index = #eq_values
- if current_index == last_index then
- current_index = 1
- else
- current_index = current_index + 1
- end
- mp.command(eq_values[current_index])
- end
-
- local function cycle_eq_back()
- local last_index = #eq_values
- if current_index == 1 then
- current_index = last_index
- else
- current_index = current_index - 1
- end
- mp.command(eq_values[current_index])
- end
-
- mp.add_key_binding("alt+e", "cycle_eq_lua", cycle_eq)
- mp.add_key_binding("alt+E", "cycle_eq_back_lua", cycle_eq_back)
|