Skip to content

Commit

Permalink
Release 1.2.3 from Google Code.
Browse files Browse the repository at this point in the history
  • Loading branch information
trash80 committed Jul 26, 2015
1 parent 93ba891 commit adcfbbd
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 88 deletions.
4 changes: 2 additions & 2 deletions Arduinoboy/Arduinoboy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ byte incomingMidiByte; //incomming midi message
byte readgbClockLine;
byte readGbSerialIn;
byte bit;
int incomingMidiData[] = {0, 0, 0};
int lastMidiData[] = {0, 0, 0};
byte midiData[] = {0, 0, 0};
byte lastMidiData[] = {0, 0, 0};

int incomingMidiNote = 0;
int incomingMidiVel = 0;
Expand Down
2 changes: 1 addition & 1 deletion Arduinoboy/Memory_Functions.ino
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void printMemory()
void sendMemory()
{
for(int m=0;m<=MEM_MAX;m++){
Serial.print(memory[m],BYTE);
Serial.write(memory[m]);
}
}

Expand Down
20 changes: 10 additions & 10 deletions Arduinoboy/Mode_LSDJ_Keyboard.ino
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void modeLSDJKeyboard()
while(1){ //Loop foreverrrr
if (Serial.available()) { //If MIDI is sending
incomingMidiByte = Serial.read(); //Get the byte sent from MIDI
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.print(incomingMidiByte, BYTE);//Echo the Byte to MIDI Output
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.write(incomingMidiByte);//Echo the Byte to MIDI Output


/***************************************************************************
Expand Down Expand Up @@ -66,14 +66,14 @@ void modeLSDJKeyboard()
//There are 3 bytes total we need: Channel, Note, and velocity, these wil be assigned to a array until we have the velocity,
//at that point we can then call our note out function to LSDJ
midiNoteOnMode = true; //Set our stupid "Note on mode" on
incomingMidiData[0] = incomingMidiByte; //Assign the byte to the first position of a data array. (this is the midi channel)
incomingMidiData[1] = false; //Force the second position to false (this will hold the note number)
midiData[0] = incomingMidiByte; //Assign the byte to the first position of a data array. (this is the midi channel)
midiData[1] = false; //Force the second position to false (this will hold the note number)
break;
case 0xC0:
//Program change message
midiProgramChange = true; //Set our silly "Program Change mode" ... we need to get the next byte later
midiNoteOnMode = false; //Turn Note-on mode off
incomingMidiData[0] = incomingMidiByte - 48;//Set the number to a "note on" message so we can use the same "channel" variable as note on messages
midiData[0] = incomingMidiByte - 48;//Set the number to a "note on" message so we can use the same "channel" variable as note on messages
break;
case 0xF0:
//Do nothing, these dont interfear with our note-on mode
Expand All @@ -85,19 +85,19 @@ void modeLSDJKeyboard()
}
} else if(midiNoteOnMode) {
//It wasnt a status bit, so lets assume it was a note message if the last status message was note-on.
if(!incomingMidiData[1]) {
if(!midiData[1]) {
//If we dont have a note number, we assume this byte is the note number, get it...
incomingMidiData[1] = incomingMidiByte;
midiData[1] = incomingMidiByte;
} else {
//We have our note and channel, so call our note function...

playLSDJNote(incomingMidiData[0], incomingMidiData[1], incomingMidiByte);
incomingMidiData[1] = false; //Set the note to false, forcing to capture the next note
playLSDJNote(midiData[0], midiData[1], incomingMidiByte);
midiData[1] = false; //Set the note to false, forcing to capture the next note
}
} else if (midiProgramChange) {
changeLSDJInstrument(incomingMidiData[0], incomingMidiByte);
changeLSDJInstrument(midiData[0], incomingMidiByte);
midiProgramChange = false;
incomingMidiData[0] = false;
midiData[0] = false;
}
}

Expand Down
14 changes: 7 additions & 7 deletions Arduinoboy/Mode_LSDJ_Map.ino
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ void modeLSDJMap()
midiTickHit=false;
break;
default:
incomingMidiData[0] = incomingMidiByte;
midiData[0] = incomingMidiByte;
midiNoteOnMode = true;
if(incomingMidiData[0] == (0x90+memory[MEM_LIVEMAP_CH])) midiTickHit=false;
if(midiData[0] == (0x90+memory[MEM_LIVEMAP_CH])) midiTickHit=false;
}
} else if(midiNoteOnMode) { //if we've received a message thats not a status and our note capture mode is true
midiNoteOnMode = false;
incomingMidiData[1] = incomingMidiByte;
if(incomingMidiData[0] == (0x90+memory[MEM_LIVEMAP_CH])) midiTickHit=false;
midiData[1] = incomingMidiByte;
if(midiData[0] == (0x90+memory[MEM_LIVEMAP_CH])) midiTickHit=false;
} else {
midiNoteOnMode = true;
if(incomingMidiData[0] == (0x90+memory[MEM_LIVEMAP_CH]) && incomingMidiByte) {
sendByteToGameboy(incomingMidiData[1]);
if(midiData[0] == (0x90+memory[MEM_LIVEMAP_CH]) && incomingMidiByte) {
sendByteToGameboy(midiData[1]);
updateVisualSync();
midiTickHit = false;
}
}
//Serial.print(incomingMidiByte, BYTE);
//Serial.write(incomingMidiByte);
checkClockTick();
} else {
setMode(); //Check if the mode button was depressed
Expand Down
14 changes: 7 additions & 7 deletions Arduinoboy/Mode_LSDJ_MasterSync.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void modeLSDJMasterSync()
while(1){
if (Serial.available()) { //If serial data was send to midi input
incomingMidiByte = Serial.read(); //Read it
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.print(incomingMidiByte, BYTE); //Send it to the midi output
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.write(incomingMidiByte); //Send it to the midi output
}
readgbClockLine = PINC & 0x01; //Read gameboy's clock line
if(readgbClockLine) { //If Gb's Clock is On
Expand Down Expand Up @@ -66,7 +66,7 @@ boolean checkLSDJStopped()
if(sequencerStarted) {
readgbClockLine=false;
countClockPause = 0; //reset our clock
Serial.print(0xFC, BYTE); //send the transport stop message
Serial.write(0xFC); //send the transport stop message
sequencerStop(); //call the global sequencer stop function
}
return true;
Expand All @@ -84,14 +84,14 @@ void sendMidiClockSlaveFromLSDJ()
{
if(!countGbClockTicks) { //If we hit 8 bits
if(!sequencerStarted) { //If the sequencer hasnt started
Serial.print((0x90+memory[MEM_LSDJMASTER_MIDI_CH]), BYTE); //Send the midi channel byte
Serial.print(readGbSerialIn, BYTE); //Send the row value as a note
Serial.print(0x7F, BYTE); //Send a velocity 127
Serial.write((0x90+memory[MEM_LSDJMASTER_MIDI_CH])); //Send the midi channel byte
Serial.write(readGbSerialIn); //Send the row value as a note
Serial.write(0x7F); //Send a velocity 127

Serial.print(0xFA, BYTE); //send MIDI transport start message
Serial.write(0xFA); //send MIDI transport start message
sequencerStart(); //call the global sequencer start function
}
Serial.print(0xF8, BYTE); //Send the MIDI Clock Tick
Serial.write(0xF8); //Send the MIDI Clock Tick

countGbClockTicks=0; //Reset the bit counter
readGbSerialIn = 0x00; //Reset our serial read value
Expand Down
50 changes: 28 additions & 22 deletions Arduinoboy/Mode_LSDJ_Midiout.ino
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ void modeLSDJMidiout()
switch(incomingMidiByte)
{
case 0x7F: //clock tick
Serial.print(0xF8, BYTE);
Serial.write(0xF8);
break;
case 0x7E: //seq stop
Serial.print(0xFC, BYTE);
Serial.write(0xFC);
stopAllNotes();
break;
case 0x7D: //seq start
Serial.print(0xFA, BYTE);
Serial.write(0xFA);
break;
default:
incomingMidiData[0] = (incomingMidiByte - 0x70);
midiData[0] = (incomingMidiByte - 0x70);
midiValueMode = true;
break;
}
} else if (midiValueMode == true) {
midiValueMode = false;
midioutDoAction(incomingMidiData[0],incomingMidiByte);
midioutDoAction(midiData[0],incomingMidiByte);
}

} else {
Expand Down Expand Up @@ -93,19 +93,21 @@ void checkStopNote(byte m)
void stopNote(byte m)
{
for(int x=0;x<midioutNoteHoldCounter[m];x++) {
Serial.print((0x80 + (memory[MEM_MIDIOUT_NOTE_CH+m])), BYTE);
Serial.print(midioutNoteHold[m][x], BYTE);
Serial.print(0x00, BYTE);
midiData[0] = (0x80 + (memory[MEM_MIDIOUT_NOTE_CH+m]));
midiData[1] = midioutNoteHold[m][x];
midiData[2] = 0x00;
Serial.write(midiData,3);
}
midiOutLastNote[m] = -1;
midioutNoteHoldCounter[m] = 0;
}

void playNote(byte m, byte n)
{
Serial.print((0x90 + (memory[MEM_MIDIOUT_NOTE_CH+m])), BYTE);
Serial.print(n, BYTE);
Serial.print(0x7F, BYTE);
midiData[0] = (0x90 + (memory[MEM_MIDIOUT_NOTE_CH+m]));
midiData[1] = n;
midiData[2] = 0x7F;
Serial.write(midiData,3);

midioutNoteHold[m][midioutNoteHoldCounter[m]] =n;
midioutNoteHoldCounter[m]++;
Expand All @@ -123,26 +125,29 @@ void playCC(byte m, byte n)
//if(v) v --;
}
n=(m*7)+((n>>4) & 0x07);
Serial.print((0xB0 + (memory[MEM_MIDIOUT_CC_CH+m])), BYTE);
Serial.print((memory[MEM_MIDIOUT_CC_NUMBERS+n]), BYTE);
Serial.print(v, BYTE);
midiData[0] = (0xB0 + (memory[MEM_MIDIOUT_CC_CH+m]));
midiData[1] = (memory[MEM_MIDIOUT_CC_NUMBERS+n]);
midiData[2] = v;
Serial.write(midiData,3);
} else {
if(memory[MEM_MIDIOUT_CC_SCALING+m]) {
float s;
s = n;
v = ((s / 0x6f) * 0x7f);
}
n=(m*7);
Serial.print((0xB0 + (memory[MEM_MIDIOUT_CC_CH+m])), BYTE);
Serial.print((memory[MEM_MIDIOUT_CC_NUMBERS+n]), BYTE);
Serial.print(v, BYTE);
midiData[0] = (0xB0 + (memory[MEM_MIDIOUT_CC_CH+m]));
midiData[1] = (memory[MEM_MIDIOUT_CC_NUMBERS+n]);
midiData[2] = v;
Serial.write(midiData,3);
}
}

void playPC(byte m, byte n)
{
Serial.print((0xC0 + (memory[MEM_MIDIOUT_NOTE_CH+m])), BYTE);
Serial.print(n, BYTE);
midiData[0] = (0xC0 + (memory[MEM_MIDIOUT_NOTE_CH+m]));
midiData[1] = n;
Serial.write(midiData,2);
}

void stopAllNotes()
Expand All @@ -151,9 +156,10 @@ void stopAllNotes()
if(midiOutLastNote[m]>=0) {
stopNote(m);
}
Serial.print((0xB0 + (memory[MEM_MIDIOUT_NOTE_CH+m])), BYTE); //Send the midi channel byte
Serial.print(123, BYTE); //Send the midi channel byte
Serial.print(0x7F, BYTE); //Send the midi channel byte
midiData[0] = (0xB0 + (memory[MEM_MIDIOUT_NOTE_CH+m]));
midiData[1] = 123;
midiData[2] = 0x7F;
Serial.write(midiData,3); //Send midi
}
}

Expand Down
14 changes: 7 additions & 7 deletions Arduinoboy/Mode_LSDJ_SlaveSync.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void modeLSDJSlaveSync()
if (Serial.available()) { //If MIDI Byte Availaibleleleiel
incomingMidiByte = Serial.read(); //Read it

if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.print(incomingMidiByte, BYTE); //Send it back to the Midi out
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.write(incomingMidiByte); //Send it back to the Midi out

if(incomingMidiByte & 0x80) { //If we have received a MIDI Status Byte
switch (incomingMidiByte) {
Expand Down Expand Up @@ -55,19 +55,19 @@ void modeLSDJSlaveSync()
default:
if(incomingMidiByte == (0x90+memory[MEM_LSDJSLAVE_MIDI_CH])) { //if a midi note was received and its on the channel of the sync effects channel
midiNoteOnMode = true; //turn on note capture
incomingMidiData[0] = false; //and reset the captured note
midiData[0] = false; //and reset the captured note
} else {
midiNoteOnMode = false; //turn off note capture
}
}
} else if(midiNoteOnMode) { //if we've received a message thats not a status and our note capture mode is true
if(!incomingMidiData[0]) { //if there is no note number yet
incomingMidiData[0] = incomingMidiByte; //then assume the byte is a note and assign it to a place holder
if(!midiData[0]) { //if there is no note number yet
midiData[0] = incomingMidiByte; //then assume the byte is a note and assign it to a place holder
} else { //else assumed velocity
if(incomingMidiByte > 0x00) {
getSlaveSyncEffect(incomingMidiData[0]); //then call our sync effects function
getSlaveSyncEffect(midiData[0]); //then call our sync effects function
}
incomingMidiData[0] = false; //and reset the captured note
midiData[0] = false; //and reset the captured note
}
}
}
Expand Down Expand Up @@ -120,7 +120,7 @@ void getSlaveSyncEffect(byte note)
countSyncSteps = 8;
break;
default: //All other notes will make LSDJ Start at the row number thats the same as the note number.
midiDefaultStartOffset = incomingMidiData[0];
midiDefaultStartOffset = midiData[0];
break;
}
}
26 changes: 13 additions & 13 deletions Arduinoboy/Mode_MidiGb.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void modeMidiGb()
if (Serial.available()) { //If MIDI is sending
incomingMidiByte = Serial.read(); //Get the byte sent from MIDI

if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.print(incomingMidiByte, BYTE); //Echo the Byte to MIDI Output
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.write(incomingMidiByte); //Echo the Byte to MIDI Output

if(incomingMidiByte & 0x80) {
switch (incomingMidiByte & 0xF0) {
Expand All @@ -38,26 +38,26 @@ void modeMidiGb()
midiStatusChannel = incomingMidiByte&0x0F;
midiStatusType = incomingMidiByte&0xF0;
if(midiStatusChannel == memory[MEM_MGB_CH]) {
incomingMidiData[0] = midiStatusType;
midiData[0] = midiStatusType;
sendByte = true;
} else if (midiStatusChannel == memory[MEM_MGB_CH+1]) {
incomingMidiData[0] = midiStatusType+1;
midiData[0] = midiStatusType+1;
sendByte = true;
} else if (midiStatusChannel == memory[MEM_MGB_CH+2]) {
incomingMidiData[0] = midiStatusType+2;
midiData[0] = midiStatusType+2;
sendByte = true;
} else if (midiStatusChannel == memory[MEM_MGB_CH+3]) {
incomingMidiData[0] = midiStatusType+3;
midiData[0] = midiStatusType+3;
sendByte = true;
} else if (midiStatusChannel == memory[MEM_MGB_CH+4]) {
incomingMidiData[0] = midiStatusType+4;
midiData[0] = midiStatusType+4;
sendByte = true;
} else {
midiValueMode =false;
midiAddressMode=false;
}
if(sendByte) {
sendByteToGameboy(incomingMidiData[0]);
sendByteToGameboy(midiData[0]);
midiValueMode =false;
midiAddressMode=true;
}
Expand All @@ -66,15 +66,15 @@ void modeMidiGb()
} else if (midiAddressMode){
midiAddressMode = false;
midiValueMode = true;
incomingMidiData[1] = incomingMidiByte;
sendByteToGameboy(incomingMidiData[1]);
midiData[1] = incomingMidiByte;
sendByteToGameboy(midiData[1]);
} else if (midiValueMode) {
incomingMidiData[2] = incomingMidiByte;
midiData[2] = incomingMidiByte;
midiAddressMode = true;
midiValueMode = false;

sendByteToGameboy(incomingMidiData[2]);
blinkLight(incomingMidiData[0],incomingMidiData[2]);
sendByteToGameboy(midiData[2]);
blinkLight(midiData[0],midiData[2]);
}
} else {
setMode(); // Check if mode button was depressed
Expand All @@ -88,7 +88,7 @@ boolean checkGbSerialStopped()
countClockPause++; //Increment the counter
if(countClockPause > 16000) { //if we've reached our waiting period
countClockPause = 0; //reset our clock
Serial.print(0xFC, BYTE); //send the transport stop message
Serial.write(0xFC); //send the transport stop message
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion Arduinoboy/Mode_Nanoloop.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void modeNanoloopSync()
while(1){ //Loop forever
if (Serial.available()) { //If MIDI Byte Availaibleleleiel
incomingMidiByte = Serial.read(); //Read it
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.print(incomingMidiByte, BYTE); //Send it back to the Midi out
if(!checkForProgrammerSysex(incomingMidiByte) && !usbMode) Serial.write(incomingMidiByte); //Send it back to the Midi out


if(incomingMidiByte & 0x80) {
Expand Down
Loading

0 comments on commit adcfbbd

Please sign in to comment.