Skip to content

Commit

Permalink
Release 0.9.1 from Google Code.
Browse files Browse the repository at this point in the history
  • Loading branch information
trash80 committed Jul 26, 2015
1 parent 72f9310 commit 7ba6f76
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 81 deletions.
46 changes: 33 additions & 13 deletions Arduinoboy/Arduinoboy.ino
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/***************************************************************************
***************************************************************************
* __ _ __ *
* ____ __________/ /_ __(_)___ ____ / /_ ____ __ __ *
* / __ `/ ___/ __ / / / / / __ \/ __ \/ __ \/ __ \/ / / / *
* / /_/ / / / /_/ / /_/ / / / / / /_/ / /_/ / /_/ / /_/ / *
* \__,_/_/ \__,_/\__,_/_/_/ /_/\____/_.___/\____/\__, / *
* /____/ *
* __ _ __ *
* ____ __________/ /_ __(_)___ ____ / /_ ____ __ __ *
* / __ `/ ___/ __ / / / / / __ \/ __ \/ __ \/ __ \/ / / / *
* / /_/ / / / /_/ / /_/ / / / / / /_/ / /_/ / /_/ / /_/ / *
* \__,_/_/ \__,_/\__,_/_/_/ /_/\____/_.___/\____/\__, / *
* /____/ *
* *
***************************************************************************
***************************************************************************
* *
* Version: 0.8.7 *
* Date: March 07 2008 *
* Version: 0.9.1 *
* Date: March 08 2008 *
* Name: Timothy Lamb *
* Email: [email protected] *
* *
Expand Down Expand Up @@ -56,9 +56,6 @@
* 60 - C-3 to C-8 Notes! *
* Prgram Change to select from instrument table *
* *
* Special Thanks to firestARTer for help with *
* keyboard & Midi handling information. *
* *
***************************************************************************/
/***************************************************************************
* *
Expand All @@ -76,7 +73,11 @@
int syncEffectsMidiChannel = 16; //midi sync effects for lsdj slave mode
int keyboardInstrumentMidiChannel = 16; //midi channel for keyboard instruments in lsdj

//Mode 0: Midi Input to LSDJ Sync, Mode 1: LSDJ MASTER to Midi output, Mode 2: LSDJ Keyboard
//Mode 0: Midi Input to LSDJ Sync
//Mode 1: LSDJ MASTER to Midi output
//Mode 2: LSDJ Keyboard
//Mode 3: Midi Input to Nanoloop
//Mode 4: Pushpin Interface
int mode = 0;

//Enforces the mode above, without reading from memory, use this to force the mode if you dont have a push button setup.
Expand Down Expand Up @@ -113,6 +114,9 @@ boolean midiNoteOffMode =false;
boolean midiProgramChange=false;
boolean statusLedIsOn =false;
boolean statusLedBlink =false;

boolean nanoState =false;
boolean nanoSkipSync =false;
/***************************************************************************
* Counter vars
***************************************************************************/
Expand Down Expand Up @@ -178,6 +182,10 @@ int keyboardLastTbl = 0;

int keyboardDiff = 0;
int keyboardCount = 0;
byte keyboardStartOctave = 0x24;
byte keyboardNoteStart = 0;
byte keyboardNoteOffset = 0;
byte keyboardCommands[12];

void setup() {
/*
Expand Down Expand Up @@ -209,7 +217,19 @@ void setup() {
*/
syncEffectsMidiChannel = 143 + syncEffectsMidiChannel; //set the midi channel to the real number (144 to 159)
keyboardInstrumentMidiChannel = 143 + keyboardInstrumentMidiChannel; //set the midi channel to the real number (144 to 159)

keyboardNoteStart = keyboardStartOctave + 12;
keyboardCommands[0] = keyboardMut1;
keyboardCommands[1] = keyboardMut2;
keyboardCommands[2] = keyboardMut3;
keyboardCommands[3] = keyboardMut4;
keyboardCommands[4] = keyboardCurL;
keyboardCommands[5] = keyboardCurR;
keyboardCommands[6] = keyboardCurU;
keyboardCommands[7] = keyboardCurD;
keyboardCommands[8] = keyboardEntr;
keyboardCommands[9] = keyboardTblDn;
keyboardCommands[10] = keyboardTblUp;
keyboardCommands[11] = keyboardTblCue;
/*
Load Settings from EEPROM
*/
Expand Down
93 changes: 28 additions & 65 deletions Arduinoboy/Mode_LSDJ_Keyboard.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ void modeLSDJKeyboardSetup()
keyboardCurrentOct = 0;
keyboardCurrentIns = 0;
keyboardCurrentTbl = 0;

modeLSDJKeyboard();
}

Expand Down Expand Up @@ -100,9 +99,13 @@ void playLSDJProgramChange()

