当前位置: 首页>>代码示例>>C++>>正文


C++ clock_delay函数代码示例

本文整理汇总了C++中clock_delay函数的典型用法代码示例。如果您正苦于以下问题:C++ clock_delay函数的具体用法?C++ clock_delay怎么用?C++ clock_delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clock_delay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: oggread_resume

    /* resume file reading */               
static void oggread_resume(t_oggread *x)
{
    if(x->x_fd > 0)
	{
		x->x_stream = 1;
		clock_delay(x->x_clock, 0);
		post("oggread~: RESUME");
	}
	else post("oggread~: encoder not initialised");
}
开发者ID:adhikasigit,项目名称:ProjectKP,代码行数:11,代码来源:oggread-.c

示例2: record_tick

static void record_tick(t_record *x)
{
    double timesince = clock_gettimesince(x->x_clocklasttick);
    if (timesince >= RECORD_REDRAWPAUSE)
    {
	arsic_redraw((t_arsic *)x);
	x->x_clocklasttick = clock_getlogicaltime();
    }
    else clock_delay(x->x_clock, RECORD_REDRAWPAUSE - timesince);
}
开发者ID:amurtet,项目名称:pd-cyclone,代码行数:10,代码来源:record.c

示例3: xeqithook_autodelay

static void xeqithook_autodelay(t_xeqit *it, int argc, t_atom *argv)
{
    t_xeq *x = (t_xeq *)it->i_owner;
    if (x->x_clock)
    {
	clock_delay(x->x_clock,
		    x->x_clockdelay = it->i_playloc.l_delay * x->x_tempo);
	x->x_whenclockset = clock_getsystime();
    }
}
开发者ID:pure-data,项目名称:xeq,代码行数:10,代码来源:xeq.c

示例4: beep_beep

/*-----------------------------------------------------------------------------------*/
void
beep_beep(int i)
{
  if(onoroff == ON) {
    /* Beep. */
    P2OUT |= BEEPER_BIT;
    clock_delay(i);
    P2OUT &= ~BEEPER_BIT;
  }
}
开发者ID:CaptFrank,项目名称:contiki-stm32w,代码行数:11,代码来源:beep.c

示例5: error

static void *tcpclient_child_connect(void *w)
{
    t_tcpclient         *x = (t_tcpclient*) w;
    struct sockaddr_in  server;
    struct hostent      *hp;
    int                 sockfd;

    if (x->x_fd >= 0)
    {
        error("%s_child_connect: already connected", objName);
        return (x);
    }

    /* create a socket */
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
#ifdef DEBUG
    post("%s: send socket %d\n", objName, sockfd);
#endif
    if (sockfd < 0)
    {
        sys_sockerror("tcpclient: socket");
        return (x);
    }
    /* connect socket using hostname provided in command line */
    server.sin_family = AF_INET;
    hp = gethostbyname(x->x_hostname);
    if (hp == 0)
    {
        sys_sockerror("tcpclient: bad host?\n");
        return (x);
    }
    memcpy((char *)&server.sin_addr, (char *)hp->h_addr, hp->h_length);

    /* assign client port number */
    server.sin_port = htons((u_short)x->x_port);

    if (x->x_verbosity) post("%s: connecting socket %d to port %d", objName, sockfd, x->x_port);
    /* try to connect */
    if (connect(sockfd, (struct sockaddr *) &server, sizeof (server)) < 0)
    {
        sys_sockerror("tcpclient: connecting stream socket");
        sys_closesocket(sockfd);
        return (x);
    }
    x->x_fd = sockfd;
    x->x_addr = ntohl(*(long *)hp->h_addr);
    /* outlet_float is not threadsafe ! */
    // outlet_float(x->x_obj.ob_outlet, 1);
    x->x_connectstate = 1;
    x->x_blocked = 0;
    /* use callback instead to set outlet */
    clock_delay(x->x_clock, 0);
    return (x);
}
开发者ID:kmatheussen,项目名称:libpd,代码行数:54,代码来源:tcpclient.c

示例6: blink_LEDs

// 1/16th second LED blink.
void blink_LEDs(unsigned char ledv) {
	unsigned char current_leds;	
	current_leds = leds_get();
	leds_on(ledv);
	clock_delay(125);
	if(current_leds == LEDS_RED) {
		leds_off(ledv & (~LEDS_RED));
	} else {
		leds_off(ledv);
	}
}
开发者ID:beaucha3,项目名称:contikiV,代码行数:12,代码来源:cusum-seq.c

示例7: cc2420_init

