Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5b6c5a
commit c8392cb
Showing
8 changed files
with
143 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 8 additions & 9 deletions
17
src/wrappers/audio-buffer-source-node-start-method-consecutive-calls.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { InvalidStateErrorFactory } from '../factories/invalid-state-error'; | ||
import { INativeConstantSourceNode } from '../interfaces'; | ||
import { TNativeAudioBufferSourceNode, TNativeOscillatorNode } from '../types'; | ||
import { TNativeAudioBufferSourceNode } from '../types'; | ||
|
||
@Injectable() | ||
export class AudioScheduledSourceNodeStartMethodConsecutiveCallsWrapper { | ||
export class AudioBufferSourceNodeStartMethodConsecutiveCallsWrapper { | ||
|
||
constructor (private _invalidStateErrorFactory: InvalidStateErrorFactory) { } | ||
|
||
public wrap (audioScheduledSourceNode: TNativeAudioBufferSourceNode | INativeConstantSourceNode | TNativeOscillatorNode) { | ||
audioScheduledSourceNode.start = ((start) => { | ||
public wrap (audioBufferSourceNode: TNativeAudioBufferSourceNode) { | ||
audioBufferSourceNode.start = ((start) => { | ||
let isScheduled = false; | ||
|
||
return (when = 0, offset = 0, duration?: number) => { | ||
if (isScheduled) { | ||
throw this._invalidStateErrorFactory.create(); | ||
} | ||
|
||
start.call(audioScheduledSourceNode, when, offset, duration); | ||
start.call(audioBufferSourceNode, when, offset, duration); | ||
|
||
isScheduled = true; | ||
}; | ||
})(audioScheduledSourceNode.start); | ||
})(audioBufferSourceNode.start); | ||
} | ||
|
||
} | ||
|
||
export const AUDIO_SCHEDULED_SOURCE_NODE_START_METHOD_CONSECUTIVE_CALLS_WRAPPER_PROVIDER = { | ||
export const AUDIO_BUFFER_SOURCE_NODE_START_METHOD_CONSECUTIVE_CALLS_WRAPPER_PROVIDER = { | ||
deps: [ InvalidStateErrorFactory ], | ||
provide: AudioScheduledSourceNodeStartMethodConsecutiveCallsWrapper | ||
provide: AudioBufferSourceNodeStartMethodConsecutiveCallsWrapper | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters