├── WaveWatch ├── voltage.tsv ├── data │ └── splash.jpg ├── WaveWatch.pde ├── control.pde ├── minim.pde └── display.pde ├── WaveMake ├── sketch.properties ├── data │ └── splash.jpg ├── minim.pde ├── WaveMake.pde ├── waveform.pde ├── display.pde └── control.pde └── README.md /WaveWatch/voltage.tsv: -------------------------------------------------------------------------------- 1 | ChA 3.3 2 | ChB 3.3 3 | vp1 1.0 4 | vp2 1.0 5 | -------------------------------------------------------------------------------- /WaveMake/sketch.properties: -------------------------------------------------------------------------------- 1 | mode.id=processing.mode.java.JavaMode 2 | mode=Java 3 | -------------------------------------------------------------------------------- /WaveMake/data/splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/D4p0up/WaveWatch/HEAD/WaveMake/data/splash.jpg -------------------------------------------------------------------------------- /WaveWatch/data/splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/D4p0up/WaveWatch/HEAD/WaveWatch/data/splash.jpg -------------------------------------------------------------------------------- /WaveMake/minim.pde: -------------------------------------------------------------------------------- 1 | class WaveformRenderer implements AudioSignal 2 | { 3 | 4 | WaveformRenderer() 5 | { 6 | 7 | } 8 | 9 | synchronized void generate(float[] samp) 10 | { 11 | generate(samp,samp); 12 | } 13 | 14 | synchronized void generate(float[] sampL,float[] sampR) 15 | { 16 | for (int i=0; i<512; i=i+1) { 17 | if (wA_on) sampL[i]=-amp_A*wave_A[int(phase_acc_A)]; else sampL[i]=0; 18 | phase_acc_A=(phase_acc_A+delta_acc_A)%2048; 19 | } 20 | for (int i=0; i<512; i=i+1) { 21 | if (wB_on) sampR[i]=-amp_B*wave_B[int(phase_acc_B)]; else sampR[i]=0; 22 | phase_acc_B=(phase_acc_B+delta_acc_B)%2048; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WaveWatch & WaveMake 2 | ====================== 3 | Soundcard Oscilloscope for Processing v1.3 4 | Soundcard Waveform Generator v1.0 5 | 6 | Project Homepage: http://www.banson.fr/wiki/doku.php?id=wavewatch 7 | 8 | 1.3 : MMI revamp and resolution increase 9 | 10 | - Horizontal display size doubled, display resolution is now 1024*480 pixels 11 | - Bottom menu re-organised, trigger and channel buttons were put together 12 | - Measurement mode display revised to allow live display of deltas during measurement 13 | - Fixed tsv file saving error that stored vp2 with vp1 label instead of vp2 14 | - Several bug fixes at display level, including dragging trigger point 15 | 16 | 1.2 : Major update - Triggering method and sample handling re-forged to handle multi point triggering, trigger level is now set by clicking right on the screen 17 | 18 | 1.1 : added "voltage.tsv" to store voltage calibration data from one session to another 19 | 20 | 1.0 : inital release 21 | -------------------------------------------------------------------------------- /WaveMake/WaveMake.pde: -------------------------------------------------------------------------------- 1 | import ddf.minim.analysis.*; 2 | import ddf.minim.*; 3 | import ddf.minim.signals.*; 4 | import static javax.swing.JOptionPane.*; 5 | 6 | /*Waveform Buffer*/ 7 | float[] wave_A; 8 | float[] wave_B; 9 | int waveform_A=0; 10 | int waveform_B=0; 11 | float amp_A=1; 12 | float amp_B=1; 13 | float freq_A=440; 14 | int ext_A=1; 15 | float freq_B=220; 16 | int ext_B=0; 17 | float delta_acc_A=2048*(freq_A)/44100; 18 | float delta_acc_B=2048*(freq_B)/44100; 19 | float phase_acc_A=0; 20 | float phase_acc_B=0; 21 | 22 | boolean wA_on=false; 23 | boolean wB_on=false; 24 | 25 | // Splash 26 | PImage splash; 27 | int dfade=235; 28 | 29 | // Audio 30 | Minim minim; 31 | AudioOutput out; 32 | WaveformRenderer waveform; 33 | 34 | void setup() { 35 | wave_A = new float[2048]; 36 | setSin(wave_A); 37 | wave_B = new float[2048]; 38 | setSin(wave_B); 39 | size(266, 256); 40 | minim = new Minim(this); 41 | out = minim.getLineOut(Minim.STEREO, 512, 44100); 42 | waveform = new WaveformRenderer(); 43 | out.addSignal( waveform ); 44 | splash = loadImage("data/splash.jpg"); 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /WaveMake/waveform.pde: -------------------------------------------------------------------------------- 1 | /* 2 | =================================================== 3 | _ __ __ ___ __ 4 | | | /| / /__ __ _____ / |/ /__ _/ /_____ 5 | | |/ |/ / _ `/ |/ / -_) /|_/ / _ `/ '_/ -_) 6 | |__/|__/\_,_/|___/\__/_/ /_/\_,_/_/\_\\__/ 7 | 8 | Open Source Soundcard Waveform generator by Banson 9 | Background image by Humusak 10 | V1.0 11 | 12 | http://www.banson.fr/wiki/doku.php?id=wavewatch 13 | 14 | ================================================= 15 | Provided under the following license: by-nc-sa 16 | http://creativecommons.org/licenses/by-nc-sa/4.0/ 17 | ================================================= 18 | 19 | */ 20 | 21 | void setSin(float[] buffer) { 22 | for (int i=0; i<2048; i=i+1) { 23 | buffer[i]=sin(2*3.1415927*i/2048); 24 | } 25 | } 26 | 27 | void setTri(float[] buffer) { 28 | int j=0; 29 | for (int i=0; i<512; i=i+1) { 30 | buffer[i]=float(i)/512; 31 | j=j+1; 32 | } 33 | for (int i=0; i<1024; i=i+1) { 34 | buffer[j]=(512-float(i))/512; 35 | j=j+1; 36 | } 37 | for (int i=0; i<512; i=i+1) { 38 | buffer[j]=-(512-float(i))/512; 39 | j=j+1; 40 | } 41 | } 42 | 43 | void setSaw(float[] buffer) { 44 | for (int i=0; i<2048; i=i+1) 45 | buffer[i]=float(i)/1024-1; 46 | } 47 | 48 | void setSqu(float[] buffer) { 49 | for (int i=0; i<2048; i=i+1){ 50 | if (i>1024) buffer[i]=-1; else buffer[i]=1; 51 | } 52 | } 53 | 54 | void setDis(float[] buffer) { 55 | for (int i=0; i<2048; i=i+1){ 56 | buffer[i]=2.3*(1/(1+float(i)/400))-1.3; 57 | } 58 | } 59 | 60 | void setRct(float[] buffer) { 61 | for (int i=0; i<2048; i=i+1) { 62 | buffer[i]=2*sin(2*3.1415927*i/4096)-1; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /WaveWatch/WaveWatch.pde: -------------------------------------------------------------------------------- 1 | /* 2 | ================================================== 3 | _ __ _ __ __ __ 4 | | | /| / /__ __ _____| | /| / /__ _/ /_____/ / 5 | | |/ |/ / _ `/ |/ / -_) |/ |/ / _ `/ __/ __/ _ \ 6 | |__/|__/\_,_/|___/\__/|__/|__/\_,_/\__/\__/_//_/ 7 | 8 | Open Source Souncard Oscilloscope by Banson 9 | Background image by Humusak 10 | V1.3 11 | 12 | http://www.banson.fr/wiki/doku.php?id=wavewatch 13 | 14 | ================================================= 15 | Provided under the following license: by-nc-sa 16 | http://creativecommons.org/licenses/by-nc-sa/4.0/ 17 | ================================================= 18 | 19 | Basic Controls : 20 | 'u' and 'j' : Turn Left & Right Channel ON and OFF 21 | 'e' and 'd' : Left Channel Gain 22 | 'r' and 'f' : Right CHannel Gain 23 | 'c' and 'v' : Time Base adjusting 24 | mouse click on leftmost or rightmost points of the window moves Channel origin 25 | 26 | Advanced Controls : 27 | 't' and 'g' : Trigger level adjustment 28 | 'h' : Toggles triggering from channel A to channel B 29 | 'b' : Activates measurement cursors 30 | 'y' : Toggles between Auto and Single mode 31 | spacebar : Pause and Resume 32 | 33 | And of course : 34 | 'o' : Exit Scope 35 | 36 | */ 37 | 38 | import ddf.minim.analysis.*; 39 | import ddf.minim.*; 40 | import ddf.minim.signals.*; 41 | import static javax.swing.JOptionPane.*; 42 | 43 | Minim minim; 44 | AudioInput in; 45 | 46 | // Interface Voltage Tuning 47 | float linelevel1; 48 | float linelevel2; 49 | float vp1; 50 | float vp2; 51 | String[] lines; 52 | PrintWriter output; 53 | 54 | // Images 55 | PImage splash; 56 | 57 | // Status and Trig 58 | boolean trig_en = false; 59 | boolean trig_dir = true; 60 | boolean trigged = false; 61 | boolean stopped = false; 62 | boolean once = false; 63 | float triglevel = 0.000; 64 | int trigdelta=256; 65 | boolean trigin = false; 66 | boolean alignment=false; 67 | int started=0; 68 | 69 | // Measurement 70 | int mesure=0; 71 | int m1X; 72 | int m1Y; 73 | int m2X; 74 | int m2Y; 75 | 76 | int dfade=235; 77 | 78 | // Gain and Timebase 79 | float gain1 = 200; 80 | float gain2 = 200; 81 | 82 | float[] tbase_list = { 83 | 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500 84 | }; 85 | int i_tbase = 4; 86 | float tbase = tbase_list[i_tbase]*44100/40000; 87 | 88 | // Frequency Calculation 89 | float freq1 = 0; 90 | //boolean freqval1=false; 91 | float freq2 = 0; 92 | //boolean freqval2=false; 93 | 94 | boolean monostereo=false; 95 | 96 | // Signal Left 97 | float[] display11; 98 | float[] l_buffer; 99 | boolean Ldisplay=true; 100 | // Signal Right 101 | float[] display21; 102 | float[] r_buffer; 103 | boolean Rdisplay=true; 104 | 105 | float display=1; 106 | 107 | float I=0; 108 | float J=0; 109 | float K=0; 110 | 111 | int offset1=240; 112 | int offset2=240; 113 | 114 | // Audio Buffer Size 115 | int A_Buffer=512; 116 | // Data buffer size 117 | int D_Buffer=4096; 118 | // Windows width and height 119 | int W_Width=1024; 120 | int W_Height=480; 121 | 122 | WaveformRenderer waveform; 123 | 124 | void setup() 125 | { 126 | size(1024, 500); 127 | 128 | splash = loadImage("data/splash.jpg"); 129 | 130 | minim = new Minim(this); 131 | in = minim.getLineIn(Minim.STEREO, A_Buffer, 44100); 132 | 133 | waveform = new WaveformRenderer(); 134 | in.addListener( waveform ); 135 | 136 | display11 = new float[W_Width]; 137 | display21 = new float[W_Width]; 138 | l_buffer = new float[D_Buffer]; 139 | r_buffer = new float[D_Buffer]; 140 | 141 | // Load Tuning Data 142 | // Load Data 143 | lines = loadStrings("voltage.tsv"); 144 | String[] pieces = split(lines[0], TAB); 145 | linelevel1 = float(pieces[1]); 146 | pieces = split(lines[1], TAB); 147 | linelevel2 = float(pieces[1]); 148 | pieces = split(lines[2], TAB); 149 | vp1 = float(pieces[1]); 150 | pieces = split(lines[3], TAB); 151 | vp2 = float(pieces[1]); 152 | } -------------------------------------------------------------------------------- /WaveMake/display.pde: -------------------------------------------------------------------------------- 1 | void draw() { 2 | background(0); 3 | strokeJoin(ROUND); 4 | strokeWeight(2); 5 | 6 | if (dfade>0) dfade=dfade-1; 7 | tint(255, 48+dfade); 8 | image(splash, 0, 0); 9 | 10 | // Waveforms Horizontal line 11 | stroke(96,32,32); 12 | line(0,64,128,64); 13 | stroke(32,96,32); 14 | line(0,192,128,192); 15 | 16 | // Channel A waveform (Left) 17 | if (wA_on) stroke(255,128,128); else stroke(148,128,128); 18 | for(int i=0;i<128;i=i+1){ 19 | line(i,64-56*wave_A[16*i]*amp_A,i+1,64-56*wave_A[16*i+15]*amp_A); 20 | } 21 | stroke(255,128,128); 22 | 23 | // Channel A Level 24 | line(128,128-amp_A*120,148,128-amp_A*120); 25 | // Channel A Frequency 26 | if (ext_A==0) line(248,128-freq_A/2,268,128-freq_A/2); 27 | if (ext_A==1) line(248,128-freq_A/20,268,128-freq_A/20); 28 | if (ext_A==2) line(248,128-freq_A/200,268,128-freq_A/200); 29 | 30 | // Channel B waveform (right) 31 | if (wB_on) stroke(128,255,128); else stroke(128,148,128); 32 | for(int i=0;i<128;i=i+1){ 33 | line(i,192-56*wave_B[16*i]*amp_B,i+1,192-56*wave_B[16*i+15]*amp_B); 34 | } 35 | stroke(128,255,128); 36 | 37 | // Channel B Level 38 | line(128,256-amp_B*120,148,256-amp_B*120); 39 | // Channel B Frequency 40 | if (ext_B==0) line(248,256-freq_B/2,268,256-freq_B/2); 41 | if (ext_B==1) line(248,256-freq_B/20,268,256-freq_B/20); 42 | if (ext_B==2) line(248,256-freq_B/200,268,256-freq_B/200); 43 | 44 | // Horizontal and vertical GUI Lines 45 | stroke(128,128,128); 46 | line(0,128,512,128); 47 | line(128,0,128,256); 48 | line(148,0,148,256); 49 | line(248,0,248,256); 50 | line(268,0,268,256); 51 | 52 | // Waveform A Displays 53 | fill(255,128,128); 54 | stroke(128,128,128); 55 | line(148,20,248,20); 56 | line(148,40,248,40); 57 | text("A:"+amp_A,154,14); 58 | text("F:"+freq_A+"Hz",154,35); 59 | 60 | // Waveform A Freq Range 61 | line(148,60,248,60); 62 | fill(128,128,128); 63 | if (ext_A==0) fill(255,128,128); 64 | text("220",156,55); 65 | if (ext_A==0) fill(128,128,128); 66 | line(182,60,182,40); 67 | if (ext_A==1) fill(255,128,128); 68 | text("2.2k",188,55); 69 | if (ext_A==1) fill(128,128,128); 70 | line(215,60,215,40); 71 | if (ext_A==2) fill(255,128,128); 72 | text("22k",223,55); 73 | 74 | // Waveform B Displays 75 | fill(128,255,128); 76 | stroke(128,128,128); 77 | line(148,148,248,148); 78 | line(148,168,248,168); 79 | text("A:"+amp_B,154,14+128); 80 | text("F:"+freq_B+"Hz",154,35+128); 81 | 82 | // Waveform B Freq Range 83 | line(148,188,248,188); 84 | fill(128,128,128); 85 | if (ext_B==0) fill(128,255,128); 86 | text("220",156,55+128); 87 | if (ext_B==0) fill(128,128,128); 88 | line(182,188,182,168); 89 | if (ext_B==1) fill(128,255,128); 90 | text("2.2k",188,55+128); 91 | if (ext_B==1) fill(128,128,128); 92 | line(215,188,215,168); 93 | if (ext_B==2) fill(128,255,128); 94 | text("22k",223,55+128); 95 | 96 | // Waveform A Selection 97 | fill(255,128,128); 98 | line(148,80,248,80); 99 | line(182,60,182,80); 100 | line(215,60,215,80); 101 | if(waveform_A==0) fill(255,128,128); 102 | else fill(128,128,128); 103 | text("SIN",156,75); 104 | if(waveform_A==1) fill(255,128,128); 105 | else fill(128,128,128); 106 | text("TRI",189,75); 107 | if(waveform_A==2) fill(255,128,128); 108 | else fill(128,128,128); 109 | text("SAW",218,75); 110 | line(148,100,248,100); 111 | line(182,100,182,80); 112 | line(215,100,215,80); 113 | if(waveform_A==3) fill(255,128,128); 114 | else fill(128,128,128); 115 | text("RCT",153,95); 116 | if(waveform_A==4) fill(255,128,128); 117 | else fill(128,128,128); 118 | text("SQU",186,95); 119 | if(waveform_A==5) fill(255,128,128); 120 | else fill(128,128,128); 121 | text("DIS",223,95); 122 | 123 | // Waveform B Selection 124 | fill(128,255,128); 125 | line(148,208,248,208); 126 | line(182,188,182,208); 127 | line(215,188,215,208); 128 | if(waveform_B==0) fill(128,255,128); 129 | else fill(128,128,128); 130 | text("SIN",156,75+128); 131 | if(waveform_B==1) fill(128,255,128); 132 | else fill(128,128,128); 133 | text("TRI",189,75+128); 134 | if(waveform_B==2) fill(128,255,128); 135 | else fill(128,128,128); 136 | text("SAW",218,75+128); 137 | line(148,228,248,228); 138 | line(182,228,182,208); 139 | line(215,228,215,208); 140 | if(waveform_B==3) fill(128,1255,128); 141 | else fill(128,128,128); 142 | text("RCT",153,95+128); 143 | if(waveform_B==4) fill(128,255,128); 144 | else fill(128,128,128); 145 | text("SQU",186,95+128); 146 | if(waveform_B==5) fill(128,255,128); 147 | else fill(128,128,128); 148 | text("DIS",223,95+128); 149 | } 150 | -------------------------------------------------------------------------------- /WaveMake/control.pde: -------------------------------------------------------------------------------- 1 | void mousePressed() 2 | { 3 | // Channel activation 4 | if (mouseX<128) { 5 | if (mouseY<128) { 6 | if (wA_on) wA_on=false; 7 | else wA_on=true; 8 | } else { 9 | if (wB_on) wB_on=false; 10 | else wB_on=true; 11 | } 12 | } 13 | 14 | // Amplitude 15 | if ((mouseX>128)&&(mouseX<148)) { 16 | if (mouseY<128) { 17 | amp_A=(128-float(mouseY))/120; 18 | } else { 19 | amp_B=(256-float(mouseY))/120; 20 | } 21 | if (amp_A>1) amp_A=1; 22 | if (amp_A<0) amp_A=0; 23 | if (amp_B>1) amp_B=1; 24 | if (amp_B<0) amp_B=0; 25 | } 26 | //Fréquence 27 | if ((mouseX>248)&&(mouseX<268)) { 28 | if (mouseY<128) { 29 | if (ext_A==0) { 30 | freq_A=(128-mouseY)*2; 31 | if (freq_A>220) freq_A=220; 32 | if (freq_A<2) freq_A=2; 33 | } 34 | if (ext_A==1) { 35 | freq_A=(128-mouseY)*20; 36 | if (freq_A>2205) freq_A=2205; 37 | if (freq_A<20) freq_A=20; 38 | } 39 | if (ext_A==2) { 40 | freq_A=(128-mouseY)*200; 41 | if (freq_A>22050) freq_A=22050; 42 | if (freq_A<200) freq_A=200; 43 | } 44 | delta_acc_A=2048*(freq_A)/44100; 45 | } 46 | if (mouseY>128) { 47 | if (ext_B==0) { 48 | freq_B=(256-mouseY)*2; 49 | if (freq_B>220) freq_B=220; 50 | if (freq_B<2) freq_B=2; 51 | } 52 | if (ext_B==1) { 53 | freq_B=(256-mouseY)*20; 54 | if (freq_B>2205) freq_B=2205; 55 | if (freq_B<20) freq_B=20; 56 | } 57 | if (ext_B==2) { 58 | freq_B=(256-mouseY)*200; 59 | if (freq_B>22050) freq_B=22050; 60 | if (freq_B<200) freq_B=200; 61 | } 62 | delta_acc_B=2048*(freq_B)/44100; 63 | } 64 | } 65 | 66 | // Freq Range A 67 | if ((mouseY>40)&&(mouseY<60)) { 68 | if ((mouseX>148)&&(mouseX<182)) ext_A=0; 69 | if ((mouseX>182)&&(mouseX<215)) ext_A=1; 70 | if ((mouseX>215)&&(mouseX<248)) ext_A=2; 71 | } 72 | 73 | // Waveform A 74 | if ((mouseY>60)&&(mouseY<80)) { 75 | if ((mouseX>148)&&(mouseX<182)) { 76 | waveform_A=0; 77 | setSin(wave_A); 78 | } 79 | if ((mouseX>182)&&(mouseX<215)) { 80 | waveform_A=1; 81 | setTri(wave_A); 82 | } 83 | if ((mouseX>215)&&(mouseX<248)) { 84 | waveform_A=2; 85 | setSaw(wave_A); 86 | } 87 | } 88 | if ((mouseY>80)&&(mouseY<100)) { 89 | if ((mouseX>148)&&(mouseX<182)) { 90 | waveform_A=3; 91 | setRct(wave_A); 92 | } 93 | if ((mouseX>182)&&(mouseX<215)) { 94 | waveform_A=4; 95 | setSqu(wave_A); 96 | } 97 | if ((mouseX>215)&&(mouseX<248)) { 98 | waveform_A=5; 99 | setDis(wave_A); 100 | } 101 | } 102 | 103 | // Waveform B 104 | if ((mouseY>60+128)&&(mouseY<80+128)) { 105 | if ((mouseX>148)&&(mouseX<182)) { 106 | waveform_B=0; 107 | setSin(wave_B); 108 | } 109 | if ((mouseX>182)&&(mouseX<215)) { 110 | waveform_B=1; 111 | setTri(wave_B); 112 | } 113 | if ((mouseX>215)&&(mouseX<248)) { 114 | waveform_B=2; 115 | setSaw(wave_B); 116 | } 117 | } 118 | if ((mouseY>208)&&(mouseY<228)) { 119 | if ((mouseX>148)&&(mouseX<182)) { 120 | waveform_B=3; 121 | setRct(wave_B); 122 | } 123 | if ((mouseX>182)&&(mouseX<215)) { 124 | waveform_B=4; 125 | setSqu(wave_B); 126 | } 127 | if ((mouseX>215)&&(mouseX<248)) { 128 | waveform_B=5; 129 | setDis(wave_B); 130 | } 131 | } 132 | 133 | // Freq Range B 134 | if ((mouseY>40+128)&&(mouseY<60+128)) { 135 | if ((mouseX>148)&&(mouseX<182)) ext_B=0; 136 | if ((mouseX>182)&&(mouseX<215)) ext_B=1; 137 | if ((mouseX>215)&&(mouseX<248)) ext_B=2; 138 | } 139 | } 140 | 141 | void mouseDragged() 142 | { 143 | if ((mouseX>128)&&(mouseX<148)) { 144 | if (mouseY<128) { 145 | amp_A=(128-float(mouseY))/120; 146 | } else { 147 | amp_B=(256-float(mouseY))/120; 148 | } 149 | if (amp_A>1) amp_A=1; 150 | if (amp_A<0) amp_A=0; 151 | if (amp_B>1) amp_B=1; 152 | if (amp_B<0) amp_B=0; 153 | } 154 | 155 | //Fréquence 156 | if ((mouseX>248)&&(mouseX<268)) { 157 | if (mouseY<128) { 158 | if (ext_B==0) { 159 | freq_A=(256-mouseY)*2; 160 | if (freq_A>220) freq_A=220; 161 | if (freq_A<2) freq_A=2; 162 | } 163 | if (ext_A==0) { 164 | freq_A=(128-mouseY)*2; 165 | if (freq_A>220) freq_A=220; 166 | if (freq_A<2) freq_A=2; 167 | } 168 | if (ext_A==1) { 169 | freq_A=(128-mouseY)*20; 170 | if (freq_A>2205) freq_A=2205; 171 | if (freq_A<20) freq_A=20; 172 | } 173 | if (ext_A==2) { 174 | freq_A=(128-mouseY)*200; 175 | if (freq_A>22050) freq_A=22050; 176 | if (freq_A<200) freq_A=200; 177 | } 178 | delta_acc_A=2048*(freq_A)/44100; 179 | } 180 | if (mouseY>128) { 181 | if (ext_B==0) { 182 | freq_B=(256-mouseY)*2; 183 | if (freq_B>220) freq_B=220; 184 | if (freq_B<2) freq_B=2; 185 | } 186 | if (ext_B==1) { 187 | freq_B=(256-mouseY)*20; 188 | if (freq_B>2205) freq_B=2205; 189 | if (freq_B<20) freq_B=20; 190 | } 191 | if (ext_B==2) { 192 | freq_B=(256-mouseY)*200; 193 | if (freq_B>22050) freq_B=22050; 194 | if (freq_B<200) freq_B=200; 195 | } 196 | delta_acc_B=2048*(freq_B)/44100; 197 | } 198 | } 199 | } 200 | 201 | void keyPressed() 202 | { 203 | switch(key) { 204 | case 'e': 205 | if (wA_on) wA_on=false; 206 | else wA_on=true; 207 | break; 208 | case 'd': 209 | if (wB_on) wB_on=false; 210 | else wB_on=true; 211 | break; 212 | case 'o': 213 | exit(); 214 | break; 215 | } 216 | } 217 | 218 | -------------------------------------------------------------------------------- /WaveWatch/control.pde: -------------------------------------------------------------------------------- 1 | void mouseDragged() 2 | { 3 | if ((mouseX<20)&&(mouseY<450)) { 4 | offset1=mouseY; 5 | } 6 | if ((mouseX>1000)&&(mouseY<450)) { 7 | offset2=mouseY; 8 | } 9 | if (offset1<5) offset1=5; 10 | if (offset1>450) offset1=450; 11 | if (offset2<5) offset2=5; 12 | if (offset2>450) offset2=450; 13 | 14 | if ((mouseX>21)&&(mouseX<1000)&&(mouseY>21)&&(mouseY<459)&&(mesure==0)&&trig_en) { 15 | if (!trigin) { 16 | triglevel=(float(mouseY)-offset1)*(-1)/gain1; 17 | } else { 18 | triglevel=(float(mouseY)-offset2)*(-1)/gain2; 19 | } 20 | trigdelta=mouseX; 21 | } 22 | } 23 | 24 | void mousePressed() 25 | { 26 | if ((mouseX<20)&&(mouseY<450)) { 27 | offset1=mouseY; 28 | } 29 | if ((mouseX>1000)&&(mouseY<450)) { 30 | offset2=mouseY; 31 | } 32 | 33 | if (offset1<5) offset1=5; 34 | if (offset1>450) offset1=450; 35 | if (offset2<5) offset2=5; 36 | if (offset2>450) offset2=450; 37 | 38 | 39 | switch (mesure) { 40 | case 0: 41 | break; 42 | 43 | case 1: 44 | m1X=mouseX; 45 | m1Y=mouseY; 46 | mesure=2; 47 | break; 48 | 49 | case 2: 50 | m2X=mouseX; 51 | m2Y=mouseY; 52 | mesure=3; 53 | break; 54 | } 55 | 56 | 57 | if (mouseY>(W_Height)) { 58 | if ((mouseX>32)&&(mouseX<72)) { 59 | if (Ldisplay) Ldisplay=false; 60 | else Ldisplay=true; 61 | } 62 | if ((mouseX>192)&&(mouseX<236)) { 63 | if (Rdisplay) Rdisplay=false; 64 | else Rdisplay=true; 65 | } 66 | if ((mouseX>632)&&(mouseX<672)) { 67 | if (trigin==false) trigin=true; 68 | else trigin=false; 69 | } 70 | if ((mouseX>72)&&(mouseX<112)) { 71 | gain1 = gain1 * 1.5; 72 | if (gain1>10000)gain1=10000; 73 | } 74 | if ((mouseX>112)&&(mouseX<152)) { 75 | gain1 = gain1 / 1.5; 76 | if (gain1<1) gain1=1; 77 | } 78 | if ((mouseX>232)&&(mouseX<272)) { 79 | gain2 = gain2 * 1.5; 80 | if (gain2>10000)gain2=10000; 81 | } 82 | if ((mouseX>272)&&(mouseX<312)) { 83 | gain2 = gain2 / 1.5; 84 | if (gain2<1) gain2=1; 85 | } 86 | if ((mouseX>392)&&(mouseX<432)) { 87 | if (i_tbase<14) i_tbase=i_tbase+1; 88 | tbase = tbase_list[i_tbase]*44100/40000; 89 | } 90 | if ((mouseX>432)&&(mouseX<476)) { 91 | if (i_tbase>0) i_tbase=i_tbase-1; 92 | tbase = tbase_list[i_tbase]*44100/40000; 93 | } 94 | if ((mouseX>752)&&(mouseX<792)) { 95 | if (once) { 96 | once=false; 97 | stopped=false; 98 | } else { 99 | once=true; 100 | stopped=true; 101 | I=0; 102 | J=0; 103 | } 104 | } 105 | if ((mouseX>792)&&(mouseX<832)) { 106 | if (stopped) stopped = false; 107 | else { 108 | stopped = true; 109 | I=0; 110 | J=0; 111 | } 112 | started=2; 113 | } 114 | if ((mouseX>672)&&(mouseX<712)) { 115 | if (trig_en) trig_en=false; 116 | else trig_en=true; 117 | } 118 | if ((mouseX>712)&&(mouseX<752)) { 119 | if (trig_dir) trig_dir=false; 120 | else trig_dir=true; 121 | } 122 | if ((mouseX>912)&&(mouseX<992)) { 123 | if (mesure!=0) mesure=0; 124 | else mesure=1; 125 | } 126 | if ((mouseX>1000)&&(mouseX<1024)) { 127 | showMessageDialog(null, "Keyboard Shortcuts :\n\r- 'u' and 'j' : Turn Left & Right Channel ON and OFF\n\r- 'e' and 'd' : Left Channel Gain\n\r- 'r' and 'f' : Right CHannel Gain\n\r- 'c' and 'v' : Time Base adjusting\n\r- mouse click on leftmost or rightmost window moves the origin\n\rAdvanced Controls :\n\r- 't' and 'g' : Trigger level adjustment\n\r- 'h' : Toggles triggering from channel A to channel B\n\r- 'b' : Activates measurement cursors\n\r- 'y' : Toggles between Auto and Single mode\n\r- 'k' : Aligns input voltage level\n\r- spacebar : Pause and Resume\n\rAnd of course :\n\r- 'o' : Exit Scope", 128 | "Controls", INFORMATION_MESSAGE); 129 | } 130 | if ((mouseX>0)&&(mouseX<16)) { 131 | showMessageDialog(null, "WaveWatch version 1.3\n\rSoundcard Scope\n\rBy banson\n\rwww.banson.fr", 132 | "Info", INFORMATION_MESSAGE); 133 | } 134 | } 135 | 136 | // Trig 137 | if ((mouseX>21)&&(mouseX<1000)&&(mouseY>21)&&(mouseY<459)&&(mesure==0)&&trig_en) { 138 | if (!trigin) { 139 | triglevel=(float(mouseY)-offset1)*(-1)/gain1; 140 | } else { 141 | triglevel=(float(mouseY)-offset2)*(-1)/gain2; 142 | } 143 | trigdelta=mouseX; 144 | } 145 | } 146 | 147 | 148 | void keyPressed() 149 | { 150 | switch(key) { 151 | case 'e': 152 | gain1 = gain1 * 1.5; 153 | if (gain1>10000)gain1=10000; 154 | break; 155 | case 'd': 156 | gain1 = gain1 / 1.5; 157 | if (gain1<1) gain1=1; 158 | break; 159 | case 'r': 160 | gain2 = gain2 * 1.5; 161 | if (gain2>10000)gain2=10000; 162 | break; 163 | case 'f': 164 | gain2 = gain2 / 1.5; 165 | if (gain2<1) gain2=1; 166 | break; 167 | case 'c': 168 | if (i_tbase>0) i_tbase=i_tbase-1; 169 | tbase = tbase_list[i_tbase]*44100/40000; 170 | break; 171 | case 'v': 172 | if (i_tbase<14) i_tbase=i_tbase+1; 173 | tbase = tbase_list[i_tbase]*44100/40000; 174 | break; 175 | case 'g': 176 | triglevel = triglevel-0.01; 177 | if (triglevel<-0.9) triglevel=-0.95; 178 | break; 179 | case 't': 180 | triglevel = triglevel+0.01; 181 | if (triglevel>0.9) triglevel=0.95; 182 | break; 183 | case 'h': 184 | if (trigin==false) trigin=true; 185 | else trigin=false; 186 | break; 187 | case ' ': 188 | if (stopped) stopped = false; 189 | else { 190 | stopped = true; 191 | I=0; 192 | J=0; 193 | } 194 | started=2; 195 | break; 196 | case 'y': 197 | if (once) { 198 | once=false; 199 | stopped=false; 200 | } else { 201 | once=true; 202 | stopped=true; 203 | I=0; 204 | J=0; 205 | } 206 | break; 207 | case 'b': 208 | if (mesure!=0) mesure=0; 209 | else mesure=1; 210 | break; 211 | case 'k': 212 | alignment=true; 213 | break; 214 | case 'u': 215 | if (Ldisplay) Ldisplay=false; 216 | else Ldisplay=true; 217 | break; 218 | case 'j': 219 | if (Rdisplay) Rdisplay=false; 220 | else Rdisplay=true; 221 | break; 222 | case 'o': 223 | while (dfade<235) { 224 | exit(); 225 | break; 226 | } 227 | } 228 | } -------------------------------------------------------------------------------- /WaveWatch/minim.pde: -------------------------------------------------------------------------------- 1 | class WaveformRenderer implements AudioListener 2 | { 3 | // private float[] left; 4 | // private float[] right; 5 | 6 | WaveformRenderer() 7 | { 8 | // left = null; 9 | // right = null; 10 | } 11 | 12 | synchronized void samples(float[] samp) 13 | { 14 | samples(samp, samp); 15 | } 16 | 17 | synchronized void samples(float[] sampL, float[] sampR) 18 | { 19 | monostereo=true; 20 | // Buffer content explorating 21 | if (!stopped) { // if Scope is running... 22 | while (J=D_Buffer) K=0; 27 | J=J+tbase; 28 | // 2/4 de buffer 29 | if (K==3072) { 30 | if (started==0) { 31 | int i=1024; 32 | boolean found=false; 33 | while ( (i<2047)&&(found==false)) { 34 | if (trig_dir) { 35 | if ((l_buffer[i]=triglevel)&&(!trigin)) found=true; 36 | if ((r_buffer[i]=triglevel)&&(trigin)) found=true; 37 | } 38 | if (!trig_dir) { 39 | if ((l_buffer[i]>triglevel)&&(l_buffer[i+1]<=triglevel)&&(!trigin)) found=true; 40 | if ((r_buffer[i]>triglevel)&&(r_buffer[i+1]<=triglevel)&&(trigin)) found=true; 41 | } 42 | i=i+1; 43 | } 44 | if (found) { 45 | for (int j=0; j<1024; j=j+1) { 46 | display11[j]=l_buffer[i+j-trigdelta]; 47 | display21[j]=r_buffer[i+j-trigdelta]; 48 | } 49 | if (once) stopped=true; 50 | } 51 | 52 | // Alignment 53 | if (alignment) { 54 | float minlvl1=10; 55 | float maxlvl1=-10; 56 | float minlvl2=10; 57 | float maxlvl2=-10; 58 | for (int j=0; j<1024; j++) { 59 | if (minlvl1>display11[j]) minlvl1=display11[j]; 60 | if (maxlvl1display21[j]) minlvl2=display21[j]; 62 | if (maxlvl2triglevel)))) j++; 82 | if (j<1024) freq1 = 40000/((j-trigdelta)*tbase_list[i_tbase]); 83 | else freq1=0; 84 | j=(trigdelta+2)%1024; 85 | while ( (j<1024)&&(!((display21[j-1]<=triglevel)&&(display21[j]>triglevel)))) j++; 86 | if (j<1024) freq2 = 40000/((j-trigdelta)*tbase_list[i_tbase]); 87 | else freq2=0; 88 | } else started=started-1; 89 | } 90 | // 3/4 de buffer 91 | if (K==0) { 92 | if (started==0) { 93 | int i=2048; 94 | boolean found=false; 95 | while ( (i<3071)&&(found==false)) { 96 | if (trig_dir) { 97 | if ((l_buffer[i]=triglevel)&&(!trigin)) found=true; 98 | if ((r_buffer[i]=triglevel)&&(trigin)) found=true; 99 | } 100 | if (!trig_dir) { 101 | if ((l_buffer[i]>triglevel)&&(l_buffer[i+1]<=triglevel)&&(!trigin)) found=true; 102 | if ((r_buffer[i]>triglevel)&&(r_buffer[i+1]<=triglevel)&&(trigin)) found=true; 103 | } 104 | i=i+1; 105 | } 106 | if (found) { 107 | for (int j=0; j<1024; j=j+1) { 108 | display11[j]=l_buffer[i+j-trigdelta]; 109 | display21[j]=r_buffer[i+j-trigdelta]; 110 | } 111 | if (once) stopped=true; 112 | } 113 | } else started=started-1; 114 | } 115 | // 4/4 de buffer 116 | if (K==1024) { 117 | if (started==0) { 118 | int i=3071; 119 | boolean found=false; 120 | while ( (i<4095)&&(found==false)) { 121 | if (trig_dir) { 122 | if ((l_buffer[i]=triglevel)&&(!trigin)) found=true; 123 | if ((r_buffer[i]=triglevel)&&(trigin)) found=true; 124 | } 125 | if (!trig_dir) { 126 | if ((l_buffer[i]>triglevel)&&(l_buffer[i+1]<=triglevel)&&(!trigin)) found=true; 127 | if ((r_buffer[i]>triglevel)&&(r_buffer[i+1]<=triglevel)&&(trigin)) found=true; 128 | } 129 | i=i+1; 130 | } 131 | if (found) { 132 | for (int j=0; j<1024; j=j+1) { 133 | display11[j]=l_buffer[(i+j-trigdelta)%4096]; 134 | display21[j]=r_buffer[(i+j-trigdelta)%4096]; 135 | } 136 | if (once) stopped=true; 137 | } 138 | } else started=started-1; 139 | } 140 | // 1/4 de buffer 141 | if (K==2048) { 142 | if (started==0) { 143 | int i=0; 144 | boolean found=false; 145 | while ( (i<1023)&&(found==false)) { 146 | if (trig_dir) { 147 | if ((l_buffer[i]=triglevel)&&(!trigin)) found=true; 148 | if ((r_buffer[i]=triglevel)&&(trigin)) found=true; 149 | } 150 | if (!trig_dir) { 151 | if ((l_buffer[i]>triglevel)&&(l_buffer[i+1]<=triglevel)&&(!trigin)) found=true; 152 | if ((r_buffer[i]>triglevel)&&(r_buffer[i+1]<=triglevel)&&(trigin)) found=true; 153 | } 154 | i=i+1; 155 | } 156 | if (found) { 157 | for (int j=0; j<1024; j=j+1) { 158 | display11[j]=l_buffer[(i+j-trigdelta+4096)%4096]; 159 | display21[j]=r_buffer[(i+j-trigdelta+4096)%4096]; 160 | } 161 | if (once) stopped=true; 162 | } 163 | } else started=started-1; 164 | } 165 | //======================================= 166 | } 167 | J=J-A_Buffer; 168 | } 169 | } 170 | } 171 | 172 | void stop() 173 | { 174 | // always close Minim audio classes when you finish with them 175 | in.close(); 176 | minim.stop(); 177 | super.stop(); 178 | } -------------------------------------------------------------------------------- /WaveWatch/display.pde: -------------------------------------------------------------------------------- 1 | void draw() 2 | { 3 | 4 | background(0); 5 | strokeWeight(1); 6 | 7 | if (dfade>0) dfade=dfade-1; 8 | 9 | tint(255, 32+dfade); 10 | image(splash, 0, 0); 11 | 12 | 13 | //trigger 14 | stroke(0, 128, 128); 15 | strokeWeight(4); 16 | line(1, 1, K%1024, 1); 17 | 18 | // GRID 19 | stroke(16, 16, 16); 20 | strokeWeight(1); 21 | for (int i=1; i<13; i++) { 22 | stroke(32, 32, 32); 23 | line(W_Width/2+40*i, 0, W_Width/2+40*i, W_Height); 24 | line(0, W_Height/2+40*i, W_Width, W_Height/2+40*i); 25 | line(W_Width/2-40*i, 0, W_Width/2-40*i, W_Height); 26 | line(0, W_Height/2-40*i, W_Width, W_Height/2-40*i); 27 | stroke(98, 202, 165); 28 | line(W_Width/2+40*i, W_Height/2-4, W_Width/2+40*i, W_Height/2+4); 29 | line(W_Width/2-40*i, W_Height/2-4, W_Width/2-40*i, W_Height/2+4); 30 | line(W_Width/2-4, W_Height/2+40*i, W_Width/2+4, W_Height/2+40*i); 31 | line(W_Width/2-4, W_Height/2-40*i, W_Width/2+4, W_Height/2-40*i); 32 | } 33 | 34 | // Channel 0V line 35 | if (Ldisplay) { 36 | stroke(84, 0, 0); 37 | line(0, offset1, 1024, offset1); 38 | } 39 | if (Rdisplay) { 40 | stroke(0, 84, 0); 41 | line(0, offset2, 1024, offset2); 42 | } 43 | 44 | // Référentiel 45 | stroke(108, 170, 195); 46 | line(W_Width/2, 0, W_Width/2, W_Height); 47 | line(0, W_Height/2, W_Width, W_Height/2); 48 | 49 | // Left Channel 50 | if (Ldisplay) { 51 | stroke(255, 128, 128); 52 | strokeJoin(ROUND); 53 | strokeWeight(2); 54 | for (int i = 1; i < 1023; i++) 55 | { 56 | line(i, offset1 - display11[i-1]*gain1, i+1, offset1 - display11[i]*gain1); 57 | } 58 | } 59 | 60 | // Right Channel 61 | if (Rdisplay) { 62 | 63 | stroke(128, 255, 128); 64 | strokeJoin(ROUND); 65 | strokeWeight(2); 66 | 67 | for (int i = 1; i < 1023; i++) 68 | { 69 | line(i, offset2 - display21[i-1]*gain2, i+1, offset2 - display21[i]*gain2); 70 | } 71 | } 72 | 73 | 74 | // Origin 75 | strokeWeight(2); 76 | strokeJoin(ROUND); 77 | if (Ldisplay) { 78 | stroke(255, 0, 0); 79 | line(0, offset1-5, 5, offset1); 80 | line(0, offset1+5, 5, offset1); 81 | } 82 | if (Rdisplay) { 83 | stroke(0, 255, 0); 84 | line(1024, offset2-5, 1019, offset2); 85 | line(1024, offset2+5, 1019, offset2); 86 | } 87 | 88 | strokeWeight(1); 89 | // Trigger level 90 | if (trigin==false) { 91 | stroke(255, 0, 0); 92 | line(trigdelta-6, offset1-gain1*triglevel, trigdelta+6, offset1-gain1*triglevel); 93 | line(trigdelta, offset1-gain1*triglevel+6, trigdelta, offset1-gain1*triglevel-6); 94 | } else { 95 | stroke(0, 255, 0); 96 | line(trigdelta-6, offset2-gain2*triglevel, trigdelta+6, offset2-gain2*triglevel); 97 | line(trigdelta, offset2-gain2*triglevel+6, trigdelta, offset2-gain2*triglevel-6); 98 | } 99 | 100 | fill(0, 0, 0); 101 | strokeWeight(2); 102 | // Channel Name and Activity 103 | if (Ldisplay) { 104 | stroke(255, 128, 128); 105 | } else stroke(96, 96, 96); 106 | rect(32, 481, 39, 19); 107 | if (Rdisplay) { 108 | stroke(128, 255, 128); 109 | } else stroke(96, 96, 96); 110 | rect(192, 481, 39, 19); 111 | fill(255, 128, 128); 112 | text("ChA", 38, 495); 113 | fill(128, 255, 128); 114 | text("ChB", 198, 495); 115 | 116 | // Timebase display 117 | fill(0); 118 | stroke(128, 128, 128); 119 | rect(472, 481, 79, 19); 120 | fill(200); 121 | text("T:"+tbase_list[i_tbase]+"ms", 482, 495); 122 | 123 | 124 | // Mode display 125 | if (stopped) { 126 | stroke(255, 128, 128); 127 | fill(255, 128, 128); 128 | rect(1002, 5, 15, 15, 7); 129 | text("Stopped", 942, 16); 130 | } else { 131 | if (!once|trigged) { 132 | stroke(128, 255, 128); 133 | fill(128, 255, 128); 134 | rect(1002, 5, 15, 15, 7); 135 | text("Running", 942, 16); 136 | } else { 137 | stroke(128, 128, 255); 138 | fill(128, 128, 255); 139 | rect(1002, 5, 15, 15, 7); 140 | text("Ready", 942, 16); 141 | } 142 | } 143 | 144 | 145 | // Channel Data 146 | if (Ldisplay) { 147 | fill(255, 128, 128); 148 | text("V:"+vp1*40/gain1+"V", 22, 475); 149 | if (!trigin) text("F:"+round(freq1)+"Hz", 142, 475); 150 | } 151 | if (Rdisplay) { 152 | fill(128, 255, 128); 153 | text("V:"+vp2*40/gain2+"V", 262, 475); 154 | if (trigin) text("F:"+round(freq2)+"Hz", 382, 475); 155 | } 156 | 157 | stroke(255, 255, 255); 158 | // Cursors 159 | switch (mesure) { 160 | case 0: 161 | break; 162 | 163 | case 1: 164 | // Display Measurement cursor 165 | strokeWeight(1); 166 | line(mouseX, 0, mouseX, W_Height); 167 | line(0, mouseY, W_Width, mouseY); 168 | break; 169 | 170 | case 2: 171 | // Display Measurement cursor 172 | strokeWeight(1); 173 | line(mouseX, 0, mouseX, W_Height); 174 | line(0, mouseY, W_Width, mouseY); 175 | // Display Cursor 1 176 | strokeWeight(2); 177 | line(m1X, m1Y, m1X+5, m1Y); 178 | line(m1X, m1Y, m1X-5, m1Y); 179 | line(m1X, m1Y, m1X, m1Y+5); 180 | line(m1X, m1Y, m1X, m1Y-5); 181 | fill(220, 220, 220); 182 | text("dT:"+(mouseX-m1X)*tbase_list[i_tbase]/40+"ms", mouseX+20, mouseY+20); 183 | text("dV:"+(mouseY-m1Y)/gain1*vp1+"V", mouseX+20, mouseY+32); 184 | break; 185 | 186 | case 3: 187 | // Display Cursor 1 188 | strokeWeight(2); 189 | line(m1X, m1Y, m1X+5, m1Y); 190 | line(m1X, m1Y, m1X-5, m1Y); 191 | line(m1X, m1Y, m1X, m1Y+5); 192 | line(m1X, m1Y, m1X, m1Y-5); 193 | // Display Cursor 2 194 | strokeWeight(2); 195 | line(m2X, m2Y, m2X+5, m2Y); 196 | line(m2X, m2Y, m2X-5, m2Y); 197 | line(m2X, m2Y, m2X, m2Y+5); 198 | line(m2X, m2Y, m2X, m2Y-5); 199 | fill(220, 220, 220); 200 | text("dT:"+(m2X-m1X)*tbase_list[i_tbase]/40+"ms", mouseX+20, mouseY+20); 201 | text("F:"+abs(round(1000/((m2X-m1X)*tbase_list[i_tbase]/40)))+"Hz", mouseX+20, mouseY+44); 202 | text("dV:"+(m2Y-m1Y)/gain1*vp1+"V", mouseX+20, mouseY+32); 203 | break; 204 | } 205 | 206 | // Bottom UI 207 | fill(0, 0, 0); 208 | if (trigin==false) { 209 | stroke(255, 128, 128); 210 | rect(632, 481, 39, 19); 211 | fill(255, 128, 128); 212 | text("TrigA", 636, 495); 213 | } else { 214 | stroke(128, 255, 128); 215 | rect(632, 481, 39, 19); 216 | fill(128, 255, 128); 217 | text("TrigB", 636, 495); 218 | } 219 | 220 | // Channel A Gain 221 | fill(0, 0, 0); 222 | stroke(255, 128, 128); 223 | rect(72, 481, 79, 19); 224 | fill(255, 128, 128); 225 | text("Gain", 98, 495); 226 | text("+", 81, 495); 227 | text("-", 132, 495); 228 | 229 | //Channel B Gain 230 | fill(0, 0, 0); 231 | stroke(128, 255, 128); 232 | rect(232, 481, 79, 19); 233 | fill(128, 255, 128); 234 | text("Gain", 258, 495); 235 | text("+", 241, 495); 236 | text("-", 292, 495); 237 | 238 | //Time base adjustment 239 | fill(0, 0, 0); 240 | stroke(168, 168, 168); 241 | rect(216+176, 481, 79, 19); 242 | fill(168, 168, 168); 243 | text("Time", 242+176, 495); 244 | text("+", 225+176, 495); 245 | text("-", 277+176, 495); 246 | 247 | //Mode display 248 | fill(0, 0, 0); 249 | stroke(168, 168, 168); 250 | rect(752, 481, 39, 19); 251 | fill(168, 168, 168); 252 | if (once) { 253 | fill(168, 168, 200); 254 | text("Single", 756, 495); 255 | } else { 256 | fill(168, 200, 168); 257 | text("Auto", 759, 495); 258 | } 259 | 260 | //Start & Stop 261 | fill(0, 0, 0); 262 | stroke(168, 168, 168); 263 | rect(792, 481, 39, 19); 264 | if (stopped) { 265 | fill(168, 255, 168); 266 | text("Start", 799, 495); 267 | } else { 268 | fill(255, 168, 168); 269 | text("Stop", 800, 495); 270 | } 271 | 272 | // Trigger display 273 | if (trig_en) fill(128, 128, 128); 274 | else fill(0, 0, 0); 275 | stroke(168, 168, 168); 276 | rect(672, 481, 79, 19); 277 | line(712, 481, 712, 500); 278 | if (trig_en) fill(0, 0, 0); 279 | else fill(168, 168, 168); 280 | text("Trig", 680, 495); 281 | 282 | // Rise Or Fall 283 | fill(0); 284 | stroke(255, 255, 255); 285 | if (trig_dir) { 286 | line(717, 495, 727, 495); 287 | line(727, 495, 737, 485); 288 | line(737, 485, 747, 485); 289 | } else { 290 | line(717, 485, 727, 485); 291 | line(727, 485, 737, 495); 292 | line(737, 495, 747, 495); 293 | } 294 | 295 | if (mesure!=0) { 296 | fill(255, 255, 255); 297 | stroke(168, 168, 168); 298 | rect(912, 481, 79, 19); 299 | fill(0, 0, 0); 300 | text("Measure", 927, 495); 301 | } else { 302 | stroke(168, 168, 168); 303 | fill(0, 0, 0); 304 | rect(912, 481, 79, 19); 305 | fill(168, 200, 168); 306 | text("Measure", 927, 495); 307 | } 308 | fill(168, 168, 0); 309 | text("?", 1007, 495); 310 | text("i", 14, 495); 311 | } --------------------------------------------------------------------------------