shithub: qk1

Download patch

ref: 779ab09145bc25536e93051873d59b3fce8fc761
parent: 555fcf8bcb99759275ae6ed6365eec87d1bf25ae
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Dec 27 22:40:38 EST 2023

openal: fix music looping

--- a/unix/snd_openal.c
+++ b/unix/snd_openal.c
@@ -771,19 +771,19 @@
 					perror("fread");
 					break;
 				}
-				left -= n;
-				if(left < 1){
-					if(!loop)
-						break;
-					if(fsetpos(f, &off) != 0){
-						perror("fsetpos");
-						break;
-					}
-					left = len;
-				}
 			}
 			if(write(s[1], tmp, n) != n)
 				break;
+			left -= n;
+			if(left < 1){
+				if(!loop)
+					break;
+				if(fsetpos(f, &off) != 0){
+					perror("fsetpos");
+					break;
+				}
+				left = len;
+			}
 		}
 		close(s[1]);
 		fclose(f);