예제 #1
0
        /// <summary>
        /// Neurorighter's stimulus/generic output server. Used in open-loop and closed-loop experiments where just-in-time buffering of output signals is required.
        /// </summary>
        /// <param name="INNERBUFFSIZE"> The size of one half of the double output buffer in samples</param>
        /// <param name="STIM_SAMPLING_FREQ">The DAC sampling frequency in Hz for all forms of output</param>
        /// <param name="masterTask">The NI Task to which all of the output clocks are synchronized to</param>
        /// <param name="debugger"> NR's real-time debugger</param>
        /// <param name="robust">used to determine if the StimServer will be recover from failures</param>
        internal StimSrv(int INNERBUFFSIZE, int STIM_SAMPLING_FREQ, Task masterTask, Logger debugger, bool robust)
        {
            this.masterTask         = masterTask;
            this.INNERBUFFSIZE      = INNERBUFFSIZE;
            this.STIM_SAMPLING_FREQ = STIM_SAMPLING_FREQ;
            int sampblanking   = 2;
            int queueThreshold = -1;//no queue thresholds for closed loop

            //create buffers
            auxOut     = new AuxBuffer(INNERBUFFSIZE, STIM_SAMPLING_FREQ, queueThreshold, robust);
            digitalOut = new DigitalBuffer(INNERBUFFSIZE, STIM_SAMPLING_FREQ, queueThreshold, robust);
            auxOut.grabPartner(digitalOut);
            digitalOut.grabPartner(auxOut);
            stimOut       = new StimBuffer(INNERBUFFSIZE, STIM_SAMPLING_FREQ, sampblanking, queueThreshold, robust);
            this.debugger = debugger;

            this.sampleFrequencyHz       = Convert.ToDouble(STIM_SAMPLING_FREQ);
            this.dacPollingPeriodSec     = Properties.Settings.Default.DACPollingPeriodSec;
            this.dacPollingPeriodSamples = Convert.ToInt32(dacPollingPeriodSec * STIM_SAMPLING_FREQ);
        }
예제 #2
0
 internal void grabPartner(AuxBuffer analogBuffer)//different from the analog buffer version!
 {
     this.analogBuffer  = analogBuffer;
     recoveryInProgress = analogBuffer.recoveryInProgress;
 }