Pages: [1]   Go Down
Author Topic: Modify&Save PadCutOff and MaxPlaytime with pushButton counter  (Read 534 times)
0 Members and 1 Guest are viewing this topic.
New York City, NY
Offline Offline
Full Member
***
Karma: 0
Posts: 141
Arduino Rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all,
I have my setup working nicely with the vs1053 shield now. I added the midi effect controller code in order to add a sustain pedal as well as change the midi voice patch.
I would like to adjust the sensitivity of the pads in real time. This requires modifying PadCutOff and MaxPlayTime values. I have four buttons setup but I'm note sure how to implement this function.

I was hoping to do something like:
ModACounter =MaxPlayTime;
ModBCounter =PadCutOff'
leavaing
ModCCounter available for use as a panic button

but that didn't work.
Can you take a look at my code and offer your opinion/advice.
Thank you in advance
Caesar

* digidrumduino_10.ino (15.99 KB - downloaded 1 times.)
« Last Edit: September 20, 2014, 09:59:27 am by Pitchoilcan » Logged

================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

New York City, NY
Offline Offline
Full Member
***
Karma: 0
Posts: 141
Arduino Rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The last mile.
This extension to the program is optional as I could edit the pad's sensitivity in the IDE before uploading the sketch.
 But that makes it harder for get a feel for what exact setting is best.
  
This is how sensitivity is set now
Code:
int PadCutOff[48] = {
  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};           // Minimum Analog value to cause a drum hit, default=600

int MaxPlayTime[48] = {
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};               // Cycles before a 2nd hit is allowed, default=90

Ideally I'd like to use 4 switches to edit PadCutOff and MaxPlayTime.
Switch1Up
Switch1Down
Switch2Up
Switch2Down

Switches to modify PadCutOff, MaxPlaytime
Code:
for( currentMODSwitch = 0; currentMODSwitch < 4; currentMODSwitch++ ) {
    if((digitalRead(MODswitches[currentMODSwitch]) != MODswitchState[currentMODSwitch] )&&(MODswitchState[currentMODSwitch] == HIGH)){
      switch( currentMODSwitch ) {
      case 0:
        //Bypass
        if( bypassIIState == LOW ) {
          bypassIIState = HIGH;
        
          digitalWrite( MODleds[currentMODSwitch], LOW );
          ModACounter++;
        }
        else {
          bypassIIState = LOW;
          
          digitalWrite( MODleds[currentMODSwitch], HIGH );
          --ModACounter;
        }
        break;
      case 1:
        //Prev Program
        USERSETTING = USERSETTING--;
        if( USERSETTING < 1 )
          USERSETTING = 0; // Don't go lower than 0
        
        flashIIPin( MODleds[currentMODSwitch], pedalActiveFlashII );
        ++ModBCounter;
        break;
      case 2:
        // Next Program
        USERSETTING = USERSETTING++;
        if( USERSETTING > 96 )
          USERSETTING = 97; // Don't go lower than 97
        
        flashIIPin( MODleds[currentMODSwitch], pedalActiveFlashII );
        --ModBCounter;
        break;
      case 3:
        // Favourite 1
        USERSETTING = 22;
      
        flashIIPin( MODleds[currentMODSwitch], pedalActiveFlashII );
        ++ModCCounter;
        break;
        //        case 4: //Panic
        //          // Favourite 2
        //          currentProgram = 27;
        /
        //          flashPin( leds[currentSwitch], pedalActiveFlash );
        //          break;
      }
      ////      delay( BOUNCEDELAY );
    }
    MODswitchState[currentMODSwitch] = digitalRead( MODswitches[currentMODSwitch] );
  }  

Pondering.......
How do I use the two values to populate the 48 values in both arrays?
When I tried I got an error say:
bad or invalid assignment int / int[48]
And I take that to mean ModACounter is a single value and PadCutOff had 48 values.
« Last Edit: September 20, 2014, 09:59:58 am by Pitchoilcan » Logged

================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

New York City, NY
Offline Offline
Full Member
***
Karma: 0
Posts: 141
Arduino Rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
MaxPlayTime=ModACounter;
Quote
incompatible types in assignment of 'int' to 'int[48]'

Code:
ModACounter=MaxPlayTime;
Quote
invalid conversion from 'int' to 'int'

any ideas?

Logged

================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

New York City, NY
Offline Offline
Full Member
***
Karma: 0
Posts: 141
Arduino Rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
MaxPlayTime++;
Quote
lvalue required as increment operand
now this looks promising....
no idea what it means yet.
Logged

================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

New York City, NY
Offline Offline
Full Member
***
Karma: 0
Posts: 141
Arduino Rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was going to abandon this addition, and perhaps use those buttons for some other purpose. Like for a transpose function. Then it occurred to me that I'd have the same issue when trying to modulate PadNote. Shifting 60=C to 60=CS or 60=B.
So I will be revisiting it problem.
The search continues....   
Logged

================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pages: [1]   Go Up
Jump to: