Coder Social home page Coder Social logo

katbox-midi's People

Contributors

celticpure avatar

Watchers

 avatar  avatar

katbox-midi's Issues

Code revision

Hi Rory
This compiles - no idea if it will work!

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeSans9pt7b.h>

// Control Surface:
#include <Control_Surface.h>
#include <AH/Hardware/MultiPurposeButton.hpp> //FOR USING MULTIPURPOSE BUTTON FUNCTION

BluetoothMIDI_Interface midi;                 //TYPE OF INTERFACE USED TO COMMUNICATE

// DISPLAY:
Adafruit_SSD1306 display(-1);

MultiPurposeButton btn1{15};      //BTN No.1
MultiPurposeButton btn2{19};      //BTN No.2
MultiPurposeButton btn3{4};       //BTN No.3
MultiPurposeButton btn4{5};       //BTN No.4

int new_button, old_button;
char str_buf[30];

void btn_disp(){
  if (new_button != old_button) {
    old_button = new_button;
    display.fillRect(0, 40, 100, 40, BLACK);
    sprintf(str_buf, "PATCH %d", new_button);
    display.setCursor(0, 40);
    display.print(str_buf);       
    display.display();
  }
}

void multibtn()
{
  switch (btn1.update()) {      //BTN No.1
    case btn1.PressStart:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_1, CHANNEL_1}, 0); 
      new_button = 1;
      break;
    case btn1.LongPress:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_2, CHANNEL_1}, 0);
      new_button = 1;
      break;
  }
  switch (btn2.update()) {      //BTN No.2
    case btn2.PressStart:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_3, CHANNEL_2}, 0);
      new_button = 2;
      break;
    case btn2.LongPress:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_4, CHANNEL_2}, 0);
      new_button = 2;
      break;
  }
  switch (btn3.update()) {      //BTN No.3
    case btn3.PressStart:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_5, CHANNEL_3}, 0);
      new_button = 3;
      break;
    case btn3.LongPress:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_6, CHANNEL_3}, 0);
      new_button = 3;
      break;
  }
  switch (btn4.update()) {      //BTN No.4
    case btn4.PressStart:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_7, CHANNEL_4}, 0);
      new_button = 4;
      break;
    case btn4.LongPress:
      Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_8, CHANNEL_4}, 0);
      new_button = 4;
      break;
  }
}


void setup() {
  Serial.begin (9600);                        // initialize serial communication:

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C
  display.clearDisplay();                     // Clear the buffer.
  display.setFont(&FreeSans9pt7b);            // Set Font

  Control_Surface.begin();                    // Set Control Surface
  btn1.setLongPressDelay(1000); 
  btn2.setLongPressDelay(1000); 
  btn3.setLongPressDelay(1000); 
  btn4.setLongPressDelay(1000);
  btn1.setMultiPressDelay(400); 
  btn2.setMultiPressDelay(400); 
  btn3.setMultiPressDelay(400); 
  btn4.setMultiPressDelay(400);
  btn1.begin(); 
  btn2.begin(); 
  btn3.begin(); 
  btn4.begin();

  display.setTextColor(WHITE, BLACK);
  display.setCursor(0, 15);
  display.println("KATBOX MIDI");
  display.display();

  old_button = 0;
  new_button = 0;
}

void loop() {
  Control_Surface.loop();
  multibtn();
  btn_disp();
}

Possibility of using "Banks" or derivative to activate Booster/FX/Reverb ON or OFF and sub settings.

Open to develop.......

I want to explore the option of having a particular button press - say hold a button down for a defined period. To activate another function for the patch buttons to change MOD, BOOST and REVERB on the Katana by Midi Commands.

However, ideally what would be great, if the KATBOX-MIDI could read the Boss Katana amp for its initial settings. From what I can determine that can be only done via Midi over USB.

If the Control Surface Library could read the Boss Katana Librarian app for its settings that it reads from the Katana amp then this could be an option. But I cannot find any reference that this can be done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.