-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptions.lua
More file actions
210 lines (202 loc) · 8.13 KB
/
Copy pathOptions.lua
File metadata and controls
210 lines (202 loc) · 8.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
-- Bears Audio Switcher - Database
-- Created by N6REJ character is Bearesquishy - dalaran please credit whenever.
-- Source on GitHub: https://n6rej.github.io
---@type
---
-- Get listing of audio devices available and populate the "Devices" variable with those values so they can be selected.
function BearsSwitcher:GetDevices()
-- query audio devices and populate array.
local Devices = {}
for index = 0, Sound_GameSystem_GetNumOutputDrivers() - 1, 1 do
table.insert(Devices, Sound_GameSystem_GetOutputDriverNameByIndex(index))
--print(index, Devices[#Devices])
end
return Devices
end
-- Set our options used in interface here
BearsSwitcher.defaults = {
profile = {
spkr1 = {}, -- default
spkr2 = {}, -- normally headset
toggle = GetBindingText("NUMPADMULTIPLY"), -- default keypress
music_toggle = GetBindingText("NUMPADDIVIDE"), -- default music keypress
Devices = {},
volumeUp = GetBindingText("NUMPADPLUS"),
volumeDown = GetBindingText("NUMPADMINUS"),
volumeSteps = 1,
enableSound = true
}
}
-- https://www.wowace.com/projects/ace3/pages/ace-config-3-0-options-tables
BearsSwitcher.options = {
type = "group",
name = "Bears Switcher",
handler = BearsSwitcher,
args = {
group1 = {
type = "group",
order = 1,
name = "Audio Devices",
inline = true,
-- getters/setters can be inherited through the table tree
get = "GetValue",
set = "SetValue",
args = {
spkr1 = {
type = "select",
order = 1,
name = "Speaker One",
style = "radio",
values = BearsSwitcher:GetDevices(),
set = function(info, value)
BearsSwitcher.db.profile.spkr1 = value
-- Now that we have a value what do we do with it?
print(
"|cff00FF00Speaker 1 set to: |r|cffe3ff00 ",
Sound_GameSystem_GetOutputDriverNameByIndex(value - 1),
"|r"
)
end,
get = function(info)
return BearsSwitcher.db.profile.spkr1
end
},
spkr2 = {
type = "select",
order = 2,
name = "Speaker Two",
style = "radio",
values = BearsSwitcher:GetDevices(),
set = function(info, value)
BearsSwitcher.db.profile.spkr2 = value
-- Now that we have a value what do we do with it?
print(
"|cff00FF00Speaker 2 set to: |r|cffe3ff00 ",
Sound_GameSystem_GetOutputDriverNameByIndex(value - 1),
"|r"
)
-- BearsSwitcher.db.profile.spkr2 = value
end,
get = function(info)
return BearsSwitcher.db.profile.spkr2
end
}
}
},
group2 = {
type = "group",
order = 2,
name = "Keybinds",
inline = true,
-- getters/setters can be inherited through the table tree
get = "GetValue",
set = "SetValue",
args = {
key = {
type = "keybinding",
order = 6,
name = "Speaker Toggle",
desc = "Key to use to switch audio devices",
get = function(info)
return GetBindingText(BearsSwitcher.db.profile.toggle)
end,
set = function(info, value)
BearsSwitcher.db.profile.toggle = value or BearsSwitcher.db.profile.toggle
-- Now that we have a value what do we do with it?
print("|cff00FF00Speaker toggle key set to: |r|cffe3ff00 ", GetBindingText(value), "|r")
end
},
mkey = {
type = "keybinding",
order = 3,
name = "Music Toggle",
desc = "Key to use to switch music on/off",
get = function(info)
return GetBindingText(BearsSwitcher.db.profile.music_toggle)
end,
set = function(info, value)
BearsSwitcher.db.profile.music_toggle = value or BearsSwitcher.db.profile.music_toggle
-- Now that we have a value what do we do with it?
print("|cff00FF00Music toggle key set to: |r|cffe3ff00 ", GetBindingText(value), "|r")
end
},
volumeUp = {
type = "keybinding",
order = 4,
name = "Volume Up",
desc = "Raise master volume",
get = function(info)
return GetBindingText(BearsSwitcher.db.profile.volumeUp)
end,
set = function(info, value)
BearsSwitcher.db.profile.volumeUp = value or BearsSwitcher.db.profile.volumeUp
-- Now that we have a value what do we do with it?
print("|cff00FF00Volume up key set to: |r|cffe3ff00 ", GetBindingText(value), "|r")
end
},
volumeDown = {
type = "keybinding",
order = 5,
name = "Volume Down",
desc = "lower master volume",
get = function(info)
return GetBindingText(BearsSwitcher.db.profile.volumeDown)
end,
set = function(info, value)
BearsSwitcher.db.profile.volumeDown = value or BearsSwitcher.db.profile.volumeDown
-- Now that we have a value what do we do with it?
print("|cff00FF00Volume down key set to: |r|cffe3ff00 ", GetBindingText(value), "|r")
end
}
}
},
group3 = {
type = "group",
order = 3,
name = "Controls",
inline = true,
-- getters/setters can be inherited through the table tree
get = "GetValue",
set = "SetValue",
args = {
volumeSteps = {
type = "range",
order = 1,
name = "Volume steps",
-- this will look for a getter/setter on our handler object
get = "GetVolumeSteps",
set = "SetVolumeSteps",
min = 1,
max = 100,
step = 1
},
enableSound = {
type = "toggle",
order = 2,
name = "Sound On",
desc = "Sound notification when changing volume",
-- inline getter/setter example
get = function(info)
return BearsSwitcher.db.profile.enableSound
end,
set = function(info, value)
BearsSwitcher.db.profile.enableSound = value
end
}
}
}
}
}
-- https://www.wowace.com/projects/ace3/pages/ace-config-3-0-options-tables#title-4-1
function BearsSwitcher:GetValue(info)
return self.db.profile[info[#info]]
end
function BearsSwitcher:SetValue(info, value)
self.db.profile[info[#info]] = value
end
function BearsSwitcher:GetVolumeSteps(info)
return self.db.profile.volumeSteps
end
function BearsSwitcher:SetVolumeSteps(info, value)
self.db.profile.volumeSteps = value
end