-
Notifications
You must be signed in to change notification settings - Fork 6
/
api.lua
188 lines (153 loc) · 4.51 KB
/
api.lua
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
-- Lua module API stub.
-- Display
---
--- Sets the display mode.
---@param mode string | '"disabled"' | '"log"' | '"points"' | '"values"' | '"scope"'
function setDisplayMode(mode) end
---
--- Clear log messages.
--- Works only in `log` display mode.
function clearLog() end
---
--- Add log message.
--- Works only in `log` display mode.
---@param message string
function log(message) end
---
--- Show one of 3 available points.
--- Works only in `points` display mode.
---@param point number
function showPoint(point) end
---
--- Hide one of 3 available points.
--- Works only in `points` display mode.
---@param point number
function hidePoint(point) end
---
--- Set point position and optionally direction (in degree, from -180 to 180).
--- Works only in `points` display mode.
---@param point number
---@param x number
---@param y number
---@param dir number | nil
function setPoint(point, x, y, dir) end
---
--- Show one of 18 (in values mode) or 4 (in scope mode) available values.
--- Works only in `values` and `scope` display modes.
---@param index number
function showValue(index) end
---
--- Hide one of 18 (in values mode) or 4 (in scope mode) available values.
--- Works only in `values` and `scope` display modes.
---@param index number
function hideValue(index) end
---
--- Set one of (in values mode) or 4 (in scope mode) available values.
--- Works only in `values` and `scope` display modes.
---@param index number
---@param value number
function setValue(index, value) end
-- Display, scope mode
---
--- Set value scale in V/div.
--- Works only in `scope` display mode.
---@param scale number
function setScopeScale(scale) end
---
--- Set value offset in volts.
--- Works only in `scope` display mode.
---@param pos number
function setScopePos(pos) end
---
--- Set time resolution in ms/div.
--- Works only in `scope` display mode.
---@param time number
function setScopeTime(time) end
---
--- Set trigger threshold.
--- Works only in `scope` display mode.
---@param value number
function setScopeTrigThreshold(value) end
---
--- Set index of value to use for trigger.
--- Pass -1 for disable.
--- Works only in `scope` display mode.
---@param index number
function setScopeTrigValue(index) end
---
--- Trigger scope.
--- Works only in `scope` display mode.
function scopeTrig() end
-- Inputs
---
--- Returns whether a cable is connected to the input port.
---@param input number
---@return boolean
function isInputConnected(input) end
---
--- Returns the voltage of the given channel.
---@param input number
---@param channel number|nil
---@return number
function getVoltage(input, channel) end
---
--- Returns the given channel's voltage if the port is polyphonic, otherwise returns the first voltage (channel 0).
---@param input number
---@param channel number|nil
---@return number
function getPolyVoltage(input, channel) end
---
--- Returns the voltage if a cable is connected, otherwise returns the given normal voltage.
---@param input number
---@param normalVoltage number
---@param channel number|nil
---@return number
function getNormalVoltage(input, normalVoltage, channel) end
---
--- Returns the voltage if a cable is connected, otherwise returns the given normal voltage.
---@param input number
---@param normalVoltage number
---@param channel number
---@return number
function getNormalPolyVoltage(input, normalVoltage, channel) end
---
--- Returns the sum of all voltages.
---@param input number
---@return number
function getVoltageSum(input) end
---
--- Returns the number of channels.
--- If the port is disconnected, it has 0 channels.
---@param input number
---@return number
function getChannels(input) end
---
--- Returns whether the cable exists and has 1 channel.
---@param input number
---@return boolean
function isMonophonic(input) end
---
--- Returns whether the cable exists and has more than 1 channel.
---@param input number
---@return boolean
function isPolyphonic(input) end
-- Outputs
---
--- Returns whether a cable is connected to the output port.
---@param output number
---@return boolean
function isOutputConnected(output) end
---
--- Sets the voltage of the given channel.
---@param output number
---@param voltage number
---@param channel number|nil
function setVoltage(output, voltage, channel) end
---
--- Sets the number of polyphony channels.
--- Also clears voltages of higher channels.
--- If disconnected, this does nothing (`channels` remains 0).
--- If 0 is given, `channels` is set to 1 but all voltages are cleared.
---@param output number
---@param channels number
function setChannels(output, channels) end