From adcfbbd29076191e6befb278141eb59feb539241 Mon Sep 17 00:00:00 2001 From: timothy lamb Date: Sun, 26 Jul 2015 15:43:31 -0700 Subject: [PATCH] Release 1.2.3 from Google Code. --- Arduinoboy/Arduinoboy.ino | 4 +-- Arduinoboy/Memory_Functions.ino | 2 +- Arduinoboy/Mode_LSDJ_Keyboard.ino | 20 ++++++------ Arduinoboy/Mode_LSDJ_Map.ino | 14 ++++---- Arduinoboy/Mode_LSDJ_MasterSync.ino | 14 ++++---- Arduinoboy/Mode_LSDJ_Midiout.ino | 50 ++++++++++++++++------------- Arduinoboy/Mode_LSDJ_SlaveSync.ino | 14 ++++---- Arduinoboy/Mode_MidiGb.ino | 26 +++++++-------- Arduinoboy/Mode_Nanoloop.ino | 2 +- Arduinoboy/Mode_Programmer.ino | 36 ++++++++++----------- 10 files changed, 94 insertions(+), 88 deletions(-) diff --git a/Arduinoboy/Arduinoboy.ino b/Arduinoboy/Arduinoboy.ino index 5fb05b1..cf13959 100644 --- a/Arduinoboy/Arduinoboy.ino +++ b/Arduinoboy/Arduinoboy.ino @@ -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; diff --git a/Arduinoboy/Memory_Functions.ino b/Arduinoboy/Memory_Functions.ino index c9afaf3..e0c98e6 100644 --- a/Arduinoboy/Memory_Functions.ino +++ b/Arduinoboy/Memory_Functions.ino @@ -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]); } } diff --git a/Arduinoboy/Mode_LSDJ_Keyboard.ino b/Arduinoboy/Mode_LSDJ_Keyboard.ino index 7c9a288..b076a75 100644 --- a/Arduinoboy/Mode_LSDJ_Keyboard.ino +++ b/Arduinoboy/Mode_LSDJ_Keyboard.ino @@ -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 /*************************************************************************** @@ -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 @@ -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; } } diff --git a/Arduinoboy/Mode_LSDJ_Map.ino b/Arduinoboy/Mode_LSDJ_Map.ino index de0e572..ad4d8bc 100644 --- a/Arduinoboy/Mode_LSDJ_Map.ino +++ b/Arduinoboy/Mode_LSDJ_Map.ino @@ -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 diff --git a/Arduinoboy/Mode_LSDJ_MasterSync.ino b/Arduinoboy/Mode_LSDJ_MasterSync.ino index 6d2373c..2412cc1 100644 --- a/Arduinoboy/Mode_LSDJ_MasterSync.ino +++ b/Arduinoboy/Mode_LSDJ_MasterSync.ino @@ -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 @@ -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; @@ -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 diff --git a/Arduinoboy/Mode_LSDJ_Midiout.ino b/Arduinoboy/Mode_LSDJ_Midiout.ino index ee3840b..0d38197 100644 --- a/Arduinoboy/Mode_LSDJ_Midiout.ino +++ b/Arduinoboy/Mode_LSDJ_Midiout.ino @@ -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 { @@ -93,9 +93,10 @@ void checkStopNote(byte m) void stopNote(byte m) { for(int x=0;x>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; @@ -133,16 +136,18 @@ void playCC(byte m, byte 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() @@ -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 } } diff --git a/Arduinoboy/Mode_LSDJ_SlaveSync.ino b/Arduinoboy/Mode_LSDJ_SlaveSync.ino index b234feb..afb109c 100644 --- a/Arduinoboy/Mode_LSDJ_SlaveSync.ino +++ b/Arduinoboy/Mode_LSDJ_SlaveSync.ino @@ -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) { @@ -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 } } } @@ -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; } } diff --git a/Arduinoboy/Mode_MidiGb.ino b/Arduinoboy/Mode_MidiGb.ino index e165b39..a1ced6b 100644 --- a/Arduinoboy/Mode_MidiGb.ino +++ b/Arduinoboy/Mode_MidiGb.ino @@ -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) { @@ -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; } @@ -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 @@ -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; diff --git a/Arduinoboy/Mode_Nanoloop.ino b/Arduinoboy/Mode_Nanoloop.ino index c41f123..da1193c 100644 --- a/Arduinoboy/Mode_Nanoloop.ino +++ b/Arduinoboy/Mode_Nanoloop.ino @@ -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) { diff --git a/Arduinoboy/Mode_Programmer.ino b/Arduinoboy/Mode_Programmer.ino index 94e82b1..8547505 100644 --- a/Arduinoboy/Mode_Programmer.ino +++ b/Arduinoboy/Mode_Programmer.ino @@ -27,19 +27,19 @@ void checkProgrammerConnected() void programmerSendSettings() { - Serial.print(0xF0,BYTE); - Serial.print(sysexManufacturerId,BYTE); - Serial.print(0x40,BYTE); + Serial.write(0xF0); + Serial.write(sysexManufacturerId); + Serial.write(0x40); sendMemory(); - Serial.print(0xF7,BYTE); + Serial.write(0xF7); } void setProgrammerRequestConnect() { - Serial.print(0xF0,BYTE); - Serial.print(sysexManufacturerId,BYTE); - Serial.print(65,BYTE); - Serial.print(0xF7,BYTE); + Serial.write(0xF0); + Serial.write(sysexManufacturerId); + Serial.write(65); + Serial.write(0xF7); } void setProgrammerMemorySave() @@ -77,12 +77,12 @@ void programmerCheckTimeout() void programmerSendConnectRequest() { if(millis() > (sysexProgrammerLastSent+sysexProgrammerCallTime)) { - Serial.print(0xF0,BYTE); - Serial.print(sysexManufacturerId,BYTE); - Serial.print(0x7F,BYTE); - Serial.print(defaultMemoryMap[MEM_VERSION_FIRST],BYTE); - Serial.print(defaultMemoryMap[MEM_VERSION_SECOND],BYTE); - Serial.print(0xF7,BYTE); + Serial.write(0xF0); + Serial.write(sysexManufacturerId); + Serial.write(0x7F); + Serial.write(defaultMemoryMap[MEM_VERSION_FIRST]); + Serial.write(defaultMemoryMap[MEM_VERSION_SECOND]); + Serial.write(0xF7); sysexProgrammerLastSent = millis(); } } @@ -121,10 +121,10 @@ void setMode(byte mode) void sendMode() { - Serial.print(0xF0,BYTE); - Serial.print(sysexManufacturerId,BYTE); - Serial.print(memory[MEM_MODE],BYTE); - Serial.print(0xF7,BYTE); + Serial.write(0xF0); + Serial.write(sysexManufacturerId); + Serial.write(memory[MEM_MODE]); + Serial.write(0xF7); } void setMidioutDelay(byte a,byte b,byte c,byte d)