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

12
LINES

< > BotCompany Repo | #1033251 // shortSamplesToQuerySound

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4000L/23K).

static IQuerySound shortSamplesToQuerySound(int channels default 1, short[] samples) {
  ret new IQuerySound {
    public int channels() { ret channels; }
    
    // time is in samples
    public double getSample(int channel, double time) {
      int t = ifloor(time);
      t /= channels;
      ret t < 0 || t >= l(samples) ? 0 : samples[t];
    }
  };
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033251
Snippet name: shortSamplesToQuerySound
Eternal ID of this version: #1033251/2
Text MD5: 594beb40e6e5c5689deaeeb233540d63
Transpilation MD5: 9b296aaf04e6ad714ad2d9080a1cc535
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-17 21:08:54
Source code size: 367 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 155 / 215
Version history: 1 change(s)
Referenced in: [show references]