/*---------------------------------------------------------------------------*/
void
cc2420_init(void)
{
  uint16_t reg;
  {
    int s = splhigh();
    cc2420_arch_init();		/* Initalize ports and SPI. */
    DISABLE_FIFOP_INT();
    FIFOP_INT_INIT();
    splx(s);
  }

  /* Turn on voltage regulator and reset. */
  SET_VREG_ACTIVE();
  //clock_delay(250); OK
  SET_RESET_ACTIVE();
  clock_delay(127);
  SET_RESET_INACTIVE();
  //clock_delay(125); OK


  /* Turn on the crystal oscillator. */
  strobe(CC2420_SXOSCON);

  /* Turn off automatic packet acknowledgment. */
  reg = getreg(CC2420_MDMCTRL0);
  reg &= ~AUTOACK;
  setreg(CC2420_MDMCTRL0, reg);

  /* Turn off address decoding. */
  reg = getreg(CC2420_MDMCTRL0);
  reg &= ~ADR_DECODE;
  setreg(CC2420_MDMCTRL0, reg);

  /* Change default values as recomended in the data sheet, */
  /* correlation threshold = 20, RX bandpass filter = 1.3uA. */
  setreg(CC2420_MDMCTRL1, CORR_THR(20));
  reg = getreg(CC2420_RXCTRL1);
  reg |= RXBPF_LOCUR;
  setreg(CC2420_RXCTRL1, reg);
  
  /* Set the FIFOP threshold to maximum. */
  setreg(CC2420_IOCFG0, FIFOP_THR(127));

  /* Turn off "Security enable" (page 32). */
  reg = getreg(CC2420_SECCTRL0);
  reg &= ~RXFIFO_PROTECTION;
  setreg(CC2420_SECCTRL0, reg);

  cc2420_set_pan_addr(0xffff, 0x0000, NULL);
  cc2420_set_channel(26);

  process_start(&cc2420_process, NULL);
}
开发者ID:kincki,项目名称:contiki,代码行数:55,代码来源:cc2420.c

示例8: pipe_list

static void pipe_list(t_pipe *x, t_symbol *s, int ac, t_atom *av)
{
    t_hang *h = (t_hang *)
        getbytes(sizeof(*h) + (x->x_n - 1) * sizeof(*h->h_vec));
    t_gpointer *gp, *gp2;
    t_pipeout *p;
    int i, n = x->x_n;
    t_atom *ap;
    t_word *w;
    h->h_gp = (t_gpointer *)getbytes(x->x_nptr * sizeof(t_gpointer));
    if (ac > n)
    {
        if (av[n].a_type == A_FLOAT)
            x->x_deltime = av[n].a_w.w_float;
        else pd_error(x, "pipe: symbol or pointer in time inlet");
        ac = n;
    }
    for (i = 0, gp = x->x_gp, p = x->x_vec, ap = av; i < ac;
        i++, p++, ap++)
    {
        switch (p->p_atom.a_type)
        {
        case A_FLOAT: p->p_atom.a_w.w_float = atom_getfloat(ap); break;
        case A_SYMBOL: p->p_atom.a_w.w_symbol = atom_getsymbol(ap); break;
        case A_POINTER:
            gpointer_unset(gp);
            if (ap->a_type != A_POINTER)
                pd_error(x, "pipe: bad pointer");
            else
            {
                *gp = *(ap->a_w.w_gpointer);
                if (gp->gp_stub) gp->gp_stub->gs_refcount++;
            }
            gp++;
        default: break;
        }
    }
    for (i = 0, gp = x->x_gp, gp2 = h->h_gp, p = x->x_vec, w = h->h_vec;
        i < n; i++, p++, w++)
    {
        if (p->p_atom.a_type == A_POINTER)
        {
            if (gp->gp_stub) gp->gp_stub->gs_refcount++;
            w->w_gpointer = gp2;
            *gp2++ = *gp++;
        }
        else *w = p->p_atom.a_w;
    }
    h->h_next = x->x_hang;
    x->x_hang = h;
    h->h_owner = x;
    h->h_clock = clock_new(h, (t_method)hang_tick);
    clock_delay(h->h_clock, (x->x_deltime >= 0 ? x->x_deltime : 0));
}
开发者ID:porres,项目名称:pure-data,代码行数:54,代码来源:x_time.c

示例9: imagebang_bang

