Libraryless. Click here for Pure Java version (14974L/104K).
1 | !7 |
2 | |
3 | import static x30_pkg.x30_util.VF1; |
4 | |
5 | module ReceiveAudio > DynPrintLog { |
6 | bool enabled; |
7 | float gain = 0.5f; |
8 | transient StreamingSoundSource soundSource; |
9 | transient GainSoundSource gainSource; |
10 | |
11 | start { |
12 | onChange(r { |
13 | set(gainSource, gain := (double) gain); |
14 | if (soundSource != null) soundSource.setEnabled(enabled); |
15 | }); |
16 | soundSource = new StreamingSoundSource; |
17 | dm_addSoundSource(gainSource = GainSoundSource(gain, soundSource)); |
18 | ownResource(vmBus_onMessage('gotFromPrivateChat, voidfunc(S sender, S msg) { |
19 | if (enabled && startsWith(msg, "audio:")) |
20 | soundSource.addChunk(shortArrayFromBytes_littleEndian(base64decode(substring(msg, 6)))); |
21 | })); |
22 | } |
23 | |
24 | visualize { |
25 | ret centerAndSouth(super.visualize(), |
26 | centerAndEast( |
27 | withLabel("Volume (0-200%):", liveSliderZeroToOne(gain/2, voidfunc(float f) { setField(gain := f*2) })), |
28 | dm_fieldCheckBox('enabled))); |
29 | } |
30 | } |
Began life as a copy of #1019651
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019654 |
Snippet name: | Play Audio From Other Machine v2 [shortened] |
Eternal ID of this version: | #1019654/4 |
Text MD5: | 48e2d673154c92cb4d5a8487aa310776 |
Transpilation MD5: | d77fb6a5e2188c45331d0ce5751e1087 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-16 21:48:16 |
Source code size: | 966 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 287 / 1763 |
Version history: | 3 change(s) |
Referenced in: | [show references] |