shithub: pplay

Download patch

ref: b8975db265d21480f4f834e6abdf88414a2d6763
parent: 72315513cf30bd581715a0ba32675fbe3d89992b
author: qwx <qwx@sciops.net>
date: Mon Aug 19 07:09:16 EDT 2024

draw: fix stereo display

--- a/dat.h
+++ b/dat.h
@@ -35,7 +35,7 @@
 enum{
 	Drawcur = 1<<0,
 	Drawrender = 1<<1,
-	Drawall = 1<<2,
+	Drawall = (1<<2) - 1,
 };
 
 extern int stereo, chan;
--- a/draw.c
+++ b/draw.c
@@ -155,8 +155,7 @@
 rendersamples 0x410450 [0 0] [1365 187] view [0 0] [1365 375]→ [187 0] [1552 187]
 */
 
-	rx = rectaddpt(rr, Pt(Dy(view->r)/2,0));
-	//fprint(2, "→ %R\n", rx);
+	rx = rectaddpt(rr, Pt(0, Dy(view->r)/2));
 	for(r=graph[chan+1&1]+2*rx.min.x, e=r+2*Dx(rr); r<e; r+=2, rx.min.x++){
 		rx.min.y = rr.min.y + bgscalyr - r[1] / bgscalf;
 		rx.max.x = rx.min.x + sampwidth;
@@ -221,7 +220,7 @@
 			break;
 		}
 		lockdisplay(display);
-		if(what == Drawrender || stalerender || working){
+		if((what & Drawrender) != 0 || stalerender || working){
 			if(!working)
 				stalerender = 0;
 			render();
--- a/pplay.c
+++ b/pplay.c
@@ -170,7 +170,7 @@
 			case Kdel:
 			case 'q': threadexitsall(nil);
 			case 'D': debugdraw ^= 1; refresh(Drawrender); break;
-			case 'S': stereo ^= 1; refresh(Drawall); break;
+			case 'S': stereo ^= 1; redraw(1); break;
 			case ' ': toggleplay(); break;
 			case 'b': setjump(dot.from); break;
 			case Kesc: setrange(0, dot.totalsz); break;