static void imagebang_bang(t_imagebang *x)
{
	
	t_glist* glist = glist_getcanvas(x->glist);
    if(x->flashing) {
		sys_vgui(".x%lx.c itemconfigure %lximage -image %lx_imagebang \n", glist, x,x->image_a);
        clock_delay(x->clock_brk, x->clockbrk);
        //x->flashed = 1;
    } else  {
		sys_vgui(".x%lx.c itemconfigure %lximage -image %lx_imagebang \n", glist, x,x->image_b);
        x->flashing = 1;
        
    }
    clock_delay(x->clock_flash, x->clockflash);
    
    outlet_bang(x->outlet);
    
    if(x->send && x->send->s_thing ) pd_bang(x->send->s_thing);
    
}
开发者ID:electrickery,项目名称:pd-tof,代码行数:20,代码来源:imagebang.c

示例10: magicGlass_updateText

void magicGlass_updateText(t_magicGlass *x, int moved)
{
	//fprintf(stderr,"magicglass_updateText\n");
    int bgSize;
	x->x_display_font = sys_hostfontsize(glist_getfont(x->x_c));

    if (x->x_visible)
    {
		if (!moved) {
			char *color;
			if (x->x_issignal || strcmp(x->x_old_string, x->x_string)) {
				color = "#ffffff";
			}
			else {
				color = "#e87216";
				clock_delay(x->x_flashClock, MG_CLOCK_FLASH_DELAY);
			}
		    sys_vgui(".x%x.c itemconfigure magicGlassText -text {%s} -fill %s -font {{%s} -%d %s}\n",
		            x->x_c,
		            x->x_string,
					color,
					sys_font, x->x_display_font, sys_fontweight);
		} else {
		    sys_vgui(".x%x.c itemconfigure magicGlassText -text {%s}\n",
		            x->x_c,
		            x->x_string);
		}

        if (strlen(x->x_string) > 0)
        {
			if (strlen(x->x_string) > x->x_maxSize) x->x_maxSize = strlen(x->x_string);
        }
		bgSize = x->x_x + (sys_fontwidth(x->x_display_font) * x->x_maxSize) + 26;
		//fprintf(stderr,"%d %d %d : %d %d\n", sys_fontheight(x->x_display_font), sys_fontwidth(x->x_display_font), x->x_maxSize, x->x_x, bgSize);
        sys_vgui(".x%x.c coords magicGlassText %d %d\n",
                 x->x_c,
                 x->x_x + 20,
                 x->x_y);
        sys_vgui(".x%x.c coords magicGlassLine %d %d %d %d %d %d\n",
                 x->x_c,
                 x->x_x + 8,
                 x->x_y,
                 x->x_x + 13,
                 x->x_y + 5,
                 x->x_x + 13,
                 x->x_y - 5);
        sys_vgui(".x%x.c coords magicGlassBg %d %d %d %d\n",
                 x->x_c,
                 x->x_x + 13,
                 x->x_y - (int)(sys_fontheight(x->x_display_font)/2) - 3,
                 bgSize,
                 x->x_y + (int)(sys_fontheight(x->x_display_font)/2) + 3);
    }
}
开发者ID:morast,项目名称:pd,代码行数:54,代码来源:g_magicglass.c

示例11: udmx_list

//----------------------------------------------------------------------------------------------------------------
// udmx_list: 	a list received in the main inlet
//
// 				update dmx buffer, send immediately if we can
//----------------------------------------------------------------------------------------------------------------
void udmx_list(t_udmx *x, t_symbol *s, short ac, t_atom *av) {
    
    t_uint16 i,chan,val,change_min,change_max;
    change_min = 512;
    change_max = 0;
    
    for(i=0; i<ac; ++i,av++) {
        
        
#ifdef PUREDATA   	// compiling for PUREDATA
        if (av->a_type==A_FLOAT)	val = av->a_w.w_float;
        else val = 0;
        if (val > 255) val = 255;
        if (val < 255) val = 0;
        
#else				// compiling for MaxMSP
        if (av->a_type==A_LONG)	val = MIN(MAX(av->a_w.w_long, 0), 255);
        else  if (av->a_type==A_FLOAT) {
         val = MIN(MAX(av->a_w.w_float * 255., 0), 255);
        }
        else val = 0;
#endif				// Max/PD switch
        
        
        chan = x->channel+i;
        
        if (val != x->dmx_buffer[chan]) {
            x->dmx_buffer[chan] = val;
            if (change_min > chan) change_min = chan;
            if (change_max < chan) change_max = chan;
        }
    }
    
    if (change_min > change_max) return;	// if there are no changes do nothing
    
    if (x->clock_running) { 				// we're over the speed limit, track changes for later
        if (change_min < x->channel_changed_min)  	x->channel_changed_min = change_min;
        if (change_max > x->channel_changed_max) 	x->channel_changed_max = change_max;
        
    } else {
        if (change_max - change_min) udmx_send_range(x,change_min,change_max);
        else udmx_send_single (x,change_min);
        
        if (x->speedlim) {
            // start clock -> prevent sending over speed limit
#ifdef PUREDATA   	// compiling for PUREDATA
            clock_delay(x->m_clock,x->speedlim);
#else				// compiling for MaxMSP
            clock_fdelay(x->m_clock,x->speedlim);
#endif				// Max/PD switch			x->clock_running  = 1;
        }
        
    }
}
开发者ID:binaryDNA--while1-program,项目名称:udmxNoSleep,代码行数:59,代码来源:udmx.c

