Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1020125 // stereoSamplesIterator_longCounter

JavaX fragment (include)

1  
srecord StereoSamplesIterator(short[] samples) extends VF1<double[]> {
2  
  long counter = 0;
3  
  
4  
  public void get(double[] pair) {
5  
    int sampleIndex = cast counter % l(samples);
6  
    pair[0] = samples[sampleIndex];
7  
    pair[1] = samples[sampleIndex+1];
8  
    counter += 2;
9  
  }
10  
}
11  
12  
static StereoSamplesIterator stereoSamplesIterator_longCounter(short[] samples) {
13  
  ret samples == null ? null : StereoSamplesIterator(samples);
14  
}

Author comment

Began life as a copy of #1016686

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020125
Snippet name: stereoSamplesIterator_longCounter
Eternal ID of this version: #1020125/2
Text MD5: 6bb5560f66c83fa4a3389f7f93f8528d
Author: stefan
Category: javax / sound
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-08 21:42:51
Source code size: 436 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 281 / 316
Version history: 1 change(s)
Referenced in: [show references]