commit 1a3453d1b77feb7707639d4ba119e5dbc58398a4 Author: mwinter Date: Tue Mar 2 18:53:43 2021 +0100 initial reboot commit diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..591c426 --- /dev/null +++ b/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..9a08389 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Rise_I + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/libs/Rise_I.jar b/libs/Rise_I.jar new file mode 100644 index 0000000..e06036e Binary files /dev/null and b/libs/Rise_I.jar differ diff --git a/libs/jsyn_16_7_3.jar b/libs/jsyn_16_7_3.jar new file mode 100644 index 0000000..ada82fc Binary files /dev/null and b/libs/jsyn_16_7_3.jar differ diff --git a/main/.DS_Store b/main/.DS_Store new file mode 100644 index 0000000..69d8019 Binary files /dev/null and b/main/.DS_Store differ diff --git a/main/.gitignore b/main/.gitignore new file mode 100644 index 0000000..72da1a0 --- /dev/null +++ b/main/.gitignore @@ -0,0 +1,75 @@ +/BoundingBox.class +/Cue.class +/CuePanel.class +/Glissandi.class +/GrainStream.class +/Note.class +/NoteFrame$1.class +/NoteFrame.class +/OpenClassIterator.class +/PitchVector.class +/PrintUtilities.class +/Rise.class +/SaveClassIterator.class +/Score.class +/ScrollBar.class +/ToolFrame$1.class +/ToolFrame$10.class +/ToolFrame$11.class +/ToolFrame$12.class +/ToolFrame$13.class +/ToolFrame$14.class +/ToolFrame$15.class +/ToolFrame$16.class +/ToolFrame$17.class +/ToolFrame$18.class +/ToolFrame$19.class +/ToolFrame$2.class +/ToolFrame$20.class +/ToolFrame$21.class +/ToolFrame$22.class +/ToolFrame$23.class +/ToolFrame$24.class +/ToolFrame$25.class +/ToolFrame$26.class +/ToolFrame$27.class +/ToolFrame$28.class +/ToolFrame$29.class +/ToolFrame$3.class +/ToolFrame$30.class +/ToolFrame$31.class +/ToolFrame$32.class +/ToolFrame$33.class +/ToolFrame$34.class +/ToolFrame$35.class +/ToolFrame$36.class +/ToolFrame$37.class +/ToolFrame$38.class +/ToolFrame$39.class +/ToolFrame$4.class +/ToolFrame$40.class +/ToolFrame$41.class +/ToolFrame$42.class +/ToolFrame$43.class +/ToolFrame$44.class +/ToolFrame$45.class +/ToolFrame$46.class +/ToolFrame$47.class +/ToolFrame$48.class +/ToolFrame$49.class +/ToolFrame$5.class +/ToolFrame$50.class +/ToolFrame$51.class +/ToolFrame$52.class +/ToolFrame$53.class +/ToolFrame$54.class +/ToolFrame$55.class +/ToolFrame$56.class +/ToolFrame$57.class +/ToolFrame$58.class +/ToolFrame$6.class +/ToolFrame$7.class +/ToolFrame$8.class +/ToolFrame$9.class +/ToolFrame.class +/WaveForm.class diff --git a/main/BoundingBox.java b/main/BoundingBox.java new file mode 100644 index 0000000..1ec8186 --- /dev/null +++ b/main/BoundingBox.java @@ -0,0 +1,49 @@ +package main; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.geom.Rectangle2D; +import javax.swing.JPanel; + +public class BoundingBox extends JPanel { + + double x1; + double x2; + double y1; + double y2; + + public BoundingBox() { + this.setOpaque(false); + this.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + this.setVisible(false); + } + + public void setCoordinates(double x1, double x2, double y1, double y2) { + this.x1 = x1; + this.x2 = x2; + this.y1 = y1; + this.y2 = y2; + + if (this.x1<0){ + this.x1=0; + } + if (this.x2>this.getWidth()){ + this.x2=this.getWidth()-1; + } + + if (this.y1<0){ + this.y1=0; + } + if (this.y2>this.getHeight()){ + this.y2=this.getHeight()-1; + } + } + + public void paint(Graphics g){ + //super.paint(g); + g.setColor(Color.BLUE); + Graphics2D g2 = (Graphics2D) g; + g2.draw(new Rectangle2D.Double(x1, y1, x2-x1, y2-y1)); + } +} \ No newline at end of file diff --git a/main/Cue.java b/main/Cue.java new file mode 100644 index 0000000..6fb4331 --- /dev/null +++ b/main/Cue.java @@ -0,0 +1,82 @@ +package main; + +import java.awt.Color; + +import javax.swing.JPanel; + +import com.softsynth.jsyn.Synth; + +public class Cue extends Thread { + + JPanel cuePanel; + int startTick; + int cuesPast; + int clicksPast; + int[] cuesPoints; + + + public Cue(JPanel cP){ + super(); + cuePanel = cP; + //add(new LineOut()); + } + + public void init(int[] cP){ + //startTick = sT; + cuesPoints = cP; + cuesPast = 0; + clicksPast = 0; + } + + public synchronized void run() { + + try { + //System.out.println("waiting"); + this.wait(0); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + //boolean isOn = true; + + int startTime = cuesPoints[0]; + + int duration = (int) (Synth.getTickRate() / 10); + //int duration = (int) (Synth.getTickRate() / 50); + + int advanceTime = (int) (Synth.getTickRate() * .5); // half second advance + Synth.sleepUntilTick(startTime - advanceTime);// /*(int) (Math.random() * 2 * Synth.getTickRate())*/); // Wake up early! + int nextTime = startTime; + int nextCueTime = startTime; + while(true) + { + if (Rise.IS_ENGINE_ON == true) { + + if (Synth.getTickCount() > nextCueTime) { + if (cuesPast % 2 == 0) { + cuePanel.setBackground(Color.BLACK); + } + else{ + cuePanel.setBackground(Color.WHITE); + } + cuesPast++; + nextCueTime = cuesPoints[cuesPast]; + //System.out.println("test " + clicksPast + " " + nextCueTime + " " + Synth.getTickCount()); + } + + nextTime += duration; + Synth.sleepUntilTick(nextTime); + + } + else { + try { + //System.out.println("waiting"); + this.wait(0); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + +} diff --git a/main/CuePanel.java b/main/CuePanel.java new file mode 100644 index 0000000..40e2897 --- /dev/null +++ b/main/CuePanel.java @@ -0,0 +1,40 @@ +package main; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; + +import javax.swing.JPanel; + +public class CuePanel extends JPanel{ + + public double envPos; + public Color color; +// public void setEnv(double eV){ +// envPos +// } + + public void paint(Graphics g){ + super.paint(g); + Graphics2D g2 = (Graphics2D) g; + FontRenderContext frc = g2.getFontRenderContext(); + Font fontTime = new Font("Times", Font.PLAIN, 40); + int totalSecs = (int) (envPos * Rise.TOTAL_DUR); + int minutes = totalSecs/60; + int seconds = totalSecs%60; + String secondString = seconds + ""; + if (seconds < 10){ + secondString = "0" + secondString; + } + String timeForString = minutes + ":" + secondString; + TextLayout time = new TextLayout(timeForString, fontTime, frc); + g2.setFont(fontTime); + + g2.setColor(color); + time.draw(g2,5,50); + } + +} diff --git a/main/Glissandi.java b/main/Glissandi.java new file mode 100644 index 0000000..6591db7 --- /dev/null +++ b/main/Glissandi.java @@ -0,0 +1,373 @@ +package main; + +import java.awt.Color; + +import com.softsynth.jsyn.AddUnit; +import com.softsynth.jsyn.DivideUnit; +import com.softsynth.jsyn.EnvelopePlayer; +import com.softsynth.jsyn.EqualTemperedTuning; +import com.softsynth.jsyn.ExponentialLag; +import com.softsynth.jsyn.LineOut; +import com.softsynth.jsyn.MultiplyUnit; +import com.softsynth.jsyn.SynthEnvelope; +import com.softsynth.jsyn.Synth; +import com.softsynth.jsyn.SynthMixer; + +public class Glissandi extends Thread{ + + WaveForm[] gliss; + AddUnit[] num; + DivideUnit[] ratio; + MultiplyUnit[] freq; + SynthEnvelope env; + MultiplyUnit denMult; + AddUnit den; + EnvelopePlayer envPlayer; + boolean isOn = false; + double fund; + GrainStream grainStream[]; + LineOut lineOut; + SynthMixer glissMixer; + SynthMixer grainMixer; + ExponentialLag grainFader; + MultiplyUnit grainMult; + ExponentialLag glissFader; + MultiplyUnit glissMult; + //MultiplyUnit glissMultForCurve; + int currentTick; + + public Glissandi(){ + } + + public void init(GrainStream[] gS, int gMin, int cT, int nG){ + + currentTick = cT; + Rise.MASTER_MIXER = new SynthMixer(3,1); + glissMixer = new SynthMixer(Rise.VOICES,1); + grainMixer = new SynthMixer(nG,1); + Rise.CLICK_MIXER = new SynthMixer(10,1); + lineOut = new LineOut(); + Rise.MASTER_MULT = new MultiplyUnit(); + Rise.MASTER_FADER = new ExponentialLag(); + grainMult = new MultiplyUnit(); + grainFader = new ExponentialLag(); + glissMult = new MultiplyUnit(); + glissFader = new ExponentialLag(); + Rise.CLICK_MULT = new MultiplyUnit(); + Rise.CLICK_FADER = new ExponentialLag(); + + //System.out.println(Rise.FIRST_NUM + " " + Rise.VOICES); + + gliss = new WaveForm[Rise.VOICES]; + num = new AddUnit[Rise.VOICES]; + ratio = new DivideUnit[Rise.VOICES]; + freq = new MultiplyUnit[Rise.VOICES]; + + fund = EqualTemperedTuning.getMIDIFrequency(24+Rise.TRANSPOSE_SCORE+Rise.TRANSPOSE_SOUND); + //System.out.println(Rise.TOTAL_DUR); + + //Make sure this is ok + envPlayer = new EnvelopePlayer(); + double[] envData = new double[302]; + double playDuration = Rise.TOTAL_DUR - Rise.START_TIME; + double startEnvPosition = Rise.START_TIME/Rise.TOTAL_DUR; + double envLength = 1 - startEnvPosition; + + envData[0] = 0; + envData[1] = startEnvPosition; + for (int i = 1; i < envData.length/2; i++){ + envData[i * 2] = playDuration/((envData.length-2)/2); + envData[i * 2 + 1] = startEnvPosition + (envLength/ ((envData.length-2)/2)) * (i); + } + //System.out.println(envData[1] + " " + envData[envData.length-1]); + env = new SynthEnvelope(envData); + + denMult = new MultiplyUnit(); + denMult.inputA.connect(envPlayer.output); + denMult.inputB.set(-1 * (Rise.VOICES - 1)); + + den = new AddUnit(); + den.inputA.set(Rise.FIRST_NUM); + den.inputB.connect(denMult.output); + + int advanceTime = (int) (currentTick + 4 * Synth.getTickRate()); + + //int[] cuePoints = new int[Rise.VOICES * 14]; + + for (int i = 0; i < Rise.VOICES; i++){ + + //System.out.println(i); + + gliss[i] = new WaveForm(); + num[i] = new AddUnit(); + ratio[i] = new DivideUnit(); + freq[i] = new MultiplyUnit(); + + double spectrum = (Rise.MAX_SPECTRUM - Rise.MIN_SPECTRUM)/2. + Rise.MIN_SPECTRUM; + gliss[i].spectrum.set(spectrum); + + num[i].inputA.set(i); + num[i].inputB.connect(den.output); + + ratio[i].inputA.connect(num[i].output); + ratio[i].inputB.connect(den.output); + + freq[i].inputA.connect(ratio[i].output); + freq[i].inputB.set(fund); + + freq[i].output.connect(gliss[i].frequency); + + //gliss[i].envRate.set(1); // figure out this number + + + int startTick = (int) (advanceTime + (((Rise.TOTAL_DUR/(Rise.VOICES-1.) * i) - Rise.START_TIME) * Synth.getTickRate())); + double startPitch = fund * Rise.FIRST_NUM/(Rise.FIRST_NUM-i); + //System.out.println("test " + startTick + " " + Synth.getTickCount()); + //System.out.println("show " + ((Rise.TOTAL_DUR/(Rise.VOICES-1.) * i) - Rise.START_TIME)); + + //double st = (Rise.TOTAL_DUR/(Rise.VOICES-1.) * i); + + double startAmp = (((1/(Rise.VOICES-1.)) * i) * (Rise.GLISS_AMP_END - Rise.GLISS_AMP_START)) + Rise.GLISS_AMP_START; + + envData = new double[6]; + + envData[0] = 1; + envData[1] = startAmp; + envData[2] = Rise.TOTAL_DUR - ((1/(Rise.VOICES-1.)) * i) - 1; + envData[3] = Rise.GLISS_AMP_END; + envData[4] = Rise.FADE_DUR + Math.random()*5; + envData[5] = 0; + + if (Rise.START_TIME > (Rise.TOTAL_DUR/(Rise.VOICES-1.) * i)){ + + startAmp = (Rise.START_TIME/Rise.TOTAL_DUR) * (Rise.GLISS_AMP_END - Rise.GLISS_AMP_START) + Rise.GLISS_AMP_START; + + envData[0] = 1; + envData[1] = startAmp; + envData[2] = Rise.TOTAL_DUR - Rise.START_TIME - 1; + envData[3] = Rise.GLISS_AMP_END; + envData[4] = Rise.FADE_DUR + Math.random()*5; + envData[5] = 0; + } + + if (i == Rise.VOICES-1){ + envData = new double[4]; + envData[0] = 1; + envData[1] = Rise.GLISS_AMP_END; + envData[2] = Rise.FADE_DUR + Math.random()*5; + envData[3] = 0; + } + +// for (int j = 0; j < envData.length; j++) { +// System.out.println(i + " " + envData[j]); +// } + + gliss[i].glissOn(startTick, startPitch, 1 /*(1./Rise.VOICES)*/, envData ); + +// envData = new double[4]; +// +// envData[0] = 0; +// envData[1] = startAmp; +// envData[2] = Rise.TOTAL_DUR - ((1/(Rise.VOICES-1.)) * i) - 1; +// envData[3] = 1; +// +// gliss[i].glissSustain((int) (startTick + Synth.getTickRate()), envData); + +// for (int j = 0; j < 14; j++){ +// cuePoints[14 * i + j] = (int) (startTick - 3 * Synth.getTickRate() + Synth.getTickRate()/2. * j); +// } + + //System.out.println("test " + startTick + " " + endTick + " " + Synth.getTickCount() + " " + ((1./ (Rise.VOICES-1)) * i)); + + //make this have jitter?? + //gliss[i].glissOff(endTick, (.5 / (Rise.FADE_DUR + Math.random()*5))); + + num[i].start(startTick); + ratio[i].start(startTick); + freq[i].start(startTick); + + glissMixer.connectInput(i, gliss[i].output, 0); + glissMixer.setGain(i, 0, (1./Rise.VOICES)); + } + + //c.init(cuePoints); + + denMult.start(advanceTime); + den.start(advanceTime); + //System.out.println(envPlayer.getSynthContext().getTickCount()); + + envPlayer.start(advanceTime); + + envPlayer.envelopePort.clear(advanceTime); + envPlayer.envelopePort.queue(advanceTime,env,0,env.getNumFrames()); + + grainStream = gS; + + for (int i = 0; i < nG; i++){ + grainMixer.connectInput(i, grainStream[i].grain.output, 0); + grainMixer.setGain(i, 0, 1); + int grainStartTick = (int) (advanceTime + Rise.START_TIME * Synth.getTickRate()); + + if (i > gMin){ + grainStartTick = (int) (advanceTime + (((Rise.TOTAL_DUR/(nG - gMin) * (i - gMin)) - Rise.START_TIME) * Synth.getTickRate())); + } + + //System.out.println("tick " + grainStartTick); + grainStream[i].setStartTick(grainStartTick + (int) (Synth.getTickRate() * Math.random() * 5)); + int endTick = (int) (advanceTime + ((Rise.TOTAL_DUR - Rise.START_TIME) * Synth.getTickRate())); + grainStream[i].setEndTick(endTick); + } + + grainMult.inputA.connect(grainFader.output); + grainMult.inputB.connect(grainMixer.getOutput(0)); + + glissMult.inputA.connect(glissFader.output); + glissMult.inputB.connect(glissMixer.getOutput(0)); + + for (int count = 0; count < 10; count++){ + Rise.CLICK_MIXER.setGain(count, 0, 1); + } + + Rise.CLICK_MULT.inputA.connect(Rise.CLICK_FADER.output); + Rise.CLICK_MULT.inputB.connect(Rise.CLICK_MIXER.getOutput(0)); + + Rise.MASTER_MIXER.connectInput(0, glissMult.output, 0); + Rise.MASTER_MIXER.setGain(0, 0, 1); + + Rise.MASTER_MIXER.connectInput(1, grainMult.output, 0); + Rise.MASTER_MIXER.setGain(1, 0, 1); + + Rise.MASTER_MIXER.connectInput(2, Rise.CLICK_MULT.output, 0); + Rise.MASTER_MIXER.setGain(2, 0, 1); + + Rise.MASTER_MULT.inputA.connect(Rise.MASTER_FADER.output); + Rise.MASTER_MULT.inputB.connect(Rise.MASTER_MIXER.getOutput(0)); + + lineOut.input.connect(0, Rise.MASTER_MULT.output, 0); + lineOut.input.connect(1, Rise.MASTER_MULT.output, 0); + + lineOut.start(advanceTime); + glissMixer.start(advanceTime); + grainMixer.start(advanceTime); + + Rise.MASTER_MIXER.start(advanceTime); + Rise.MASTER_MULT.start(advanceTime); + Rise.MASTER_FADER.start(advanceTime); + Rise.CLICK_MIXER.start(advanceTime); + Rise.CLICK_MULT.start(advanceTime); + Rise.CLICK_FADER.start(advanceTime); + + grainMult.start(advanceTime); + grainFader.start(advanceTime); + glissMult.start(advanceTime); + glissFader.start(advanceTime); + + for (int i = 0; i < nG; i++){ + grainStream[i].setTimer(envPlayer); + } + + isOn = true; + } + + public void setGlissFader(double a){ + if (Rise.IS_ENGINE_ON == true) { + glissFader.input.set(a); + } + } + + public void setGrainFader(double a){ + if (Rise.IS_ENGINE_ON == true) { + grainFader.input.set(a); + } + } + + public synchronized void run() { + + try { + //System.out.println("waiting"); + this.wait(0); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + Synth.sleepUntilTick( (int) (currentTick + 1 * Synth.getTickRate()) ); + + Rise.CUE_PANEL.color = Color.YELLOW; + Rise.CUE_PANEL.repaint(); + + Synth.sleepUntilTick( (int) (currentTick + 2 * Synth.getTickRate()) ); + + Rise.CUE_PANEL.color = Color.GREEN; + Rise.CUE_PANEL.repaint(); + + Synth.sleepUntilTick( (int) (currentTick + 3 * Synth.getTickRate()) ); + + Rise.CUE_PANEL.color = Color.BLACK; + Rise.CUE_PANEL.repaint(); + + int startTime = (int) (currentTick + 3 * Synth.getTickRate()); ///*Synth.getTickCount()*/ currentTick + (int) Synth.getTickRate(); + int duration = (int) (Synth.getTickRate() / 5); // Resolution should be pixles in view + + int advanceTime = (int) (Synth.getTickRate() * 0.05); // half second advance + Synth.sleepUntilTick( startTime - advanceTime ); // Wake up early! + int nextTime = startTime; + + while(true) + { + if (Rise.IS_ENGINE_ON == true) { + //System.out.println(envPlayer.output.get()); + + Rise.CUE_PANEL.envPos = envPlayer.output.get(); + Rise.CUE_PANEL.repaint(); + + Rise.SCROLLBAR.xPos = envPlayer.output.get() * Rise.SCROLLBAR_WIDTH; + if (envPlayer.output.get() == 0){ + Rise.SCROLLBAR.xPos = (Rise.START_TIME/Rise.TOTAL_DUR) * Rise.SCROLLBAR_WIDTH; + } + + Rise.SCROLLBAR.repaint(); + nextTime += duration; // Advance nextTime by fixed amount. + Synth.sleepUntilTick( nextTime - advanceTime ); // Wake up early! + } + else { + try { + //System.out.println("waiting"); + this.wait(0); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + + public void kill() { + isOn = false; + for (int i = 0; i < Rise.VOICES; i++){ + gliss[i].glissOff(0, 1); + num[i].stop(); + ratio[i].stop(); + freq[i].stop(); + } + + denMult.stop(); + den.stop(); + envPlayer.stop(); + + glissMixer.stop(0); + grainMixer.stop(0); + + Rise.MASTER_FADER.stop(0); + Rise.MASTER_MULT.stop(0); + Rise.MASTER_MIXER.stop(0); + + Rise.CLICK_FADER.stop(0); + Rise.CLICK_MULT.stop(0); + Rise.CLICK_MIXER.stop(0); + + grainMult.stop(0); + grainFader.stop(0); + glissMult.stop(0); + glissFader.stop(0); + lineOut.stop(0); + } +} diff --git a/main/GrainStream.java b/main/GrainStream.java new file mode 100644 index 0000000..82cf478 --- /dev/null +++ b/main/GrainStream.java @@ -0,0 +1,194 @@ +package main; + +import com.softsynth.jsyn.EnvelopePlayer; +import com.softsynth.jsyn.Synth; + +public class GrainStream extends Thread { + + WaveForm grain = new WaveForm(); +// double ampValStart; +// double ampValEnd; +// double ampJitStart; +// double ampJitEnd; +// +// double soundDurValStart; +// double soundDurValEnd; +// double soundDurJitStart; +// double soundDurJitEnd; +// +// double silenceDurValStart; +// double silenceDurValEnd; +// double silenceDurJitStart; +// double silenceDurJitEnd; + + int startTick; + int endTick; + + EnvelopePlayer envPlayer; + + PitchVector pitchVector; + + int instance; + + int noGrains; + + public GrainStream(){ + } + + public void init(double aVS, double aVE, double aJS, double aJE, + double soDVS, double soDVE, double soDJS, double soDJE, + double siDVS, double siDVE, double siDJS, double siDJE, + PitchVector pV, int nG, int i){ + + //System.out.println("WOOHOO!!!"); + +// ampValStart = aVS; +// ampValEnd = aVE; +// ampJitStart = aJS; +// ampJitEnd = aJE; +// +// soundDurValStart = soDVS; +// soundDurValEnd = soDVE; +// soundDurJitStart = soDJS; +// soundDurJitEnd = soDJE; +// +// //System.out.println(soundDurValStart); +// +// silenceDurValStart = siDVS; +// silenceDurValEnd = siDVE; +// silenceDurJitStart = siDJS; +// silenceDurJitEnd = siDJE; + + pitchVector = pV; + noGrains = nG; + + instance = i; + + } + + public void setStartTick(int sT){ + startTick = sT; + } + + public void setEndTick(int eT){ + endTick = eT; + } + + public void setTimer(EnvelopePlayer eP){ + envPlayer = eP; + } + + public synchronized void run() { + + try { + //System.out.println("waiting"); + this.wait(0); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + //boolean isOn = true; + + int startTime = startTick; + int endTime = endTick; + + int advanceTime = (int) (Synth.getTickRate() * 0.5); // half second advance + Synth.sleepUntilTick( startTime - advanceTime /*(int) (Math.random() * 2 * Synth.getTickRate())*/); // Wake up early! + + int upDuration = (int) (Synth.getTickRate() / 10); + + int nextTime = startTime; + int nextGrainTime = startTime; + + while(true) + { + if (Rise.IS_ENGINE_ON == true) { + + //System.out.println("IM ON!!!"); + + //double freq = Math.random() * 300 + 300; + if (Synth.getTickCount() > nextGrainTime - advanceTime) { + + double envPosition = envPlayer.output.get(); + + int aPos = (int) (envPosition * (int) (Rise.TOTAL_DUR * 10)); + + int rand = (int) (Math.random() * pitchVector.array[aPos].size()); + + double randFadeJitter = (Math.random() * 5); + + //System.out.println(aPos + " " + pitchVector.array[aPos].size()); + + double freq = (Double) pitchVector.array[aPos].get(rand); + +// double duration = +// (soundDurValStart - envPosition * Math.abs(soundDurValStart - soundDurValEnd)) + +// ((soundDurJitStart - envPosition * Math.abs(soundDurJitStart - soundDurJitEnd)) * +// (Math.random() * 2 - 1)); +// grain.envRate.set(1./duration); +// +// double pause = +// (silenceDurValStart - envPosition * Math.abs(silenceDurValStart - silenceDurValEnd)) + +// ((silenceDurJitStart - envPosition * Math.abs(silenceDurJitStart - silenceDurJitEnd)) * +// (Math.random() * 2 - 1)); +// +// double amp = +// ((ampValStart + envPosition * Math.abs(ampValEnd - ampValStart)) + +// ((ampJitStart + envPosition * Math.abs(ampJitEnd - ampJitStart)) * +// (Math.random() * 2 - 1))); + + double duration = + (Rise.GRAIN_SOUND_DUR_VAL_START - envPosition * Math.abs(Rise.GRAIN_SOUND_DUR_VAL_START - Rise.GRAIN_SOUND_DUR_VAL_END)) + + ((Rise.GRAIN_SOUND_DUR_JIT_START - envPosition * Math.abs(Rise.GRAIN_SOUND_DUR_JIT_START - Rise.GRAIN_SOUND_DUR_JIT_END)) * + (Math.random() * 2 - 1)); + grain.envRate.set(1./duration); + + double pause = + (Rise.GRAIN_SILENCE_DUR_VAL_START - envPosition * Math.abs(Rise.GRAIN_SILENCE_DUR_VAL_START - Rise.GRAIN_SILENCE_DUR_VAL_END)) + + ((Rise.GRAIN_SILENCE_DUR_JIT_START - envPosition * Math.abs(Rise.GRAIN_SILENCE_DUR_JIT_START - Rise.GRAIN_SILENCE_DUR_JIT_END)) * + (Math.random() * 2 - 1)); + + double amp = + ((Rise.GRAIN_AMP_VAL_START + envPosition * Math.abs(Rise.GRAIN_AMP_VAL_END - Rise.GRAIN_AMP_VAL_START)) + + ((Rise.GRAIN_AMP_JIT_START + envPosition * Math.abs(Rise.GRAIN_AMP_JIT_END - Rise.GRAIN_AMP_JIT_START)) * + (Math.random() * 2 - 1))); + + if (Synth.getTickCount() > endTime) { + amp = amp * Math.abs((Synth.getTickCount() - endTime)/((Rise.FADE_DUR+randFadeJitter)*Synth.getTickRate())-1); + if (Synth.getTickCount() > endTime + (Rise.FADE_DUR+randFadeJitter)*Synth.getTickRate()){ + amp = 0; + } + } + + //System.out.println((Synth.getTickCount() - endTime) + " " + amp + " " + (Synth.getTickCount() - endTime)/(Rise.FADE_DUR*Synth.getTickRate())); + + double spectrum = + Rise.MIN_SPECTRUM + Math.random() * Math.abs(Rise.MAX_SPECTRUM - Rise.MIN_SPECTRUM); + + grain.spectrum.set(spectrum); + grain.grainOn(0, freq, amp); + + //System.out.println("instance = " + instance); + + //System.out.println(duration + " " + pause + " " + amp); + + int durationInTicks = (int) (Synth.getTickRate() * duration); + int pauseInTicks = (int) (Synth.getTickRate() * pause); + nextGrainTime += (durationInTicks + pauseInTicks); + + } + nextTime += (upDuration); // Advance nextTime by fixed amount. + Synth.sleepUntilTick( nextTime - advanceTime ); // Wake up early! + } + else { + try { + //System.out.println("waiting"); + this.wait(0); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + +} diff --git a/main/Note.java b/main/Note.java new file mode 100644 index 0000000..fd2d5c7 --- /dev/null +++ b/main/Note.java @@ -0,0 +1,405 @@ +package main; + +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; +import javax.swing.JPanel; +import java.awt.geom.Rectangle2D; + +public class Note extends JPanel{ + + int noTimesClicked = 0; + double x; + double y; + int n; + int d; + int v; + int p; + double pitch; + int clefChoice; + int octavaAndBassoChoice; + int spellingChoice; + int ratioChoice; + int noteHeadChoice = 0; + String[] clefs = {"\uf03f", "\uf042", "\uf042", "\uf026"}; + String[] octavasAndBassos = {"15", "8", " ", "8", "15"}; + String[] acc = {"\uf062","\uf06e", "\uf023"}; + + float clickAndPlayX1; + float clickAndPlayX2; + + Color color = Color.BLACK; + + boolean isListening = false; + + public Note(double x, double y, double p, int v, int pP){ + this.x = x; + this.y = y; + n = (int) (Rise.FIRST_NUM+v-pP); + d = (int) (Rise.FIRST_NUM-pP); + this.pitch = p + Rise.TRANSPOSE_SCORE * 100.; + this.v = v; + this.p = pP; + this.setOpaque(false); + this.setBackground(Color.WHITE); + this.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + initializeChoices(); + } + + public void paint(Graphics g){ + g.setColor(color); + Graphics2D g2 = (Graphics2D) g; + this.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + g2.translate(Rise.PAGE_MARGIN*Rise.ZOOM, Rise.PAGE_MARGIN*Rise.ZOOM); + g2.scale(Rise.ZOOM, Rise.ZOOM); + + FontRenderContext frc = g2.getFontRenderContext(); + Font fontMusic = new Font("Maestro", Font.PLAIN, (int) Rise.FONT); + fontMusic.deriveFont(Rise.FONT); + Font fontNumbers = new Font("Liberation Serif", Font.PLAIN, (int) Math.round(Rise.FONT/1.714)); + Font fontOBSigns = new Font("Liberation Serif", Font.PLAIN, (int) Math.round(Rise.FONT/2.4)); + TextLayout note = new TextLayout("\uf0cf", fontMusic, frc); + TextLayout staff = new TextLayout("\uf03d\uf03d", fontMusic, frc); + TextLayout ledgerLine = new TextLayout("\uf02d", fontMusic, frc); + g2.setFont(fontMusic); + FontMetrics fontMetrics = g2.getFontMetrics(); + double noteWidth = fontMetrics.stringWidth("\uf0cf"); + double staffWidth = fontMetrics.stringWidth("\uf03d"); + double ledgerWidth = fontMetrics.stringWidth("\uf02d"); + double staffSpace = Rise.FONT/8.; + float noteX = (float) (x*Rise.IMAGE_WIDTH - noteWidth/2. /*- ((1./(Rise.VOICES-1))*(p-v)/p)*Rise.IMAGE_WIDTH*Rise.X_DIV*/); + float noteY = (float) y*Rise.IMAGE_HEIGHT; + + float toneX1 = (float) (x*Rise.IMAGE_WIDTH - ((1./(Rise.VOICES-1))*(p-v)/p)*Rise.IMAGE_WIDTH*Rise.X_DIV); + float toneX2; + if (p != Rise.VOICES-1) { + toneX2 = (float) (x*Rise.IMAGE_WIDTH + ((1./(Rise.VOICES-1))*v/(p+1))*Rise.IMAGE_WIDTH*Rise.X_DIV); + } + else { + toneX2 = (float) (x*Rise.IMAGE_WIDTH + ((1./(Rise.VOICES-1))*.25)*Rise.IMAGE_WIDTH*Rise.X_DIV); + } + float toneY1 = (float) (noteY - note.getBounds().getMaxY()/3); + float toneY2 = (float) (noteY - note.getBounds().getMinY()/3); + + //System.out.println("notes " + ((1./(Rise.VOICES-1))*(p-v)/p) + " " + ((1./(Rise.VOICES-1))*v/(p+1))); + + g2.setColor(new Color(200, 200, 200)); + g2.fill(new Rectangle2D.Float(toneX1, toneY1, toneX2-toneX1, toneY2-toneY1)); + g2.setColor(color); + + clickAndPlayX1 = toneX1; + clickAndPlayX2 = toneX2; + + note.draw(g2,noteX,noteY); + + double accWidth = fontMetrics.stringWidth(acc[getAcc((int) (Math.round(pitch/100.)%12))]); + TextLayout accidental = new TextLayout(acc[getAcc((int) (Math.round(pitch/100.)%12))], fontMusic, frc); + accidental.draw(g2,(float) (noteX-accWidth-2),(float) y*Rise.IMAGE_HEIGHT); + + int notePosition = getNotePosition((int) (Math.round(pitch/100.)%12)); + + int centDeviation = (int) Math.round((pitch/100. - Math.round(pitch/100.))*100.); + TextLayout centDeviationText; + if (centDeviation >= 0) { + centDeviationText = new TextLayout("+" + String.valueOf(centDeviation), fontNumbers, frc); + } + else { + centDeviationText = new TextLayout(String.valueOf(centDeviation), fontNumbers, frc); + } + + for (int i = d; i > 0; i--) { + if (Math.round((float) d/i) == (float) d/i + && Math.round((float) n/i) == (float) n/i) { + n = n/i; + d = d/i; + } + } + TextLayout ratioText = new TextLayout(String.valueOf(n) + "/" + String.valueOf(d), fontNumbers, frc); + + int stepsToLowestC = 0; + int addOctaves = 0; + int stepsToClef = 0; + + if (clefChoice == 0){ + stepsToLowestC = -11; + stepsToClef = 6; + } + else if (clefChoice == 1){ + stepsToLowestC = -15; + stepsToClef = 6; + } + else if (clefChoice == 2){ + stepsToLowestC = -17; + stepsToClef = 4; + } + else if (clefChoice == 3){ + stepsToLowestC = -23; + stepsToClef = 2; + } + + if (octavaAndBassoChoice == 0){ + stepsToLowestC = stepsToLowestC+14; + } + else if (octavaAndBassoChoice == 1){ + stepsToLowestC = stepsToLowestC+7; + } + else if (octavaAndBassoChoice == 2){ + } + else if (octavaAndBassoChoice == 3){ + stepsToLowestC = stepsToLowestC-7; + } + else if (octavaAndBassoChoice == 4){ + stepsToLowestC = stepsToLowestC-14; + } + + addOctaves = (int) (Math.round(pitch/100.)/12)*7; + float staffX = (float) (x*Rise.IMAGE_WIDTH - 1.5*staffWidth /*- ((1./(Rise.VOICES-1))*(p-v)/p)*Rise.IMAGE_WIDTH*Rise.X_DIV*noteHeadChoice*/); + float staffY = (float) (y*Rise.IMAGE_HEIGHT+(stepsToLowestC+notePosition+addOctaves)*staffSpace); + staff.draw(g2, staffX, staffY); + float clefX = (float) (x*Rise.IMAGE_WIDTH - 1.5*staffWidth /*- ((1./(Rise.VOICES-1))*(p-v)/p)*Rise.IMAGE_WIDTH*Rise.X_DIV*noteHeadChoice*/); + float clefY = (float) (y*Rise.IMAGE_HEIGHT+((stepsToLowestC-stepsToClef)+notePosition+addOctaves)*staffSpace); + TextLayout clef = new TextLayout(clefs[clefChoice], fontMusic, frc); + clef.draw(g2, clefX, clefY); + TextLayout octavaAndBasso = new TextLayout(octavasAndBassos[octavaAndBassoChoice], fontOBSigns, frc); + if (octavaAndBassoChoice < 2){ + octavaAndBasso.draw(g2,(float) (clefX+clef.getVisibleAdvance()/2.-octavaAndBasso.getAdvance()/2),(float) (clefY+clef.getBounds().getMaxY()-octavaAndBasso.getBounds().getMinY())); + } + else if (octavaAndBassoChoice < 3){ + } + else if(octavaAndBassoChoice < 5){ + if (clefChoice == 3 && octavaAndBassoChoice == 3) { + octavaAndBasso.draw(g2,(float) (clefX+clef.getVisibleAdvance()/2.-octavaAndBasso.getAdvance()/16.),(float) (clefY+clef.getBounds().getMinY())); + } + else if (clefChoice == 3 && octavaAndBassoChoice == 4) { + octavaAndBasso.draw(g2,(float) (clefX+clef.getVisibleAdvance()/2.-octavaAndBasso.getAdvance()/4.),(float) (clefY+clef.getBounds().getMinY())); + } + else { + octavaAndBasso.draw(g2,(float) (clefX+clef.getVisibleAdvance()/2.-octavaAndBasso.getAdvance()/2),(float) (clefY+clef.getBounds().getMinY())); + } + } + + if (noteY-staffY >= staffSpace*2){ + float ledgerLineX = (float) (x*Rise.IMAGE_WIDTH - ledgerWidth/2.); + float ledgerLineY = (float) (staffY+staffSpace*2); + while (ledgerLineY <= noteY){ + ledgerLine.draw(g2, ledgerLineX, ledgerLineY); + ledgerLineY = (float) (ledgerLineY+staffSpace*2); + } + } + if (staffY-noteY >= staffSpace*10){ + float ledgerLineX = (float) (x*Rise.IMAGE_WIDTH - ledgerWidth/2.); + float ledgerLineY = (float) (staffY-staffSpace*10); + while (ledgerLineY >= noteY){ + ledgerLine.draw(g2, ledgerLineX, ledgerLineY); + ledgerLineY = (float) (ledgerLineY-staffSpace*2); + } + } + + if (noteY >= staffY-staffSpace*6){ + centDeviationText.draw(g2, (float) (noteX-centDeviationText.getAdvance()/4.), (float) (staffY-staffSpace*9)); + } + else { + centDeviationText.draw(g2, (float) (noteX-centDeviationText.getAdvance()/4.), (float) (noteY-staffSpace*3)); + } + + if (ratioChoice == 0) { + if (noteY <= staffY-staffSpace*2){ + ratioText.draw(g2, (float) (noteX-ratioText.getAdvance()/4.), (float) (staffY+staffSpace*1+ratioText.getAscent())); + } + else { + ratioText.draw(g2, (float) (noteX-ratioText.getAdvance()/4.), (float) (noteY+staffSpace*3+ratioText.getAscent())); + } + } + } + + public int getNotePosition(int mN) { + int notePosition = 0; + if (spellingChoice == 0) { + int modNote = mN; + switch(modNote) { + case 0 : notePosition = 0; break; + case 1 : notePosition = 0; break; + case 2 : notePosition = 1; break; + case 3 : notePosition = 1; break; + case 4 : notePosition = 2; break; + case 5 : notePosition = 3; break; + case 6 : notePosition = 3; break; + case 7 : notePosition = 4; break; + case 8 : notePosition = 4; break; + case 9 : notePosition = 5; break; + case 10 : notePosition = 5; break; + case 11: notePosition = 6; break; + case 12: notePosition = 7; break; + } + } + else if (spellingChoice == 1){ + int modNote = mN; + switch(modNote) { + case 0 : notePosition = 0; break; + case 1 : notePosition = 1; break; + case 2 : notePosition = 1; break; + case 3 : notePosition = 2; break; + case 4 : notePosition = 2; break; + case 5 : notePosition = 3; break; + case 6 : notePosition = 4; break; + case 7 : notePosition = 4; break; + case 8 : notePosition = 5; break; + case 9 : notePosition = 5; break; + case 10 : notePosition = 6; break; + case 11: notePosition = 6; break; + case 12: notePosition = 7; break; + } + } + return notePosition; + } + + public int getAcc(int mN) { + int accidental = 1; + if (spellingChoice == 0){ + int modNote = mN; + switch(modNote) { + case 0 : accidental = 1; break; + case 1 : accidental = 2; break; + case 2 : accidental = 1; break; + case 3 : accidental = 2; break; + case 4 : accidental = 1; break; + case 5 : accidental = 1; break; + case 6 : accidental = 2; break; + case 7 : accidental = 1; break; + case 8 : accidental = 2; break; + case 9 : accidental = 1; break; + case 10 : accidental = 2; break; + case 11: accidental = 1; break; + case 12: accidental = 1; break; + } + } + if (spellingChoice == 1){ + int modNote = mN; + switch(modNote) { + case 0 : accidental = 1; break; + case 1 : accidental = 0; break; + case 2 : accidental = 1; break; + case 3 : accidental = 0; break; + case 4 : accidental = 1; break; + case 5 : accidental = 1; break; + case 6 : accidental = 0; break; + case 7 : accidental = 1; break; + case 8 : accidental = 0; break; + case 9 : accidental = 1; break; + case 10 : accidental = 0; break; + case 11: accidental = 1; break; + case 12: accidental = 1; break; + } + } + return accidental; + } + + public void initializeChoices(){ + + spellingChoice = 1; + ratioChoice = 0; + + int stepsToLowestC = 0; + int addOctaves = 0; + double staffSpace = Rise.FONT/8.; + float noteY = (float) y*Rise.IMAGE_HEIGHT; + int notePosition = getNotePosition((int) (Math.round(pitch/100.)%12)); + + float min = 500000; + for (int c = 0; c < 4; c++){ + int oBStart = 0; + int oBMax = 0; + if (c == 0) { + oBStart = 0; + oBMax = 3; + } + else if (c < 3) { + oBStart = 2; + oBMax = 3; + } + else if (c < 4) { + oBStart = 2; + oBMax = 5; + } + + for (int oB = oBStart; oB < oBMax; oB++){ + + if (c == 0){ + stepsToLowestC = -11; + } + else if (c == 1){ + stepsToLowestC = -15; + } + else if (c == 2){ + stepsToLowestC = -17; + } + else if (c == 3){ + stepsToLowestC = -23; + } + + if (oB == 0){ + stepsToLowestC = stepsToLowestC+14; + } + else if (oB == 1){ + stepsToLowestC = stepsToLowestC+7; + } + else if (oB == 2){ + } + else if (oB == 3){ + stepsToLowestC = stepsToLowestC-7; + } + else if (oB == 4){ + stepsToLowestC = stepsToLowestC-14; + } + + addOctaves = (int) (Math.round(pitch/100.)/12)*7; + float staffY = (float) (y*Rise.IMAGE_HEIGHT+(stepsToLowestC+notePosition+addOctaves)*staffSpace); + if (Math.abs((staffY-4*staffSpace)-noteY) < min){ + clefChoice = c; + octavaAndBassoChoice = oB; + min = (float) Math.abs((staffY-4*staffSpace)-noteY); + } + } + } + } + + public int testSelect(float x1, float y1, float x2, float y2){ + if ((float) (Rise.PAGE_MARGIN*Rise.ZOOM+x*Rise.IMAGE_WIDTH*Rise.ZOOM) > x1 + && (float) (Rise.PAGE_MARGIN*Rise.ZOOM+x*Rise.IMAGE_WIDTH*Rise.ZOOM) < x2 + && (float) (Rise.PAGE_MARGIN*Rise.ZOOM+y*Rise.IMAGE_HEIGHT*Rise.ZOOM) > y1 + && (float) (Rise.PAGE_MARGIN*Rise.ZOOM+y*Rise.IMAGE_HEIGHT*Rise.ZOOM) < y2){ + color = Color.BLUE; + isListening = true; + return 1; + } + else { + color = Color.BLACK; + isListening = false; + return 0; + } + } + + + public int testSelectClickAndPlay(float xMouse, float yMouse){ + if ((Rise.PAGE_MARGIN*Rise.ZOOM + clickAndPlayX1*Rise.ZOOM) < xMouse + && (Rise.PAGE_MARGIN*Rise.ZOOM + clickAndPlayX2*Rise.ZOOM) > xMouse + && (float) (Rise.PAGE_MARGIN*Rise.ZOOM+(y)*Rise.IMAGE_HEIGHT*Rise.ZOOM + 10*Rise.ZOOM) > yMouse + && (float) (Rise.PAGE_MARGIN*Rise.ZOOM+(y)*Rise.IMAGE_HEIGHT*Rise.ZOOM - 10*Rise.ZOOM) < yMouse){ + color = Color.BLUE; + isListening = true; + //double toReturn = (xMouse - Rise.PAGE_MARGIN*Rise.ZOOM)/(Rise.IMAGE_WIDTH*Rise.ZOOM); + //System.out.println((xMouse) + " " + (clickAndPlayX1*Rise.ZOOM) + " " + (clickAndPlayX2*Rise.ZOOM) + " " + yMouse + " " + (Rise.PAGE_MARGIN*Rise.ZOOM+y*Rise.IMAGE_HEIGHT*Rise.ZOOM)); + //System.out.println(toReturn); + return 1; + } + else { + color = Color.BLACK; + isListening = false; + return 0; + } + } +} diff --git a/main/NoteFrame.java b/main/NoteFrame.java new file mode 100644 index 0000000..334b128 --- /dev/null +++ b/main/NoteFrame.java @@ -0,0 +1,255 @@ +package main; + +import java.awt.Color; +import java.awt.Container; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ArrayList; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; + +public class NoteFrame extends JFrame implements ActionListener{ + + JRadioButton bass = new JRadioButton("bass"); + JRadioButton tenor = new JRadioButton("tenor"); + JRadioButton alto = new JRadioButton("alto"); + JRadioButton treble = new JRadioButton("treble"); + JRadioButton clefNada = new JRadioButton("nada"); + + JRadioButton ma = new JRadioButton("15ma"); + JRadioButton va = new JRadioButton("8va"); + JRadioButton none = new JRadioButton("none"); + JRadioButton vb = new JRadioButton("8vb"); + JRadioButton mb = new JRadioButton("15mb"); + JRadioButton oBNada = new JRadioButton("nada"); + + JRadioButton sharps = new JRadioButton("sharps"); + JRadioButton flats = new JRadioButton("flats"); + JRadioButton spellNada = new JRadioButton("nada"); + + JRadioButton show = new JRadioButton("show"); + JRadioButton hide = new JRadioButton("hide"); + JRadioButton ratiosNada = new JRadioButton("nada"); + + ArrayList notes; + ArrayList listeningNotes; + + int clefChoice; + int octavaAndBassoChoice; + int ratioChoice; + int spellingChoice; + + public NoteFrame(){ + + this.setTitle("Note Frame"); + + this.addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent we){ + Rise.BOUNDING_BOX.setVisible(false); + for (int i = 0; i < notes.size(); i++) { + ((Note) notes.get(i)).color = Color.BLACK; + } + } + }); + + Container noteContainer = this.getContentPane(); + noteContainer.setLayout(new GridLayout(0,2)); + + bass.setActionCommand("bass"); + bass.addActionListener(this); + tenor.setActionCommand("tenor"); + tenor.addActionListener(this); + alto.setActionCommand("alto"); + alto.addActionListener(this); + treble.setActionCommand("treble"); + treble.addActionListener(this); + + ma.setActionCommand("ma"); + ma.addActionListener(this); + va.setActionCommand("va"); + va.addActionListener(this); + none.setActionCommand("none"); + none.addActionListener(this); + vb.setActionCommand("vb"); + vb.addActionListener(this); + mb.setActionCommand("mb"); + mb.addActionListener(this); + + sharps.setActionCommand("sharps"); + sharps.addActionListener(this); + flats.setActionCommand("flats"); + flats.addActionListener(this); + + show.setActionCommand("show"); + show.addActionListener(this); + hide.setActionCommand("hide"); + hide.addActionListener(this); + + ButtonGroup clef = new ButtonGroup(); + clef.add(bass); + clef.add(tenor); + clef.add(alto); + clef.add(treble); + clef.add(clefNada); + //clefNada.setVisible(false); + + ButtonGroup oB = new ButtonGroup(); + oB.add(ma); + oB.add(va); + oB.add(none); + oB.add(vb); + oB.add(mb); + oB.add(oBNada); + //oBNada.setVisible(false); + + ButtonGroup spell = new ButtonGroup(); + spell.add(sharps); + spell.add(flats); + spell.add(spellNada); + //spellNada.setVisible(false); + + ButtonGroup ratios = new ButtonGroup(); + ratios.add(show); + ratios.add(hide); + ratios.add(ratiosNada); + //ratiosNada.setVisible(false); + + JPanel clefPanel = new JPanel(); + clefPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + clefPanel.setLayout(new GridLayout(0,1)); + clefPanel.add(new JLabel("Clef")); + clefPanel.add(bass); + clefPanel.add(tenor); + clefPanel.add(alto); + clefPanel.add(treble); + + JPanel oBPanel = new JPanel(); + oBPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + oBPanel.setLayout(new GridLayout(0,1)); + oBPanel.add(new JLabel("Octava/Basso")); + oBPanel.add(ma); + oBPanel.add(va); + oBPanel.add(none); + oBPanel.add(vb); + oBPanel.add(mb); + + JPanel spellPanel = new JPanel(); + spellPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + spellPanel.setLayout(new GridLayout(0,1)); + spellPanel.add(new JLabel("Spelling Pref.")); + spellPanel.add(sharps); + spellPanel.add(flats); + + JPanel ratiosPanel = new JPanel(); + ratiosPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + ratiosPanel.setLayout(new GridLayout(0,1)); + ratiosPanel.add(new JLabel("Ratios")); + ratiosPanel.add(show); + ratiosPanel.add(hide); + + noteContainer.add(clefPanel); + noteContainer.add(oBPanel); + noteContainer.add(spellPanel); + noteContainer.add(ratiosPanel); + + this.setSize(200,400); + this.setLocation(0, 0); + } + + public void setNoteAccess(ArrayList n){ + notes = n; + } + + public void setListeningNotes(){ + listeningNotes = new ArrayList(); + for (int i = 0; i < notes.size(); i++) { + if (((Note) notes.get(i)).isListening == true){ + //System.out.println(((Note) notes.get(i)).pitch); + listeningNotes.add(notes.get(i)); + } + } + } + + public void actionPerformed(ActionEvent e) { + if ("bass".equals(e.getActionCommand())){ + clefChoice = 0; + } + else if ("tenor".equals(e.getActionCommand())){ + clefChoice = 1; + } + else if ("alto".equals(e.getActionCommand())){ + clefChoice = 2; + } + else if ("treble".equals(e.getActionCommand())){ + clefChoice = 3; + } + + else if ("mb".equals(e.getActionCommand())){ + octavaAndBassoChoice = 0; + } + else if ("vb".equals(e.getActionCommand())){ + octavaAndBassoChoice = 1; + } + else if ("none".equals(e.getActionCommand())){ + octavaAndBassoChoice = 2; + } + else if ("va".equals(e.getActionCommand())){ + octavaAndBassoChoice = 3; + } + else if ("ma".equals(e.getActionCommand())){ + octavaAndBassoChoice = 4; + } + + else if ("sharps".equals(e.getActionCommand())){ + spellingChoice = 0; + } + else if ("flats".equals(e.getActionCommand())){ + spellingChoice = 1; + } + + else if ("show".equals(e.getActionCommand())){ + ratioChoice = 0; + } + else if ("hide".equals(e.getActionCommand())){ + ratioChoice = 1; + } + + for (int i = 0; i < listeningNotes.size(); i++){ + if ("bass".equals(e.getActionCommand()) + || "tenor".equals(e.getActionCommand()) + || "alto".equals(e.getActionCommand()) + || "treble".equals(e.getActionCommand())){ + ((Note) listeningNotes.get(i)).clefChoice = clefChoice; + } + + if ("mb".equals(e.getActionCommand()) + || "vb".equals(e.getActionCommand()) + || "none".equals(e.getActionCommand()) + || "va".equals(e.getActionCommand()) + || "ma".equals(e.getActionCommand())){ + ((Note) listeningNotes.get(i)).octavaAndBassoChoice = octavaAndBassoChoice; + } + + if ("sharps".equals(e.getActionCommand()) + || "flats".equals(e.getActionCommand())){ + ((Note) listeningNotes.get(i)).spellingChoice = spellingChoice; + } + + if ("show".equals(e.getActionCommand()) + || "hide".equals(e.getActionCommand())){ + ((Note) listeningNotes.get(i)).ratioChoice = ratioChoice; + } + ((Note) listeningNotes.get(i)).repaint(); + } + } +} + + diff --git a/main/OpenClassIterator.java b/main/OpenClassIterator.java new file mode 100644 index 0000000..ad30c97 --- /dev/null +++ b/main/OpenClassIterator.java @@ -0,0 +1,40 @@ +package main; + +import java.awt.Container; +import java.io.IOException; +import java.io.ObjectInputStream; + +import javax.swing.JSlider; +import javax.swing.JTextField; + +public class OpenClassIterator { + +public OpenClassIterator(Container c, ObjectInputStream in){ + + if (c.getClass() == new JTextField().getClass()){ + try { + ((JTextField) c).setText((String) in.readObject()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + else if (c.getClass() == new JSlider().getClass()){ + try { + ((JSlider) c).setValue(in.readInt()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + for (int i = 0; i < c.getComponentCount(); i++){ + OpenClassIterator oCI = new OpenClassIterator((Container) c.getComponent(i),in); + } + } + +} diff --git a/main/PitchVector.java b/main/PitchVector.java new file mode 100644 index 0000000..3b70fbe --- /dev/null +++ b/main/PitchVector.java @@ -0,0 +1,54 @@ +package main; + +import java.util.Vector; + +import com.softsynth.jsyn.EqualTemperedTuning; + +public class PitchVector{ + + Vector[] array; + + public PitchVector(){ + + } + + public void init(){ + + int aLength = (int) (Rise.TOTAL_DUR * 10); + array = new Vector[aLength]; + + double fund = EqualTemperedTuning.getMIDIFrequency(24+Rise.TRANSPOSE_SCORE+Rise.TRANSPOSE_SOUND); + + for (int i = 0; i < aLength; i++){ + array[i] = new Vector(); + array[i].add(fund); + } + for (int plotPoint = 1; plotPoint < Rise.VOICES; plotPoint++){ + + //int plotPoint = + for (int voice = 1; voice <= plotPoint; voice++){ + double x = (1./(Rise.VOICES-1))*plotPoint; + double pitch = 1200./Math.log(2.)*Math.log((double) (Rise.FIRST_NUM+voice-plotPoint)/(Rise.FIRST_NUM-plotPoint)); + double frequency = EqualTemperedTuning.getMIDIFrequency(24+Rise.TRANSPOSE_SCORE+Rise.TRANSPOSE_SOUND+pitch/100.); + + int start = (int) ((x - ((1./(Rise.VOICES-1))*(plotPoint-voice)/plotPoint)) * (aLength-1)); + int end = (int) ((x + ((1./(Rise.VOICES-1))*voice/(plotPoint+1))) * (aLength-1)); + + if (end >= aLength){ + end = aLength; + } + + //System.out.println("s and e " + start + " " + end + " " + pitch); + + for (int i = start; i < end; i++) { + array[i].add(frequency); + } + + //System.out.println("notes 2 " + plotPoint + " " + pitch + " " + frequency + (x - ((1./(Rise.VOICES-1))*(plotPoint-voice)/plotPoint)) + " " + (x + ((1./(Rise.VOICES-1))*voice/(plotPoint+1)))); + // p is plot point, v is voice + } + } + + } + +} diff --git a/main/PrintUtilities.java b/main/PrintUtilities.java new file mode 100644 index 0000000..525d5c6 --- /dev/null +++ b/main/PrintUtilities.java @@ -0,0 +1,79 @@ +package main; + +import java.awt.*; +import javax.swing.*; +import java.awt.print.*; + +public class PrintUtilities extends JPanel implements Printable { + + Score score; + int xPage; + int yPage; + PrinterJob pj = PrinterJob.getPrinterJob(); + + public PrintUtilities() { + + } + + public void init(Score score, int xPage, int yPage){ + this.score = score; + this.xPage = xPage; + this.yPage = yPage; + pageSetup(); + //this.setName("yo"); + } + + public void pageSetup() { + PageFormat pf = new PageFormat(); + //figure out how to get this to return user page format + pf = pj.pageDialog(pj.defaultPage()); + Paper paper = new Paper(); + double margin = 0; + paper.setSize(pf.getPaper().getWidth(), pf.getPaper().getHeight()); + paper.setImageableArea(margin, margin, paper.getWidth(), paper.getHeight()); + pf.setPaper(paper); + pj.setPrintable(this, pf); + if (pj.printDialog()) { + try { pj.print(); } + catch (PrinterException e) { + System.out.println(e); + } + } + } + + public int print(Graphics g, PageFormat pageFormat, int pageIndex) { + if (pageIndex >= Rise.X_DIV * Rise.Y_DIV){ + Rise.CURRENT_X_PAGE = xPage; + Rise.CURRENT_Y_PAGE = yPage; + return(NO_SUCH_PAGE); + } + else { + Rise.CURRENT_X_PAGE = pageIndex % Rise.X_DIV; + Rise.CURRENT_Y_PAGE = pageIndex / Rise.X_DIV; + score.removeAll(); + score.setNotes(); + score.setNoteChoices(); + Graphics2D g2 = (Graphics2D)g; + disableDoubleBuffering(this); + g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); + Dimension d = score.getSize(); + double scaleX = pageFormat.getImageableWidth()/d.width; + double scaleY = pageFormat.getImageableHeight() / d.height; + g2.scale(scaleX, scaleY); + score.paint(g2); + enableDoubleBuffering(this); + return(PAGE_EXISTS); + } + } + + public static void disableDoubleBuffering(Component c) { + RepaintManager currentManager = RepaintManager.currentManager(c); + currentManager.setDoubleBufferingEnabled(false); + } + + public static void enableDoubleBuffering(Component c) { + RepaintManager currentManager = RepaintManager.currentManager(c); + currentManager.setDoubleBufferingEnabled(true); + } + +} \ No newline at end of file diff --git a/main/Rise.java b/main/Rise.java new file mode 100644 index 0000000..87ce62e --- /dev/null +++ b/main/Rise.java @@ -0,0 +1,130 @@ +package main; + +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JViewport; +import javax.swing.UIManager; +import java.awt.Font; + +import com.softsynth.jsyn.ExponentialLag; +import com.softsynth.jsyn.MultiplyUnit; +import com.softsynth.jsyn.SynthMixer; + +public class Rise { + + static int PAGE_WIDTH = 1224; + static int PAGE_HEIGHT = 792; + static int PAGE_MARGIN = 36+18; + static int IMAGE_WIDTH = PAGE_WIDTH-PAGE_MARGIN*2; + static int IMAGE_HEIGHT = PAGE_HEIGHT-PAGE_MARGIN*2; + static double ZOOM = .64; + static float FONT = 12; + static float LINE_THICKNESS = (float) .05; + static int FIRST_NUM = 16; + static int VOICES = 12; + static int X_DIV = 1; + static int Y_DIV = 1; + static int CURRENT_X_PAGE = 0; + static int CURRENT_Y_PAGE = 0; + //static float TOTAL_TIME = (VOICES-1)*60; + static float TRANSPOSE_SCORE = 36; + static float TRANSPOSE_SOUND = 0; + static int MODE = 0; + static double MASTER_AMP = 0; + static double START_AMP = 0; + static double END_AMP = 0; + static double MIN_SPECTRUM = 0; + static double MAX_SPECTRUM = 0; + static int START_DENSITY = 0; + static int END_DENSITY = 0; + static double START_DUR = 0; + static double END_DUR = 0; + static double TOTAL_DUR = 1650; + static double START_TIME = 0; + static double FADE_DUR = 150; + static boolean IS_ENGINE_ON = false; + static int SCROLLBAR_WIDTH; + + static CuePanel CUE_PANEL; + + Score score; + JScrollPane scroller; + JPanel scrollPanel; + + static NoteFrame NOTE_FRAME = new NoteFrame(); + static BoundingBox BOUNDING_BOX = new BoundingBox(); + static ScrollBar SCROLLBAR = new ScrollBar(); + + static SynthMixer MASTER_MIXER; + static ExponentialLag MASTER_FADER; + static MultiplyUnit MASTER_MULT; + static SynthMixer CLICK_MIXER; + static ExponentialLag CLICK_FADER; + static MultiplyUnit CLICK_MULT; + + static double GRAIN_AMP_VAL_START; + static double GRAIN_AMP_VAL_END; + static double GRAIN_AMP_JIT_START; + static double GRAIN_AMP_JIT_END; + + static double GRAIN_SOUND_DUR_VAL_START; + static double GRAIN_SOUND_DUR_VAL_END; + static double GRAIN_SOUND_DUR_JIT_START; + static double GRAIN_SOUND_DUR_JIT_END; + + static double GRAIN_SILENCE_DUR_VAL_START; + static double GRAIN_SILENCE_DUR_VAL_END; + static double GRAIN_SILENCE_DUR_JIT_START; + static double GRAIN_SILENCE_DUR_JIT_END; + + static double GLISS_AMP_START; + static double GLISS_AMP_END; + + public static void setUIFont (javax.swing.plaf.FontUIResource f){ + java.util.Enumeration keys = UIManager.getDefaults().keys(); + while (keys.hasMoreElements()) { + Object key = keys.nextElement(); + Object value = UIManager.get (key); + if (value instanceof javax.swing.plaf.FontUIResource) + UIManager.put (key, f); + } + } + + + public Rise() { + + setUIFont (new javax.swing.plaf.FontUIResource("Liberation Serif", Font.BOLD, 8)); + + JFrame scoreFrame = new JFrame(); + scoreFrame.setTitle("Score Frame"); + Container scoreContainer = scoreFrame.getContentPane(); + + scrollPanel = new JPanel(); + scroller = new JScrollPane(scrollPanel, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + score = new Score(); + score.setPreferredSize(new Dimension((int) (PAGE_WIDTH*ZOOM), (int) (PAGE_HEIGHT*ZOOM))); + score.setBackground(Color.WHITE); + scrollPanel.add(score); + scoreContainer.add(scroller); + scroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); + + ToolFrame controlFrame = new ToolFrame(score); + + scoreFrame.pack(); + scoreFrame.setSize(800,550); + scoreFrame.setVisible(true); + + controlFrame.setLocation(800, 0); + controlFrame.setVisible(true); + } + + public static void main(String args[]) { + Rise rise = new Rise(); + } +} diff --git a/main/SaveClassIterator.java b/main/SaveClassIterator.java new file mode 100644 index 0000000..d1e63ef --- /dev/null +++ b/main/SaveClassIterator.java @@ -0,0 +1,37 @@ +package main; + +import java.awt.Container; +import java.io.IOException; +import java.io.ObjectOutputStream; + +import javax.swing.JSlider; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; + +public class SaveClassIterator { + + public SaveClassIterator(Container c, ObjectOutputStream out){ + + if (c.getClass() == new JTextField().getClass()){ + try { + out.writeObject(((JTextField) c).getText()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + else if (c.getClass() == new JSlider().getClass()){ + try { + out.writeInt(((JSlider) c).getValue()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + for (int i = 0; i < c.getComponentCount(); i++){ + SaveClassIterator sCI = new SaveClassIterator((Container) c.getComponent(i),out); + } + } +} diff --git a/main/Score.java b/main/Score.java new file mode 100644 index 0000000..aa3fcaf --- /dev/null +++ b/main/Score.java @@ -0,0 +1,372 @@ +package main; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.geom.Line2D; +import java.util.ArrayList; +import javax.swing.JPanel; + +import com.softsynth.jsyn.EqualTemperedTuning; +import com.softsynth.jsyn.ExponentialLag; +import com.softsynth.jsyn.LineOut; +import com.softsynth.jsyn.MultiplyUnit; +import com.softsynth.jsyn.Synth; +import com.softsynth.jsyn.SynthMixer; + +public class Score extends JPanel implements MouseListener, MouseMotionListener{ + + ArrayList notes = new ArrayList(); + ArrayList lastNotes; + float x1; + float x2; + float y1; + float y2; + + WaveForm clickAndPlay; + + LineOut lineOut; + + int counter = 0; + + public Score(){ + + this.addMouseListener(this); + this.addMouseMotionListener(this); + this.setLayout(null); + this.setBackground(Color.WHITE); + this.add(Rise.BOUNDING_BOX); + + setNotes(); + + this.add(Rise.SCROLLBAR); + + } + + public void setNotes(){ + lastNotes = (ArrayList) notes.clone(); + notes = new ArrayList(); + double centRange = (1200/Math.log(2.))*Math.log((double) Rise.FIRST_NUM/(Rise.FIRST_NUM-Rise.VOICES+1)); + int totalVoices = Rise.VOICES; + int plotPoints = totalVoices; + int count = 0; + for (int voice = 0; voice < totalVoices; voice++){ + for (int plotPoint = voice; plotPoint < plotPoints; plotPoint++){ + double x = (1./(plotPoints-1))*plotPoint; + double pitch = 1200./Math.log(2.)*Math.log((double) (Rise.FIRST_NUM+voice-plotPoint)/(Rise.FIRST_NUM-plotPoint)); + double y = Math.abs(((pitch)/centRange)-1); + notes.add(new Note((x*Rise.X_DIV-((double) Rise.X_DIV/Rise.X_DIV)*Rise.CURRENT_X_PAGE), + (y*Rise.Y_DIV-((double) Rise.Y_DIV/Rise.Y_DIV)*Math.abs(Rise.CURRENT_Y_PAGE-(Rise.Y_DIV-1))), + pitch,voice,plotPoint)); + if (x >= (1./Rise.X_DIV)*Rise.CURRENT_X_PAGE && x <= (1./Rise.X_DIV)*(Rise.CURRENT_X_PAGE+1) + && y >= 1-(1./Rise.Y_DIV)*(Rise.CURRENT_Y_PAGE+1) && y <= 1-(1./Rise.Y_DIV)*(Rise.CURRENT_Y_PAGE)) { + this.add((Note) notes.get(count)); + + } + count++; + } + } + Rise.NOTE_FRAME.setNoteAccess(notes); + } + + public void setNoteChoices(){ + for (int count = 0; count < notes.size(); count++){ + ((Note) notes.get(count)).clefChoice = ((Note) lastNotes.get(count)).clefChoice; + ((Note) notes.get(count)).octavaAndBassoChoice = ((Note) lastNotes.get(count)).octavaAndBassoChoice; + ((Note) notes.get(count)).spellingChoice = ((Note) lastNotes.get(count)).spellingChoice; + ((Note) notes.get(count)).ratioChoice = ((Note) lastNotes.get(count)).ratioChoice; + } + } + + public void paint(Graphics g){ + + super.paint(g); + Rise.SCROLLBAR_WIDTH = (int) (this.getPreferredSize().width - Rise.PAGE_MARGIN*Rise.ZOOM * 2); + Graphics2D g2 = (Graphics2D) g; + g2.translate(Rise.PAGE_MARGIN*Rise.ZOOM, Rise.PAGE_MARGIN*Rise.ZOOM); + g2.scale(Rise.ZOOM, Rise.ZOOM); + g2.setStroke(new BasicStroke(Rise.LINE_THICKNESS,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER)); + int totalVoices = Rise.VOICES; + double centRange = (1200/Math.log(2.))*Math.log((double) Rise.FIRST_NUM/(Rise.FIRST_NUM-Rise.VOICES+1)); + int plotPoints = totalVoices*25; + for (int voice = 1; voice < totalVoices-1; voice++){ + for (int plotPoint = voice*(plotPoints/totalVoices); plotPoint < plotPoints-(plotPoints/totalVoices); plotPoint++){ + double startX = (1./(plotPoints-plotPoints/totalVoices))*plotPoint; + double startY = Math.abs(((1200./Math.log(2.)*Math.log((Rise.FIRST_NUM+voice-plotPoint/((double) plotPoints/totalVoices))/(Rise.FIRST_NUM-plotPoint/((double) plotPoints/totalVoices))))/centRange)-1); + double endX = (1./(plotPoints-plotPoints/totalVoices))*(plotPoint+1); + double endY = Math.abs(((1200./Math.log(2.)*Math.log((Rise.FIRST_NUM+voice-(plotPoint+1)/((double) plotPoints/totalVoices))/(Rise.FIRST_NUM-(plotPoint+1)/((double) plotPoints/totalVoices))))/centRange)-1); + if (startX >= (1./Rise.X_DIV)*Rise.CURRENT_X_PAGE && startX <= (1./Rise.X_DIV)*(Rise.CURRENT_X_PAGE+1) + && startY >= 1-(1./Rise.Y_DIV)*(Rise.CURRENT_Y_PAGE+1) && startY <= 1-(1./Rise.Y_DIV)*(Rise.CURRENT_Y_PAGE)) { + g2.draw(new Line2D.Double((startX*Rise.X_DIV-((double) Rise.X_DIV/Rise.X_DIV)*Rise.CURRENT_X_PAGE)*Rise.IMAGE_WIDTH, + (startY*Rise.Y_DIV-((double) Rise.Y_DIV/Rise.Y_DIV)*Math.abs(Rise.CURRENT_Y_PAGE-(Rise.Y_DIV-1)))*Rise.IMAGE_HEIGHT, + (endX*Rise.X_DIV-((double) Rise.X_DIV/Rise.X_DIV)*Rise.CURRENT_X_PAGE)*Rise.IMAGE_WIDTH, + (endY*Rise.Y_DIV-((double) Rise.Y_DIV/Rise.Y_DIV)*Math.abs(Rise.CURRENT_Y_PAGE-(Rise.Y_DIV-1)))*Rise.IMAGE_HEIGHT)); + } + } + } + } + + public void setMasterFader(double a){ + if (Rise.IS_ENGINE_ON == true) { + Rise.MASTER_FADER.input.set(a); + } + } + + public void setClickFader(double a){ + if (Rise.IS_ENGINE_ON == true) { + Rise.CLICK_FADER.input.set(a); + } + } + + public void mouseClicked(MouseEvent e) { + } + public void mousePressed(MouseEvent e) { + x1 = e.getX(); + y1 = e.getY(); + if (Rise.MODE == 0){ + + Rise.NOTE_FRAME.setVisible(false); + } + else { + int registered = 0; + for(int i = 0; i < notes.size(); i++ ) { + //int add = ((Note) notes.get(i)).testSelectClickAndPlay((float) (x1-20*Rise.ZOOM), (float) (y1-20*Rise.ZOOM), (float) (x1+20*Rise.ZOOM), (float) (y1+20*Rise.ZOOM)); + int add = ((Note) notes.get(i)).testSelectClickAndPlay((float) (x1), (float) (y1)); + + if (add != 0) { + registered = registered + add; + + //System.out.println(((Note) notes.get(i)).x + " " + ((Note) notes.get(i)).y + + // " " + ((Note) notes.get(i)).p + " " + ((Note) notes.get(i)).v); + + ((Note) notes.get(i)).repaint(); + if (Rise.IS_ENGINE_ON == false){ + Rise.IS_ENGINE_ON = true; + Synth.startEngine(0); + Rise.MASTER_MIXER = new SynthMixer(1,1); + Rise.CLICK_MIXER = new SynthMixer(10,1); + Rise.MASTER_MULT = new MultiplyUnit(); + Rise.MASTER_FADER = new ExponentialLag(); + Rise.CLICK_MULT = new MultiplyUnit(); + Rise.CLICK_FADER = new ExponentialLag(); + lineOut = new LineOut(); + + for (int c = 0; c < 10; c++){ + Rise.CLICK_MIXER.setGain(c, 0, 1); + } + + Rise.CLICK_MULT.inputA.connect(Rise.CLICK_FADER.output); + Rise.CLICK_MULT.inputB.connect(Rise.CLICK_MIXER.getOutput(0)); + + + Rise.MASTER_MIXER.connectInput(0, Rise.CLICK_MULT.output, 0); + Rise.MASTER_MIXER.setGain(0, 0, 1); + + Rise.MASTER_MULT.inputA.connect(Rise.MASTER_FADER.output); + Rise.MASTER_MULT.inputB.connect(Rise.MASTER_MIXER.getOutput(0)); + + lineOut.input.connect(0, Rise.MASTER_MULT.output, 0); + lineOut.input.connect(1, Rise.MASTER_MULT.output, 0); + + lineOut.start(0); + Rise.MASTER_MIXER.start(0); + Rise.MASTER_MULT.start(0); + Rise.MASTER_FADER.start(0); + Rise.CLICK_MIXER.start(0); + Rise.CLICK_MULT.start(0); + Rise.CLICK_FADER.start(0); + + setMasterFader(1); + setClickFader(1); + + //System.out.println("STARTED!!!"); + + } + + //clickAndPlay = new WaveForm(); + + clickAndPlay = new WaveForm(); + Rise.CLICK_MIXER.connectInput((counter%10), clickAndPlay.output, 0); + counter++; + + double envPosition = (x1 - Rise.PAGE_MARGIN*Rise.ZOOM)/(Rise.IMAGE_WIDTH*Rise.ZOOM); + + double duration = + (Rise.GRAIN_SOUND_DUR_VAL_START - envPosition * Math.abs(Rise.GRAIN_SOUND_DUR_VAL_START - Rise.GRAIN_SOUND_DUR_VAL_END)) + + ((Rise.GRAIN_SOUND_DUR_JIT_START - envPosition * Math.abs(Rise.GRAIN_SOUND_DUR_JIT_START - Rise.GRAIN_SOUND_DUR_JIT_END)) * + (Math.random() * 2 - 1)); + clickAndPlay.envRate.set(1./duration); + + double amp = + ((Rise.GRAIN_AMP_VAL_START + envPosition * Math.abs(Rise.GRAIN_AMP_VAL_END - Rise.GRAIN_AMP_VAL_START)) + + ((Rise.GRAIN_AMP_JIT_START + envPosition * Math.abs(Rise.GRAIN_AMP_JIT_END - Rise.GRAIN_AMP_JIT_START)) * + (Math.random() * 2 - 1))); + + double spectrum = + Rise.MIN_SPECTRUM + Math.random() * Math.abs(Rise.MAX_SPECTRUM - Rise.MIN_SPECTRUM); + + //System.out.println("Tone Info; dur = " + duration + ", amp = " + amp); + + clickAndPlay.spectrum.set(spectrum); + double frequency = EqualTemperedTuning.getMIDIFrequency(24/*+Rise.TRANSPOSE_SCORE*/+Rise.TRANSPOSE_SOUND+((Note) notes.get(i)).pitch/100.); + + clickAndPlay.clickOn(0, frequency, amp); + } + } + //System.out.println(registered); + + } + } + public void mouseReleased(MouseEvent e) { + if (Rise.MODE == 0){ + Rise.NOTE_FRAME.bass.setSelected(false); + Rise.NOTE_FRAME.tenor.setSelected(false); + Rise.NOTE_FRAME.alto.setSelected(false); + Rise.NOTE_FRAME.treble.setSelected(false); + + int clef = 0; + int oB = 0; + int spell = 0; + int ratio = 0; + + x2 = e.getX(); + y2 = e.getY(); + + double rectX1; + double rectX2; + double rectY1; + double rectY2; + + if (e.getX() < x1){ + rectX2 = x1; + rectX1 = e.getX(); + } + else { + rectX1 = x1; + rectX2 = e.getX(); + } + if (e.getY() < y1){ + rectY2 = y1; + rectY1 = e.getY(); + } + else { + rectY1 = y1; + rectY2 = e.getY(); + } + + + int registered = 0; + for(int i = 0; i < notes.size(); i++ ) { + int add = ((Note) notes.get(i)).testSelect((float) (rectX1-10*Rise.ZOOM), (float) (rectY1-10*Rise.ZOOM), (float) (rectX2+10*Rise.ZOOM), (float) (rectY2+10*Rise.ZOOM)); + + if (add != 0) { + registered = registered + add; + clef = ((Note) notes.get(i)).clefChoice; + oB = ((Note) notes.get(i)).octavaAndBassoChoice; + spell = ((Note) notes.get(i)).spellingChoice; + ratio = ((Note) notes.get(i)).ratioChoice; + } + } + if (registered > 0) { + Rise.NOTE_FRAME.setListeningNotes(); + Rise.BOUNDING_BOX.setVisible(true); + Rise.BOUNDING_BOX.setCoordinates(rectX1, rectX2, rectY1, rectY2); + Rise.BOUNDING_BOX.repaint(); + Rise.NOTE_FRAME.setVisible(true); + if (registered == 1) { + if (clef == 0) { + Rise.NOTE_FRAME.bass.setSelected(true); + } + else if (clef == 1) { + Rise.NOTE_FRAME.tenor.setSelected(true); + } + else if (clef == 2) { + Rise.NOTE_FRAME.alto.setSelected(true); + } + else if (clef == 3) { + Rise.NOTE_FRAME.treble.setSelected(true); + } + + if (oB == 0) { + Rise.NOTE_FRAME.mb.setSelected(true); + } + else if (oB == 1) { + Rise.NOTE_FRAME.vb.setSelected(true); + } + else if (oB == 2) { + Rise.NOTE_FRAME.none.setSelected(true); + } + else if (oB == 3) { + Rise.NOTE_FRAME.va.setSelected(true); + } + else if (oB == 4) { + Rise.NOTE_FRAME.ma.setSelected(true); + } + + if (spell == 0) { + Rise.NOTE_FRAME.sharps.setSelected(true); + } + else if (spell == 1) { + Rise.NOTE_FRAME.flats.setSelected(true); + } + + if (ratio == 0) { + Rise.NOTE_FRAME.show.setSelected(true); + } + else if (ratio == 1) { + Rise.NOTE_FRAME.hide.setSelected(true); + } + } + else { + Rise.NOTE_FRAME.clefNada.setSelected(true); + Rise.NOTE_FRAME.oBNada.setSelected(true); + Rise.NOTE_FRAME.spellNada.setSelected(true); + Rise.NOTE_FRAME.ratiosNada.setSelected(true); + } + } + else { + Rise.BOUNDING_BOX.setVisible(false); + } + } + } + public void mouseEntered(MouseEvent e) { + } + public void mouseExited(MouseEvent e) { + } + + public void mouseDragged(MouseEvent e) { + if (Rise.MODE == 0){ + Rise.BOUNDING_BOX.setVisible(true); + double rectX1; + double rectX2; + double rectY1; + double rectY2; + + if (e.getX() < x1){ + rectX2 = x1; + rectX1 = e.getX(); + } + else { + rectX1 = x1; + rectX2 = e.getX(); + } + if (e.getY() < y1){ + rectY2 = y1; + rectY1 = e.getY(); + } + else { + rectY1 = y1; + rectY2 = e.getY(); + } + Rise.BOUNDING_BOX.setCoordinates(rectX1, rectX2, rectY1, rectY2); + Rise.BOUNDING_BOX.repaint(); + } + } + public void mouseMoved(MouseEvent e) { + } + +} diff --git a/main/ScrollBar.java b/main/ScrollBar.java new file mode 100644 index 0000000..012b725 --- /dev/null +++ b/main/ScrollBar.java @@ -0,0 +1,26 @@ +package main; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.geom.Line2D; + +import javax.swing.JPanel; + +public class ScrollBar extends JPanel{ + + double xPos; + + public ScrollBar() { + this.setOpaque(false); + this.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + this.setVisible(false); + } + + public void paint(Graphics g){ + g.setColor(Color.BLUE); + Graphics2D g2 = (Graphics2D) g; + g2.draw(new Line2D.Double(Rise.PAGE_MARGIN*Rise.ZOOM + xPos,0, Rise.PAGE_MARGIN*Rise.ZOOM + xPos,Rise.PAGE_HEIGHT*Rise.ZOOM)); + } + +} diff --git a/main/ToolFrame.java b/main/ToolFrame.java new file mode 100644 index 0000000..b46d942 --- /dev/null +++ b/main/ToolFrame.java @@ -0,0 +1,2806 @@ +package main; + +import java.awt.Container; +import javax.swing.JPanel; +import javax.swing.JFrame; +import javax.swing.JTabbedPane; +import java.awt.Rectangle; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JTextField; +import javax.swing.JLabel; +import java.awt.Color; +import javax.swing.JSlider; +import java.awt.Dimension; +import java.util.Hashtable; + +import com.softsynth.jsyn.Synth; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +public class ToolFrame extends JFrame { + + private static final long serialVersionUID = 1L; + private JPanel jContentPane = null; + private JTabbedPane jTabbedPane = null; + private JPanel editModePanel = null; + private JButton zoomInButtonEdit = null; + private JButton zoomOutButtonEdit = null; + private JButton zoomInButtonPlay = null; + private JButton zoomOutButtonPlay = null; + private JTextField yGridTextField = null; + private JTextField xGridTextField = null; + private JLabel gridLabel = null; + private JLabel xDivLabel = null; + private JLabel divLabel1 = null; + private JLabel divLabel2 = null; + private JLabel yDivLabel = null; + private JPanel pageLayoutPanel = null; + private JTextField yDimTextField = null; + private JTextField xDimTextField = null; + private JLabel pageLabel = null; + private JLabel pageWidthLabel = null; + private JLabel pageHeightLabel = null; + private JLabel pageMarginLabel = null; + private JTextField marginTextField = null; + private JPanel pieceVariablesPanel = null; + private JTextField numeratorTextField = null; + private JTextField sectionsTextField = null; + private JLabel pieceVariablesLabel = null; + private JLabel numeratorLabel = null; + private JLabel sectionsLabel = null; + private JLabel transpositionScoreLabel = null; + private JTextField transpositionScoreTextField = null; + private JPanel formatPanel = null; + private JTextField fontSizeTextField = null; + private JTextField lineThicknessTextField = null; + private JLabel formatLabel = null; + private JLabel fontLabel = null; + private JLabel lineLabel = null; + private JButton xPageDownEdit = null; + private JButton xPageUpEdit = null; + private JButton yPageUpEdit = null; + private JButton yPageDownEdit = null; + private JButton xPageDownPlay = null; + private JButton xPageUpPlay = null; + private JButton yPageUpPlay = null; + private JButton yPageDownPlay = null; + private JLabel pageNavEditLabel = null; + private JLabel zoomEditLabel = null; + private JLabel pageNavPlayLabel = null; + private JLabel zoomPlayLabel = null; + private JButton redrawButton = null; + private JPanel playModePanel = null; + private JSlider masterAmpSlider = null; + private JButton saveButton = null; + private JButton openButton = null; + private JButton printButton = null; + private JLabel masterLabel = null; + private JLabel pieceDurLabel = null; + private JTextField minTextField = null; + private JLabel colonLabel = null; + private JTextField secTextField = null; + private JLabel minsecLabel = null; + private double glissAmp = 0; + private double masterAmp = 1; + private double grainAmp = 0; + private double clickAmp = 1; + + Score score; + private JButton playButton = null; + private JButton pauseButton = null; + private JLabel transpositionSoundingLabel = null; + private JTextField transpositionSoundingTextField = null; + JFileChooser fc=new JFileChooser(); + PrintUtilities printUtilities = new PrintUtilities(); + + WaveForm clickAndPlay; + Glissandi gliss; // @jve:decl-index=0: + GrainStream[] grainStream; + //Cue cue; + private JLabel ampLabel = null; + private JTabbedPane jTabbedPane1 = null; + private JPanel masterControlsPanel = null; + private JPanel grainValuesPanel = null; + private JPanel glissValuesPanel = null; + private JPanel spectrumPanel = null; + private JTabbedPane spectrumTabPane = null; + private JPanel spectrumValPanel = null; + private JSlider spectrumMaxValFader = null; + private JSlider spectrumMinValFader = null; + private JLabel spectrumLabel = null; + private JTabbedPane toolsTabbedPane = null; + private JLabel minMaxSpectrumValLabel = null; + private JPanel glissAmpPanel = null; + private JPanel glissAmpValPanel = null; + private JSlider glissAmpValMaxFader = null; + private JSlider glissAmpValMinFader = null; + private JLabel glissAmpLabel = null; + private JLabel startEndGlissampValLabel = null; + + private JPanel grainAmpPanel = null; + private JTabbedPane grainAmpTabPane = null; + private JPanel grainAmpValPanel = null; + private JSlider grainAmpValMaxFader = null; + private JSlider grainAmpValMinFader = null; + private JLabel grainAmpLabel = null; + private JPanel grainAmpJitPanel = null; + private JSlider grainAmpJitMaxFader = null; + private JSlider grainAmpJitMinFader = null; + private JLabel startEndGrainampValLabel = null; + private JLabel startEndGrainAmpJitLabel = null; + + private JPanel grainDenPanel = null; + private JTabbedPane grainDenTabPane = null; + private JPanel grainDenValPanel = null; + private JSlider grainDenValMaxFader = null; + private JSlider grainDenValMinFader = null; + private JLabel grainDenLabel = null; + + private JPanel grainSoundDurPanel = null; + private JTabbedPane grainSoundDurTabPane = null; + private JPanel grainSoundDurValPanel = null; + private JSlider grainSoundDurValMaxFader = null; + private JSlider grainSoundDurValMinFader = null; + private JLabel grainSoundDurLabel = null; + private JPanel grainSoundDurJitPanel = null; + private JSlider grainSoundDurJitMaxFader = null; + private JSlider grainSoundDurJitMinFader = null; + private JLabel startEndGrainSoundDurJitLabel = null; + + private JPanel grainSilenceDurPanel = null; + private JTabbedPane grainSilenceDurTabPane = null; + private JPanel grainSilenceDurValPanel = null; + private JSlider grainSilenceDurValMaxFader = null; + private JSlider grainSilenceDurValMinFader = null; + private JLabel grainSilenceDurLabel = null; + private JPanel grainSilenceDurJitPanel = null; + private JSlider grainSilenceDurJitMaxFader = null; + private JSlider grainSilenceDurJitMinFader = null; + private JLabel startEndGrainSilenceDurJitLabel = null; + private JPanel masterFaderPanel = null; + private JPanel glissFaderPanel = null; + private JSlider glissFader = null; + private JLabel glissFaderLabel = null; + private JLabel glissFaderLabel2 = null; + private JPanel grainsFaderPanel = null; + private JSlider grainFader = null; + private JLabel grainFaderLabel = null; + private JLabel grainFaderLabel2 = null; + private JPanel timePanel = null; + private JPanel startTimePanel = null; + private JLabel startTimeLabel = null; + private JLabel minsecStartLabel = null; + private JTextField minStartTextField = null; + private JLabel colonStartLabel = null; + private JTextField secStartTextField = null; + private JPanel fadePanel = null; + private JLabel fadeOutLabe = null; + private JLabel minsecFadeLabel = null; + private JTextField minFadeField = null; + private JLabel colonStartLabel1 = null; + private JTextField secFadeField = null; + PitchVector pV; + private JPanel cuePanel = null; + private JPanel clickFaderPanel = null; + private JSlider clickFader = null; + private JLabel clickFaderLabel = null; + private JLabel grainFaderLabel21 = null; + /** + * This is the default constructor + */ + public ToolFrame(Score s) { + super(); + score = s; + initialize(); + Synth.startEngine(0); + gliss = new Glissandi(); + gliss.start(); + +// grainStream = new GrainStream[40]; +// for (int i = 0; i < 40; i++){ +// grainStream[i] = new GrainStream(); +// grainStream[i].start(); +// } + + //cue = new Cue(cuePanel); + //cue.start(); + } + + /** + * This method initializes this + * + * @return void + */ + private void initialize() { + this.setSize(517, 522); + this.setContentPane(getJContentPane()); + this.setTitle("Tool Frame"); + } + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.add(getJTabbedPane(), null); + } + return jContentPane; + } + + /** + * This method initializes jTabbedPane + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getJTabbedPane() { + if (jTabbedPane == null) { + jTabbedPane = new JTabbedPane(); + jTabbedPane.setBounds(new Rectangle(0, 0, 513, 522)); + jTabbedPane.addTab("Edit Mode", null, getEditModePanel(), null); + jTabbedPane.addTab("Play Mode", null, getPlayModePanel(), null); + jTabbedPane.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + Rise.MODE = jTabbedPane.getSelectedIndex(); + if (Rise.MODE == 0){ + Rise.SCROLLBAR.setVisible(false); + } + else { + Rise.SCROLLBAR.setVisible(true); + } + } + }); + } + return jTabbedPane; + } + + /** + * This method initializes editModePanel + * + * @return javax.swing.JPanel + */ + private JPanel getEditModePanel() { + if (editModePanel == null) { + zoomEditLabel = new JLabel(); + zoomEditLabel.setBounds(new Rectangle(192, 41, 36, 16)); + zoomEditLabel.setText("Zoom"); + pageNavEditLabel = new JLabel(); + pageNavEditLabel.setBounds(new Rectangle(25, 15, 101, 16)); + pageNavEditLabel.setText("Page Navigation"); + editModePanel = new JPanel(); + editModePanel.setLayout(null); + editModePanel.add(getZoomInButtonEdit(), null); + editModePanel.add(getZoomOutButtonEdit(), null); + editModePanel.add(getXPageDownEdit(), null); + editModePanel.add(getXPageUpEdit(), null); + editModePanel.add(getYPageUpEdit(), null); + editModePanel.add(getYPageDownEdit(), null); + editModePanel.add(pageNavEditLabel, null); + editModePanel.add(zoomEditLabel, null); + editModePanel.add(getRedrawButton(), null); + editModePanel.add(getSaveButton(), null); + editModePanel.add(getOpenButton(), null); + editModePanel.add(getPrintButton(), null); + editModePanel.add(getToolsTabbedPane(), null); + } + return editModePanel; + } + + /** + * This method initializes zoomInButtonEdit + * + * @return javax.swing.JButton + */ + private JButton getZoomInButtonEdit() { + if (zoomInButtonEdit == null) { + zoomInButtonEdit = new JButton(); + zoomInButtonEdit.setBounds(new Rectangle(210, 60, 41, 26)); + zoomInButtonEdit.setText("+"); + zoomInButtonEdit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.ZOOM = Rise.ZOOM*1.25; + Rise.BOUNDING_BOX.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + Rise.SCROLLBAR.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + + Rise.BOUNDING_BOX.x1 = Rise.BOUNDING_BOX.x1*1.25; + Rise.BOUNDING_BOX.x2 = Rise.BOUNDING_BOX.x2*1.25; + Rise.BOUNDING_BOX.y1 = Rise.BOUNDING_BOX.y1*1.25; + Rise.BOUNDING_BOX.y2 = Rise.BOUNDING_BOX.y2*1.25; + Rise.BOUNDING_BOX.repaint(); + + score.repaint(); + score.revalidate(); + } + }); + } + return zoomInButtonEdit; + } + + /** + * This method initializes zoomOutButtonEdit + * + * @return javax.swing.JButton + */ + private JButton getZoomOutButtonEdit() { + if (zoomOutButtonEdit == null) { + zoomOutButtonEdit = new JButton(); + zoomOutButtonEdit.setBounds(new Rectangle(170, 60, 41, 26)); + zoomOutButtonEdit.setText("-"); + zoomOutButtonEdit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.ZOOM = Rise.ZOOM*(1/1.25); + Rise.BOUNDING_BOX.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + Rise.SCROLLBAR.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + + Rise.BOUNDING_BOX.x1 = Rise.BOUNDING_BOX.x1*(1/1.25); + Rise.BOUNDING_BOX.x2 = Rise.BOUNDING_BOX.x2*(1/1.25); + Rise.BOUNDING_BOX.y1 = Rise.BOUNDING_BOX.y1*(1/1.25); + Rise.BOUNDING_BOX.y2 = Rise.BOUNDING_BOX.y2*(1/1.25); + Rise.BOUNDING_BOX.repaint(); + + score.repaint(); + score.revalidate(); + } + }); + } + return zoomOutButtonEdit; + } + + /** + * This method initializes zoomInButtonPlay + * + * @return javax.swing.JButton + */ + private JButton getZoomInButtonPlay() { + if (zoomInButtonPlay == null) { + zoomInButtonPlay = new JButton(); + zoomInButtonPlay.setBounds(new Rectangle(254, 48, 41, 26)); + zoomInButtonPlay.setText("+"); + zoomInButtonPlay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.ZOOM = Rise.ZOOM*1.25; + Rise.BOUNDING_BOX.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + Rise.SCROLLBAR.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + + Rise.BOUNDING_BOX.x1 = Rise.BOUNDING_BOX.x1*1.25; + Rise.BOUNDING_BOX.x2 = Rise.BOUNDING_BOX.x2*1.25; + Rise.BOUNDING_BOX.y1 = Rise.BOUNDING_BOX.y1*1.25; + Rise.BOUNDING_BOX.y2 = Rise.BOUNDING_BOX.y2*1.25; + Rise.BOUNDING_BOX.repaint(); + + score.repaint(); + score.revalidate(); + } + }); + } + return zoomInButtonPlay; + } + + /** + * This method initializes zoomOutButtonPlay + * + * @return javax.swing.JButton + */ + private JButton getZoomOutButtonPlay() { + if (zoomOutButtonPlay == null) { + zoomOutButtonPlay = new JButton(); + zoomOutButtonPlay.setBounds(new Rectangle(214, 48, 41, 26)); + zoomOutButtonPlay.setText("-"); + zoomOutButtonPlay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.ZOOM = Rise.ZOOM*(1/1.25); + Rise.BOUNDING_BOX.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + Rise.SCROLLBAR.setBounds((int) 0, (int) 0,(int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM)); + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + + Rise.BOUNDING_BOX.x1 = Rise.BOUNDING_BOX.x1*(1/1.25); + Rise.BOUNDING_BOX.x2 = Rise.BOUNDING_BOX.x2*(1/1.25); + Rise.BOUNDING_BOX.y1 = Rise.BOUNDING_BOX.y1*(1/1.25); + Rise.BOUNDING_BOX.y2 = Rise.BOUNDING_BOX.y2*(1/1.25); + Rise.BOUNDING_BOX.repaint(); + + score.repaint(); + score.revalidate(); + } + }); + } + return zoomOutButtonPlay; + } + + /** + * This method initializes yGridTextField + * + * @return javax.swing.JTextField + */ + private JTextField getYGridTextField() { + if (yGridTextField == null) { + yGridTextField = new JTextField(); + yGridTextField.setText("1"); + yGridTextField.setBounds(new Rectangle(330, 70, 21, 22)); + yGridTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.BOUNDING_BOX.setVisible(false); + Rise.NOTE_FRAME.setVisible(false); + Rise.X_DIV = Integer.valueOf(xGridTextField.getText()).intValue(); + Rise.Y_DIV = Integer.valueOf(yGridTextField.getText()).intValue(); + Rise.CURRENT_X_PAGE = 0; + Rise.CURRENT_Y_PAGE = 0; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + }); + } + return yGridTextField; + } + + /** + * This method initializes xGridTextField + * + * @return javax.swing.JTextField + */ + private JTextField getXGridTextField() { + if (xGridTextField == null) { + xGridTextField = new JTextField(); + xGridTextField.setText("1"); + xGridTextField.setBounds(new Rectangle(240, 70, 21, 22)); + xGridTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.BOUNDING_BOX.setVisible(false); + Rise.NOTE_FRAME.setVisible(false); + Rise.X_DIV = Integer.valueOf(xGridTextField.getText()).intValue(); + Rise.Y_DIV = Integer.valueOf(yGridTextField.getText()).intValue(); + Rise.CURRENT_X_PAGE = 0; + Rise.CURRENT_Y_PAGE = 0; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + }); + } + return xGridTextField; + } + + /** + * This method initializes pageLayoutPanel + * + * @return javax.swing.JPanel + */ + private JPanel getPageLayoutPanel() { + if (pageLayoutPanel == null) { + yDivLabel = new JLabel(); + yDivLabel.setText("Vertical"); + yDivLabel.setBounds(new Rectangle(330, 30, 47, 16)); + divLabel2 = new JLabel(); + divLabel2.setText("Divisions"); + divLabel2.setBounds(new Rectangle(240, 50, 59, 16)); + divLabel1 = new JLabel(); + divLabel1.setText("Divisions"); + divLabel1.setBounds(new Rectangle(330, 50, 59, 16)); + xDivLabel = new JLabel(); + xDivLabel.setText("Horizontal"); + xDivLabel.setBounds(new Rectangle(240, 30, 66, 16)); + gridLabel = new JLabel(); + gridLabel.setText("Tile Score"); + gridLabel.setBounds(new Rectangle(240, 10, 61, 16)); + pageMarginLabel = new JLabel(); + pageMarginLabel.setBounds(new Rectangle(142, 40, 50, 16)); + pageMarginLabel.setText("Margins"); + pageHeightLabel = new JLabel(); + pageHeightLabel.setBounds(new Rectangle(82, 40, 42, 16)); + pageHeightLabel.setText("Height"); + pageWidthLabel = new JLabel(); + pageWidthLabel.setBounds(new Rectangle(22, 40, 36, 16)); + pageWidthLabel.setText("Width"); + pageLabel = new JLabel(); + pageLabel.setBounds(new Rectangle(20, 10, 144, 16)); + pageLabel.setText("Page Layout (in Inches)"); + pageLayoutPanel = new JPanel(); + pageLayoutPanel.setLayout(null); + pageLayoutPanel.add(getYDimTextField(), null); + pageLayoutPanel.add(getXDimTextField(), null); + pageLayoutPanel.add(pageLabel, null); + pageLayoutPanel.add(pageWidthLabel, null); + pageLayoutPanel.add(pageHeightLabel, null); + pageLayoutPanel.add(pageMarginLabel, null); + pageLayoutPanel.add(getMarginTextField(), null); + pageLayoutPanel.add(gridLabel, null); + pageLayoutPanel.add(xDivLabel, null); + pageLayoutPanel.add(divLabel2, null); + pageLayoutPanel.add(getXGridTextField(), null); + pageLayoutPanel.add(getYGridTextField(), null); + pageLayoutPanel.add(divLabel1, null); + pageLayoutPanel.add(yDivLabel, null); + + } + return pageLayoutPanel; + } + + /** + * This method initializes yDimTextField + * + * @return javax.swing.JTextField + */ + private JTextField getYDimTextField() { + if (yDimTextField == null) { + yDimTextField = new JTextField(); + yDimTextField.setBounds(new Rectangle(80, 70, 31, 22)); + yDimTextField.setText("11"); + yDimTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.PAGE_WIDTH = (int) Double.valueOf(xDimTextField.getText()).doubleValue()*72; + Rise.PAGE_HEIGHT = (int) (Double.valueOf(yDimTextField.getText()).doubleValue()*72); + Rise.PAGE_MARGIN = (int) (Double.valueOf(marginTextField.getText()).doubleValue()*72)+18; + Rise.IMAGE_WIDTH = Rise.PAGE_WIDTH-Rise.PAGE_MARGIN*2; + Rise.IMAGE_HEIGHT = Rise.PAGE_HEIGHT-Rise.PAGE_MARGIN*2; + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + score.repaint(); + score.revalidate(); + } + }); + } + return yDimTextField; + } + + /** + * This method initializes xDimTextField + * + * @return javax.swing.JTextField + */ + private JTextField getXDimTextField() { + if (xDimTextField == null) { + xDimTextField = new JTextField(); + xDimTextField.setBounds(new Rectangle(20, 70, 31, 22)); + xDimTextField.setText("17"); + xDimTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.PAGE_WIDTH = (int) Double.valueOf(xDimTextField.getText()).doubleValue()*72; + Rise.PAGE_HEIGHT = (int) (Double.valueOf(yDimTextField.getText()).doubleValue()*72); + Rise.PAGE_MARGIN = (int) (Double.valueOf(marginTextField.getText()).doubleValue()*72)+18; + Rise.IMAGE_WIDTH = Rise.PAGE_WIDTH-Rise.PAGE_MARGIN*2; + Rise.IMAGE_HEIGHT = Rise.PAGE_HEIGHT-Rise.PAGE_MARGIN*2; + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + score.repaint(); + score.revalidate(); + } + }); + } + return xDimTextField; + } + + /** + * This method initializes marginTextField + * + * @return javax.swing.JTextField + */ + private JTextField getMarginTextField() { + if (marginTextField == null) { + marginTextField = new JTextField(); + marginTextField.setBounds(new Rectangle(140, 70, 30, 22)); + marginTextField.setText(".5"); + marginTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.PAGE_WIDTH = (int) Double.valueOf(xDimTextField.getText()).doubleValue()*72; + Rise.PAGE_HEIGHT = (int) (Double.valueOf(yDimTextField.getText()).doubleValue()*72); + Rise.PAGE_MARGIN = (int) (Double.valueOf(marginTextField.getText()).doubleValue()*72)+18; + Rise.IMAGE_WIDTH = Rise.PAGE_WIDTH-Rise.PAGE_MARGIN*2; + Rise.IMAGE_HEIGHT = Rise.PAGE_HEIGHT-Rise.PAGE_MARGIN*2; + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + score.repaint(); + score.revalidate(); + } + }); + } + return marginTextField; + } + + /** + * This method initializes pieceVariablesPanel + * + * @return javax.swing.JPanel + */ + private JPanel getPieceVariablesPanel() { + if (pieceVariablesPanel == null) { + transpositionScoreLabel = new JLabel(); + transpositionScoreLabel.setBounds(new Rectangle(230, 30, 65, 16)); + transpositionScoreLabel.setText("Transpose"); + sectionsLabel = new JLabel(); + sectionsLabel.setBounds(new Rectangle(120, 30, 53, 16)); + sectionsLabel.setText("Sections"); + numeratorLabel = new JLabel(); + numeratorLabel.setBounds(new Rectangle(10, 30, 91, 16)); + numeratorLabel.setText("1st Numerator"); + pieceVariablesLabel = new JLabel(); + pieceVariablesLabel.setBounds(new Rectangle(10, 10, 93, 16)); + pieceVariablesLabel.setText("Piece Variables"); + pieceVariablesPanel = new JPanel(); + pieceVariablesPanel.setLayout(null); + pieceVariablesPanel.add(getNumeratorTextField(), null); + pieceVariablesPanel.add(getSectionsTextField(), null); + pieceVariablesPanel.add(pieceVariablesLabel, null); + pieceVariablesPanel.add(numeratorLabel, null); + pieceVariablesPanel.add(sectionsLabel, null); + pieceVariablesPanel.add(transpositionScoreLabel, null); + pieceVariablesPanel.add(getTranspositionScoreTextField(), null); + } + return pieceVariablesPanel; + } + + /** + * This method initializes numeratorTextField + * + * @return javax.swing.JTextField + */ + private JTextField getNumeratorTextField() { + if (numeratorTextField == null) { + numeratorTextField = new JTextField(); + numeratorTextField.setBounds(new Rectangle(10, 50, 31, 22)); + numeratorTextField.setText("16"); + numeratorTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.FIRST_NUM = Integer.valueOf(numeratorTextField.getText()).intValue(); + Rise.VOICES = Integer.valueOf(sectionsTextField.getText()).intValue()+1; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.repaint(); + score.revalidate(); + } + }); + } + return numeratorTextField; + } + + /** + * This method initializes sectionsTextField + * + * @return javax.swing.JTextField + */ + private JTextField getSectionsTextField() { + if (sectionsTextField == null) { + sectionsTextField = new JTextField(); + sectionsTextField.setBounds(new Rectangle(120, 50, 31, 22)); + sectionsTextField.setText("11"); + sectionsTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.FIRST_NUM = Integer.valueOf(numeratorTextField.getText()).intValue(); + Rise.VOICES = Integer.valueOf(sectionsTextField.getText()).intValue()+1; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.repaint(); + score.revalidate(); + } + }); + } + return sectionsTextField; + } + + /** + * This method initializes transpositionScoreTextField + * + * @return javax.swing.JTextField + */ + private JTextField getTranspositionScoreTextField() { + if (transpositionScoreTextField == null) { + transpositionScoreTextField = new JTextField(); + transpositionScoreTextField.setBounds(new Rectangle(230, 50, 30, 22)); + transpositionScoreTextField.setText("36."); + transpositionScoreTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.TRANSPOSE_SCORE = Float.valueOf(transpositionScoreTextField.getText()).floatValue(); + Rise.LINE_THICKNESS = Float.valueOf(lineThicknessTextField.getText()).floatValue(); + Rise.FONT = Float.valueOf(fontSizeTextField.getText()).floatValue(); + Rise.PAGE_WIDTH = (int) Double.valueOf(xDimTextField.getText()).doubleValue()*72; + Rise.PAGE_HEIGHT = (int) (Double.valueOf(yDimTextField.getText()).doubleValue()*72); + Rise.PAGE_MARGIN = (int) (Double.valueOf(marginTextField.getText()).doubleValue()*72)+18; + Rise.IMAGE_WIDTH = Rise.PAGE_WIDTH-Rise.PAGE_MARGIN*2; + Rise.IMAGE_HEIGHT = Rise.PAGE_HEIGHT-Rise.PAGE_MARGIN*2; + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + Rise.X_DIV = Integer.valueOf(xGridTextField.getText()).intValue(); + Rise.Y_DIV = Integer.valueOf(yGridTextField.getText()).intValue(); + Rise.CURRENT_X_PAGE = 0; + Rise.CURRENT_Y_PAGE = 0; + Rise.FIRST_NUM = Integer.valueOf(numeratorTextField.getText()).intValue(); + Rise.VOICES = Integer.valueOf(sectionsTextField.getText()).intValue()+1; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.repaint(); + score.revalidate(); + } + }); + } + return transpositionScoreTextField; + } + + /** + * This method initializes formatPanel + * + * @return javax.swing.JPanel + */ + private JPanel getFormatPanel() { + if (formatPanel == null) { + lineLabel = new JLabel(); + lineLabel.setBounds(new Rectangle(80, 30, 94, 16)); + lineLabel.setText("Line Thickness"); + fontLabel = new JLabel(); + fontLabel.setBounds(new Rectangle(10, 30, 57, 16)); + fontLabel.setText("Font Size"); + formatLabel = new JLabel(); + formatLabel.setBounds(new Rectangle(10, 10, 133, 16)); + formatLabel.setText("Text and Line Format"); + formatPanel = new JPanel(); + formatPanel.setLayout(null); + formatPanel.add(getFontSizeTextField(), null); + formatPanel.add(getLineThicknessTextField(), null); + formatPanel.add(formatLabel, null); + formatPanel.add(fontLabel, null); + formatPanel.add(lineLabel, null); + } + return formatPanel; + } + + /** + * This method initializes fontSizeTextField + * + * @return javax.swing.JTextField + */ + private JTextField getFontSizeTextField() { + if (fontSizeTextField == null) { + fontSizeTextField = new JTextField(); + fontSizeTextField.setBounds(new Rectangle(10, 50, 29, 22)); + fontSizeTextField.setText("12"); + fontSizeTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.FONT = Float.valueOf(fontSizeTextField.getText()).floatValue(); + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + score.repaint(); + score.revalidate(); + } + }); + } + return fontSizeTextField; + } + + /** + * This method initializes lineThicknessTextField + * + * @return javax.swing.JTextField + */ + private JTextField getLineThicknessTextField() { + if (lineThicknessTextField == null) { + lineThicknessTextField = new JTextField(); + lineThicknessTextField.setBounds(new Rectangle(80, 50, 28, 22)); + lineThicknessTextField.setText(".05"); + lineThicknessTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.LINE_THICKNESS = Float.valueOf(lineThicknessTextField.getText()).floatValue(); + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + score.repaint(); + score.revalidate(); + } + }); + } + return lineThicknessTextField; + } + + /** + * This method initializes xPageDownEdit + * + * @return javax.swing.JButton + */ + private JButton getXPageDownEdit() { + if (xPageDownEdit == null) { + xPageDownEdit = new JButton(); + xPageDownEdit.setBounds(new Rectangle(35, 60, 41, 26)); + xPageDownEdit.setText("<"); + xPageDownEdit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_X_PAGE > 0) { + Rise.CURRENT_X_PAGE--; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return xPageDownEdit; + } + + /** + * This method initializes xPageUpEdit + * + * @return javax.swing.JButton + */ + private JButton getXPageUpEdit() { + if (xPageUpEdit == null) { + xPageUpEdit = new JButton(); + xPageUpEdit.setBounds(new Rectangle(75, 60, 41, 26)); + xPageUpEdit.setText(">"); + xPageUpEdit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_X_PAGE < Rise.X_DIV - 1) { + Rise.CURRENT_X_PAGE++; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return xPageUpEdit; + } + + /** + * This method initializes yPageUpEdit + * + * @return javax.swing.JButton + */ + private JButton getYPageUpEdit() { + if (yPageUpEdit == null) { + yPageUpEdit = new JButton(); + yPageUpEdit.setBounds(new Rectangle(55, 35, 41, 26)); + yPageUpEdit.setText("^"); + yPageUpEdit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_Y_PAGE < Rise.Y_DIV - 1) { + Rise.CURRENT_Y_PAGE++; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return yPageUpEdit; + } + + /** + * This method initializes yPageDownEdit + * + * @return javax.swing.JButton + */ + private JButton getYPageDownEdit() { + if (yPageDownEdit == null) { + yPageDownEdit = new JButton(); + yPageDownEdit.setBounds(new Rectangle(55, 85, 41, 26)); + yPageDownEdit.setText("v"); + yPageDownEdit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_Y_PAGE > 0) { + Rise.CURRENT_Y_PAGE--; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return yPageDownEdit; + } + + /** + * This method initializes xPageDownPlay + * + * @return javax.swing.JButton + */ + private JButton getXPageDownPlay() { + if (xPageDownPlay == null) { + xPageDownPlay = new JButton(); + xPageDownPlay.setBounds(new Rectangle(84, 48, 41, 26)); + xPageDownPlay.setText("<"); + xPageDownPlay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_X_PAGE > 0) { + Rise.CURRENT_X_PAGE--; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return xPageDownPlay; + } + + /** + * This method initializes xPageUpPlay + * + * @return javax.swing.JButton + */ + private JButton getXPageUpPlay() { + if (xPageUpPlay == null) { + xPageUpPlay = new JButton(); + xPageUpPlay.setBounds(new Rectangle(124, 48, 41, 26)); + xPageUpPlay.setText(">"); + xPageUpPlay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_X_PAGE < Rise.X_DIV - 1) { + Rise.CURRENT_X_PAGE++; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return xPageUpPlay; + } + + /** + * This method initializes yPageUpPlay + * + * @return javax.swing.JButton + */ + private JButton getYPageUpPlay() { + if (yPageUpPlay == null) { + yPageUpPlay = new JButton(); + yPageUpPlay.setBounds(new Rectangle(104, 23, 41, 26)); + yPageUpPlay.setText("^"); + yPageUpPlay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_Y_PAGE < Rise.Y_DIV - 1) { + Rise.CURRENT_Y_PAGE++; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return yPageUpPlay; + } + + /** + * This method initializes yPageDownPlay + * + * @return javax.swing.JButton + */ + private JButton getYPageDownPlay() { + if (yPageDownPlay == null) { + yPageDownPlay = new JButton(); + yPageDownPlay.setBounds(new Rectangle(104, 73, 41, 26)); + yPageDownPlay.setText("v"); + yPageDownPlay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (Rise.CURRENT_Y_PAGE > 0) { + Rise.CURRENT_Y_PAGE--; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.setNoteChoices(); + score.repaint(); + score.revalidate(); + } + } + }); + } + return yPageDownPlay; + } + + /** + * This method initializes redrawButton + * + * @return javax.swing.JButton + */ + private JButton getRedrawButton() { + if (redrawButton == null) { + redrawButton = new JButton(); + redrawButton.setBounds(new Rectangle(270, 15, 141, 29)); + redrawButton.setText("Redraw"); + redrawButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + redraw(); + } + }); + } + return redrawButton; + } + + public void redraw(){ +// Rise.BOUNDING_BOX.setVisible(false); + //Rise.NOTE_FRAME.setVisible(false); + Rise.LINE_THICKNESS = Float.valueOf(lineThicknessTextField.getText()).floatValue(); + Rise.FONT = Float.valueOf(fontSizeTextField.getText()).floatValue(); + Rise.PAGE_WIDTH = (int) Double.valueOf(xDimTextField.getText()).doubleValue()*72; + Rise.PAGE_HEIGHT = (int) (Double.valueOf(yDimTextField.getText()).doubleValue()*72); + Rise.PAGE_MARGIN = (int) (Double.valueOf(marginTextField.getText()).doubleValue()*72)+18; + Rise.IMAGE_WIDTH = Rise.PAGE_WIDTH-Rise.PAGE_MARGIN*2; + Rise.IMAGE_HEIGHT = Rise.PAGE_HEIGHT-Rise.PAGE_MARGIN*2; + score.setPreferredSize(new Dimension((int) (Rise.PAGE_WIDTH*Rise.ZOOM), (int) (Rise.PAGE_HEIGHT*Rise.ZOOM))); + Rise.X_DIV = Integer.valueOf(xGridTextField.getText()).intValue(); + Rise.Y_DIV = Integer.valueOf(yGridTextField.getText()).intValue(); + Rise.CURRENT_X_PAGE = 0; + Rise.CURRENT_Y_PAGE = 0; + Rise.FIRST_NUM = Integer.valueOf(numeratorTextField.getText()).intValue(); + Rise.VOICES = Integer.valueOf(sectionsTextField.getText()).intValue()+1; + score.removeAll(); + score.add(Rise.BOUNDING_BOX); + score.add(Rise.SCROLLBAR); + score.setNotes(); + score.repaint(); + score.revalidate(); + } + + /** + * This method initializes playModePanel + * + * @return javax.swing.JPanel + */ + private JPanel getPlayModePanel() { + if (playModePanel == null) { + ampLabel = new JLabel(); + ampLabel.setText("Fader"); + ampLabel.setBounds(new Rectangle(0, 20, 65, 16)); + transpositionSoundingLabel = new JLabel(); + transpositionSoundingLabel.setText("Transpose"); + transpositionSoundingLabel.setBounds(new Rectangle(0, 240, 65, 16)); + minsecLabel = new JLabel(); + minsecLabel.setText("minutes:seconds"); + minsecLabel.setBounds(new Rectangle(0, 20, 107, 16)); + colonLabel = new JLabel(); + colonLabel.setText(":"); + colonLabel.setBounds(new Rectangle(35, 45, 10, 16)); + pieceDurLabel = new JLabel(); + pieceDurLabel.setText("Piece Duration"); + pieceDurLabel.setBounds(new Rectangle(0, 0, 91, 16)); + masterLabel = new JLabel(); + masterLabel.setText("Master"); + masterLabel.setBounds(new Rectangle(0, 0, 42, 16)); + playModePanel = new JPanel(); + playModePanel.setLayout(null); + + zoomPlayLabel = new JLabel(); + zoomPlayLabel.setBounds(new Rectangle(236, 29, 36, 16)); + zoomPlayLabel.setText("Zoom"); + pageNavPlayLabel = new JLabel(); + pageNavPlayLabel.setBounds(new Rectangle(74, 3, 101, 16)); + pageNavPlayLabel.setText("Page Navigation"); + playModePanel.add(getZoomInButtonPlay(), null); + playModePanel.add(getZoomOutButtonPlay(), null); + playModePanel.add(getXPageDownPlay(), null); + playModePanel.add(getXPageUpPlay(), null); + playModePanel.add(getYPageUpPlay(), null); + playModePanel.add(getYPageDownPlay(), null); + playModePanel.add(zoomPlayLabel, null); + playModePanel.add(pageNavPlayLabel, null); + + playModePanel.add(getJTabbedPane1(), null); + playModePanel.add(getCuePanel(), null); + } + return playModePanel; + } + + /** + * This method initializes masterAmpSlider + * + * @return javax.swing.JSlider + */ + private JSlider getMasterAmpSlider() { + if (masterAmpSlider == null) { + Hashtable labelAmpTable = new Hashtable(); + labelAmpTable.put( new Integer( 1189 ), new JLabel("5") ); + labelAmpTable.put( new Integer( 1000 ), new JLabel("0 dB") ); + labelAmpTable.put( new Integer( 841 ), new JLabel("-5") ); + labelAmpTable.put( new Integer( 707 ), new JLabel("-10") ); + labelAmpTable.put( new Integer( 500 ), new JLabel("-20") ); + labelAmpTable.put( new Integer( 250 ), new JLabel("-40") ); + labelAmpTable.put( new Integer( 0 ), new JLabel("-inf") ); + masterAmpSlider = new JSlider(JSlider.VERTICAL, 0, 1189, 1000); + masterAmpSlider.setBounds(new Rectangle(-10, 40, 71, 201)); + masterAmpSlider.setLabelTable(labelAmpTable); + masterAmpSlider.setPaintLabels(true); + masterAmpSlider.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + double dB = Math.log(masterAmpSlider.getValue()/1000.)/Math.log(2)*20; + masterAmp = Math.pow(10,(dB/20.)); + //System.out.println(dB + " " + amp); + score.setMasterFader(masterAmp); + } + }); + } + return masterAmpSlider; + } + + /** + * This method initializes saveButton + * + * @return javax.swing.JButton + */ + private JButton getSaveButton() { + if (saveButton == null) { + saveButton = new JButton(); + saveButton.setBounds(new Rectangle(300, 45, 71, 26)); + saveButton.setText("Save"); + saveButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + int fd = fc.showSaveDialog(score); + if(fd==JFileChooser.APPROVE_OPTION) + try { + { + ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(fc.getSelectedFile()))); + SaveClassIterator sCI = new SaveClassIterator((Container) jTabbedPane, out); + out.close(); + } + } catch (FileNotFoundException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); + } + return saveButton; + } + + /** + * This method initializes openButton + * + * @return javax.swing.JButton + */ + private JButton getOpenButton() { + if (openButton == null) { + openButton = new JButton(); + openButton.setBounds(new Rectangle(300, 75, 71, 26)); + openButton.setText("Open"); + openButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + int fd = fc.showOpenDialog(score); + + if(fd==JFileChooser.APPROVE_OPTION){ + ObjectInputStream in; + try { + in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(fc.getSelectedFile()))); + OpenClassIterator sCI = new OpenClassIterator((Container) jTabbedPane, in); + in.close(); + redraw(); + } catch (FileNotFoundException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + } + }); + } + return openButton; +} + + /** + * This method initializes printButton + * + * @return javax.swing.JButton + */ + private JButton getPrintButton() { + if (printButton == null) { + printButton = new JButton(); + printButton.setBounds(new Rectangle(300, 105, 71, 26)); + printButton.setText("Print"); + printButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + printUtilities.init(score, Rise.CURRENT_X_PAGE, Rise.CURRENT_Y_PAGE); + } + }); + } + return printButton; + } + + /** + * This method initializes minField + * + * @return javax.swing.JTextField + */ + private JTextField getMinTextField() { + if (minTextField == null) { + minTextField = new JTextField(); + minTextField.setText("27"); + minTextField.setBounds(new Rectangle(0, 40, 31, 22)); + minTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.TOTAL_DUR = 60 * Integer.valueOf(minTextField.getText()).intValue() + Integer.valueOf(secTextField.getText()).intValue(); + } + }); + } + return minTextField; + } + + /** + * This method initializes secTextField + * + * @return javax.swing.JTextField + */ + private JTextField getSecTextField() { + if (secTextField == null) { + secTextField = new JTextField(); + secTextField.setText("30"); + secTextField.setBounds(new Rectangle(45, 40, 31, 21)); + secTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.TOTAL_DUR = 60 * Integer.valueOf(minTextField.getText()).intValue() + Integer.valueOf(secTextField.getText()).intValue(); + } + }); + } + return secTextField; + } + + /** + * This method initializes playButton + * + * @return javax.swing.JButton + */ + private JButton getPlayButton() { + if (playButton == null) { + playButton = new JButton(); + playButton.setText("Play"); + playButton.setBounds(new Rectangle(0, 200, 61, 41)); + playButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + + //There is thread issues with double clicking start + if (gliss.isOn == true){ + //System.out.println("MEEMEE!!!"); + gliss.kill(); + } + + if (Rise.IS_ENGINE_ON == true){ + Rise.IS_ENGINE_ON = false; + Synth.stopEngine(); + } + + Synth.startEngine(0); + + //System.out.println("check " + grainSoundDurValMinFader.getValue()); + + Rise.IS_ENGINE_ON = true; + + pV = new PitchVector(); + pV.init(); + + grainStream = new GrainStream[grainDenValMaxFader.getValue()]; + for (int i = 0; i < grainStream.length; i++){ + grainStream[i] = new GrainStream(); + grainStream[i].start(); + } + + initializeGrains(); + + //score.setGrainStream(grainStream); + + int currentTick = Synth.getTickCount(); + + gliss.init(grainStream, grainDenValMinFader.getValue(), currentTick, grainDenValMaxFader.getValue()); + + synchronized (gliss){ + gliss.notify(); + } + + gliss.setGlissFader(glissAmp); + gliss.setGrainFader(grainAmp); + score.setMasterFader(masterAmp); + score.setClickFader(clickAmp); + + for (int i = 0; i < grainDenValMaxFader.getValue(); i++){ + synchronized (grainStream[i]){ + grainStream[i].notify(); + } + } + + //synchronized (cue){ + // cue.notify(); + //} + + } + }); + } + return playButton; + } + + public void initializeGrains(){ + for (int i = 0; i < grainDenValMaxFader.getValue(); i++){ + grainStream[i].init( + grainAmpValMinFader.getValue()/1000., + grainAmpValMaxFader.getValue()/1000., + grainAmpJitMinFader.getValue()/1000., + grainAmpJitMaxFader.getValue()/1000., + grainSoundDurValMinFader.getValue()/100., + grainSoundDurValMaxFader.getValue()/100., + grainSoundDurJitMinFader.getValue()/100., + grainSoundDurJitMaxFader.getValue()/100., + grainSilenceDurValMinFader.getValue()/100., + grainSilenceDurValMaxFader.getValue()/100., + grainSilenceDurJitMinFader.getValue()/100., + grainSilenceDurJitMaxFader.getValue()/100., + pV, + grainDenValMaxFader.getValue(), + i + ); + + } + } + + /** + * This method initializes pauseButton + * + * @return javax.swing.JButton + */ + private JButton getPauseButton() { + if (pauseButton == null) { + pauseButton = new JButton(); + pauseButton.setText("Stop"); + pauseButton.setBounds(new Rectangle(60, 200, 61, 41)); + pauseButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + gliss.kill(); +// for (int i = 0; i < grainDenValMaxFader.getValue(); i++){ +// grainStream[i].interrupt(); +// try { +// grainStream[i].wait(0); +// } catch (InterruptedException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// } + //gliss.interrupt(); + if (Rise.IS_ENGINE_ON == true){ + Rise.IS_ENGINE_ON = false; + Synth.stopEngine(); + } +// synchronized (gliss) { +// try { +// gliss.wait(); +// } catch (InterruptedException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// } + + } + }); + } + return pauseButton; + } + + /** + * This method initializes transpositionSoundingTextField + * + * @return javax.swing.JTextField + */ + private JTextField getTranspositionSoundingTextField() { + if (transpositionSoundingTextField == null) { + transpositionSoundingTextField = new JTextField(); + transpositionSoundingTextField.setText("0.0"); + transpositionSoundingTextField.setBounds(new Rectangle(0, 260, 35, 20)); + transpositionSoundingTextField + .addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.TRANSPOSE_SOUND = Float.valueOf(transpositionSoundingTextField.getText()).floatValue(); + } + }); + } + return transpositionSoundingTextField; + } + + + /** + * This method initializes jTabbedPane1 + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getJTabbedPane1() { + if (jTabbedPane1 == null) { + jTabbedPane1 = new JTabbedPane(); + jTabbedPane1.setBounds(new Rectangle(0, 105, 489, 331)); + jTabbedPane1.addTab("Master Controls", null, getMasterControlsPanel(), null); + jTabbedPane1.addTab("Grain Values", null, getGrainValuesPanel(), null); + jTabbedPane1.addTab("Glissandi Values", null, getGlissValuesPanel(), null); + } + return jTabbedPane1; + } + + /** + * This method initializes masterControlsPanel + * + * @return javax.swing.JPanel + */ + private JPanel getMasterControlsPanel() { + if (masterControlsPanel == null) { + masterControlsPanel = new JPanel(); + masterControlsPanel.setLayout(null); + masterControlsPanel.add(getTranspositionSoundingTextField(), null); + masterControlsPanel.add(transpositionSoundingLabel, null); + masterControlsPanel.add(getPauseButton(), null); + masterControlsPanel.add(getPlayButton(), null); + masterControlsPanel.add(getSecTextField(), null); + masterControlsPanel.add(getMasterFaderPanel(), null); + masterControlsPanel.add(getGlissFaderPanel(), null); + masterControlsPanel.add(getGrainsFaderPanel(), null); + masterControlsPanel.add(getTimePanel(), null); + masterControlsPanel.add(getStartTimePanel(), null); + masterControlsPanel.add(getSpectrumPanel(), null); + masterControlsPanel.add(getFadePanel(), null); + masterControlsPanel.add(getClickFaderPanel(), null); + } + return masterControlsPanel; + } + + /** + * This method initializes grainValuesPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainValuesPanel() { + if (grainValuesPanel == null) { + grainValuesPanel = new JPanel(); + grainValuesPanel.setLayout(null); + grainValuesPanel.add(getGrainAmpPanel(), null); + grainValuesPanel.add(getGrainSoundDurPanel(), null); + grainValuesPanel.add(getGrainSilenceDurPanel(), null); + grainValuesPanel.add(getGrainDenPanel(), null); + } + return grainValuesPanel; + } + + /** + * This method initializes grainAmpPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainAmpPanel() { + if (grainAmpPanel == null) { + grainAmpLabel = new JLabel(); + grainAmpLabel.setBounds(new Rectangle(0, 0, 96, 16)); + grainAmpLabel.setText("Amplitude"); + grainAmpPanel = new JPanel(); + grainAmpPanel.setLayout(null); + grainAmpPanel.setBounds(new Rectangle(0, 0, 101, 271)); + grainAmpPanel.add(getGrainAmpTabPane(), null); + grainAmpPanel.add(grainAmpLabel, null); + } + return grainAmpPanel; + } + + /** + * This method initializes grainAmpTabPane + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getGrainAmpTabPane() { + if (grainAmpTabPane == null) { + grainAmpTabPane = new JTabbedPane(); + grainAmpTabPane.setBounds(new Rectangle(1, 20, 100, 251)); + grainAmpTabPane.addTab("Val", null, getGrainAmpValPanel(), null); + grainAmpTabPane.addTab("Jit", null, getGrainAmpJitPanel(), null); + } + return grainAmpTabPane; + } + + /** + * This method initializes grainAmpValPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainAmpValPanel() { + if (grainAmpValPanel == null) { + startEndGrainampValLabel = new JLabel(); + startEndGrainampValLabel.setBounds(new Rectangle(0, 0, 59, 16)); + startEndGrainampValLabel.setText("start/end"); + grainAmpValPanel = new JPanel(); + grainAmpValPanel.setLayout(null); + grainAmpValPanel.add(getGrainAmpValMaxFader(), null); + grainAmpValPanel.add(getGrainAmpValMinFader(), null); + grainAmpValPanel.add(startEndGrainampValLabel, null); + } + return grainAmpValPanel; + } + + /** + * This method initializes grainAmpValMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainAmpValMaxFader() { + if (grainAmpValMaxFader == null) { + grainAmpValMaxFader = new JSlider(JSlider.VERTICAL, 0, 1000, 750); + Hashtable labelAmpTable = new Hashtable(); + labelAmpTable.put( new Integer( 1000 ), new JLabel("1") ); + labelAmpTable.put( new Integer( 750 ), new JLabel(".75") ); + labelAmpTable.put( new Integer( 500 ), new JLabel(".5") ); + labelAmpTable.put( new Integer( 250 ), new JLabel(".25") ); + labelAmpTable.put( new Integer( 0 ), new JLabel("0") ); + grainAmpValMaxFader.setLabelTable(labelAmpTable); + grainAmpValMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + grainAmpValMaxFader.setMinorTickSpacing(50); + grainAmpValMaxFader.setPaintLabels(true); + grainAmpValMaxFader.setPaintTicks(true); + grainAmpValMaxFader.setMajorTickSpacing(250); + Rise.GRAIN_AMP_VAL_END = grainAmpValMaxFader.getValue()/1000.; + grainAmpValMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainAmpValMinFader.getValue() > grainAmpValMaxFader.getValue()){ + grainAmpValMinFader.setValue(grainAmpValMaxFader.getValue()); + Rise.GRAIN_AMP_VAL_START = grainAmpValMinFader.getValue()/1000.; + } + Rise.GRAIN_AMP_VAL_END = grainAmpValMaxFader.getValue()/1000.; + //initializeGrains(); + } + }); + } + return grainAmpValMaxFader; + } + + /** + * This method initializes grainAmpValMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainAmpValMinFader() { + if (grainAmpValMinFader == null) { + grainAmpValMinFader = new JSlider(JSlider.VERTICAL, 0, 1000, 500); + grainAmpValMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + grainAmpValMinFader.setPaintLabels(true); + Rise.GRAIN_AMP_VAL_START = grainAmpValMinFader.getValue()/1000.; + grainAmpValMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainAmpValMaxFader.getValue() < grainAmpValMinFader.getValue()){ + grainAmpValMaxFader.setValue(grainAmpValMinFader.getValue()); + Rise.GRAIN_AMP_VAL_END = grainAmpValMaxFader.getValue()/1000.; + } + Rise.GRAIN_AMP_VAL_START = grainAmpValMinFader.getValue()/1000.; + //initializeGrains(); + } + }); + } + return grainAmpValMinFader; + } + + /** + * This method initializes grainAmpJitPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainAmpJitPanel() { + if (grainAmpJitPanel == null) { + startEndGrainAmpJitLabel = new JLabel(); + startEndGrainAmpJitLabel.setBounds(new Rectangle(0, 0, 61, 16)); + startEndGrainAmpJitLabel.setText("start/end"); + grainAmpJitPanel = new JPanel(); + grainAmpJitPanel.setLayout(null); + grainAmpJitPanel.add(getGrainAmpJitMaxFader(), null); + grainAmpJitPanel.add(getGrainAmpJitMinFader(), null); + grainAmpJitPanel.add(startEndGrainAmpJitLabel, null); + } + return grainAmpJitPanel; + } + + /** + * This method initializes grainAmpJitMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainAmpJitMaxFader() { + if (grainAmpJitMaxFader == null) { + grainAmpJitMaxFader = new JSlider(JSlider.VERTICAL, 0, 1000, 250); + Hashtable labelAmpTable = new Hashtable(); + labelAmpTable.put( new Integer( 1000 ), new JLabel("1") ); + labelAmpTable.put( new Integer( 750 ), new JLabel(".75") ); + labelAmpTable.put( new Integer( 500 ), new JLabel(".5") ); + labelAmpTable.put( new Integer( 250 ), new JLabel(".25") ); + labelAmpTable.put( new Integer( 0 ), new JLabel("0") ); + grainAmpJitMaxFader.setLabelTable(labelAmpTable); + grainAmpJitMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + grainAmpJitMaxFader.setMinorTickSpacing(50); + grainAmpJitMaxFader.setPaintLabels(true); + grainAmpJitMaxFader.setPaintTicks(true); + grainAmpJitMaxFader.setMajorTickSpacing(250); + Rise.GRAIN_AMP_JIT_END = grainAmpJitMaxFader.getValue()/1000.; + grainAmpJitMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainAmpJitMinFader.getValue() > grainAmpJitMaxFader.getValue()){ + grainAmpJitMinFader.setValue(grainAmpJitMaxFader.getValue()); + Rise.GRAIN_AMP_JIT_START = grainAmpJitMinFader.getValue()/1000.; + } + Rise.GRAIN_AMP_JIT_END = grainAmpJitMaxFader.getValue()/1000.; + //initializeGrains(); + } + }); + } + return grainAmpJitMaxFader; + } + + /** + * This method initializes grainAmpJitMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainAmpJitMinFader() { + if (grainAmpJitMinFader == null) { + grainAmpJitMinFader = new JSlider(JSlider.VERTICAL, 0, 1000, 250); + grainAmpJitMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + grainAmpJitMinFader.setPaintLabels(true); + Rise.GRAIN_AMP_JIT_START = grainAmpJitMinFader.getValue()/1000.; + grainAmpJitMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainAmpJitMaxFader.getValue() < grainAmpJitMinFader.getValue()){ + grainAmpJitMaxFader.setValue(grainAmpJitMinFader.getValue()); + Rise.GRAIN_AMP_JIT_END = grainAmpJitMaxFader.getValue()/1000.; + } + Rise.GRAIN_AMP_JIT_START = grainAmpJitMinFader.getValue()/1000.; + //initializeGrains(); + } + }); + } + return grainAmpJitMinFader; + } + + + /** + * This method initializes grainDenPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainDenPanel() { + if (grainDenPanel == null) { + grainDenLabel = new JLabel(); + grainDenLabel.setBounds(new Rectangle(0, 0, 96, 16)); + grainDenLabel.setText("Density"); + grainDenPanel = new JPanel(); + grainDenPanel.setLayout(null); + grainDenPanel.setBounds(new Rectangle(100, 0, 101, 271)); + grainDenPanel.add(getGrainDenTabPane(), null); + grainDenPanel.add(grainDenLabel, null); + } + return grainDenPanel; + } + + /** + * This method initializes grainDenTabPane + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getGrainDenTabPane() { + if (grainDenTabPane == null) { + grainDenTabPane = new JTabbedPane(); + grainDenTabPane.setBounds(new Rectangle(1, 20, 100, 251)); + grainDenTabPane.addTab("Val", null, getGrainDenValPanel(), null); + } + return grainDenTabPane; + } + + /** + * This method initializes grainDenValPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainDenValPanel() { + if (grainDenValPanel == null) { + startEndGrainampValLabel = new JLabel(); + startEndGrainampValLabel.setBounds(new Rectangle(0, 0, 59, 16)); + startEndGrainampValLabel.setText("start/end"); + grainDenValPanel = new JPanel(); + grainDenValPanel.setLayout(null); + grainDenValPanel.add(getGrainDenValMaxFader(), null); + grainDenValPanel.add(getGrainDenValMinFader(), null); + grainDenValPanel.add(startEndGrainampValLabel, null); + } + return grainDenValPanel; + } + + /** + * This method initializes grainDenValMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainDenValMaxFader() { + if (grainDenValMaxFader == null) { + grainDenValMaxFader = new JSlider(JSlider.VERTICAL, 0, 40, 20); + Hashtable labelDenTable = new Hashtable(); + labelDenTable.put( new Integer( 40 ), new JLabel("40") ); + labelDenTable.put( new Integer( 30 ), new JLabel("30") ); + labelDenTable.put( new Integer( 20 ), new JLabel("20") ); + labelDenTable.put( new Integer( 10 ), new JLabel("10") ); + labelDenTable.put( new Integer( 0 ), new JLabel("0") ); + grainDenValMaxFader.setLabelTable(labelDenTable); + grainDenValMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + grainDenValMaxFader.setMinorTickSpacing(1); + grainDenValMaxFader.setPaintLabels(true); + grainDenValMaxFader.setPaintTicks(true); + grainDenValMaxFader.setMajorTickSpacing(10); + grainDenValMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainDenValMinFader.getValue() > grainDenValMaxFader.getValue()){ + grainDenValMinFader.setValue(grainDenValMaxFader.getValue()); + } + } + }); + } + return grainDenValMaxFader; + } + + /** + * This method initializes grainDenValMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainDenValMinFader() { + if (grainDenValMinFader == null) { + grainDenValMinFader = new JSlider(JSlider.VERTICAL, 0, 40, 5); + grainDenValMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + grainDenValMinFader.setPaintLabels(true); + grainDenValMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainDenValMaxFader.getValue() < grainDenValMinFader.getValue()){ + grainDenValMaxFader.setValue(grainDenValMinFader.getValue()); + } + } + }); + } + return grainDenValMinFader; + } + + /** + * This method initializes grainSoundDurPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainSoundDurPanel() { + if (grainSoundDurPanel == null) { + grainSoundDurLabel = new JLabel(); + grainSoundDurLabel.setBounds(new Rectangle(0, 0, 96, 16)); + grainSoundDurLabel.setText("Sounding Dur."); + grainSoundDurPanel = new JPanel(); + grainSoundDurPanel.setLayout(null); + grainSoundDurPanel.setBounds(new Rectangle(200, 0, 101, 271)); + grainSoundDurPanel.add(getGrainSoundDurTabPane(), null); + grainSoundDurPanel.add(grainSoundDurLabel, null); + } + return grainSoundDurPanel; + } + + /** + * This method initializes grainSoundDurTabPane + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getGrainSoundDurTabPane() { + if (grainSoundDurTabPane == null) { + grainSoundDurTabPane = new JTabbedPane(); + grainSoundDurTabPane.setBounds(new Rectangle(1, 20, 100, 251)); + grainSoundDurTabPane.addTab("Val", null, getGrainSoundDurValPanel(), null); + grainSoundDurTabPane.addTab("Jit", null, getGrainSoundDurJitPanel(), null); + } + return grainSoundDurTabPane; + } + + /** + * This method initializes grainSoundDurValPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainSoundDurValPanel() { + if (grainSoundDurValPanel == null) { + startEndGrainampValLabel = new JLabel(); + startEndGrainampValLabel.setBounds(new Rectangle(0, 0, 59, 16)); + startEndGrainampValLabel.setText("start/end"); + grainSoundDurValPanel = new JPanel(); + grainSoundDurValPanel.setLayout(null); + grainSoundDurValPanel.add(getGrainSoundDurValMaxFader(), null); + grainSoundDurValPanel.add(getGrainSoundDurValMinFader(), null); + grainSoundDurValPanel.add(startEndGrainampValLabel, null); + } + return grainSoundDurValPanel; + } + + /** + * This method initializes grainSoundDurValMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSoundDurValMaxFader() { + if (grainSoundDurValMaxFader == null) { + grainSoundDurValMaxFader = new JSlider(JSlider.VERTICAL, 0, 2000, 300); + Hashtable labelSoundDurTable = new Hashtable(); + labelSoundDurTable.put( new Integer( 2000 ), new JLabel("20") ); + labelSoundDurTable.put( new Integer( 1500 ), new JLabel("15") ); + labelSoundDurTable.put( new Integer( 1000 ), new JLabel("10") ); + labelSoundDurTable.put( new Integer( 500 ), new JLabel("5") ); + labelSoundDurTable.put( new Integer( 0 ), new JLabel("0") ); + grainSoundDurValMaxFader.setLabelTable(labelSoundDurTable); + grainSoundDurValMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + grainSoundDurValMaxFader.setMinorTickSpacing(100); + grainSoundDurValMaxFader.setPaintLabels(true); + grainSoundDurValMaxFader.setPaintTicks(true); + grainSoundDurValMaxFader.setMajorTickSpacing(500); + Rise.GRAIN_SOUND_DUR_VAL_END = grainSoundDurValMaxFader.getValue()/100.; + grainSoundDurValMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSoundDurValMinFader.getValue() < grainSoundDurValMaxFader.getValue()){ + grainSoundDurValMinFader.setValue(grainSoundDurValMaxFader.getValue()); + Rise.GRAIN_SOUND_DUR_VAL_START = grainSoundDurValMinFader.getValue()/100.; + } + if (grainSoundDurJitMinFader.getValue() > grainSoundDurValMinFader.getValue()){ + grainSoundDurJitMinFader.setValue(grainSoundDurValMinFader.getValue()); + Rise.GRAIN_SOUND_DUR_JIT_START = grainSoundDurJitMinFader.getValue()/100.; + } + Rise.GRAIN_SOUND_DUR_VAL_END = grainSoundDurValMaxFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSoundDurValMaxFader; + } + + /** + * This method initializes grainSoundDurValMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSoundDurValMinFader() { + if (grainSoundDurValMinFader == null) { + grainSoundDurValMinFader = new JSlider(JSlider.VERTICAL, 0, 2000, 1000); + grainSoundDurValMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + grainSoundDurValMinFader.setPaintLabels(true); + Rise.GRAIN_SOUND_DUR_VAL_START = grainSoundDurValMinFader.getValue()/100.; + grainSoundDurValMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSoundDurValMaxFader.getValue() > grainSoundDurValMinFader.getValue()){ + grainSoundDurValMaxFader.setValue(grainSoundDurValMinFader.getValue()); + Rise.GRAIN_SOUND_DUR_VAL_END = grainSoundDurValMaxFader.getValue()/100.; + } + if (grainSoundDurJitMaxFader.getValue() > grainSoundDurValMaxFader.getValue()){ + grainSoundDurJitMaxFader.setValue(grainSoundDurValMaxFader.getValue()); + Rise.GRAIN_SOUND_DUR_JIT_END = grainSoundDurJitMaxFader.getValue()/100.; + } + Rise.GRAIN_SOUND_DUR_VAL_START = grainSoundDurValMinFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSoundDurValMinFader; + } + + /** + * This method initializes grainSoundDurJitPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainSoundDurJitPanel() { + if (grainSoundDurJitPanel == null) { + startEndGrainSoundDurJitLabel = new JLabel(); + startEndGrainSoundDurJitLabel.setBounds(new Rectangle(0, 0, 61, 16)); + startEndGrainSoundDurJitLabel.setText("start/end"); + grainSoundDurJitPanel = new JPanel(); + grainSoundDurJitPanel.setLayout(null); + grainSoundDurJitPanel.add(getGrainSoundDurJitMaxFader(), null); + grainSoundDurJitPanel.add(getGrainSoundDurJitMinFader(), null); + grainSoundDurJitPanel.add(startEndGrainSoundDurJitLabel, null); + } + return grainSoundDurJitPanel; + } + + /** + * This method initializes grainSoundDurJitMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSoundDurJitMaxFader() { + if (grainSoundDurJitMaxFader == null) { + grainSoundDurJitMaxFader = new JSlider(JSlider.VERTICAL, 0, 2000, 150); + Hashtable labelSoundDurTable = new Hashtable(); + labelSoundDurTable.put( new Integer( 2000 ), new JLabel("20") ); + labelSoundDurTable.put( new Integer( 1500 ), new JLabel("15") ); + labelSoundDurTable.put( new Integer( 1000 ), new JLabel("10") ); + labelSoundDurTable.put( new Integer( 500 ), new JLabel("5") ); + labelSoundDurTable.put( new Integer( 0 ), new JLabel("0") ); + grainSoundDurJitMaxFader.setLabelTable(labelSoundDurTable); + grainSoundDurJitMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + grainSoundDurJitMaxFader.setMinorTickSpacing(100); + grainSoundDurJitMaxFader.setPaintLabels(true); + grainSoundDurJitMaxFader.setPaintTicks(true); + grainSoundDurJitMaxFader.setMajorTickSpacing(500); + Rise.GRAIN_SOUND_DUR_JIT_END = grainSoundDurJitMaxFader.getValue()/100.; + grainSoundDurJitMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSoundDurJitMinFader.getValue() < grainSoundDurJitMaxFader.getValue()){ + grainSoundDurJitMinFader.setValue(grainSoundDurJitMaxFader.getValue()); + Rise.GRAIN_SOUND_DUR_JIT_START = grainSoundDurJitMinFader.getValue()/100.; + } + if (grainSoundDurJitMinFader.getValue() > grainSoundDurValMinFader.getValue()){ + grainSoundDurJitMinFader.setValue(grainSoundDurValMinFader.getValue()); + Rise.GRAIN_SOUND_DUR_JIT_START = grainSoundDurJitMinFader.getValue()/100.; + } + Rise.GRAIN_SOUND_DUR_JIT_END = grainSoundDurJitMaxFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSoundDurJitMaxFader; + } + + /** + * This method initializes grainSoundDurJitMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSoundDurJitMinFader() { + if (grainSoundDurJitMinFader == null) { + grainSoundDurJitMinFader = new JSlider(JSlider.VERTICAL, 0, 2000, 250); + grainSoundDurJitMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + grainSoundDurJitMinFader.setPaintLabels(true); + Rise.GRAIN_SOUND_DUR_JIT_START = grainSoundDurJitMinFader.getValue()/100.; + grainSoundDurJitMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSoundDurJitMaxFader.getValue() > grainSoundDurJitMinFader.getValue()){ + grainSoundDurJitMaxFader.setValue(grainSoundDurJitMinFader.getValue()); + Rise.GRAIN_SOUND_DUR_JIT_END = grainSoundDurJitMaxFader.getValue()/100.; + } + if (grainSoundDurJitMaxFader.getValue() > grainSoundDurValMaxFader.getValue()){ + grainSoundDurJitMaxFader.setValue(grainSoundDurValMaxFader.getValue()); + Rise.GRAIN_SOUND_DUR_JIT_END = grainSoundDurJitMaxFader.getValue()/100.; + //grainSoundDurJitMaxFader.repaint(); + } + Rise.GRAIN_SOUND_DUR_JIT_START = grainSoundDurJitMinFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSoundDurJitMinFader; + } + + /** + * This method initializes grainSilenceDurPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainSilenceDurPanel() { + if (grainSilenceDurPanel == null) { + grainSilenceDurLabel = new JLabel(); + grainSilenceDurLabel.setBounds(new Rectangle(0, 0, 96, 16)); + grainSilenceDurLabel.setText("Silence Dur."); + grainSilenceDurPanel = new JPanel(); + grainSilenceDurPanel.setLayout(null); + grainSilenceDurPanel.setBounds(new Rectangle(300, 0, 101, 271)); + grainSilenceDurPanel.add(getGrainSilenceDurTabPane(), null); + grainSilenceDurPanel.add(grainSilenceDurLabel, null); + } + return grainSilenceDurPanel; + } + + /** + * This method initializes grainSilenceDurTabPane + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getGrainSilenceDurTabPane() { + if (grainSilenceDurTabPane == null) { + grainSilenceDurTabPane = new JTabbedPane(); + grainSilenceDurTabPane.setBounds(new Rectangle(1, 20, 100, 251)); + grainSilenceDurTabPane.addTab("Val", null, getGrainSilenceDurValPanel(), null); + grainSilenceDurTabPane.addTab("Jit", null, getGrainSilenceDurJitPanel(), null); + } + return grainSilenceDurTabPane; + } + + /** + * This method initializes grainSilenceDurValPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainSilenceDurValPanel() { + if (grainSilenceDurValPanel == null) { + startEndGrainampValLabel = new JLabel(); + startEndGrainampValLabel.setBounds(new Rectangle(0, 0, 59, 16)); + startEndGrainampValLabel.setText("start/end"); + grainSilenceDurValPanel = new JPanel(); + grainSilenceDurValPanel.setLayout(null); + grainSilenceDurValPanel.add(getGrainSilenceDurValMaxFader(), null); + grainSilenceDurValPanel.add(getGrainSilenceDurValMinFader(), null); + grainSilenceDurValPanel.add(startEndGrainampValLabel, null); + } + return grainSilenceDurValPanel; + } + + /** + * This method initializes grainSilenceDurValMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSilenceDurValMaxFader() { + if (grainSilenceDurValMaxFader == null) { + grainSilenceDurValMaxFader = new JSlider(JSlider.VERTICAL, 0, 2000, 50); + Hashtable labelSilenceDurTable = new Hashtable(); + labelSilenceDurTable.put( new Integer( 2000 ), new JLabel("20") ); + labelSilenceDurTable.put( new Integer( 1500 ), new JLabel("15") ); + labelSilenceDurTable.put( new Integer( 1000 ), new JLabel("10") ); + labelSilenceDurTable.put( new Integer( 500 ), new JLabel("5") ); + labelSilenceDurTable.put( new Integer( 0 ), new JLabel("0") ); + grainSilenceDurValMaxFader.setLabelTable(labelSilenceDurTable); + grainSilenceDurValMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + grainSilenceDurValMaxFader.setMinorTickSpacing(100); + grainSilenceDurValMaxFader.setPaintLabels(true); + grainSilenceDurValMaxFader.setPaintTicks(true); + grainSilenceDurValMaxFader.setMajorTickSpacing(500); + Rise.GRAIN_SILENCE_DUR_VAL_END = grainSilenceDurValMaxFader.getValue()/100.; + grainSilenceDurValMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSilenceDurValMinFader.getValue() < grainSilenceDurValMaxFader.getValue()){ + grainSilenceDurValMinFader.setValue(grainSilenceDurValMaxFader.getValue()); + Rise.GRAIN_SILENCE_DUR_VAL_START = grainSilenceDurValMinFader.getValue()/100.; + } + if (grainSilenceDurJitMinFader.getValue() > grainSilenceDurValMinFader.getValue()){ + grainSilenceDurJitMinFader.setValue(grainSilenceDurValMinFader.getValue()); + Rise.GRAIN_SILENCE_DUR_JIT_START = grainSilenceDurJitMinFader.getValue()/100.; + } + Rise.GRAIN_SILENCE_DUR_VAL_END = grainSilenceDurValMaxFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSilenceDurValMaxFader; + } + + /** + * This method initializes grainSilenceDurValMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSilenceDurValMinFader() { + if (grainSilenceDurValMinFader == null) { + grainSilenceDurValMinFader = new JSlider(JSlider.VERTICAL, 0, 2000, 500); + grainSilenceDurValMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + grainSilenceDurValMinFader.setPaintLabels(true); + Rise.GRAIN_SILENCE_DUR_VAL_START = grainSilenceDurValMinFader.getValue()/100.; + grainSilenceDurValMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSilenceDurValMaxFader.getValue() > grainSilenceDurValMinFader.getValue()){ + grainSilenceDurValMaxFader.setValue(grainSilenceDurValMinFader.getValue()); + Rise.GRAIN_SILENCE_DUR_VAL_END = grainSilenceDurValMaxFader.getValue()/100.; + } + if (grainSilenceDurJitMaxFader.getValue() > grainSilenceDurValMaxFader.getValue()){ + grainSilenceDurJitMaxFader.setValue(grainSilenceDurValMaxFader.getValue()); + Rise.GRAIN_SILENCE_DUR_JIT_END = grainSilenceDurJitMaxFader.getValue()/100.; + } + Rise.GRAIN_SILENCE_DUR_VAL_START = grainSilenceDurValMinFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSilenceDurValMinFader; + } + + /** + * This method initializes grainSilenceDurJitPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainSilenceDurJitPanel() { + if (grainSilenceDurJitPanel == null) { + startEndGrainSilenceDurJitLabel = new JLabel(); + startEndGrainSilenceDurJitLabel.setBounds(new Rectangle(0, 0, 61, 16)); + startEndGrainSilenceDurJitLabel.setText("start/end"); + grainSilenceDurJitPanel = new JPanel(); + grainSilenceDurJitPanel.setLayout(null); + grainSilenceDurJitPanel.add(getGrainSilenceDurJitMaxFader(), null); + grainSilenceDurJitPanel.add(getGrainSilenceDurJitMinFader(), null); + grainSilenceDurJitPanel.add(startEndGrainSilenceDurJitLabel, null); + } + return grainSilenceDurJitPanel; + } + + /** + * This method initializes grainSilenceDurJitMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSilenceDurJitMaxFader() { + if (grainSilenceDurJitMaxFader == null) { + grainSilenceDurJitMaxFader = new JSlider(JSlider.VERTICAL, 0, 2000, 40); + Hashtable labelSilenceDurTable = new Hashtable(); + labelSilenceDurTable.put( new Integer( 2000 ), new JLabel("20") ); + labelSilenceDurTable.put( new Integer( 1500 ), new JLabel("15") ); + labelSilenceDurTable.put( new Integer( 1000 ), new JLabel("10") ); + labelSilenceDurTable.put( new Integer( 500 ), new JLabel("5") ); + labelSilenceDurTable.put( new Integer( 0 ), new JLabel("0") ); + grainSilenceDurJitMaxFader.setLabelTable(labelSilenceDurTable); + grainSilenceDurJitMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + grainSilenceDurJitMaxFader.setMinorTickSpacing(100); + grainSilenceDurJitMaxFader.setPaintLabels(true); + grainSilenceDurJitMaxFader.setPaintTicks(true); + grainSilenceDurJitMaxFader.setMajorTickSpacing(500); + Rise.GRAIN_SILENCE_DUR_JIT_END = grainSilenceDurJitMaxFader.getValue()/100.; + grainSilenceDurJitMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSilenceDurJitMinFader.getValue() < grainSilenceDurJitMaxFader.getValue()){ + grainSilenceDurJitMinFader.setValue(grainSilenceDurJitMaxFader.getValue()); + Rise.GRAIN_SILENCE_DUR_JIT_START = grainSilenceDurJitMinFader.getValue()/100.; + } + if (grainSilenceDurJitMinFader.getValue() > grainSilenceDurValMinFader.getValue()){ + grainSilenceDurJitMinFader.setValue(grainSilenceDurValMinFader.getValue()); + Rise.GRAIN_SILENCE_DUR_JIT_START = grainSilenceDurJitMinFader.getValue()/100.; + } + Rise.GRAIN_SILENCE_DUR_JIT_END = grainSilenceDurJitMaxFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSilenceDurJitMaxFader; + } + + /** + * This method initializes grainSilenceDurJitMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainSilenceDurJitMinFader() { + if (grainSilenceDurJitMinFader == null) { + grainSilenceDurJitMinFader = new JSlider(JSlider.VERTICAL, 0, 2000, 250); + grainSilenceDurJitMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + grainSilenceDurJitMinFader.setPaintLabels(true); + Rise.GRAIN_SILENCE_DUR_JIT_START = grainSoundDurJitMinFader.getValue()/100.; + grainSilenceDurJitMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (grainSilenceDurJitMaxFader.getValue() > grainSilenceDurJitMinFader.getValue()){ + grainSilenceDurJitMaxFader.setValue(grainSilenceDurJitMinFader.getValue()); + Rise.GRAIN_SILENCE_DUR_JIT_END = grainSilenceDurJitMaxFader.getValue()/100.; + } + if (grainSilenceDurJitMaxFader.getValue() > grainSilenceDurValMaxFader.getValue()){ + grainSilenceDurJitMaxFader.setValue(grainSilenceDurValMaxFader.getValue()); + Rise.GRAIN_SILENCE_DUR_JIT_END = grainSilenceDurJitMaxFader.getValue()/100.; + //grainSilenceDurJitMaxFader.repaint(); + } + Rise.GRAIN_SILENCE_DUR_JIT_START = grainSoundDurJitMinFader.getValue()/100.; + //initializeGrains(); + } + }); + } + return grainSilenceDurJitMinFader; + } + + /** + * This method initializes glissAmpPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGlissAmpPanel() { + if (glissAmpPanel == null) { + glissAmpLabel = new JLabel(); + glissAmpLabel.setBounds(new Rectangle(0, 0, 96, 16)); + glissAmpLabel.setText("Amplitude"); + glissAmpPanel = new JPanel(); + glissAmpPanel.setLayout(null); + glissAmpPanel.setBounds(new Rectangle(0, 0, 101, 271)); + glissAmpPanel.add(glissAmpLabel, null); + glissAmpPanel.add(getGlissAmpValPanel(), null); + } + return glissAmpPanel; + } + + /** + * This method initializes glissAmpValPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGlissAmpValPanel() { + if (glissAmpValPanel == null) { + startEndGlissampValLabel = new JLabel(); + startEndGlissampValLabel.setBounds(new Rectangle(0, 0, 59, 16)); + startEndGlissampValLabel.setText("start/end"); + glissAmpValPanel = new JPanel(); + glissAmpValPanel.setLayout(null); + glissAmpValPanel.setBounds(new Rectangle(0, 30, 81, 211)); + glissAmpValPanel.add(getGlissAmpValMaxFader(), null); + glissAmpValPanel.add(getGlissAmpValMinFader(), null); + glissAmpValPanel.add(startEndGlissampValLabel, null); + } + return glissAmpValPanel; + } + + /** + * This method initializes glissAmpValMaxFader + * + * @return javax.swing.JSlider + */ + private JSlider getGlissAmpValMaxFader() { + if (glissAmpValMaxFader == null) { + glissAmpValMaxFader = new JSlider(JSlider.VERTICAL, 0, 1000, 750); + Hashtable labelAmpTable = new Hashtable(); + labelAmpTable.put( new Integer( 1000 ), new JLabel("1") ); + labelAmpTable.put( new Integer( 750 ), new JLabel(".75") ); + labelAmpTable.put( new Integer( 500 ), new JLabel(".5") ); + labelAmpTable.put( new Integer( 250 ), new JLabel(".25") ); + labelAmpTable.put( new Integer( 0 ), new JLabel("0") ); + glissAmpValMaxFader.setLabelTable(labelAmpTable); + glissAmpValMaxFader.setBounds(new Rectangle(20, 10, 61, 201)); + glissAmpValMaxFader.setMinorTickSpacing(50); + glissAmpValMaxFader.setPaintLabels(true); + glissAmpValMaxFader.setPaintTicks(true); + glissAmpValMaxFader.setMajorTickSpacing(250); + Rise.GLISS_AMP_END = glissAmpValMaxFader.getValue()/1000.; + glissAmpValMaxFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (glissAmpValMinFader.getValue() > glissAmpValMaxFader.getValue()){ + glissAmpValMinFader.setValue(glissAmpValMaxFader.getValue()); + } + Rise.GLISS_AMP_START = glissAmpValMinFader.getValue()/1000.; + Rise.GLISS_AMP_END = glissAmpValMaxFader.getValue()/1000.; + } + }); + } + return glissAmpValMaxFader; + } + + /** + * This method initializes glissAmpValMinFader + * + * @return javax.swing.JSlider + */ + private JSlider getGlissAmpValMinFader() { + if (glissAmpValMinFader == null) { + glissAmpValMinFader = new JSlider(JSlider.VERTICAL, 0, 1000, 100); + glissAmpValMinFader.setBounds(new Rectangle(0, 10, 26, 201)); + glissAmpValMinFader.setPaintLabels(true); + Rise.GLISS_AMP_START = glissAmpValMinFader.getValue()/1000.; + glissAmpValMinFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (glissAmpValMaxFader.getValue() < glissAmpValMinFader.getValue()){ + glissAmpValMaxFader.setValue(glissAmpValMinFader.getValue()); + } + Rise.GLISS_AMP_START = glissAmpValMinFader.getValue()/1000.; + Rise.GLISS_AMP_END = glissAmpValMaxFader.getValue()/1000.; + } + }); + } + return glissAmpValMinFader; + } + + + /** + * This method initializes glissValuesPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGlissValuesPanel() { + if (glissValuesPanel == null) { + glissValuesPanel = new JPanel(); + glissValuesPanel.setLayout(null); + glissValuesPanel.add(getGlissAmpPanel(), null); + } + return glissValuesPanel; + } + + /** + * This method initializes spectrumPanel + * + * @return javax.swing.JPanel + */ + private JPanel getSpectrumPanel() { + if (spectrumPanel == null) { + spectrumLabel = new JLabel(); + spectrumLabel.setBounds(new Rectangle(0, 0, 96, 16)); + spectrumLabel.setText("Spectrum"); + spectrumPanel = new JPanel(); + spectrumPanel.setLayout(null); + spectrumPanel.setBounds(new Rectangle(365, 8, 101, 271)); + spectrumPanel.add(getSpectrumTabPane(), null); + spectrumPanel.add(spectrumLabel, null); + } + return spectrumPanel; + } + + /** + * This method initializes spectrumTabPane + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getSpectrumTabPane() { + if (spectrumTabPane == null) { + spectrumTabPane = new JTabbedPane(); + spectrumTabPane.setBounds(new Rectangle(1, 20, 100, 251)); + spectrumTabPane.addTab("Val", null, getSpectrumValPanel(), null); + } + return spectrumTabPane; + } + + /** + * This method initializes spectrumValPanel + * + * @return javax.swing.JPanel + */ + private JPanel getSpectrumValPanel() { + if (spectrumValPanel == null) { + minMaxSpectrumValLabel = new JLabel(); + minMaxSpectrumValLabel.setBounds(new Rectangle(0, 0, 76, 16)); + minMaxSpectrumValLabel.setText("min/max"); + spectrumValPanel = new JPanel(); + spectrumValPanel.setLayout(null); + spectrumValPanel.add(getSpectrumMaxValFader(), null); + spectrumValPanel.add(getSpectrumMinValFader(), null); + spectrumValPanel.add(minMaxSpectrumValLabel, null); + } + return spectrumValPanel; + } + + /** + * This method initializes spectrumMaxValFader + * + * @return javax.swing.JSlider + */ + private JSlider getSpectrumMaxValFader() { + if (spectrumMaxValFader == null) { + spectrumMaxValFader = new JSlider(JSlider.VERTICAL, 0, 1000, 250); + Hashtable labelSpectrumTable = new Hashtable(); + labelSpectrumTable.put( new Integer( 1000 ), new JLabel("saw") ); + labelSpectrumTable.put( new Integer( 0 ), new JLabel("sine") ); + spectrumMaxValFader.setLabelTable(labelSpectrumTable); + spectrumMaxValFader.setBounds(new Rectangle(20, 10, 61, 201)); + spectrumMaxValFader.setMinorTickSpacing(50); + spectrumMaxValFader.setPaintLabels(true); + spectrumMaxValFader.setPaintTicks(true); + spectrumMaxValFader.setMajorTickSpacing(250); + spectrumMaxValFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (spectrumMinValFader.getValue() > spectrumMaxValFader.getValue()){ + spectrumMinValFader.setValue(spectrumMaxValFader.getValue()); + } + Rise.MAX_SPECTRUM = spectrumMaxValFader.getValue()/1000.; + } + }); + } + return spectrumMaxValFader; + } + + /** + * This method initializes spectrumMinValFader + * + * @return javax.swing.JSlider + */ + private JSlider getSpectrumMinValFader() { + if (spectrumMinValFader == null) { + spectrumMinValFader = new JSlider(JSlider.VERTICAL, 0, 1000, 0); + spectrumMinValFader.setBounds(new Rectangle(0, 10, 26, 201)); + spectrumMinValFader.setPaintLabels(true); + spectrumMinValFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + if (spectrumMaxValFader.getValue() < spectrumMinValFader.getValue()){ + spectrumMaxValFader.setValue(spectrumMinValFader.getValue()); + Rise.MIN_SPECTRUM = spectrumMinValFader.getValue()/1000.; + } + Rise.MIN_SPECTRUM = spectrumMinValFader.getValue()/1000.; + } + }); + } + return spectrumMinValFader; + } + + /** + * This method initializes toolsTabbedPane + * + * @return javax.swing.JTabbedPane + */ + private JTabbedPane getToolsTabbedPane() { + if (toolsTabbedPane == null) { + toolsTabbedPane = new JTabbedPane(); + toolsTabbedPane.setBounds(new Rectangle(0, 150, 436, 181)); + toolsTabbedPane.addTab("Piece Variables", null, getPieceVariablesPanel(), null); + toolsTabbedPane.addTab("Page Layout", null, getPageLayoutPanel(), null); + toolsTabbedPane.addTab("Text Format", null, getFormatPanel(), null); + } + return toolsTabbedPane; + } + + /** + * This method initializes masterFaderPanel + * + * @return javax.swing.JPanel + */ + private JPanel getMasterFaderPanel() { + if (masterFaderPanel == null) { + masterFaderPanel = new JPanel(); + masterFaderPanel.setLayout(null); + masterFaderPanel.setBounds(new Rectangle(120, 10, 56, 271)); + masterFaderPanel.add(getMasterAmpSlider(), null); + masterFaderPanel.add(masterLabel, null); + masterFaderPanel.add(ampLabel, null); + } + return masterFaderPanel; + } + + /** + * This method initializes glissFaderPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGlissFaderPanel() { + if (glissFaderPanel == null) { + glissFaderLabel2 = new JLabel(); + glissFaderLabel2.setBounds(new Rectangle(0, 20, 65, 16)); + glissFaderLabel2.setText("Fader"); + glissFaderLabel = new JLabel(); + glissFaderLabel.setBounds(new Rectangle(0, 0, 58, 16)); + glissFaderLabel.setText("Gliss."); + glissFaderPanel = new JPanel(); + glissFaderPanel.setLayout(null); + glissFaderPanel.setBounds(new Rectangle(180, 10, 56, 271)); + glissFaderPanel.add(getGlissFader(), null); + glissFaderPanel.add(glissFaderLabel, null); + glissFaderPanel.add(glissFaderLabel2, null); + } + return glissFaderPanel; + } + + /** + * This method initializes glissFader + * + * @return javax.swing.JSlider + */ + private JSlider getGlissFader() { + if (glissFader == null) { + Hashtable labelAmpTable = new Hashtable(); + labelAmpTable.put( new Integer( 1189 ), new JLabel("5") ); + labelAmpTable.put( new Integer( 1000 ), new JLabel("0 dB") ); + labelAmpTable.put( new Integer( 841 ), new JLabel("-5") ); + labelAmpTable.put( new Integer( 707 ), new JLabel("-10") ); + labelAmpTable.put( new Integer( 500 ), new JLabel("-20") ); + labelAmpTable.put( new Integer( 250 ), new JLabel("-40") ); + labelAmpTable.put( new Integer( 0 ), new JLabel("-inf") ); + glissFader = new JSlider(JSlider.VERTICAL, 0, 1189, 0); + glissFader.setBounds(new Rectangle(-10, 40, 71, 201)); + glissFader.setLabelTable(labelAmpTable); + glissFader.setPaintLabels(true); + glissFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + double dB = Math.log(glissFader.getValue()/1000.)/Math.log(2)*20; + glissAmp = Math.pow(10,(dB/20.)); + //System.out.println(dB + " " + amp); + gliss.setGlissFader(glissAmp); + //gliss.setMasterfader(amp); + //score.clickAndPlay.amplitude.set(Rise.MASTER_AMP); + } + }); + } + return glissFader; + } + + /** + * This method initializes grainsFaderPanel + * + * @return javax.swing.JPanel + */ + private JPanel getGrainsFaderPanel() { + if (grainsFaderPanel == null) { + grainFaderLabel2 = new JLabel(); + grainFaderLabel2.setBounds(new Rectangle(0, 20, 65, 16)); + grainFaderLabel2.setText("Fader"); + grainFaderLabel = new JLabel(); + grainFaderLabel.setBounds(new Rectangle(0, 0, 74, 16)); + grainFaderLabel.setText("Grains"); + grainsFaderPanel = new JPanel(); + grainsFaderPanel.setLayout(null); + grainsFaderPanel.setBounds(new Rectangle(240, 10, 56, 271)); + grainsFaderPanel.add(getGrainFader(), null); + grainsFaderPanel.add(grainFaderLabel, null); + grainsFaderPanel.add(grainFaderLabel2, null); + } + return grainsFaderPanel; + } + + /** + * This method initializes grainFader + * + * @return javax.swing.JSlider + */ + private JSlider getGrainFader() { + if (grainFader == null) { + Hashtable labelAmpTable = new Hashtable(); + labelAmpTable.put( new Integer( 1189 ), new JLabel("5") ); + labelAmpTable.put( new Integer( 1000 ), new JLabel("0 dB") ); + labelAmpTable.put( new Integer( 841 ), new JLabel("-5") ); + labelAmpTable.put( new Integer( 707 ), new JLabel("-10") ); + labelAmpTable.put( new Integer( 500 ), new JLabel("-20") ); + labelAmpTable.put( new Integer( 250 ), new JLabel("-40") ); + labelAmpTable.put( new Integer( 0 ), new JLabel("-inf") ); + grainFader = new JSlider(JSlider.VERTICAL, 0, 1189, 0); + grainFader.setBounds(new Rectangle(-10, 40, 71, 201)); + grainFader.setLabelTable(labelAmpTable); + grainFader.setPaintLabels(true); + grainFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + double dB = Math.log(grainFader.getValue()/1000.)/Math.log(2)*20; + grainAmp = Math.pow(10,(dB/20.)); + //System.out.println(dB + " " + amp); + gliss.setGrainFader(grainAmp); + //gliss.setMasterfader(amp); + } + }); + } + return grainFader; + } + + /** + * This method initializes timePanel + * + * @return javax.swing.JPanel + */ + private JPanel getTimePanel() { + if (timePanel == null) { + timePanel = new JPanel(); + timePanel.setLayout(null); + timePanel.setBounds(new Rectangle(0, 10, 111, 61)); + timePanel.add(pieceDurLabel, null); + timePanel.add(minsecLabel, null); + timePanel.add(getMinTextField(), null); + timePanel.add(colonLabel, null); + timePanel.add(getSecTextField(), null); + } + return timePanel; + } + + /** + * This method initializes startTimePanel + * + * @return javax.swing.JPanel + */ + private JPanel getStartTimePanel() { + if (startTimePanel == null) { + colonStartLabel = new JLabel(); + colonStartLabel.setBounds(new Rectangle(35, 45, 10, 16)); + colonStartLabel.setText(":"); + minsecStartLabel = new JLabel(); + minsecStartLabel.setBounds(new Rectangle(0, 20, 107, 16)); + minsecStartLabel.setText("minutes:seconds"); + startTimeLabel = new JLabel(); + startTimeLabel.setBounds(new Rectangle(0, 0, 91, 16)); + startTimeLabel.setText("Start From:"); + startTimePanel = new JPanel(); + startTimePanel.setLayout(null); + startTimePanel.setBounds(new Rectangle(0, 140, 111, 61)); + startTimePanel.add(startTimeLabel, null); + startTimePanel.add(minsecStartLabel, null); + startTimePanel.add(getMinStartTextField(), null); + startTimePanel.add(colonStartLabel, null); + startTimePanel.add(getSecStartTextField(), null); + } + return startTimePanel; + } + + /** + * This method initializes minStartTextField + * + * @return javax.swing.JTextField + */ + private JTextField getMinStartTextField() { + if (minStartTextField == null) { + minStartTextField = new JTextField(); + minStartTextField.setBounds(new Rectangle(0, 40, 31, 22)); + minStartTextField.setText("0"); + minStartTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.START_TIME = 60 * Integer.valueOf(minStartTextField.getText()).intValue() + Integer.valueOf(secStartTextField.getText()).intValue(); + Rise.SCROLLBAR.xPos = (Rise.START_TIME/Rise.TOTAL_DUR) * Rise.SCROLLBAR_WIDTH; + Rise.SCROLLBAR.repaint(); + } + }); + } + return minStartTextField; + } + + /** + * This method initializes secStartTextField + * + * @return javax.swing.JTextField + */ + private JTextField getSecStartTextField() { + if (secStartTextField == null) { + secStartTextField = new JTextField(); + secStartTextField.setBounds(new Rectangle(45, 40, 31, 21)); + secStartTextField.setText("00"); + secStartTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.START_TIME = 60 * Integer.valueOf(minStartTextField.getText()).intValue() + Integer.valueOf(secStartTextField.getText()).intValue(); + Rise.SCROLLBAR.xPos = (Rise.START_TIME/Rise.TOTAL_DUR) * Rise.SCROLLBAR_WIDTH; + Rise.SCROLLBAR.repaint(); + } + }); + } + return secStartTextField; + } + + /** + * This method initializes fadePanel + * + * @return javax.swing.JPanel + */ + private JPanel getFadePanel() { + if (fadePanel == null) { + colonStartLabel1 = new JLabel(); + colonStartLabel1.setBounds(new Rectangle(35, 45, 10, 16)); + colonStartLabel1.setText(":"); + minsecFadeLabel = new JLabel(); + minsecFadeLabel.setBounds(new Rectangle(0, 20, 107, 16)); + minsecFadeLabel.setText("minutes:seconds"); + fadeOutLabe = new JLabel(); + fadeOutLabe.setBounds(new Rectangle(0, 0, 91, 16)); + fadeOutLabe.setText("Fade Out"); + fadePanel = new JPanel(); + fadePanel.setLayout(null); + fadePanel.setBounds(new Rectangle(0, 75, 111, 61)); + fadePanel.add(fadeOutLabe, null); + fadePanel.add(minsecFadeLabel, null); + fadePanel.add(getMinFadeField(), null); + fadePanel.add(colonStartLabel1, null); + fadePanel.add(getSecFadeField(), null); + } + return fadePanel; + } + + /** + * This method initializes minFadeField + * + * @return javax.swing.JTextField + */ + private JTextField getMinFadeField() { + if (minFadeField == null) { + minFadeField = new JTextField(); + minFadeField.setBounds(new Rectangle(0, 40, 31, 22)); + minFadeField.setText("2"); + minFadeField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.FADE_DUR = 60 * Integer.valueOf(minFadeField.getText()).intValue() + Integer.valueOf(secFadeField.getText()).intValue(); + } + }); + } + return minFadeField; + } + + /** + * This method initializes secFadeField + * + * @return javax.swing.JTextField + */ + private JTextField getSecFadeField() { + if (secFadeField == null) { + secFadeField = new JTextField(); + secFadeField.setBounds(new Rectangle(45, 40, 31, 21)); + secFadeField.setText("30"); + secFadeField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + Rise.FADE_DUR = 60 * Integer.valueOf(minFadeField.getText()).intValue() + Integer.valueOf(secFadeField.getText()).intValue(); + } + }); + + } + return secFadeField; + } + + /** + * This method initializes cuePanel + * + * @return javax.swing.JPanel + */ + private JPanel getCuePanel() { + if (cuePanel == null) { + Rise.CUE_PANEL = new CuePanel(); + cuePanel = Rise.CUE_PANEL; + cuePanel.setLayout(null); + cuePanel.setBackground(Color.WHITE); + cuePanel.setBounds(new Rectangle(315, 15, 121, 76)); + } + return cuePanel; + } + + /** + * This method initializes clickFaderPanel + * + * @return javax.swing.JPanel + */ + private JPanel getClickFaderPanel() { + if (clickFaderPanel == null) { + grainFaderLabel21 = new JLabel(); + grainFaderLabel21.setBounds(new Rectangle(0, 20, 65, 16)); + grainFaderLabel21.setText("Fader"); + clickFaderLabel = new JLabel(); + clickFaderLabel.setBounds(new Rectangle(0, 0, 74, 16)); + clickFaderLabel.setText("Click"); + clickFaderPanel = new JPanel(); + clickFaderPanel.setLayout(null); + clickFaderPanel.setBounds(new Rectangle(300, 10, 61, 269)); + clickFaderPanel.add(getClickFader(), null); + clickFaderPanel.add(clickFaderLabel, null); + clickFaderPanel.add(grainFaderLabel21, null); + } + return clickFaderPanel; + } + + /** + * This method initializes clickFader + * + * @return javax.swing.JSlider + */ + private JSlider getClickFader() { + if (clickFader == null) { + Hashtable labelAmpTable = new Hashtable(); + labelAmpTable.put( new Integer( 1189 ), new JLabel("5") ); + labelAmpTable.put( new Integer( 1000 ), new JLabel("0 dB") ); + labelAmpTable.put( new Integer( 841 ), new JLabel("-5") ); + labelAmpTable.put( new Integer( 707 ), new JLabel("-10") ); + labelAmpTable.put( new Integer( 500 ), new JLabel("-20") ); + labelAmpTable.put( new Integer( 250 ), new JLabel("-40") ); + labelAmpTable.put( new Integer( 0 ), new JLabel("-inf") ); + + clickFader = new JSlider(JSlider.VERTICAL, 0, 1189, 1000); + clickFader.setBounds(new Rectangle(-10, 40, 71, 201)); + clickFader.setLabelTable(labelAmpTable); + clickFader.setPaintLabels(true); + clickFader.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + double dB = Math.log(clickFader.getValue()/1000.)/Math.log(2)*20; + clickAmp = Math.pow(10,(dB/20.)); + //System.out.println(dB + " " + amp); + score.setClickFader(clickAmp); + //gliss.setMasterfader(amp); + } + }); + } + return clickFader; + } + +} // @jve:decl-index=0:visual-constraint="15,12" diff --git a/main/WaveForm.java b/main/WaveForm.java new file mode 100644 index 0000000..d5ef078 --- /dev/null +++ b/main/WaveForm.java @@ -0,0 +1,118 @@ +package main; + +import com.softsynth.jsyn.*; + +public class WaveForm extends SynthNote { + + EnvelopePlayer envPlayer; + SynthEnvelope env; + SynthInput envRate; + SynthInput spectrum; + int noOsc = 5; + //Set random phase + SineOscillator[] oscBank = new SineOscillator[noOsc]; + BusWriter[] busWriter = new BusWriter[noOsc]; + MultiplyUnit[] multAmp = new MultiplyUnit[noOsc]; + MultiplyUnit[] multFreq = new MultiplyUnit[noOsc]; + LineOut lineOut; + BusReader busReader; + SynthDistributor freqDist = new SynthDistributor("frequency"); + SynthDistributor spectrumDist = new SynthDistributor("spectrum"); + double[] envData; + SynthEnvelope glissEnv; + + public WaveForm() { + super(); + add(envPlayer = new EnvelopePlayer()); + add(busReader = new BusReader()); + + add(busWriter[0] = new BusWriter()); + add(oscBank[0] = new SineOscillator()); + add(lineOut = new LineOut()); + + double randomPhase = Math.random(); + oscBank[0].phase.set(randomPhase); + + oscBank[0].frequency.connect(freqDist); + oscBank[0].output.connect(busWriter[0].input); + busWriter[0].busOutput.connect(busReader.busInput); + + + for(int i = 1; i < noOsc; i++){ + add(busWriter[i] = new BusWriter()); + add(oscBank[i] = new SineOscillator()); + add(multFreq[i] = new MultiplyUnit()); + add(multAmp[i] = new MultiplyUnit()); + multFreq[i].inputA.set(i+1.); + multFreq[i].inputB.connect(freqDist); + multFreq[i].output.connect(oscBank[i].frequency); + multAmp[i].inputA.set(1./(i+1.)); + multAmp[i].inputB.connect(spectrumDist); + multAmp[i].output.connect(oscBank[i].amplitude); + oscBank[i].output.connect(busWriter[i].input); + busWriter[i].busOutput.connect(busReader.busInput); + envPlayer.output.connect(busReader.amplitude); + + oscBank[i].phase.set(randomPhase); + } + + addPort(amplitude = envPlayer.amplitude); + addPort(frequency = freqDist); + addPort(envRate = envPlayer.rate); + addPort(output = busReader.output); + addPort(spectrum = spectrumDist); + + //double[] envData = { .5, 1.0, .5, 0.0 }; + envData = new double[42]; + for (int i = 0; i < 21; i++) { + envData[i*2] = 1/20.; + envData[i*2+1] = (Math.cos(2*(1/20.*i)*Math.PI+Math.PI)+1)/2; + //System.out.println(envData[i*2] + " " + envData[i*2+1]); + } + env = new SynthEnvelope(envData); + + frequency.set(400); + amplitude.set(1.); + spectrum.set(0); + } + + public void grainOn(int t, double f, double a) { + start(t); + frequency.set(t, f); + amplitude.set(t, a); + //spectrum.set(arg0); + envPlayer.envelopePort.clear(t); + envPlayer.envelopePort.queue(env,0,env.getNumFrames(),Synth.FLAG_AUTO_STOP); + //envPlayer.envelopePort.queueLoop(t, env, 1, 1); + + } + + public void clickOn(int t, double f, double a) { + + start(t); + frequency.set(t, f); + amplitude.set(t, a); + //spectrum.set(arg0); + envPlayer.envelopePort.clear(t); + envPlayer.envelopePort.queue(env,0,env.getNumFrames(),Synth.FLAG_AUTO_STOP); + //envPlayer.envelopePort.queueLoop(t, env, 1, 1); + + } + + public void glissOn(int t, double f, double a , double[] eD) { + glissEnv = new SynthEnvelope(eD); + start(t); + frequency.set(t, f); + amplitude.set(t, a); + envPlayer.envelopePort.clear(t); + envPlayer.envelopePort.queue(t,glissEnv,0,glissEnv.getNumFrames(), Synth.FLAG_AUTO_STOP); + + } + + + public void glissOff(int t, double r) { + envRate.set(t, r); + envPlayer.envelopePort.clear(t); + envPlayer.envelopePort.queue(t, glissEnv, glissEnv.getNumFrames() - 1, 1, Synth.FLAG_AUTO_STOP); + } +}