Update audioseqq.js

parent 8b123b51
......@@ -732,6 +732,7 @@ var frameRemains;
function vssoundRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'vssound'-------
let continueRoutine = true;
// get current time
t = vssoundClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -742,14 +743,15 @@ function vssoundRoutineEachFrame(snapshot) {
sound_2.tStart = t; // (not accounting for frame time here)
sound_2.frameNStart = frameN; // exact frame index
sound_2.play(); // start the sound (it finishes automatically)
psychoJS.window.callOnFlip(function(){ sound_2.play(); }); // screen flip
sound_2.status = PsychoJS.Status.STARTED;
}
frameRemains = start[x] + numtosec(vslist[z][x]) - psychoJS.window.monitorFramePeriod * 0.75; // most of one frame period left
if ((sound_2.status === PsychoJS.Status.STARTED || sound_2.status === PsychoJS.Status.FINISHED) && t >= frameRemains) {
if (numtosec(vslist[z][x]) > 0.5) { sound_2.stop(); // stop the sound (if longer than duration)
if ((sound_2.status === PsychoJS.Status.STARTED && t >= frameRemains) {
//if (numtosec(vslist[z][x]) > 0.5) {
sound_2.stop(); // stop the sound (if longer than duration)
sound_2.status = PsychoJS.Status.FINISHED;
}
// }
}
// check for quit (typically the Esc key)
if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment