audio-buffer-player.js 477 B

123456789101112131415
  1. export default class MockAudioBufferPlayer {
  2. constructor (samples, sampleRate) {
  3. this.samples = samples;
  4. this.sampleRate = sampleRate;
  5. this.buffer = {
  6. getChannelData: jest.fn(() => samples),
  7. sampleRate: sampleRate
  8. };
  9. this.play = jest.fn((trimStart, trimEnd, onUpdate) => {
  10. this.onUpdate = onUpdate;
  11. });
  12. this.stop = jest.fn();
  13. MockAudioBufferPlayer.instance = this;
  14. }
  15. }