public void initBlockSequence(List <int> inTargetSequence, List <List <float> > inTargets) { // wait until the textures are loaded before continuing while (doLoadTextures > 0) { Thread.Sleep(50); } // lock for textures events (thread safety) lock (textureLock) { // int i = 0; // clear all block sequence information for (i = 0; i < blocks.Count; ++i) { blocks[i].texture = 0; } blocks.Clear(); // set the block variables nothing currentBlock = noBlock; cursorInCurrentBlock = false; // loop through the targets in the sequence float startX = 0; for (i = 0; i < inTargetSequence.Count; ++i) { // calculate the block height and y position (based on percentages) float height = getContentHeight() * (inTargets[1][inTargetSequence[i]] / 100.0f); float y = getContentHeight() * (inTargets[0][inTargetSequence[i]] / 100.0f) - height / 2.0f; // calculate the block width (based on sec) float widthSec = inTargets[2][inTargetSequence[i]]; float widthPixels = (float)getContentWidth() / ((float)getContentWidth() / blockSpeed) * widthSec; // set the start position startX -= widthPixels; // create the color (decomposes the 24-bit integer into seperate RGB components RGBColorFloat color = new RGBColorFloat((int)inTargets[3][inTargetSequence[i]]); // create a block object MultiClicksBlock block = new MultiClicksBlock(startX, y, widthPixels, height, color.getRed(), color.getGreen(), color.getBlue()); // set the block texture (initialized to 0 = no texture) if (inTargetSequence[i] < (int)blockTextures.Count) { block.texture = blockTextures[inTargetSequence[i]]; } // add block for display blocks.Add(block); } } }
public void setCursorEscapeColor(RGBColorFloat color) { cursorEscapeColor = color; }
public void setCursorEscapeColor(float red, float green, float blue) { cursorEscapeColor = new RGBColorFloat(red, blue, green); }
public void setCursorMissColor(RGBColorFloat color) { cursorMissColor = color; }
public void setTargetMissColor(RGBColorFloat color) { targetMissColorR = color.getRed(); targetMissColorG = color.getGreen(); targetMissColorB = color.getBlue(); }
public void setCursorMissColor(RGBColorFloat color) { cursorMissColorR = color.getRed(); cursorMissColorG = color.getGreen(); cursorMissColorB = color.getBlue(); }
public bool configure(ref SamplePackageFormat input) { // check sample-major ordered input if (input.valueOrder != SamplePackageFormat.ValueOrder.SampleMajor) { logger.Error("This application is designed to work only with sample-major ordered input"); return(false); } // check if the number of input channels is higher than 0 if (input.numChannels <= 0) { logger.Error("Number of input channels cannot be 0"); return(false); } // store a reference to the input format inputFormat = input; // PARAMETER TRANSFER // transfer window settings windowLeft = parameters.getValue <int>("WindowLeft"); windowTop = parameters.getValue <int>("WindowTop"); windowWidth = parameters.getValue <int>("WindowWidth"); windowHeight = parameters.getValue <int>("WindowHeight"); windowRedrawFreqMax = parameters.getValue <int>("WindowRedrawFreqMax"); windowBackgroundColor = parameters.getValue <RGBColorFloat>("WindowBackgroundColor"); // transfer task specific values stimuli = parameters.getValue <string[][]>("Stimuli"); stimuliSequence = parameters.getValue <int[]>("StimuliSequence"); numberOfRepetitions = parameters.getValue <int>("NumberOfRepetitions"); firstSequenceWait = parameters.getValueInSamples("FirstSequenceWait"); betweenSequenceWait = parameters.getValueInSamples("BetweenSequenceWait"); startText = parameters.getValue <string>("StartText"); waitText = parameters.getValue <string>("WaitText"); endText = parameters.getValue <string>("EndText"); // PARAMETER CHECK // TODO: parameters.checkminimum, checkmaximum // check if stimuli are defined if (stimuli.Length != 4) { logger.Error("Stimuli not defined (correctly)."); return(false); } else { // if stimuli are defined, check if duration is defined for each stimulus for (int i = 0; i < stimuli[3].Length; i++) { if (string.IsNullOrEmpty(stimuli[3][i]) || stimuli[3][i] == " ") { logger.Error("Timing of stimulus " + (i + 1).ToString() + " is not defined."); return(false); } else { // if timing is defined, see if it is parsable to integer int timing = 0; if (!int.TryParse(stimuli[3][i], out timing)) { logger.Error("The timing given for stimulus " + (i + 1).ToString() + " (\"" + stimuli[3][i] + "\") is not a valid value, should be a positive integer."); return(false); } // if timing is parsable, check if larger than 0 else if (timing <= 0) { logger.Error("The timing given for stimulus " + (i + 1).ToString() + " (" + stimuli[3][i] + ") is too short. The value should be a positive integer."); return(false); } } } } // check if stimulus sequence is defined if (stimuliSequence.Length <= 0) { logger.Error("No stimuli sequence given."); return(false); } // determine maximal stimulus defined in stimulus sequence int stimMax = 0; for (int i = 0; i < stimuliSequence.Length; i++) { if (stimuliSequence[i] > stimMax) { stimMax = stimuliSequence[i]; } } // check if there are stimuli defined that are not included in stimuli definition if (stimMax > stimuli[0].Length) { logger.Error("In stimuli sequence, stimulus " + stimMax + " is defined. This stimulus can not be found in stimuli definition, as there are only " + stimuli[0].Length + " stimuli defined."); return(false); } // check if amount of repetitions is higher than 0 if (numberOfRepetitions <= 0) { logger.Error("Amount of repetitions should be a positive integer."); return(false); } // check if first sequence wait is not smaller than 0 if (firstSequenceWait < 0) { logger.Error("The time to wait before the start of the first sequence can not be lower than 0."); return(false); } // check if sequence wait is not smaller than 0 if (betweenSequenceWait < 0) { logger.Error("The time to wait before the start of the subsequent sequence can not be lower than 0."); return(false); } // view checks if (windowRedrawFreqMax < 0) { logger.Error("The maximum window redraw frequency can be no smaller then 0"); return(false); } if (windowWidth < 1) { logger.Error("The window width can be no smaller then 1"); return(false); } if (windowHeight < 1) { logger.Error("The window height can be no smaller then 1"); return(false); } return(true); }
public bool setValue(RGBColorFloat value) { this.value = value; return(true); }