コード例 #1
0
ファイル: Anushri.cpp プロジェクト: smillan/ORSINI_ARPEGGIO
void  Anushri::makeSequence( byte *sequence, byte *scal, byte scalSize, byte direction, byte octave, byte arp_size, byte offst){
 arp_loop_size = arp_size;
 offset= offst;
 seqSelect=octave;
       
 switch(direction){
 case 0:
 
			up( sequence, scal,   scalSize);
		break;
		case 1:
			down( sequence, scal, scalSize );
		break;
		case 2:
			upDown( sequence, scal , scalSize);
		break;
		case 3:
			randomArp( sequence, scal, scalSize );
		break;

}



}
コード例 #2
0
ファイル: remote_control.cpp プロジェクト: Galdeano/zowi
void loop()
{
    if(Serial.available()){
        while (Serial.available()) input = Serial.read();
        switch(input){
            case 'A':
                walk(1, 1200);
                break;

            case 'B':
                turnR();
                break;

            case 'C':
                backward();
                break;

            case 'D':
                turnL();
                break;

            case 'E':
                upDown();
                break;

            case 'F':
                punchR();
                delay(300);
                break;

            case 'G':
                attack();
                delay(300);
                break;

            case 'H':
                punchL();
                delay(300);
                break;

            case 'I':
                queno();
                break;

            case 'J':
                nono(1000);
                break;
            default:
                home();
                break;
        }
        Serial.flush();
    }
    else home();
}
コード例 #3
0
ファイル: loop-recognizer.cpp プロジェクト: berndhs/pantomime
QGestureRecognizer::Result
LoopRecognizer::handleCursorMove (LoopGesture *gesture,
                                  QPointF scenePoint)
{
  GEUZEN_PRETTY_DEBUG << gesture << scenePoint;
  if (gesture == 0) {
    return QGestureRecognizer::Ignore;
  }
  if (!(user && user->contains(user->mapFromScene(scenePoint)))) {
      return QGestureRecognizer::Ignore; // not our point
  }
  QPointF last = gesture->lastPos;
  gesture->lastPos = scenePoint;
  if (!gesture->haveStarted) {
    gesture->reset ();
    gesture->haveStarted = true;
    gesture->setHotSpot (scenePoint);
    GEUZEN_PRETTY_DEBUG << " ____maybbe " << gesture << gesture->state();
    return QGestureRecognizer::Ignore;
  }
  quint8 leftRight (0);
  quint8 upDown (0);
 
  leftRight = last.x() < scenePoint.x() ? 1
                : last.x() > scenePoint.x() ? 0xff : 0;
  upDown = last.y() < scenePoint.y() ? 0x1
                : last.y() > scenePoint.y() ? 0xff : 0;
  quint32 segment = (upDown << 8) | leftRight;
  qDebug () << hex << " new seg " << segment << dec;
  if (leftRight != 0 && upDown != 0) {
    if (gesture->sequence.isEmpty()
        || gesture->sequence.last() != segment) {
     gesture-> sequence.append (segment);
    }
  }
  qDebug () << hex << gesture->sequence << dec;
  if (chopTailCircle(gesture->sequence)) {
    qDebug () << " detected CIRCLE";
    gesture->sequence.clear();
    GEUZEN_PRETTY_DEBUG << " fer SURE " << gesture << gesture->state();
    
    notifyUser();
    
  }
  return QGestureRecognizer::Ignore;
}
コード例 #4
0
ファイル: smpedit.cpp プロジェクト: tildearrow/orchestrack
void Sampler::drawSampleEdit() {
  f->draw(10,40,tempc,0,0,0,"Rate");
  /*
  tempr.x=80;  tempr1.x=0;
  tempr.y=10; tempr1.y=0;
  tempr.w=600; tempr1.w=600;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,spath,&tempr1,&tempr);*/
  tSName->setPos(80,10);
  tSName->draw();
  tempr.x=690; tempr1.x=40*sloadS;
  tempr.y=10; tempr1.y=0;
  tempr.w=40;  tempr1.w=40;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,sload,&tempr1,&tempr);
  tempr.x=630; tempr1.x=40*seupS;
  tempr.y=40; tempr1.y=0;
  SDL_RenderCopy(r,sload,&tempr1,&tempr);
  tempr.x=580; tempr1.x=40*sedownS;
  SDL_RenderCopy(r,sload,&tempr1,&tempr);
  tempr.x=680; tempr1.x=50;
  tempr.y=40; tempr1.y=0;
  tempr.w=50;  tempr1.w=50;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,scancel,&tempr1,&tempr);
  
  tempr.x=10; tempr1.x=60*sselectS;
  tempr.y=10; tempr1.y=0;
  tempr.w=60;  tempr1.w=60;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,sselect,&tempr1,&tempr);
  f->draw(40,10,tempc,1,0,0,"Sample");
  
  f->drawf(83,40,tempc,0,0,"%f",s[curSample].rate);
  f->draw(710,10,tempc,1,0,0,"Load");
  f->draw(705,40,tempc,1,0,0,"Keypad");
  f->draw(650,40,tempc,1,0,0,"Up");
  f->draw(600,40,tempc,1,0,0,"Down");
  
  /// envelopes ///
  
  // volume //
  tempr.x=90;  tempr1.x=0;
  tempr.y=70; tempr1.y=0;
  tempr.w=275; tempr1.w=275;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,spathshort,&tempr1,&tempr);
  if (s[curSample].envVol==-1) {
    f->draw((180+275)/2,70,tempc,1,0,0,"<-off->");
  } else {
    f->draw(93,70,tempc,0,0,0,e[s[curSample].envVol].name[0]);
  }
  
  tempr.x=10; tempr1.x=70*sevolS;
  tempr.y=70; tempr1.y=0;
  tempr.w=70;  tempr1.w=70;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,senvsel,&tempr1,&tempr);
  f->draw(45,70,tempc,1,0,0,"Volume");
  
  kVolAmp->setPos(10,100);
  kVolAmp->draw();
  f->draw(42,170,tempc,1,0,0,"Amount");
  
  kVolCap->setPos(84,100);
  kVolCap->draw();
  f->draw(116,170,tempc,1,0,0,"Handicap");
  
  // panning //
  tempr.x=455;  tempr1.x=0;
  tempr.y=70; tempr1.y=0;
  tempr.w=275; tempr1.w=275;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,spathshort,&tempr1,&tempr);
  if (s[curSample].envPan==-1) {
    f->draw((455+455+275)/2,70,tempc,1,0,0,"<-off->");
  } else {
    f->draw(458,70,tempc,0,0,0,e[s[curSample].envPan].name[0]);
  }
  
  tempr.x=375; tempr1.x=70*sepanS;
  tempr.y=70; tempr1.y=0;
  tempr.w=70;  tempr1.w=70;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,senvsel,&tempr1,&tempr);
  f->draw(410,70,tempc,1,0,0,"Panning");
  
  kPanAmp->setPos(375,100);
  kPanAmp->draw();
  f->draw(407,170,tempc,1,0,0,"Amount");
  
  kPanCap->setPos(449,100);
  kPanCap->draw();
  f->draw(481,170,tempc,1,0,0,"Handicap");
  
  // pitch //
  tempr.x=90;  tempr1.x=0;
  tempr.y=200; tempr1.y=0;
  tempr.w=275; tempr1.w=275;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,spathshort,&tempr1,&tempr);
  if (s[curSample].envPitch==-1) {
    f->draw((180+275)/2,200,tempc,1,0,0,"<-off->");
  } else {
    f->draw(93,200,tempc,0,0,0,e[s[curSample].envPitch].name[0]);
  }
  
  tempr.x=10; tempr1.x=70*sepitchS;
  tempr.y=200; tempr1.y=0;
  tempr.w=70;  tempr1.w=70;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,senvsel,&tempr1,&tempr);
  f->draw(45,200,tempc,1,0,0,"Pitch");
  
  kPitchAmp->setPos(10,230);
  kPitchAmp->draw();
  f->draw(42,300,tempc,1,0,0,"Amount");
  
  kPitchCap->setPos(84,230);
  kPitchCap->draw();
  f->draw(116,300,tempc,1,0,0,"Handicap");
  
  // cutoff //
  tempr.x=455;  tempr1.x=0;
  tempr.y=200; tempr1.y=0;
  tempr.w=275; tempr1.w=275;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,spathshort,&tempr1,&tempr);
  if (s[curSample].envCut==-1) {
    f->draw((455+455+275)/2,200,tempc,1,0,0,"<-off->");
  } else {
    f->draw(458,200,tempc,0,0,0,e[s[curSample].envCut].name[0]);
  }
  
  tempr.x=375; tempr1.x=70*secutS;
  tempr.y=200; tempr1.y=0;
  tempr.w=70;  tempr1.w=70;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,senvsel,&tempr1,&tempr);
  f->draw(410,200,tempc,1,0,0,"Cutoff");
  
  kCutAmp->setPos(375,230);
  kCutAmp->draw();
  f->draw(407,300,tempc,1,0,0,"Amount");
  
  kCutCap->setPos(449,230);
  kCutCap->draw();
  f->draw(481,300,tempc,1,0,0,"Handicap");
  
  // resonance //
  tempr.x=90;  tempr1.x=0;
  tempr.y=330; tempr1.y=0;
  tempr.w=275; tempr1.w=275;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,spathshort,&tempr1,&tempr);
  if (s[curSample].envRes==-1) {
    f->draw((180+275)/2,330,tempc,1,0,0,"<-off->");
  } else {
    f->draw(93,330,tempc,0,0,0,e[s[curSample].envRes].name[0]);
  }
  
  tempr.x=10; tempr1.x=70*seresS;
  tempr.y=330; tempr1.y=0;
  tempr.w=70;  tempr1.w=70;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,senvsel,&tempr1,&tempr);
  f->draw(45,330,tempc,1,0,0,"Resonan.");
  
  kResAmp->setPos(10,360);
  kResAmp->draw();
  f->draw(42,430,tempc,1,0,0,"Amount");
  
  kResCap->setPos(84,360);
  kResCap->draw();
  f->draw(116,430,tempc,1,0,0,"Handicap");
  
  // not exactly envelope, but filter //
  tempr.x=455;  tempr1.x=0;
  tempr.y=330; tempr1.y=0;
  tempr.w=275; tempr1.w=275;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,spathshort,&tempr1,&tempr);
  switch (s[curSample].filter) {
    case 0: f->draw((455+455+275)/2,330,tempc,1,0,0,"<-off->"); break;
    case 1: f->draw((455+455+275)/2,330,tempc,1,0,0,"Low Pass"); break;
    case 2: f->draw((455+455+275)/2,330,tempc,1,0,0,"High Pass"); break;
    case 3: f->draw((455+455+275)/2,330,tempc,1,0,0,"Band Stop"); break;
    case 4: f->draw((455+455+275)/2,330,tempc,1,0,0,"Band Pass"); break;
    case 5: f->draw((455+455+275)/2,330,tempc,1,0,0,"Low+Band Pass"); break;
    case 6: f->draw((455+455+275)/2,330,tempc,1,0,0,"High+Band Pass"); break;
    case 7: f->draw((455+455+275)/2,330,tempc,1,0,0,"All Pass"); break;
    default: f->draw((455+455+275)/2,330,tempc,1,0,0,""); break;
  }
  
  // low
  tempr.x=446;  tempr1.x=64*sfiltlS;
  tempr.y=372; tempr1.y=0;
  tempr.w=64; tempr1.w=64;
  tempr.h=40;  tempr1.h=40;
  SDL_RenderCopy(r,(s[curSample].filter&1)?(sfiltactive):(sfilt),&tempr1,&tempr);
  f->draw(446+32,372+20,tempc,1,1,0,"Low");
  
  // high
  tempr.x=520;  tempr1.x=64*sfilthS;
  tempr.y=372; tempr1.y=0;
  tempr.w=64; tempr1.w=64;
  tempr.h=40;  tempr1.h=40;
  SDL_RenderCopy(r,(s[curSample].filter&2)?(sfiltactive):(sfilt),&tempr1,&tempr);
  f->draw(520+32,372+20,tempc,1,1,0,"High");
  
  // band
  tempr.x=594;  tempr1.x=64*sfiltbS;
  tempr.y=372; tempr1.y=0;
  tempr.w=64; tempr1.w=64;
  tempr.h=40;  tempr1.h=40;
  SDL_RenderCopy(r,(s[curSample].filter&4)?(sfiltactive):(sfilt),&tempr1,&tempr);
  f->draw(594+32,372+20,tempc,1,1,0,"Band");
  
  tempr.x=375; tempr1.x=70*seresS;
  tempr.y=330; tempr1.y=0;
  tempr.w=70;  tempr1.w=70;
  tempr.h=20;  tempr1.h=20;
  SDL_RenderCopy(r,senvsel,&tempr1,&tempr);
  f->draw(410,330,tempc,1,0,0,"Filter");
  
  upDown();
}
コード例 #5
0
ファイル: AWin.cpp プロジェクト: rucquo-a/notreallybabel
bool	AWin::gestEvent(sf::Event event)
{
  std::list<Button*>::iterator  it;
  std::list<Button*>::iterator  itNew;
  std::list<Button*>::iterator  itEnd;
  std::list<Button*>    but;
  int   mX;
  int   mY;
  int   i;
  bool	newCur = false;

  but = getButton();
  if(event.type == sf::Event::Closed)
    {
      getWindow().close();
      return (false);
    }
  if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
    return (false);
  if (event.type == sf::Event::MouseMoved)
    {
      mX = event.mouseMove.x;
      mY = event.mouseMove.y;
      it = but.begin();
      itEnd = but.end();
      while (it != itEnd && but.size() > 0)
        {
          if ((*it)->isIn(mX, mY) == true)
	    {
	      itNew = it;
	      (*it)->setTarget(true);
	      newCur = true;
	    }
	  it++;
        }
      it = but.begin();
      while (it != itEnd && newCur == true && but.size() > 0)
	{
	  if (it != itNew)
	    (*it)->setTarget(false);
	  it++;
	}
    }
  if (event.type == sf::Event::MouseButtonReleased)
    {
      it = but.begin();
      itEnd = but.end();
      mX = event.mouseButton.x;
      mY = event.mouseButton.y;
      std::cout << mX <<"," << mY << std::endl;
      std::cout << event.type << std::endl;
      while (it != itEnd &&but.size() > 0)
        {
          if ((*it)->isIn(mX, mY) == true)
	    {
	      while (getButton().size() > 0)
		getButton().pop_back();
	      if ((*it) != NULL)
		if ((*it)->getWin() != NULL)
		  {
		    (*it)->getWin()->mainDraw();
		    return (false);
		  }
	    }
	  it++;
        }
    }
  if (event.type == sf::Event::Resized)
    updateButton();
  if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Down)
    upDown();
  if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Up)
    upUp();
  if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Return)
    {    
      launchWindow();
      return (false);
    }  
  getWindow().clear();
  drawContent();
  getWindow().display();
  usleep(1000);
  return (true);
}
コード例 #6
0
ファイル: remote_control.cpp プロジェクト: MiguelAngelLV/zowi
void loop()
{
    if(Serial.available()){
        while (Serial.available()) input = Serial.read();
        Serial.println(input);
        switch(input){
            case 'A':
                walk(1, 750);
                break;

            case 'B':
                turnR(1, 800);
                break;

            case 'C':
                backward(1, 800);
                break;

            case 'D':
                turnL(1, 800);
                break;

            case 'E':
                tone(11, 800, 250);
                delay(50);
                tone(11, 1600, 250);

                upDown();
                break;

            case 'F':
                tone(11, 800, 250);
                delay(50);
                tone(11, 1600, 250);

                punchR();
                delay(250);
                home();
                delay(100);
                break;

            case 'G':
                tone(11, 800, 250);
                delay(50);
                tone(11, 1600, 250);

                attack();
                delay(250);
                home();
                delay(100);
                break;

            case 'H':
                tone(11, 800, 250);
                delay(50);
                tone(11, 1600, 250);

                punchL();
                delay(250);
                home();
                delay(100);
                break;

            case 'I':
                ninuninu();
                break;

            case 'J':
                mareo();
                break;

            default:
                home();
                break;
        }
    }
    else home();
}