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

24
LINES

< > BotCompany Repo | #1009775 // MonoSampleBuffer - byte PCM stream to mono samples [dev.]

JavaX fragment (include)

sclass MonoSampleBuffer {
  int halfSample;
  new L<float[]> samples;

  void append(S s) {
    currentLine += s;
    int i;
    while ((i = currentLine.indexOf('\n')) >= 0) {
      // inefficient
      completeLines.add(dropTrailingBackslashR(substring(currentLine, 0, i)));
      currentLine = substring(currentLine, i+1);
    }
  }
  
  float[] getAndClearSamples() {
    int n = 0;
    n += samples.length;
    if (empty(samples)) ret new float[0];
    float[] _samples = samples;
    if (samples.length != 0)
      samples = new float[0];
    ret _samples;
  }
}

Author comment

Began life as a copy of #1009574

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009775
Snippet name: MonoSampleBuffer - byte PCM stream to mono samples [dev.]
Eternal ID of this version: #1009775/1
Text MD5: cfc5385ddc77a039d4f4a81f77e9fb09
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-16 17:26:53
Source code size: 590 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 354 / 373
Referenced in: [show references]