Uses 3874K of libraries. Click here for Pure Java version (6079L/42K/154K).
1 | !7 |
2 | |
3 | import javax.sound.sampled.*; |
4 | |
5 | static TargetDataLine currentLine; |
6 | |
7 | p-substance { |
8 | final L<Mixer> devices = inputAudioDevices(); |
9 | L<S> deviceNames = map(func(Mixer m) { |
10 | audioDeviceName(m) + " [" + n(m.getTargetLineInfo(), "line") + "]" |
11 | }, devices); |
12 | ButtonGroup buttons = showUnselectedRadioButtons("Input Audio Devices", deviceNames); |
13 | JFrame frame = minFrameWidth(300, packFrame(buttons)); |
14 | final JLabel lblLevel = jcenteredBoldLabel("Level: "); |
15 | addToWindowAndPack(frame, lblLevel); |
16 | awtEvery(lblLevel, 100, r { |
17 | S text = "Level: "; |
18 | if (currentLine != null) try { |
19 | text += currentLine.getLevel(); |
20 | } catch e { |
21 | text += str(e); |
22 | printStackTrace(e); |
23 | } |
24 | lblLevel.setText(text); |
25 | }); |
26 | onRadioButtonChange(buttons, voidfunc(int i) { |
27 | if (i < 0) ret; |
28 | Mixer m = devices.get(i); |
29 | Line.Info[] lines = m.getTargetLineInfo(); |
30 | print("Device " + i + ": " + audioDeviceName(m)); |
31 | print("Have " + n(lines, "line")); |
32 | currentLine = (TargetDataLine) m.getLine(first(lines)); |
33 | }); |
34 | } |
Began life as a copy of #1007014
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007018 |
Snippet name: | Show Input Audio Devices With Audio Level [dev.] |
Eternal ID of this version: | #1007018/8 |
Text MD5: | e835487fc95cc9c8ff3fac26e726539a |
Transpilation MD5: | 95e2b9c95236dbe0eb64358e6bd75559 |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-25 16:37:23 |
Source code size: | 1071 bytes / 34 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 522 / 634 |
Version history: | 7 change(s) |
Referenced in: | [show references] |