Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

40
LINES

< > BotCompany Repo | #1007023 // Show Individual Audio Lines [works]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 3874K of libraries. Click here for Pure Java version (6241L/44K/161K).

1  
!7
2  
3  
import javax.sound.sampled.*;
4  
5  
static /*Target*/Line currentLine;
6  
7  
p-substance {
8  
  final L<AudioLine> lines = allAudioLines();
9  
  L<S> lineNames = allToString(lines);
10  
  ButtonGroup buttons = showUnselectedRadioButtons("All Audio Lines", lineNames);
11  
  JFrame frame = minFrameWidth(300, packFrame(buttons));
12  
  final JLabel lblLevel = jcenteredBoldLabel("Level: ");
13  
  addToWindowAndPack(frame, lblLevel);
14  
  awtEvery(lblLevel, 100, r {
15  
    S text = "Level: ";
16  
    if (currentLine instanceof DataLine) try {
17  
      text += ((DataLine) currentLine).getLevel();
18  
    } catch e {
19  
      text += str(e);
20  
      printStackTrace(e);
21  
    }
22  
    lblLevel.setText(text);
23  
  });
24  
  onRadioButtonChange(buttons, voidfunc(int i) {
25  
    if (i < 0) ret;
26  
    AudioLine line = lines.get(i);
27  
    currentLine = line.open();
28  
    print("Line type: " + shortClassName(currentLine));
29  
    Control[] controls = currentLine.getControls();
30  
    print("Controls: " + l(controls));
31  
    for ic over controls:
32  
      print("Control " + (ic+1) + ": " + controls[ic]);
33  
    if (currentLine instanceof DataLine)
34  
      thread {
35  
        print("Capturing");
36  
        captureAudioFromLine((DataLine) currentLine, sphinxAudioFormat());
37  
        print("Capture done");
38  
      }
39  
  });
40  
}

Author comment

Began life as a copy of #1007018

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: #1007023
Snippet name: Show Individual Audio Lines [works]
Eternal ID of this version: #1007023/13
Text MD5: cadd13a57af8065eacec757423c25b44
Transpilation MD5: beaaeb9dcba9c5b2791fd9a5b3dc06c8
Author: stefan
Category: javax / audio
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-02 23:17:38
Source code size: 1269 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 467 / 638
Version history: 12 change(s)
Referenced in: [show references]