mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-10 10:40:54 +00:00
small edits to Sound and TonePlayer
This commit is contained in:
parent
b461e224a6
commit
66bcefe1f1
@ -39,7 +39,7 @@ import { TrackPlayer } from './TrackPlayer';
|
|||||||
* @param {Window} options.win - the associated Window
|
* @param {Window} options.win - the associated Window
|
||||||
* @param {number|string} [options.value= 'C'] - the sound value (see above for a full description)
|
* @param {number|string} [options.value= 'C'] - the sound value (see above for a full description)
|
||||||
* @param {number} [options.octave= 4] - the octave corresponding to the tone (if applicable)
|
* @param {number} [options.octave= 4] - the octave corresponding to the tone (if applicable)
|
||||||
* @param {number} [options.secs= 0.5] - duration of the tone (in seconds)
|
* @param {number} [options.secs= 0.5] - duration of the tone (in seconds) If secs == -1, the sound will play indefinitely.
|
||||||
* @param {number} [options.startTime= 0] - start of playback for tracks (in seconds)
|
* @param {number} [options.startTime= 0] - start of playback for tracks (in seconds)
|
||||||
* @param {number} [options.stopTime= -1] - end of playback for tracks (in seconds)
|
* @param {number} [options.stopTime= -1] - end of playback for tracks (in seconds)
|
||||||
* @param {boolean} [options.stereo= true] whether or not to play the sound or track in stereo
|
* @param {boolean} [options.stereo= true] whether or not to play the sound or track in stereo
|
||||||
@ -124,7 +124,7 @@ export class Sound extends PsychObject {
|
|||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
* @param {number} volume - the volume (values should be between 0 and 1)
|
* @param {number} volume - the volume (values should be between 0 and 1)
|
||||||
* @param {booleam} [mute= false] - whether or not to mute the sound
|
* @param {boolean} [mute= false] - whether or not to mute the sound
|
||||||
* @param {boolean} [log= true] - whether of not to log
|
* @param {boolean} [log= true] - whether of not to log
|
||||||
*/
|
*/
|
||||||
setVolume(volume, mute = false, log = true) {
|
setVolume(volume, mute = false, log = true) {
|
||||||
|
@ -188,9 +188,9 @@ export class TonePlayer extends SoundPlayer {
|
|||||||
this._loops = loops;
|
this._loops = loops;
|
||||||
|
|
||||||
// if duration_s == -1, the sound should play indefinitely, therefore we use an arbitrarily long playing time
|
// if duration_s == -1, the sound should play indefinitely, therefore we use an arbitrarily long playing time
|
||||||
const actualDuration_s = (this._duration_s === -1)?10000000: this._duration_s;
|
const actualDuration_s = (this._duration_s === -1) ? 1000000 : this._duration_s;
|
||||||
const self = this;
|
const self = this;
|
||||||
const callback = () => { self._synth.triggerAttackRelease(self._note, actualDuration_s, Tone.now()); };
|
const callback = () => { self._synth.triggerAttackRelease(self._note, actualDuration_s); };
|
||||||
|
|
||||||
if (this.loops === 0)
|
if (this.loops === 0)
|
||||||
this._toneId = Tone.Transport.scheduleOnce(callback, Tone.now());
|
this._toneId = Tone.Transport.scheduleOnce(callback, Tone.now());
|
||||||
|
Loading…
Reference in New Issue
Block a user