Exemplo n.º 1
0
        StreamReader olstimfile; // The stream reader for the .olstim file being used

        #endregion Fields

        #region Constructors

        //internal File2Stim(string stimfile, int STIM_SAMPLING_FREQ, Int32 BUFFSIZE, Task stimDigitalTask,
        //    Task stimAnalogTask, Task buffLoadTask, DigitalSingleChannelWriter stimDigitalWriter,
        //    AnalogMultiChannelWriter stimAnalogWriter, Logger debugger)
        //{
        //    this.stimfile = stimfile;
        //    //Get references to tasks
        //    this.BUFFSIZE = BUFFSIZE;
        //    this.stimDigitalTask = stimDigitalTask;
        //    this.stimAnalogTask = stimAnalogTask;
        //    this.buffLoadTask = buffLoadTask;
        //    this.stimDigitalWriter = stimDigitalWriter;
        //    this.stimAnalogWriter = stimAnalogWriter;
        //    this.STIM_SAMPLING_FREQ = STIM_SAMPLING_FREQ;
        //    this.debugger = debugger;
        //    stimbuff = new StimBuffer(BUFFSIZE, STIM_SAMPLING_FREQ, 2, numStimPerLoad);
        //}
        internal File2Stim(string stimfile, int STIM_SAMPLING_FREQ, Int32 BUFFSIZE, Task buffLoadTask, Task masterTask, string masterLoad, Logger debugger, double[] cannedWave, bool robust)
        {
            this.stimfile = stimfile;

            //Get references to tasks
            this.BUFFSIZE = BUFFSIZE;

            this.buffLoadTask = buffLoadTask;
            this.masterTask = masterTask;
            this.masterLoad = masterLoad;
            this.STIM_SAMPLING_FREQ = STIM_SAMPLING_FREQ;
            this.cannedWaveform = cannedWave;
            this.debugger = debugger;

            stimbuff = new StimBuffer(BUFFSIZE, STIM_SAMPLING_FREQ, 2, numStimPerLoad,robust);
        }
Exemplo n.º 2
0
        //internal File2Stim(string stimfile, int STIM_SAMPLING_FREQ, Int32 BUFFSIZE, Task stimDigitalTask,
        //    Task stimAnalogTask, Task buffLoadTask, DigitalSingleChannelWriter stimDigitalWriter,
        //    AnalogMultiChannelWriter stimAnalogWriter, Logger debugger)
        //{

        //    this.stimfile = stimfile;

        //    //Get references to tasks
        //    this.BUFFSIZE = BUFFSIZE;
        //    this.stimDigitalTask = stimDigitalTask;
        //    this.stimAnalogTask = stimAnalogTask;
        //    this.buffLoadTask = buffLoadTask;
        //    this.stimDigitalWriter = stimDigitalWriter;
        //    this.stimAnalogWriter = stimAnalogWriter;
        //    this.STIM_SAMPLING_FREQ = STIM_SAMPLING_FREQ;
        //    this.debugger = debugger;

        //    stimbuff = new StimBuffer(BUFFSIZE, STIM_SAMPLING_FREQ, 2, numStimPerLoad);
        //}

        internal File2Stim(string stimfile, int STIM_SAMPLING_FREQ, Int32 BUFFSIZE, Task buffLoadTask, Task masterTask, string masterLoad, Logger debugger, double[] cannedWave, bool robust)
        {
            this.stimfile = stimfile;

            //Get references to tasks
            this.BUFFSIZE = BUFFSIZE;

            this.buffLoadTask       = buffLoadTask;
            this.masterTask         = masterTask;
            this.masterLoad         = masterLoad;
            this.STIM_SAMPLING_FREQ = STIM_SAMPLING_FREQ;
            this.cannedWaveform     = cannedWave;
            this.debugger           = debugger;

            stimbuff = new StimBuffer(BUFFSIZE, STIM_SAMPLING_FREQ, 2, numStimPerLoad, robust);
        }
Exemplo n.º 3
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);
        }