void playLSDJKeyboardNote()
{
if(incomingMidiData[1] >= 0x3C) {
incomingMidiData[1] = incomingMidiData[1] - 0x3C;
if(incomingMidiData[1] >= 0x30) {
if(incomingMidiData[1] >= keyboardNoteStart) {
keyboardNoteOffset = 0;
incomingMidiData[1] = incomingMidiData[1] - keyboardNoteStart;
if(incomingMidiData[1] >= 0x3C) {
keyboardNoteOffset = 0x0C;
keyboardCurrentOct = 4;
} else if(incomingMidiData[1] >= 0x30) {
keyboardCurrentOct = 4;
} else if (incomingMidiData[1] >= 0x24) {
keyboardCurrentOct = 3;
Expand All @@ -114,70 +117,30 @@ void playLSDJKeyboardNote()
keyboardCurrentOct = 0;
}

if(keyboardCurrentOct != keyboardLastOct)
{
if(keyboardCurrentOct > keyboardLastOct) {
keyboardDiff = keyboardCurrentOct - keyboardLastOct;
for(keyboardCount=0;keyboardCount<keyboardDiff;keyboardCount++)
{
addGameboyByte(keyboardOctUp);
}
} else {
keyboardDiff = keyboardLastOct - keyboardCurrentOct;
for(keyboardCount=0;keyboardCount<keyboardDiff;keyboardCount++)
{
addGameboyByte(keyboardOctDn);
if(keyboardCurrentOct != keyboardLastOct)
{
if(keyboardCurrentOct > keyboardLastOct) {
keyboardDiff = keyboardCurrentOct - keyboardLastOct;
for(keyboardCount=0;keyboardCount<keyboardDiff;keyboardCount++)
{
addGameboyByte(keyboardOctUp);
}
} else {
keyboardDiff = keyboardLastOct - keyboardCurrentOct;
for(keyboardCount=0;keyboardCount<keyboardDiff;keyboardCount++)
{
addGameboyByte(keyboardOctDn);
}
}
}
}

incomingMidiData[1] = incomingMidiData[1] % 12;
addGameboyByte(keyboardNotes[incomingMidiData[1]]);
keyboardLastOct = keyboardCurrentOct;
keyboardLastIns = keyboardCurrentIns;
} else {
switch(incomingMidiData[1]) {
case 0x30:
addGameboyByte(keyboardMut1);
break;
case 0x31:
addGameboyByte(keyboardMut2);
break;
case 0x32:
addGameboyByte(keyboardMut3);
break;
case 0x33:
addGameboyByte(keyboardMut4);
break;
case 0x34:
addGameboyByte(keyboardEntr);
break;
case 0x35:
addGameboyByte(0xE0);
addGameboyByte(keyboardCurL);
break;
case 0x36:
addGameboyByte(0xE0);
addGameboyByte(keyboardCurR);
break;
case 0x37:
addGameboyByte(0xE0);
addGameboyByte(keyboardCurU);
break;
case 0x38:
addGameboyByte(0xE0);
addGameboyByte(keyboardCurD);
break;
case 0x39:
addGameboyByte(keyboardTblDn);
break;
case 0x3A:
addGameboyByte(keyboardTblUp);
break;
case 0x3B:
addGameboyByte(keyboardTblCue);
break;
}
incomingMidiData[1] = (incomingMidiData[1] % 12) + keyboardNoteOffset;
addGameboyByte(keyboardNotes[incomingMidiData[1]]);
keyboardLastOct = keyboardCurrentOct;
keyboardLastIns = keyboardCurrentIns;

} else if (incomingMidiData[1] >=keyboardStartOctave) {
addGameboyByte(keyboardCommands[incomingMidiData[1] - keyboardStartOctave]);
}
}

Expand Down
65 changes: 62 additions & 3 deletions Arduinoboy/Mode_Nanoloop.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,70 @@
* (at your option) any later version. *
* *
***************************************************************************/

// Placeholder, not implemented yet. :/

void modeNanoloopSetup()
{
pinMode(pinGBClock,OUTPUT);
digitalWrite(pinGBClock,LOW);
modeNanoloopSync();
}

void modeNanoloopSync()
{
while(1){
setMode();
if (Serial.available() > 0) {
incomingMidiByte = Serial.read();
Serial.print(incomingMidiByte, BYTE);
if(incomingMidiByte > 0x7F) {
switch (incomingMidiByte) {
case 0xF8: // Clock Message Recieved
//send a clock tick out if the sequencer is runn
if(sequencerStarted) {
nanoSkipSync = !nanoSkipSync;
if(countSyncTime) {
nanoState = sendTickToNanoloop(nanoState, false);
} else {
nanoState = sendTickToNanoloop(true, true);
}
nanoState = sendTickToNanoloop(nanoState, nanoSkipSync);

if(!countSyncPulse) statusLedOn();
countSyncPulse++;
countSyncPulse = countSyncPulse % 24;
break;
}
break;
case 0xFA: // Transport Start Message
case 0xFB: // Transport Continue Message
sequencerStart();
break;
case 0xFC: // Transport Stop Message
sequencerStop();
break;
default:
break;
}
}
setMode();
updateStatusLed();
} else {
setMode();
updateStatusLed();
}
}
}

boolean sendTickToNanoloop(boolean state, boolean last_state)
{
if(!state) {
if(last_state) {
digitalWrite(pinGBSerialOut,HIGH);
} else {
digitalWrite(pinGBSerialOut,LOW);
}
return true;
} else {
digitalWrite(pinGBSerialOut,HIGH);
return false;
}
}
1 change: 1 addition & 0 deletions Arduinoboy/Mode_PushPin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// Placeholder, not implemented yet. :/
void modePushpinSetup()
{
pinMode(pinGBClock,OUTPUT);
while(1){
setMode();
}
Expand Down

0 comments on commit 7ba6f76

Please sign in to comment.