I didn't bother creating set() or get() methods for the majority of the classes because, again, I wrote this app for my personal use and I don't intend to use it for multi-threading. Besides, the code is long enough as it is. I only needed a few constructors, and I added the methods that seemed necessary as I went along. Class definitions: metronome is used for the onscreen metronome. --------------------------------------------- int bpm - Beats per Minute int tmr - Holder for the timer counter for updating beat counts int cntr - Beat counter (right now, goes from 1 to 4). int bpmTotal - bpm * 1000 ms boolean state - On/Off state of the Metronome button metronome(int bpm, int cntr, int state) - class constructor. portSettings is used for holding the channel numbers for the K-Pro, keyboard and default synth. ----------------------------------------------------------------------------------------------- int kProChannelNo - K-Pro channel number (I'm using MIDI channel 1, Java calls this channel 0). int keyboardChannelNo - Keyboard channel number. I'll probably use 1 when I get a keyboard. int defaultChannelNo - Starting channel for the software synth. I'm using 12 channels, and starting at 2 by default. portSettings(int kProChannelNo, int keyboardChannelNo, int defaultChannelNo) - class constructor. Take, K-Pro, keyboard and default channel numbers. setKProChannel(int kProChannelNo) - K-Pro set method with error handling. setKeyboardChannel(int keyboardChannelNo) - Keyboard set method with error handling. setDefaultSynthChannel(int defaultChannelNo) - Default synth staring channel number with error handling. checkChannelConflict(void) - Make sure that the hardware doesn't have overlapping channel numbers. gateArp is used for holding the arpeggiator settings. ---------------------------------------------------- The gateArp is the heart of this program. If a keyboard is connected and the arp is turned off, we just pass the NOTE_ON and NOTE_OFF messages to the K-Pro or the default synth. If it's on, we use it to arpeggiate the key being pressed. This means we need to know how long to keep a note on and off, which note the user is playing, and which note we play in the pattern. Say the pattern is 0 1 2 3, keyboard base note is 40, rate is 1/2 sec., ratio is 40%, and arp spacing is 2. The arp base note would be 40 (keyboard base note plus whatever key is being pressed). The synth would see instructions to turn on notes: 40, 42, 44, 44. The note would remain on (500 * .4) 200ms and off for (500 * .6) 300ms. ---------------------------------------------------- boolean state - gateArp turned on or off int rate - Seconds per note int ratio - Ratio of note on to note off boolean onOff - Toggle for note on and off int onTime - Number of milliseconds for note on int offTime - Number of milliseconds for note off int arpTime - Contains either onTime or offTime when arpeggiator is running int arpTmr - Number of milliseconds since timer started int currentNote - Note currently being played from the arp pattern list int calcNote - Calculated note to play based on bottom note, pattern and step size int patPtr - Which note within the pattern is currently being played int currentPat - Which pattern is currently being played (space delimited) int patLength - Number of notes in the current pattern int stepSize - Size of steps to take based on the pattern contents gateArp(int rate, int ratio, int onTime, int offTime, int stepSize) - class constructor calc(void) - Calculate the timing for note on and note off times based on ratio and rate nextNote(int arpBaseNote) - Calculate the next note to play based on pattern, bottom note and Arp note spacing. patch - This is the super class that we use for storing program patches. ------------------------------------------------------------------------ For my purposes, a "patch" consists of all of the screen settings (channel numbers, instruments attached to each of the preset buttons, the name of the arp patterns file, metronome settings, gate arp settings, etc.) needed to recreate whatever the user has entered. I save the settings to an ArrayList of patches, allowing me to save them to file and read them back. Because I can not figure out object serialization for the life of me, I have to do file reading and writing the hard way. There's no constructor for this class. ------------------------------------------------------------------------ String name; int kProChannel - K-Pro channel number int keyboardChannel - keyboard channel number int defaultChannel - Java software synth starting channel number int [] pkProVoices - Instrument numbers assigned to the K-Pro preset buttons int [] pdefaultVoices - Instrument numbers assigned to the default synth preset buttons int selectedVoice - Identifies which preset button is currently "on" int volume - K-Pro volume setting int bpm - Metronome beats per minute int keyboardBaseNote - Keyboard bottom note int keyboardNoteSpacing - Spacing between keys on the keyboard for covering more than 1 octave String arpPatternFile - Path name of the file used to hold the gate arp patterns int arpRate - Arpeggiator rate int arpRatio - Arpeggiator note on/note off ratio int arpNoteSpacing - Step size for arp pattern (0 1 2 3 pattern with stepsize 3 gives an output of base note + 0, 3, 6, 9) int arpPattern - ArrayList Index of the pattern currently running. void gatherPatch(void) - Copy data from the jButton and jTextfield components to the patch object. void loadPatch(void) - Copy date from the patch object to the jButton and jTextField components. String makeString(void) - Convert all the member contents to one long string for saving to file. void parseFromFile(String) - Take the string from the file and parse to all of the object's members. TimerExec is the sole timer used in this app. --------------------------------------------- I tried having two separate timer objects, but they kept clobbering each other. So I figured the easiest choice was to just have the timer increment two different counter variables every millisecond, and when one or the other reached the max limit, call the method for that counter. --------------------------------------------- no dedicated members. run() - Overload the run() method. <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> Functions private void initJButtonList() - Load pointers to the jButtons to an ArrayList to ease button manipulation initMidiDevices() - Check for the K-Pro and keyboard and open MIDI objects private void readSoundBank() - Open software synth and read the sound bank to the combo box private void initSliders() - Preset some of the slider components and init other buttons private void initkProInstrumentList() - Load the K-Pro instrument voice array to the combo box private void readArpPatFile(File fname) - Read the pareggiator patterns file selected by the user private void playArp(int n) - Play the notes as calculated by the arpggiator object private void kProProgram(int voiceNumber) - Change the K-Pro instrument voice (change program) private void kProNote(int channel, int col, int row, int onOff) - Turn the K-Pro note at "row" and "col" on or off private void kProAllOff() - Set K-Pro note 0,0 off. Forces NOTE_OFF private boolean isInt(String s) - Function for testing if the contents of a string can be converted to an int private void savePatchFile(String fName) - Save the patch ArrayList to the file selected by the user. All other code is located within the action listeners of the various GUI components.