@@ -387,37 +387,78 @@ public void zRange(float zMin, float zMax) {
387
387
zaxisMax = zMax ;
388
388
}
389
389
390
+ /**
391
+ * Use XYscope on a modded Vectrex monitor for XYZ input. This will automatically adjust the canvas and amplitude settings to match the ratio of the Vectrex.
392
+ *
393
+ */
390
394
public void vectrex (){
391
- vectrex (vectrexWidth , vectrexHeight , vectrexAmpInit );
395
+ vectrex (vectrexWidth , vectrexHeight , vectrexAmpInit , vectrexRotation );
392
396
}
393
397
398
+ /**
399
+ * Use XYscope on a modded Vectrex monitor for XYZ input. This will automatically adjust the canvas and amplitude settings to match the ratio of the Vectrex. You can customize the rotation of the monitor +/- 90° if landscape oriented.
400
+ *
401
+ * @param vrot
402
+ * int for degrees of rotation, 90 or -90
403
+ */
394
404
public void vectrex (int vrot ){
395
405
if (vrot == 90 ){
396
406
vectrexRotation = vrot ;
397
- vectrex (vectrexHeight , vectrexWidth , vectrexAmpInit );
407
+ vectrex (vectrexHeight , vectrexWidth , vectrexAmpInit , vectrexRotation );
398
408
}else if (vrot == -90 ){
399
409
vectrexRotation = vrot ;
400
- vectrex (vectrexHeight , vectrexWidth , vectrexAmpInit );
401
- }else {
402
- vectrexRotation = vrot ;
403
- vectrex (vectrexWidth , vectrexHeight , vectrexAmpInit );
410
+ vectrex (vectrexHeight , vectrexWidth , vectrexAmpInit , vectrexRotation );
411
+ }else {
412
+ vectrexRotation = 0 ;
413
+ vectrex (vectrexWidth , vectrexHeight , vectrexAmpInit , vectrexRotation );
404
414
}
405
415
}
406
416
407
- public void vectrex (int vw , int vh , float vamp ){
417
+ /**
418
+ * Use XYscope on a modded Vectrex monitor for XYZ input. Set custom width, height, initial amplitude scaling and rotation/orientation.
419
+ *
420
+ * @param vw
421
+ * int for width of canvas, default is 330
422
+ * @param vh
423
+ * int for height of canvas, default is 410
424
+ * @param vrot
425
+ * float for initial amplitude adjustment of signal to screen (0.0 - 1.0), default is .6
426
+ * @param vrot
427
+ * int for degrees of rotation, 90 or -90, default is 0
428
+ */
429
+ public void vectrex (int vw , int vh , float vamp , int vrot ){
408
430
useVectrex = true ;
431
+ vectrexRotation = vrot ;
409
432
myParent .getSurface ().setResizable (true );
410
433
myParent .getSurface ().setSize (vw , vh );
411
434
xyWidth = vw ;
412
435
xyHeight = vh ;
413
- amp (vamp );
436
+ vectrexAmpInit = vamp ;
437
+ amp (vectrexAmpInit );
438
+ }
439
+
440
+
441
+ /**
442
+ * Get current amplitude difference used for ratio of Vectrex.
443
+ *
444
+ * @return float
445
+ */
446
+ public float vectrexRatio (){
447
+ return vectrexAmp ;
448
+ }
449
+
450
+
451
+ /**
452
+ * Set current amplitude difference used for ratio of Vectrex.
453
+ *
454
+ * @param vectrexAmpVal
455
+ * float for amplitude difference (0.0 - 1.0), default is .82
456
+ */
457
+ public void vectrexRatio (float vectrexAmpVal ){
458
+ vectrexAmp = constrain (vectrexAmpVal , 0f , 1f );
459
+ amp (vectrexAmpInit );
414
460
}
415
461
416
- // public void vectrexRotation(int vrot){
417
- // myParent.translate(xyWidth / 2, xyHeight / 2);
418
- // myParent.rotate(radians(vrot));
419
- // myParent.translate(-xyWidth / 2, -xyHeight / 2);
420
- // }
421
462
422
463
/**
423
464
* Get current amplitude setting of XY oscillators.
@@ -754,18 +795,20 @@ public void buildWaves(int bwm) {
754
795
for (int i = 0 ; i < shapePreX .length ; i ++) {
755
796
shapeX [i ] = shapePreX [i ];
756
797
shapeY [i ] = shapePreY [i ];
798
+
757
799
if (useVectrex ){
758
800
if (vectrexRotation == 90 ){
759
801
shapeX [i ] = shapePreY [i ];
760
802
shapeY [i ] = shapePreX [i ]*-1 ;
761
803
}else if (vectrexRotation == -90 ){
762
804
shapeX [i ] = shapePreY [i ]*-1 ;
763
805
shapeY [i ] = shapePreX [i ];
764
- }else {
806
+ }else if ( vectrexRotation == 0 ) {
765
807
shapeX [i ] = shapePreX [i ]*-1 ;
766
808
shapeY [i ] = shapePreY [i ]*-1 ;
767
809
}
768
810
}
811
+
769
812
if (zaxis && useZ )
770
813
shapeZ [i ] = shapePreZ [i ];
771
814
}
@@ -1008,12 +1051,20 @@ public void drawXY() {
1008
1051
for (int i = 0 ; i < tempXY .bufferSize () - 1 ; i ++) {
1009
1052
float lAudio = tempXY .left .get (i ) * (float ) xyWidth / 2 ;
1010
1053
float rAudio = tempXY .right .get (i ) * (float ) xyHeight / 2 ;
1054
+
1011
1055
if (useVectrex ){
1012
1056
if (vectrexRotation == 90 ){
1013
- rAudio = tempXY .left .get (i ) * (float ) xyWidth / 2 ;
1014
- lAudio = tempXY .right .get (i ) * (float ) xyHeight / 2 * -1f ;
1057
+ rAudio = tempXY .left .get (i ) * (float ) xyHeight / 2 ;
1058
+ lAudio = tempXY .right .get (i ) * (float ) xyWidth / 2 * -1f * vectrexAmp ;
1059
+ }else if (vectrexRotation == -90 ){
1060
+ rAudio = tempXY .left .get (i ) * (float ) xyHeight / 2 * -1f ;
1061
+ lAudio = tempXY .right .get (i ) * (float ) xyWidth / 2 * vectrexAmp ;
1062
+ }else if (vectrexRotation == 0 ){
1063
+ lAudio = tempXY .left .get (i ) * (float ) xyWidth / 2 * -1f ;
1064
+ rAudio = tempXY .right .get (i ) * (float ) xyHeight / 2 * -1f * vectrexAmp ;
1015
1065
}
1016
1066
}
1067
+
1017
1068
myParent .curveVertex (lAudio , rAudio * -1f );
1018
1069
}
1019
1070
0 commit comments