Libraryless. Click here for Pure Java version (3886L/22K).
1 | srecord noeq SampleIteratorToQuerySound(int channels, ShortIterator it) is IQuerySound { |
2 | int idx = 0; // points to the one we haven't queried yet |
3 | |
4 | public int channels() { ret channels; } |
5 | public double getSample(int channel, double time) { |
6 | int t = ifloor(time); |
7 | if (t < idx) |
8 | fail("Earlier time queried: " + t + " / " + idx); |
9 | |
10 | if (it == null) ret 0; // we're done |
11 | while ping (true) { |
12 | if (!it.hasNext()) { it = null; ret 0; } // we're done |
13 | double sample = it.next(); |
14 | if (t == idx++) |
15 | ret sample; |
16 | } |
17 | } |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033033 |
Snippet name: | SampleIteratorToQuerySound |
Eternal ID of this version: | #1033033/6 |
Text MD5: | 73169bf609b109da1fbe66722c0504f0 |
Transpilation MD5: | 9fa9dbb4ca5a83f690f0d5e9978f8046 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-11 15:22:39 |
Source code size: | 583 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 166 / 287 |
Version history: | 5 change(s) |
Referenced in: | [show references] |