summaryrefslogtreecommitdiff
path: root/audio/muse/patches/patch-ac
blob: a46422ceb63ee7cb7e6ae8bad5da4976f48641b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
$NetBSD: patch-ac,v 1.3 2005/12/11 23:44:40 joerg Exp $

--- src/pipe.cpp.orig	2003-12-08 12:20:33.000000000 +0000
+++ src/pipe.cpp
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA.
 
 #include <iostream>
 #include <stdlib.h>
+#include <errno.h>
 #include <audioproc.h>
 #include <pipe.h>
 #include <jutils.h>
@@ -61,7 +62,7 @@ Pipe::Pipe(int size) {
   end=start=buffer;
   blocking = true;
   _thread_init();
-  unlock();
+  //unlock();
 }
 
 Pipe::~Pipe() {
@@ -118,9 +119,9 @@ int Pipe::read_float_intl(int samples, f
     }
     /* --- */
 
-    (char*)start += currentBlockSize;
+    start = (char*)start + currentBlockSize;
     len -= currentBlockSize;
-    (char*)pp += currentBlockSize;
+    pp = (float *)((char*)pp + currentBlockSize);
     length -= currentBlockSize;
     if ((end!=buffer) && (start==bufferEnd))
       start = buffer;
@@ -146,8 +147,8 @@ int Pipe::read_float_intl(int samples, f
     }
     /* --- */
     
-    (char*)pp += len;
-    (char*)start += len;
+    pp = (float *)((char*)pp + len);
+    start = (char*)start + len;
     length -= len;
     if ((end!=buffer) && (start==bufferEnd))
       start = buffer;
@@ -224,9 +225,9 @@ int Pipe::read_float_bidi(int samples, f
     }
     /* --- */
 
-    (char*)start += currentBlockSize;
+    start = (char*)start + currentBlockSize;
     len -= currentBlockSize;
-    (char*)pp += currentBlockSize;
+    pp = (float **)((char*)pp + currentBlockSize);
     length -= currentBlockSize;
     if ((end!=buffer) && (start==bufferEnd))
       start = buffer;
@@ -253,8 +254,8 @@ int Pipe::read_float_bidi(int samples, f
       }
       /* --- */
       
-      (char*)pp += len;
-      (char*)start += len;
+      pp = (float **)((char*)pp + len);
+      start = (char*)start + len;
       length -= len;
       if ((end!=buffer) && (start==bufferEnd))
 	start = buffer;
@@ -309,9 +310,9 @@ int Pipe::mix16stereo(int samples, int32
       pp[c] += (int32_t) ((IN_DATATYPE*)start)[c];
     /* --- */
 
-    (char*)start += currentBlockSize;
+    start = (char*)start + currentBlockSize;
     len -= currentBlockSize;
-    (char*)pp += currentBlockSize;
+    pp = (int32_t *)((char*)pp + currentBlockSize);
     length -= currentBlockSize;
     if ((end!=buffer) && (start==bufferEnd))
       start = buffer;
@@ -324,8 +325,8 @@ int Pipe::mix16stereo(int samples, int32
 	pp[c] += (int) ((IN_DATATYPE*)start)[c];
       /* --- */
 
-      (char*)pp += len;
-      (char*)start += len;
+      pp = (int32_t *)((char*)pp + len);
+      start = (char*)start + len;
       length -= len;
       if ((end!=buffer) && (start==bufferEnd))
 	start = buffer;
@@ -372,17 +373,17 @@ int Pipe::read(int length, void *data) {
     /* fill */
     memcpy(data, start, currentBlockSize);
     
-    (char*)start += currentBlockSize;
+    start = (char*)start + currentBlockSize;
     len -= currentBlockSize;
-    (char*)data += currentBlockSize;
+    data = (char*)data + currentBlockSize;
     length -= currentBlockSize;
     if ((end!=buffer) && (start==bufferEnd))
       start = buffer;
     
     if (len) { /* short circuit */
       memcpy(data, start, len);
-      (char*)data += len;
-      (char*)start += len;
+      data = (char*)data + len;
+      start = (char*)start + len;
       length -= len;
       if ((end!=buffer) && (start==bufferEnd))
 	start = buffer;
@@ -418,19 +419,19 @@ int Pipe::write(int length, void *data) 
     currentBlockSize=MIN(currentBlockSize, len);
     ::memcpy(end, data, currentBlockSize);
     
-    (char*)end += currentBlockSize;
+    end = (char*)end + currentBlockSize;
     
     len -= currentBlockSize;
     
-    (char*)data += currentBlockSize;
+    data = (char*)data + currentBlockSize;
     length -= currentBlockSize;
     if ((start!=buffer) && (end==bufferEnd))
       end = buffer;
 		
     if (len) { // short circuit		
       ::memcpy(end, data, len);
-      (char*)data += len;
-      (char*)end += len;
+      data = (char*)data + len;
+      end = (char*)end + len;
       length -= len;
       
       if ((start!=buffer) && (end==bufferEnd))