Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions js/utils/synthutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2038,9 +2038,18 @@ function Synth() {
* @memberof Synth
*/
this.playRecording = async () => {
const player = new Tone.Player().toDestination();
await player.load(this.audioURL)
player.start();
this.player = new Tone.Player().toDestination();
await this.player.load(this.audioURL)
this.player.start();
}

/**
* Stops Recording
* @function
* @memberof Synth
*/
this.stopPlayBackRecording = () => {
this.player.stop();
}

/**
Expand Down
15 changes: 11 additions & 4 deletions js/widgets/sampler.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ function SampleWidget() {
this._playbackBtn.classList.add("disabled");

this.is_recording = false;
this.playback = false;

this._recordBtn.onclick = async () => {
if (!this.is_recording) {
Expand All @@ -477,10 +478,16 @@ function SampleWidget() {
};

this._playbackBtn.onclick = () => {
this.sampleData = this.recordingURL;
this.sampleName = `Recorded Audio ${this.recordingURL}`;
this._addSample();
this.activity.logo.synth.playRecording();
if (!this.playback) {
this.sampleData = this.recordingURL;
this.sampleName = `Recorded Audio ${this.recordingURL}`;
this._addSample();
this.activity.logo.synth.playRecording();
this.playback = true
} else {
this.activity.logo.synth.stopPlayBackRecording();
this.playback = false;
}
};

widgetWindow.sendToCenter();
Expand Down
Loading