关于QLab一主一备同步播放的话题,我们可以使用OSC通过本地网络实现:多台电脑QLab同步播放 QLab热备份 但是毕竟网络是无线的,很多人担心稳定性与延迟的问题。那么就会偏好使用硬件控制。

最早接触的Qlab双机同步控制器应该是widgeteering的Q-Widget  就是下图这款



$249美元的价格当时还很多朋友问我有没有渠道购买。到后来国内也有很多自制的控制盒子出现,并且也有众多量产的产品。

对于喜欢DIY折腾的我 能自己动手做的一般都会去折腾一番,谷歌里面随便搜一下Qlab button能找到很多DIY高手的杰作
这里面其中有单机控制的 也有双USB输出控制的。无非就是多了一块开发板的事。

这篇文章里我搬运了其中的一个双USB输出控制两台电脑QLab同步的方案,使用两块Teensy 3.2加几个PUSH BUTTON 这些淘宝都非常容易找到。材料清单:

原理图:

代码:

volatile int gonow = 0;
volatile int golast = 0;
volatile int stopingnow = 0;
volatile int stopinglast = 0;
volatile int pausenow = 0;
volatile int pauselast = 0;
volatile int nextnow = 0;
volatile int nextlast = 0;
volatile int prevnow = 0;
volatile int prevlast = 0;



volatile int debounce = 300;


void setup() {
  //Serial.begin(9600);
  pinMode(13, INPUT_PULLDOWN); // GO
  pinMode(14, INPUT_PULLDOWN); // Stop
  pinMode(15, INPUT_PULLDOWN); // Pause
  pinMode(16, INPUT_PULLDOWN); // Next Cue
  pinMode(17, INPUT_PULLDOWN); // Prev. Cue
  
  pinMode(3,OUTPUT);  // GO LED
  analogWrite(3, 25); // GO LED BRIGHTNESS 0-255    

  attachInterrupt(digitalPinToInterrupt(13), go, HIGH);
  attachInterrupt(digitalPinToInterrupt(14), stoping, HIGH);
  attachInterrupt(digitalPinToInterrupt(15), pause, HIGH);
  attachInterrupt(digitalPinToInterrupt(16), next, HIGH);
  attachInterrupt(digitalPinToInterrupt(17), prev, HIGH);

}

void loop() {




 
}


void go(){
    //Serial.println("Go");
    gonow = millis();
    
    if  ( gonow >= golast ){

        golast= millis() + debounce;
        
        Keyboard.set_modifier(0);
        Keyboard.set_key1(KEY_SPACE);
        Keyboard.send_now();
    
        //clear the keyboard
        Keyboard.set_modifier(0);
        Keyboard.set_key1(0);
        Keyboard.send_now();
    }
  
}//go()

void stoping(){
    //Serial.println("stop");
    stopingnow = millis();
    
    if  ( stopingnow >= stopinglast ){

        stopinglast= millis() + debounce;
        
        Keyboard.set_modifier(0);
        Keyboard.set_key1(KEY_ESC);
        Keyboard.send_now();
    
        //clear the keyboard
        Keyboard.set_modifier(0);
        Keyboard.set_key1(0);
        Keyboard.send_now();
    }
  
}//stoping()

void pause(){
    //Serial.println("pause");
    pausenow = millis();
    
    if  ( pausenow >= pauselast ){
      
        pauselast= millis() + debounce;
        
        Keyboard.set_modifier(0);
        Keyboard.set_key1(KEY_P);
        Keyboard.send_now();
    
        //clear the keyboard
        Keyboard.set_modifier(0);
        Keyboard.set_key1(0);
        Keyboard.send_now();
    }
  
}//pause()

void next(){
    //Serial.println("next");
    nextnow = millis();

    if  ( nextnow >= nextlast ){
    
        nextlast= millis() + debounce;
        
        Keyboard.set_modifier(0);
        Keyboard.set_key1(KEY_UP);
        Keyboard.send_now();
    
        //clear the keyboard
        Keyboard.set_modifier(0);
        Keyboard.set_key1(0);
        Keyboard.send_now();
    }
  
}//next()

void prev(){
    //Serial.println("prev");
    prevnow = millis();
    
    if  ( prevnow >= prevlast ){
    
        prevlast= millis() + debounce;
        
        Keyboard.set_modifier(0);
        Keyboard.set_key1(KEY_DOWN);
        Keyboard.send_now();
    
        //clear the keyboard
        Keyboard.set_modifier(0);
        Keyboard.set_key1(0);
        Keyboard.send_now();
    }
  
}//prev()

成品图:

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。