Libraryless. Click here for Pure Java version (3286L/18K).
1 | static L<short[]> soundSourceToShortArrays(double maxSeconds, VF1<double[]> source, int channels default 2) { |
2 | source = new CutOffSoundSource(maxSeconds, source); |
3 | double[] lr = new[channels]; |
4 | new L<short[]> out; |
5 | short[] buf = new short[1024]; |
6 | int i = 0; |
7 | while licensed { |
8 | source.get(lr); |
9 | if (isNaN(lr[0])) break; |
10 | for c to channels: |
11 | buf[i++] = clipShort(lr[c]); |
12 | if (i >= l(buf)) { |
13 | out.add(buf); |
14 | buf = new short[l(buf)]; |
15 | i = 0; |
16 | } |
17 | } |
18 | if (i > 0) |
19 | out.add(subShortArray(buf, 0, i)); |
20 | ret out; |
21 | } |
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: | #1018701 |
Snippet name: | soundSourceToShortArrays - stereo by default |
Eternal ID of this version: | #1018701/6 |
Text MD5: | e277eefb61d9f37e7f1a0ba4d9f72d68 |
Transpilation MD5: | 381f5279251f81007eb94dc137ede68a |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-03 03:12:08 |
Source code size: | 570 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 362 / 433 |
Version history: | 5 change(s) |
Referenced in: | [show references] |