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

14
LINES

< > BotCompany Repo | #1020125 // stereoSamplesIterator_longCounter

JavaX fragment (include)

srecord StereoSamplesIterator(short[] samples) extends VF1<double[]> {
  long counter = 0;
  
  public void get(double[] pair) {
    int sampleIndex = cast counter % l(samples);
    pair[0] = samples[sampleIndex];
    pair[1] = samples[sampleIndex+1];
    counter += 2;
  }
}

static StereoSamplesIterator stereoSamplesIterator_longCounter(short[] samples) {
  ret samples == null ? null : StereoSamplesIterator(samples);
}

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: 279 / 314
Version history: 1 change(s)
Referenced in: [show references]