audio-buffer-list
Advanced tools
Comparing version 1.3.1 to 1.3.2
20
index.js
@@ -99,2 +99,3 @@ /** | ||
//shortcut single buffer preserving subarraying | ||
if (this._bufs.length === 1) return this._bufs[0].getChannelData(channel) | ||
@@ -398,5 +399,20 @@ | ||
//return new buffer by mapping it | ||
AudioBufferList.prototype.map = function map (fn) { | ||
return new AudioBufferList(this._bufs.map(fn)) | ||
AudioBufferList.prototype.map = function map (fn, from, to) { | ||
let before, after, middle | ||
if (from != null) { | ||
before = this.shallowSlice(0, from) | ||
} | ||
if (to != null) { | ||
after = this.shallowSlice(to) | ||
} | ||
if (before || after) middle = this.shallowSlice(from, to) | ||
else middle = this | ||
middle._bufs = middle._bufs.map(fn) | ||
if (before) middle = before.append(middle) | ||
if (after) middle = middle.append(after) | ||
return middle | ||
} | ||
{ | ||
"name": "audio-buffer-list", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Data structure for sequence of AudioBuffers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,5 +43,5 @@ # audio-buffer-list [![Build Status](https://travis-ci.org/audiojs/audio-buffer-list.svg?branch=master)](https://travis-ci.org/audiojs/audio-buffer-list) [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges) | ||
### `list.map((buffer, index) => buffer)` | ||
### `list.map((buffer, index) => buffer, from=0, to=-0)` | ||
Create new list by mapping every buffer. | ||
Create new list by mapping every buffer. Optionally pass offsets `from` and `to` to map only subset. | ||
@@ -48,0 +48,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18325
376