int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i++)
    {
        general[i] = i;
        scanf("%d", &soldier[i]);
    }
    for(int i = 1; i <= m; i++)
    {
        int a, b, ga, gb;
        scanf("%d%d", &a, &b);
        ga = root(a);
        gb = root(b);
        if(ga != gb)
        {
            if(soldier[ga] > soldier[gb] || (soldier[ga] == soldier[gb] && ga < gb))
            {
                beat(ga, gb);
                printf("%d\n", ga);
                soldier[ga] += soldier[gb]/2;
                soldier[gb] /= 2;
            }
            else if(soldier[ga] < soldier[gb] || (soldier[ga] == soldier[gb] && ga > gb))
            {
                beat(gb, ga);
                printf("%d\n", gb);
                soldier[gb] += soldier[ga]/2;
                soldier[ga] /= 2;
            }
        }
        else printf("-1\n");
    }
}
Beispiel #2
0
QDSHeartBeat::QDSHeartBeat( const QString& channel, QObject* parent )
:   QObject( parent ),
    mChannel( channel ),
    mTimer( 0 )
{
    mTimer = new QTimer( this );
    connect( mTimer, SIGNAL(timeout()), this, SLOT(beat()) );
    mTimer->start( QDS::SERVERING_HEARTBEAT_PERIOD );
    beat();
}
Beispiel #3
0
const QDSHeartBeat& QDSHeartBeat::operator=( const QDSHeartBeat& other )
{
    if (&other != this) {
        mChannel = other.mChannel;
        
        delete mTimer;
        if (other.mTimer != 0) {
            mTimer = new QTimer( this );
            connect( mTimer, SIGNAL(timeout()), this, SLOT(beat()) );
            mTimer->start( QDS::SERVERING_HEARTBEAT_PERIOD );
            beat();
        }
    }

    return *this;
}
    void initialize(void*)
    {
        _loop = 0;

        _proxyCounter = 0;

        _group = create_group();

        lemon::timer_t timer;

        for(size_t i =0; i < maxTaxis; ++ i)
        {
            _taxis.push_back(iTaxi::create(runQ(),&_group));
        }

        time_duration duration = timer.duration();

        std::cout << "create taxis (" << _taxis.size() << ")"

                  << " -- success(" << duration / 10000000 << "."

                  << std::setw(6) << std::setfill('0') <<(duration % 10000000) / 10

                  << " s)" << std::endl;

        beat();
    }
    void recv(lemon_job_id , mutable_buffer)
    {
        ++ _responses;

        //free(buf);

        if(_taxis.size() == _responses)
        {
            time_duration duration = _timer.duration();

            std::cout << "recv taxi heart beat (" << _responses << ")"

                      << " -- success(" << duration / 10000000 << "."

                      << std::setw(6) << std::setfill('0') <<(duration % 10000000) / 10

                      << " s)" << std::endl;

            ++ _loop;

            if(_loop == maxLoop) {

                start_timer(2000);
                return;
            }

            beat();

        }
    }
