Commit 05857dad authored by Zhaleh Mohammad Alipour's avatar Zhaleh Mohammad Alipour

Update audioseqq.js

parent 92dc25c6
......@@ -735,6 +735,7 @@ var frameRemains;
function vssoundRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'vssound'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = vssoundClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -745,14 +746,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) {
......@@ -1087,6 +1089,7 @@ function SOUNDRoutineBegin(snapshot) {
function SOUNDRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'SOUND'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = SOUNDClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -1097,14 +1100,15 @@ function SOUNDRoutineEachFrame(snapshot) {
sound_1.tStart = t; // (not accounting for frame time here)
sound_1.frameNStart = frameN; // exact frame index
sound_1.play(); // start the sound (it finishes automatically)
psychoJS.window.callOnFlip(function(){ sound_1.play(); }); // screen flip
sound_1.status = PsychoJS.Status.STARTED;
}
frameRemains = durationn(intervall)[c] + stop(ran) - psychoJS.window.monitorFramePeriod * 0.75; // most of one frame period left
if ((sound_1.status === PsychoJS.Status.STARTED || sound_1.status === PsychoJS.Status.FINISHED) && t >= frameRemains) {
if (stop(ran) > 0.5) { sound_1.stop(); // stop the sound (if longer than duration)
if (sound_1.status === PsychoJS.Status.STARTED && t >= frameRemains) {
//if (stop(ran) > 0.5) {
sound_1.stop(); // stop the sound (if longer than duration)
sound_1.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