Revert "feat: Sampler can be loaded with ToneAudioBuffers"

This reverts commit 368a7f43cb.
This commit is contained in:
Yotam Mann 2020-05-12 22:57:13 -04:00
parent ba8e82b1ca
commit 510a08df4e
2 changed files with 21 additions and 53 deletions

View file

@ -6,7 +6,6 @@ import { InstrumentTest } from "test/helper/InstrumentTests";
import { atTime, Offline } from "test/helper/Offline";
import { ToneAudioBuffer } from "Tone/core/context/ToneAudioBuffer";
import { Sampler } from "Tone/instrument/Sampler";
import { ToneAudioBuffers } from "Tone/core/context/ToneAudioBuffers";
describe("Sampler", () => {
@ -145,33 +144,6 @@ describe("Sampler", () => {
}, 0.3);
});
it("can be constructed with a ToneAudioBuffers in an object", () => {
const sampler = new Sampler({
urls: new ToneAudioBuffers({
A4: A4_buffer
})
});
sampler.dispose();
});
it("can be constructed with unloaded a ToneAudioBuffers", (done) => {
const sampler = new Sampler({
urls: new ToneAudioBuffers({
A4: "./audio/sine.wav",
}, () => {
sampler.dispose();
done();
})
});
});
it("can be constructed with ToneAudioBuffers", () => {
const sampler = new Sampler(new ToneAudioBuffers({
A4: A4_buffer,
}));
sampler.dispose();
});
});
context("Makes sound", () => {

View file

@ -23,7 +23,7 @@ export interface SamplerOptions extends InstrumentOptions {
onerror: (error: Error) => void;
baseUrl: string;
curve: ToneBufferSourceCurve;
urls: SamplesMap | ToneAudioBuffers;
urls: SamplesMap;
}
/**
@ -102,9 +102,6 @@ export class Sampler extends Instrument<SamplerOptions> {
super(optionsFromArguments(Sampler.getDefaults(), arguments, ["urls", "onload", "baseUrl"], "urls"));
const options = optionsFromArguments(Sampler.getDefaults(), arguments, ["urls", "onload", "baseUrl"], "urls");
if (options.urls instanceof ToneAudioBuffers) {
this._buffers = options.urls;
} else {
const urlMap = {};
Object.keys(options.urls).forEach((note) => {
const noteNumber = parseInt(note, 10);
@ -126,7 +123,6 @@ export class Sampler extends Instrument<SamplerOptions> {
baseUrl: options.baseUrl,
onerror: options.onerror,
});
}
this.attack = options.attack;
this.release = options.release;
this.curve = options.curve;