Skip to content

Commit

Permalink
fix use of byte-data old API
Browse files Browse the repository at this point in the history
  • Loading branch information
rochars committed Dec 4, 2017
1 parent 4de205f commit 64c9ccc
Show file tree
Hide file tree
Showing 17 changed files with 3,142 additions and 56 deletions.
78 changes: 39 additions & 39 deletions dist/wavefile-min.js

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions dist/wavefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1330,10 +1330,7 @@ class WaveFileReaderWriter extends WaveFileHeader {
throw Error(WaveErrors.format);
}
let bigEndian = this.LEorBE();
this.chunkSize = byteData.fromBytes(
bytes.slice(4, 8),
32,
{"be": bigEndian, "single": true});
this.chunkSize = byteData.unpack(bytes.slice(4, 8), uInt32);
this.format = byteData.unpackArray(bytes.slice(8, 12), chr);
if (this.format != "WAVE") {
throw Error(WaveErrors.wave);
Expand Down Expand Up @@ -1481,12 +1478,10 @@ class WaveFileReaderWriter extends WaveFileHeader {
* Turn samples to bytes.
*/
samplesToBytes_(options) {
let bytes = [];
options.bits = this.bitsPerSample == 4 ? 8 : this.bitsPerSample;
options.signed = options.bits == 8 ? false : true;
options.float = (this.audioFormat == 3 || this.bitsPerSample == 64) ? true : false;

bytes = byteData.packArray(this.samples_, options);
let bytes = byteData.packArray(this.samples_, options);
if (bytes.length % 2) {
bytes.push(0);
}
Expand Down
Loading

0 comments on commit 64c9ccc

Please sign in to comment.