Beispiel #6
0
static void heartbeat_handler(struct btstack_timer_source *ts){
    if (le_notification_enabled) {
        beat();
        att_server_request_can_send_now_event(con_handle);
    }
    btstack_run_loop_set_timer(ts, HEARTBEAT_PERIOD_MS);
    btstack_run_loop_add_timer(ts);
} 
Beispiel #7
0
void MasterTimer::timerTick()
{
    Doc* doc = qobject_cast<Doc*> (parent());
    Q_ASSERT(doc != NULL);

#ifdef DEBUG_MASTERTIMER
    qDebug() << "[MasterTimer] *********** tick:" << ticksCount++ << "**********";
#endif

    switch (m_beatSourceType)
    {
        case Internal:
        {
            int elapsedTime = qRound((double)m_beatTimer->nsecsElapsed() / 1000000) + m_lastBeatOffset;
            //qDebug() << "Elapsed beat:" << elapsedTime;
            if (elapsedTime >= m_beatTimeDuration)
            {
                // it's time to fire a beat
                m_beatRequested = true;

                // restart the time for the next beat, starting at a delta
                // milliseconds, otherwise it will generate an unpleasant drift
                //qDebug() << "Elapsed:" << elapsedTime << ", delta:" << elapsedTime - m_beatTimeDuration;
                m_lastBeatOffset = elapsedTime - m_beatTimeDuration;
                m_beatTimer->restart();

                // inform the listening classes that a beat is happening
                emit beat();
            }
        }
        break;
        case External:
        break;

        case None:
        default:
            m_beatRequested = false;
        break;
    }

    QList<Universe *> universes = doc->inputOutputMap()->claimUniverses();
    for (int i = 0 ; i < universes.count(); i++)
    {
        universes[i]->flushInput();
        universes[i]->zeroIntensityChannels();
        universes[i]->zeroRelativeValues();
    }

    timerTickFunctions(universes);
    timerTickDMXSources(universes);
    timerTickFader(universes);

    doc->inputOutputMap()->releaseUniverses();
    doc->inputOutputMap()->dumpUniverses();

    m_beatRequested = false;
}
int btstack_main(void)
{

    // register for HCI events
    hci_event_callback_registration.callback = &packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);

    l2cap_init();

    rfcomm_init();
    rfcomm_register_service(packet_handler, RFCOMM_SERVER_CHANNEL, 0xffff);

    // init SDP, create record for SPP and register with SDP
    sdp_init();
    memset(spp_service_buffer, 0, sizeof(spp_service_buffer));
    spp_create_sdp_record(spp_service_buffer, 0x10001, RFCOMM_SERVER_CHANNEL, "SPP Counter");
    sdp_register_service(spp_service_buffer);
    printf("SDP service record size: %u\n", de_get_len(spp_service_buffer));

    gap_set_local_name("SPP and LE Counter 00:00:00:00:00:00");
    gap_ssp_set_io_capability(SSP_IO_CAPABILITY_DISPLAY_YES_NO);
    gap_discoverable_control(1);

    // setup le device db
    le_device_db_init();

    // setup SM: Display only
    sm_init();

    // setup ATT server
    att_server_init(profile_data, att_read_callback, att_write_callback);    
    att_server_register_packet_handler(packet_handler);

    // set one-shot timer
    heartbeat.process = &heartbeat_handler;
    btstack_run_loop_set_timer(&heartbeat, HEARTBEAT_PERIOD_MS);
    btstack_run_loop_add_timer(&heartbeat);

    // setup advertisements
    uint16_t adv_int_min = 0x0030;
    uint16_t adv_int_max = 0x0030;
    uint8_t adv_type = 0;
    bd_addr_t null_addr;
    memset(null_addr, 0, 6);
    gap_advertisements_set_params(adv_int_min, adv_int_max, adv_type, 0, null_addr, 0x07, 0x00);
    gap_advertisements_set_data(adv_data_len, (uint8_t*) adv_data);
    gap_advertisements_enable(1);

    // beat once
    beat();

    // turn on!
	hci_power_control(HCI_POWER_ON);
	    
    return 0;
}
Beispiel #9
0
Heartbeat::Heartbeat(QObject *parent)
	: QObject(parent),
	m_advertiser(true)
{
	QTimer *timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), SLOT(beat()));
	timer->start(3000);
	
	QTimer *timer2 = new QTimer(this);
	connect(timer2, SIGNAL(timeout()), SLOT(reset()));
	timer2->start(10000);
}
Beispiel #10
0
void handle_run_click( ClickRecognizerRef recognizer,
                       Window* win )
{
   running = ! running;
   text_layer_set_text( &run_layer, ( running ? "stop" : "start" ) );
   
   if( running ) {
      num_beats = 0;
      beat();
   } else {
      app_timer_cancel_event( my_ctx, beat_timer );
   }
}
Beispiel #11
0
complex EnergyToBeat::transform_fwd (Seconds time, float energy)
{
  float dt = max(1e-8f, time - m_time);
  m_time = time;
  float fast_rate = 1.0f - expf(-m_max_tempo_hz * dt);
  float slow_rate = 1.0f - expf(-m_min_tempo_hz * dt);

  float old_pos_mean = m_pos_mean;
  float old_pos = m_pos;
  float new_pos = powf(max(0.0f, energy), -1/3.0f);
  float pos_mean = old_pos_mean + slow_rate * (new_pos - old_pos_mean);
  float pos = old_pos + fast_rate * (new_pos - old_pos_mean - old_pos);
  m_pos = pos;

  float old_vel = m_vel;
  float new_vel = (pos - old_pos) / dt;
  float vel = old_vel + fast_rate * (new_vel - old_vel);
  m_vel = vel;

  float old_acc = m_acc;
  float new_acc = (vel - old_vel) / dt;
  float acc = old_acc + fast_rate * (new_acc - old_acc);
  m_acc = acc;

  // Version 1: exact for sinusoids
  //float beat_real_absval = sqrtf(max(0.0f, -pos * acc));
  // Version 2: continuous
  float beat_real_absval = sqrtf(fabsf(pos * acc));

  float beat_real_sign = ( pos / sqrtf(m_pos_variance)
                        - acc / sqrtf(m_acc_variance)
                        ) / 2;
  complex beat(beat_real_absval * beat_real_sign, -vel);

  float old_norm = m_norm;
  float new_norm = norm(beat);
  float norm = old_norm + fast_rate * (new_norm - old_norm);
  m_norm = norm;

  beat /= sqrtf(norm);

  m_mutex.lock();
  m_pos_mean = pos_mean;
  m_pos_variance += slow_rate * (sqr(pos - m_pos_mean) - m_pos_variance);
  m_acc_variance += slow_rate * (sqr(acc) - m_acc_variance);
  m_mutex.unlock();

  return beat;
}
Beispiel #12
0
void picture_move()
{
  if(beat())
  {
   move = move +1;
   if (move > 2000)
   {
     move = 0;
   }
 
   draw_picture(move); 

  }
 
}
Beispiel #13
0
bool handle_beat_timeout( AppContextRef app_ctx,
                          AppTimerHandle handle,
                          uint32_t cookie )
{
   if( handle == beat_timer ) {
      beat();
   } else if( handle == clear_beat_timer ) {
      draw_beat = 0;
      layer_mark_dirty( &visual_beat_layer );
   } else {
      return false;
   }

   return true;
}
Beispiel #14
0
void snake()
{
   if (beat())
   {
      int vol = volume();
      move_back(0);
      int amount = (float)vol/600 * 8;
      int length = (float)vol/600 * (float)num_panels* 16;
  
       for (int i = 0; i < length  ;i++)
       {
            picture[i][amount] =red;
       }
  
   }
  
}
Beispiel #15
0
void stargase()
{
  int mybeat = beat();
  int amount = 100;
  if (mybeat)
  {
    amount = 40;
  }
   for (int i =0; i < amount;i++)
  {
  
  
    picture[random(num_panels * 16)][random(8)] = getcolor(mybeat);
   
  
 }
  
}
void loop()
{
 
 volume();
 beat();
 current = (float)analogRead(2)/ (1024/ 8)+1;
// current = 8;
 
 
 switch (current)
   {
      case 1:
       stargase();
       break;
      case 2:
      vol_meter();
      break;
      case 3:
       vol_visual();
       break;
      case 4:
      picture_move();
      break;
      case 5:
      vol_wave();
      break;
      case 6:
      snake();
      break;
      case 7:
      snake2();
      break;
      case 8:
      matrix();
       break;
   }
   
  last_value = current;
 
  print();
}
Beispiel #17
0
void mikro_disko()
{
  clear_scr();
 
  if (beat())
  {
    move_mikro++;
    if (random(100) > 40)
    {
       stargase(); 
    }
  }
  for(int i=0;i < 48 * 8 ; i ++)
  {
    if (mikrodisko_text[i] == 1)
    {
     picture[3* 16 - i % 48+ move_mikro % 2][i / 48] = mikrodisko_text[i];
    }
}
  
 
}
void loop()
{

  timechk();

    volume();
    beat();
    int tmp_mode = system_mode;
    system_mode = (int)(float)analogRead(pot_one)/ (1024/ num_modes);
 

    if (num_modes ==system_mode)
    {
      system_mode = do_automatic_mode();
    }
     changed = system_mode != x_mode;
    x_mode = system_mode;
 
    
    printit = true;
    show_mode(system_mode);

 Serial.print(current_volume);
 Serial.print(' ');
 Serial.print(amount);
 Serial.print(' ');
Serial.println((int)running_vol_avg );
    
   
  
 
  if (printit)
  {
    print();
  }


}
Beispiel #19
0
void vol_wave()
{
   if (beat())
   {
  for (int x = 0; x < num_panels* 16; x ++)
   {
       int vol = analogRead(5)- 512;
       int amount = (float)vol / 600 * 8;
    for (int y = 0; y < 8;y++)
    {
  
      if (amount > y)  
      {
        picture[x][y] = red ;
      }
      else
      {
       picture[x][y] = black; 
      }
   }
   }
   }
}
Beispiel #20
0
//--------------------------------------------------------------
void testApp::draw()
{
    /////////////
    // ofxBeatTracking draw
    //////////
    char str[32];
	// 背景黒
	// ofBackground(0, 0, 0);
	// The value of the acquired FFT
    // Can be accessed as if bd.magnitude [i]
    // In the following we will draw the FFT to access in the form of bd.magnitude [i] the FFT obtained
   
	// Draw (column 1) the value of the FFT of the raw
    ofSetColor(155,155,75);
    for (int i = 1; i < (int)testApp_fft_size/2; i++){
        if(i % 16 == 0)
            ofSetColor(200,0,0);
        else
            ofSetColor(155,155,75);
		ofLine(10+(i*3),150,  10+(i*3),150-bd.magnitude[i]*10.0f);
        //printf("%f \n", magnitude_average[i]);
	}

    // Draw (column 1) the value of the FFT, which is averaged
    for (int i = (int)testApp_fft_size/2,b = 1; i<testApp_fft_size ; i++){
        if(i % 16 == 0)
            ofSetColor(200,0,0);
        else
            ofSetColor(155,155,75);
		ofLine(10+(b*3),300,  10+(b*3),300-bd.magnitude[i]*10.0f);
        b++;
        // printf("%f \n", magnitude_average[i]);
	}


    // averaged FFT (column 1)
    ofSetColor(134,113,89);
	for (int i = 1; i < (int)testApp_fft_size/2; i++){
        if(i % 16 == 0)
            ofSetColor(200,0,0);
        else
            ofSetColor(134,113,89);
		ofLine(10+(i*3),500,  10+(i*3),500-bd.magnitude_average[i]*10.0f);
	}
    // column 2
    for (int i = (int)testApp_fft_size/2,b = 1; i<testApp_fft_size ; i++){
        if(i % 16 == 0)
            ofSetColor(200,0,0);
        else
            ofSetColor(134,113,89);
		ofLine(10+(b*3),650,  10+(b*3),650-bd.magnitude_average[i]*10.0f);
        b++;
	}

    //ofSetColor(200,200,200);
	//for (int i = 1; i < (int)testApp_fft_size/2; i++){
	//	//ofLine(200+(i*4),200,200+(i*4),400-magnitude[i]*10.0f);
    //    //ofLine(10+(i*5.3),400,  10+(i*5.3),400-magnitude[i]*10.0f);
    //    sprintf(str, "%.0f", magnitude[i]);
    //    fbook.drawString(str,5+(i*7), 270);
    //    fbook.drawString(str,10+(i*5.3),250-magnitude[i]*10.0f);
    //}

    // ドラム音の検出
    if(drumVisible){
        if(bd.isBeatRange(0,2,2)){
            ofSetColor(255,0,0);
            ofRect(100,700,200,50);
            ofSetColor(0, 255, 0);
            ofDrawBitmapString("BASS!!",100,735);
        }else{
            ofSetColor(0,255,0);
            ofRect(100,700,200,50);
        }
    }

    // スネア音の検出
    if(snareVisible){
        if(bd.isBeatRange(12,18,4)){
            ofSetColor(255,0,0);
            ofRect(350,700,200,50);
            ofSetColor(0, 255, 0);
            ofDrawBitmapString("SNARE!!", 350, 735);
        }else{
            ofSetColor(0,255,0);
            ofRect(350,700,200,50);
        }
    }

    // ハイハット音の検出
    if(hihatVisible){
        if(bd.isBeatRange(27,31,3)){
            ofSetColor(255,0,0);
            ofRect(600,700,200,50);
            ofSetColor(0, 255, 0);
            ofDrawBitmapString("HiHat!!", 600, 735);
        }else{
            ofSetColor(0,255,0);
            ofRect(600,700,200,50);
        }
    }
    
    /////////////
    // Arduino Communication debug texts
    //////////
    
    // bgImage.draw(0,0);
       
    ofEnableAlphaBlending();
    ofSetColor(0, 0, 0, 127);
    ofRect(510, 15, 275, 150);
    ofDisableAlphaBlending();
    
    ofSetColor(255, 255, 255);
	if (!bSetupArduino){
		font.drawString("arduino not ready...\n", 515, 40);
		//ofDrawBitmapString("arduino not ready...\n", 515, 40);
	} else {
		font.drawString(potValue + "\n" + buttonState +
						"\nsending pwm: " + ofToString((int)(128 + 128 * sin(ofGetElapsedTimef()))), 515, 40);
		//ofDrawBitmapString(potValue + "\n" + buttonState +
		//				"\nsending pwm: " + ofToString((int)(128 + 128 * sin(ofGetElapsedTimef()))), 515, 40);
        
        ofSetColor(64, 64, 64);
        smallFont.drawString("If a servo is attached, use the left arrow key to rotate " 
                             "\ncounterclockwise and the right arrow key to rotate clockwise.", 200, 550);
        //ofDrawBitmapString("If a servo is attached, use the left arrow key to rotate " 
        //                     "\ncounterclockwise and the right arrow key to rotate clockwise.", 200, 550);
        ofSetColor(255, 255, 255);
	}
    
    // Move motor when beat is detected (bass & snare || bass & hihat)
    if(bd.isBeatRange(0,2,2) || bd.isBeatRange(12,18,4) || bd.isBeatRange(0,2,2) || bd.isBeatRange(27,31,3)){
        beat();
    }
}
Beispiel #21
0
/* flags: only XML_IGNORE_CASE is handled */
void css_parse_style_sheet(CSSStyleSheet *s, CSSParseState *b)
{
    char value[1024];
    char tag[64];
    char tag_id[64];
    char *q;
    int ch, media, val, last_tree_op, i;
    CSSStyleSheetEntry *e, **first_eprops;
    CSSSimpleSelector ss2, *ss = &ss2, *last_ss, *ss1;
    CSSProperty *props;

    ch = bgetc(b);
    media = CSS_MEDIA_ALL;
    for (;;) {
redo:
        first_eprops = s->plast_entry;
        bskip_spaces(b, &ch);
        if (ch == EOF)
            break;
        /* eat inserted HTML comments for compatible STYLE tag parsing */
        if (ch == '<') {
            beat(b, &ch, "<!--");
            goto redo;
        } else if (ch == '-') {
            beat(b, &ch, "-->");
            goto redo;
        }

        /* handle '@media { ... }' */
        if (ch == '@') {
            ch = bgetc(b);
            read_ident(b, &ch, tag, sizeof(tag));
            switch (css_get_enum(tag, "media,page")) {
            case 0:
                /* @media */
                media = 0;
                for (;;) {
                    bskip_spaces(b, &ch);
                    read_ident(b, &ch, tag, sizeof(tag));
                    val = css_get_enum(tag, "tty,screen,print,tv,speech,all");
                    if (val < 0 || val == 5)
                        media = CSS_MEDIA_ALL;
                    else
                        media |= (1 << val);
                    bskip_spaces(b, &ch);
                    if (ch == ',') {
                        ch = bgetc(b);
                    } else if (ch == '{' || ch == EOF) {
                        ch = bgetc(b);
                        break;
                    }
                }
                goto redo;
            case 1:
                /* @page */
                bskip_spaces(b, &ch);
                if (ch != '{') {
                    read_ident(b, &ch, tag_id, sizeof(tag_id));
                    bskip_spaces(b, &ch);
                }
                memset(ss, 0, sizeof(CSSSimpleSelector));
                ss->tag = css_new_ident("@page");
                if (tag_id[0] != '\0')
                    ss->tag_id = css_new_ident(tag_id);
                add_style_entry(s, ss, media);
                goto parse_props;
            default:
                css_error1(b, "unrecognized css directive '@%s'", tag);
                break;
            }
        } else if (ch == '}') {
            /* XXX: end of media, should unstack */
            ch = bgetc(b);
            goto redo;
        }

        /* parse a selector list */
        for (;;) {
            /* parse simple selectors with operations */
            last_ss = NULL;
            last_tree_op = CSS_TREE_OP_NONE;
            for (;;) {
                int tree_op;
                bskip_spaces(b, &ch);
                parse_simple_selector(ss, b, &ch);
                bskip_spaces(b, &ch);
                ss->tree_op = last_tree_op;
                ss->next = last_ss;
                if (ch == '+') {
                    tree_op = CSS_TREE_OP_PRECEEDED;
                    ch = bgetc(b);
                    goto add_tree;
                } else if (ch == '>') {
                    tree_op = CSS_TREE_OP_CHILD;
                    ch = bgetc(b);
                    goto add_tree;
                } else if (isalpha(ch)) {
                    tree_op = CSS_TREE_OP_DESCENDANT;
add_tree:
                    ss1 = malloc(sizeof(CSSSimpleSelector));
                    if (ss1) {
                        memcpy(ss1, ss, sizeof(CSSSimpleSelector));
                        last_ss = ss1;
                    }
                    last_tree_op = tree_op;
                } else {
                    /* other char: exit */
                    break;
                }
            }
            add_style_entry(s, ss, media);

            /* get next selector, if present */
            if (ch != ',')
                break;
            ch = bgetc(b);
        }
parse_props:
        /* expect start of properties */
        if (ch != '{')
            break;
        ch = bgetc(b);

        q = value;
        while (ch != '}' && ch != EOF) {
            if ((q - value) < (int)sizeof(value) - 1)
                *q++ = ch;
            ch = bgetc(b);
        }
        *q = '\0';

        if (ch == '}')
            ch = bgetc(b);

        /* the properties are extracted, now add them to each tag */
        /* XXX: should locate entries first, then add, to avoid adding
           duplicate entries */
        /* XXX: should put font properties first to avoid em/ex units
           problems, but it would still not be sufficient. */
        props = css_parse_properties(b, value);
        i = 0;
        for (e = *first_eprops; e != NULL; e = e->next) {
            if (i == 0)
                e->props = props;
            else
                e->props = dup_properties(props);
            i++;
        }
    }
#ifdef DEBUG
    css_dump_style_sheet(s);
#endif
}
TransportHeartBeat::TransportHeartBeat(ConfigurationManager &config) : _configurationManager(config)
{
    _timer.setInterval(config.getHeartBeatInterval());
    connect(&_timer, SIGNAL(timeout()), this, SLOT(beat()));
    _timer.start();
}
Beispiel #23
0
//--------------------------------------------------------------
void testApp::keyPressed(int key){
	/////////////
    // ofxBeatTracking keyPressed
    //////////
    // 真偽値を反転させて画面表示をコントロール
    if(key == 'd'){
        drumVisible = !drumVisible;
    }
    if(key == 's'){
        snareVisible = !snareVisible;
    }
    if(key == 'h'){
        hihatVisible = !hihatVisible;
    }
    
    /////////////
    // Custom Apache Key handling
    //////////
    switch (key) {
        case OF_KEY_RIGHT:
            
            // turn LED on
            ard.sendDigital(18, ARD_HIGH);  // pin 20 if using StandardFirmata from Arduino 0022 or older
            
            if (ofGetKeyPressed(OF_KEY_SHIFT)) {
                // rotate servo head to 180 degrees
                moveServo(180, false);
                cout << "keyPressed(OF_KEY_RIGHT); // with OF_KEY_SHIFT pressed" << endl;
            } else {
                // rotate servo incrementally every time key is pressed
                cout << "keyPressed(OF_KEY_RIGHT);" << endl;
                moveServo(30, true);
            }
            break;
            
        case OF_KEY_LEFT:
            
            // turn LED off
            ard.sendDigital(18, ARD_LOW);  // pin 20 if using StandardFirmata from Arduino 0022 or older
            
            if (ofGetKeyPressed(OF_KEY_SHIFT)) {
                // rotate servo head to 0 degrees
                moveServo(0, false);
                cout << "keyPressed(OF_KEY_LEFT); // with OF_KEY_SHIFT pressed" << endl;
            } else {
                // rotate servo incrementally every time key is pressed
                moveServo(-30, true);
                cout << "keyPressed(OF_KEY_LEFT);" << endl;
            }
            break;
            
        case 32:
            beat();
            cout << "keyPressed(" ");" << endl;
            break;
            
            
        case OF_KEY_SHIFT:
            cout << "keyPressed(OF_KEY_SHIFT);" << endl;
            break;
            
        default:
            cout << "keyPressed(key); // key = " << key << endl;
            break;
    }    
}
Beispiel #24
0
// Do one cycle (two beats) return length of a cycle in μs
long Bendulum::cycle() {
	return beat() + beat();						// Do two beats, return how long it took
}