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).

!7

import javax.sound.sampled.*;

static /*Target*/Line currentLine;

p-substance {
  final L<AudioLine> lines = allAudioLines();
  L<S> lineNames = allToString(lines);
  ButtonGroup buttons = showUnselectedRadioButtons("All Audio Lines", lineNames);
  JFrame frame = minFrameWidth(300, packFrame(buttons));
  final JLabel lblLevel = jcenteredBoldLabel("Level: ");
  addToWindowAndPack(frame, lblLevel);
  awtEvery(lblLevel, 100, r {
    S text = "Level: ";
    if (currentLine instanceof DataLine) try {
      text += ((DataLine) currentLine).getLevel();
    } catch e {
      text += str(e);
      printStackTrace(e);
    }
    lblLevel.setText(text);
  });
  onRadioButtonChange(buttons, voidfunc(int i) {
    if (i < 0) ret;
    AudioLine line = lines.get(i);
    currentLine = line.open();
    print("Line type: " + shortClassName(currentLine));
    Control[] controls = currentLine.getControls();
    print("Controls: " + l(controls));
    for ic over controls:
      print("Control " + (ic+1) + ": " + controls[ic]);
    if (currentLine instanceof DataLine)
      thread {
        print("Capturing");
        captureAudioFromLine((DataLine) currentLine, sphinxAudioFormat());
        print("Capture done");
      }
  });
}

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: 408 / 557
Version history: 12 change(s)
Referenced in: [show references]