Пример #1
0
byte ADCMeasureAll(byte Wait)
{
  if (State != STOP) {               
    return 1;                  
  }
  State = RUN;;                  
  ChannelIndex = 0;                       
  ZeroSamples();                         
  ADCSC1 = ChannelCodes[ChannelIndex];        

  if (Wait) 
  {                 
    while (State == RUN) 
    	;     
  }
  
  return 0;                       
}
Пример #2
0
    virtual void CbSignal()
    {
        int c = CntOutSig(),rc;

        if(stream) {
            int sc = stream->getChannels();
            rc = c < sc?c:sc;
            if(rc) 
                stream->doGet(rc,OutSig(),Blocksize(),Samplerate());
            else
                stream->doWakeup();
        }
        else 
            rc = 0;

        // clear remaining channels
        while(rc < c) ZeroSamples(OutSig(rc++),Blocksize());
    }
Пример #3
0
	virtual V m_bang() 
	{ 
		if(!ref.Ok() || !ref.Check()) {
/*
			if(!frms) 
				post("%s - No length defined!",thisName());
			else 
*/
			{
				ImmBuf ibuf(frms,zero);
				Vasp ret(frms,Vasp::Ref(ibuf));
                ToOutVasp(0,ret);
			}
		}
		else if(ref.Vectors() > 1) 
			post("%s - More than one vector in vasp!",thisName());
		else {
			VBuffer *buf = ref.Buffer(0);
			const I len = buf->Length(),chns = buf->Channels();

			// size of memory reservation (at least frms samples)
			const I rlen = frms > len?frms:len; 
			
			ImmBuf imm(rlen,false);

			BS *dst = imm.Pointer();
			const BS *src = buf->Pointer();

//			post("!copy: src: %p,%i,%i -> dst: %p,%i",src,len,chns,dst,rlen);

			register int i;
			_DE_LOOP(i,len, ( dst[i] = *src,src += chns ) )
			if(zero && rlen > len) ZeroSamples(dst+len,rlen-len);

			Vasp::Ref vr(imm);

//			post("!vr: %s,%i",vr.Ok()?vr.Symbol().Name():"***",vr.Offset());

			Vasp ret(len,vr);
			ToOutVasp(0,ret);

            delete buf;
		}
	}