!7 cmodule AudioInput > DynPrintLog { int bufSize = 40960; transient recordToAudioListeners_AudioLoop loop; transient SimpleLiveValue<Float> lvVolume = floatLiveValue(); // in percent transient L<VF1<short[]>> audioListeners = synchroList(); visualize { ret centerAndSouthWithMargins(super.visualize(), jCenteredLine(jLiveValueLabel(mapLiveValue(func(float volume) -> S { "Volume: " + iround(volume) + " %" }, S, lvVolume)))); } start { ownTimer(loop = recordToAudioListeners(audioListeners, bufSize, lvVolume)).start(); JComponent trayIcon = jMinWidth(16, jVerticalGreenBar(lvVolume, max := 100)); componentPopupMenuItem(trayIcon, "Audio Input", r { dm_showModule(module()) }); dm_setTrayIcon(trayIcon); } // hold audio listeners during reload O _getReloadData() { ret audioListeners; } void _setReloadData(L<VF1<short[]>> listeners) { addAll(audioListeners, listeners); } // API void addAudioListener(VF1<short[]> l) { audioListeners.add(l); } void removeAudioListener(VF1<short[]> l) { audioListeners.remove(l); } AudioFormat getAudioFormat() { ret javaSound_cdQuality(); } float getVolume() { ret lvVolume!; } }
Began life as a copy of #1017138
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026862 |
Snippet name: | Audio Input [Dyn Module, backup before sample rate field] |
Eternal ID of this version: | #1026862/1 |
Text MD5: | a1483ab34fa1c91e9bfee8166db92d39 |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-29 16:08:21 |
Source code size: | 1227 bytes / 34 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 196 / 197 |
Referenced in: | -