示例12: bang_output

void bang_output(t_bang *x, t_symbol* s, long argc, t_atom* argv)
{
    x->f_active = 1;
    ebox_invalidate_layer((t_ebox *)x, gensym("background_layer"));
    ebox_redraw((t_ebox *)x);
    outlet_bang(x->f_out);
    if(ebox_getsender((t_ebox *) x))
        pd_bang(ebox_getsender((t_ebox *) x));
    
    clock_delay(x->f_clock, 100);
}
开发者ID:rvega,项目名称:CicmWrapper,代码行数:11,代码来源:c.bang.cpp

示例13: testsample_perform64

void testsample_perform64(t_testsample *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam)
{
	if (x->x_vectorcountdown) {
		x->x_vectorcountdown--;
		return;
	}
	if (!x->x_hasrun) {
		memcpy(x->x_samples, ins[0]+x->x_offset, sizeof(t_double) * x->x_samplecount);		
		clock_delay(x->x_clock, 0);
		x->x_hasrun = true;
	}
}
开发者ID:AlvaroBuitrago,项目名称:max-test,代码行数:12,代码来源:test.sample~.c

示例14: my_set_channel

// Set the channel fast and discard the first wrong readings
void my_set_channel(int ch)
{
  int k, temp;
  SPI_SETCHANNEL_SUPERFAST(357+((ch-11)*5)); // Approx. 292 us
  // Discard first 16 bad readings
  CC2420_SPI_ENABLE();
  for (k=0; k<=16; k++) {
    MY_FASTSPI_GETRSSI(temp);
  }
  clock_delay(1);
  CC2420_SPI_DISABLE();
}
开发者ID:EDAyele,项目名称:Mobilty_Interference_Plugin_Patch_Contiki2.7,代码行数:13,代码来源:interferer_settings.c

示例15: while

t_int *centroid_perform(t_int *w) {

	t_float *in = (t_float *)(w[1]);
	t_centroid *x = (t_centroid *)(w[2]);
	t_int n = (int)(w[3]);

	t_int *myintin = (t_int *)in;
	t_int *myintBuf1 = (t_int *)(x->Buf1);
	t_int *myintBuf2 = (t_int *)(x->Buf2);
	t_int *myintBufFFT = (t_int *)(x->BufFFT);
	t_int i, index = 0, cpt = n, maxindex;
	t_int overlapindex = x->BufSize - x->c_overlap;
	t_float *TmpBuf = x->Buf1;
			
	// Copy input samples into FFT buffer	
	while ((x->BufWritePos < x->BufSize) && (cpt > 0)) {
		myintBuf1[x->BufWritePos] = myintin[index];
		x->BufWritePos++;
		index++;
		cpt--;
	}
	
	// When Buffer is full...
	if (x->BufWritePos >= x->BufSize) {
			
		// Save overlapping samples into Buffer 2
		for (i=0; i<x->c_overlap; ++i) 
			myintBuf2[i] = myintBuf1[overlapindex+i];

		maxindex = n - index + x->c_overlap;

		// Copy the rest of incoming samples into Buffer 2
		for (i=x->c_overlap; i<maxindex; ++i) {
			myintBuf2[i] = myintin[index];
			index++;
		}
		
		x->BufWritePos = maxindex;
										
		// Make a copy of Buffer 1 into Buffer FFT for computation outside the perform function
		for (i=0; i<x->BufSize; ++i) 
			myintBufFFT[i] = myintBuf1[i];

		// Go for the FFT outside the perform function with a delay of 0 ms!
		clock_delay(x->c_clock,0);
		
		// Swap buffers
		x->Buf1 = x->Buf2;
		x->Buf2 = TmpBuf;
	}

	return (w+4);
}
开发者ID:CNMAT,项目名称:CNMAT-Externs,代码行数:53,代码来源:centroid~.c


注:本文中的clock_delay函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。