Example #1
0
void EnvelopeFreeEdit::update(void)
{
    oscWrite("Penvpoints");
    oscWrite("Penvdt");
    oscWrite("Penvval");
    oscWrite("Penvsustain");
}
Example #2
0
void Fl_Osc_Dial::cb(void)
{
    assert(osc);

    if(64 != (int)minimum())
        oscWrite(ext, "i", (int)(value()-minimum()));
    else
        oscWrite(ext, "i", (int)(value()));

    if(cb_data.first)
        cb_data.first(this, cb_data.second);
}
Example #3
0
void Fl_Osc_Check::cb(void)
{
    //Order is significant for takeback style callbacks
    if(cb_data.first)
        cb_data.first(this, cb_data.second);


    if(type == 'T')
        oscWrite(ext, value() ? "T" : "F");
    else {
	if(type=='c')
	    fprintf(stderr, "invalid `c' from checkbox %s%s, using `i'\n", loc.c_str(), ext.c_str());
	oscWrite(ext, "i", value());
    }
}
Example #4
0
void Fl_Osc_VSlider::cb(void)
{
    const float val = Fl_Slider::value();
    if(osc_type == 'f')
        oscWrite(ext, "f", val-minimum());
    else if(osc_type == 'i')
        oscWrite(ext, "i", (int)(val-minimum()));
    else {
	fprintf(stderr, "invalid `c' from vslider %s%s, using `i'\n", loc.c_str(), ext.c_str());
	oscWrite(ext, "i", (int)(val-minimum()));
    }
    //OSC_value(val);
    
    if(cb_data.first)
        cb_data.first(this, cb_data.second);
}
Example #5
0
void Fl_Osc_Roller::cb(void)
{
    oscWrite(name, "i", (int)value());
    
    if(cb_data.first)
        cb_data.first(this, cb_data.second);
}
Example #6
0
void AppleRemoteSender::send(byte remote_id, byte key)
{
    //prepare data
    long temp = remote_id;
    temp = temp << 8;
    temp += key;
    temp = temp << 16;
    temp += APPLE_ID;
    
    //send preamble
    oscWrite(9000);
    delayMicroseconds(3040);
    
    byte bit = 0;
    //send data
    for(int i = 0; i < 32; i++)
    {
        bit = temp % 2;
        temp = temp >> 1;
        //space
        oscWrite(560);
        
        //data
        if(bit == 0)
        {
            delayMicroseconds(565);
        }
        else
        {
            delayMicroseconds(1690);
        }
    }
    //end of data header
    oscWrite(560);
    
}
Example #7
0
void Fl_Osc_VSlider::update(void)
{
    oscWrite(ext, "");
}
Example #8
0
int EnvelopeFreeEdit::handle(int event)
{
    const int x_=Fl::event_x()-x();
    const int y_=Fl::event_y()-y();
    static Fl_Widget *old_focus;
    int key;

    switch(event) {
      case FL_ENTER:
          old_focus=Fl::focus();
          Fl::focus(this);
          // Otherwise the underlying window seems to regrab focus,
          // and I can't see the KEYDOWN action.
          return 1;
      case FL_LEAVE:
          Fl::focus(old_focus);
          break;
      case FL_KEYDOWN:
      case FL_KEYUP:
          key = Fl::event_key();
          if (key==FL_Control_L || key==FL_Control_R){
              ctrldown = (event==FL_KEYDOWN);
              redraw();
              if (pair!=NULL) pair->redraw();
          }
          break;
      case FL_PUSH:
            currentpoint=getnearest(x_,y_);
            cpx=x_;
            cpdt=Penvdt[currentpoint];
            lastpoint=currentpoint;
            redraw();
            if (pair)
                pair->redraw();
            return 1;
      case FL_RELEASE:
            currentpoint=-1;
            redraw();
            if (pair)
                pair->redraw();
            return 1;
      case FL_MOUSEWHEEL:
          if (lastpoint>=0) {
              if (!ctrldown) {
                  int ny = Penvval[lastpoint] - Fl::event_dy();
                  ny = ny < 0 ? 0 : ny > 127 ? 127 : ny;
                  Penvval[lastpoint] = ny;
                  oscWrite(to_s("Penvval")+to_s(lastpoint), "c", ny);
                  oscWrite("Penvval","");
              } else if (lastpoint > 0) {
                  int newdt = Fl::event_dy() + Penvdt[lastpoint];
                  newdt = newdt < 0 ? 0 : newdt > 127 ? 127 : newdt;
                  Penvdt[lastpoint] = newdt;
                  oscWrite(to_s("Penvdt")+to_s(lastpoint),  "c", newdt);
                  oscWrite("Penvdt","");
              }
              redraw();
              if (pair!=NULL) pair->redraw();
              return 1;
          }
      case FL_DRAG:
          if (currentpoint>=0){
              int ny=limit(127-(int) (y_*127.0/h()), 0, 127);

              Penvval[currentpoint]=ny;

              const int dx=(int)((x_-cpx)*0.1);
              const int newdt=limit(cpdt+dx,0,127);

              if(currentpoint!=0)
                  Penvdt[currentpoint]=newdt;
              else
                  Penvdt[currentpoint]=0;

              oscWrite(to_s("Penvval")+to_s(currentpoint), "c", ny);
              oscWrite(to_s("Penvdt")+to_s(currentpoint),  "c", newdt);
              oscWrite("Penvdt","");
              oscWrite("Penvval","");
              redraw();

              if(pair)
                  pair->redraw();
              return 1;
          }
    }
      // Needed to propagate undo/redo keys.
    return 0;
}
Example #9
0
void Fl_Osc_Roller::update(void)
{
    oscWrite(name);
}