summaryrefslogtreecommitdiff
path: root/emulators/qemu-devel/files/patch-malc-17h_aqemu
blob: 6c5a033bd74a11905cd40d3bfa4f0c012a160188 (plain) (blame)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
Index: qemu/audio/alsaaudio.c
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/audio/alsaaudio.c,v
retrieving revision 1.1.1.4
retrieving revision 1.1.1.1.2.8
diff -u -r1.1.1.4 -r1.1.1.1.2.8
--- audio/alsaaudio.c	21 Nov 2005 12:47:06 -0000	1.1.1.4
+++ audio/alsaaudio.c	7 Apr 2006 22:05:21 -0000	1.1.1.1.2.8
@@ -61,8 +61,8 @@
     .size_in_usec_in = 1,
     .size_in_usec_out = 1,
 #endif
-    .pcm_name_out = "hw:0,0",
-    .pcm_name_in = "hw:0,0",
+    .pcm_name_out = "default",
+    .pcm_name_in = "default",
 #ifdef HIGH_LATENCY
     .buffer_size_in = 400000,
     .period_size_in = 400000 / 4,
Index: qemu/audio/audio.h
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/audio/audio.h,v
retrieving revision 1.1.1.3
retrieving revision 1.1.1.1.2.5
diff -u -r1.1.1.3 -r1.1.1.1.2.5
--- audio/audio.h	21 Nov 2005 12:47:06 -0000	1.1.1.3
+++ audio/audio.h	7 Apr 2006 22:05:21 -0000	1.1.1.1.2.5
@@ -111,7 +111,7 @@
 }
 
 uint32_t popcount (uint32_t u);
-inline uint32_t lsbindex (uint32_t u);
+uint32_t lsbindex (uint32_t u);
 
 #ifdef __GNUC__
 #define audio_MIN(a, b) ( __extension__ ({      \
Index: qemu/audio/dsound_template.h
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/audio/dsound_template.h,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.2 -r1.1.1.1.2.2
--- audio/dsound_template.h	5 Nov 2005 20:42:14 -0000	1.1.1.2
+++ audio/dsound_template.h	7 Apr 2006 22:05:21 -0000	1.1.1.1.2.2
@@ -70,7 +70,13 @@
     int i;
     LPVOID p1 = NULL, p2 = NULL;
     DWORD blen1 = 0, blen2 = 0;
+    DWORD flag;
 
+#ifdef DSBTYPE_IN
+    flag = entire ? DSCBLOCK_ENTIREBUFFER : 0;
+#else
+    flag = entire ? DSBLOCK_ENTIREBUFFER : 0;
+#endif
     for (i = 0; i < conf.lock_retries; ++i) {
         hr = glue (IFACE, _Lock) (
             buf,
@@ -80,13 +86,7 @@
             &blen1,
             &p2,
             &blen2,
-            (entire
-#ifdef DSBTYPE_IN
-             ? DSCBLOCK_ENTIREBUFFER
-#else
-             ? DSBLOCK_ENTIREBUFFER
-#endif
-             : 0)
+            flag
             );
 
         if (FAILED (hr)) {
Index: qemu/audio/dsoundaudio.c
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/audio/dsoundaudio.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.2 -r1.1.1.1.2.2
--- audio/dsoundaudio.c	5 Nov 2005 20:42:14 -0000	1.1.1.2
+++ audio/dsoundaudio.c	7 Apr 2006 22:05:21 -0000	1.1.1.1.2.2
@@ -987,6 +987,12 @@
     hr = IDirectSound_Initialize (s->dsound, NULL);
     if (FAILED (hr)) {
         dsound_logerr (hr, "Could not initialize DirectSound\n");
+
+        hr = IDirectSound_Release (s->dsound);
+        if (FAILED (hr)) {
+            dsound_logerr (hr, "Could not release DirectSound\n");
+        }
+        s->dsound = NULL;
         return NULL;
     }
 
Index: qemu/audio/ossaudio.c
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/audio/ossaudio.c,v
retrieving revision 1.1.1.4
retrieving revision 1.1.1.1.2.5
diff -u -r1.1.1.4 -r1.1.1.1.2.5
--- audio/ossaudio.c	21 Nov 2005 12:47:06 -0000	1.1.1.4
+++ audio/ossaudio.c	7 Apr 2006 22:23:42 -0000	1.1.1.1.2.5
@@ -324,9 +324,18 @@
             return 0;
         }
 
-        if (abinfo.bytes < 0 || abinfo.bytes > bufsize) {
-            ldebug ("warning: Invalid available size, size=%d bufsize=%d\n",
-                    abinfo.bytes, bufsize);
+        if (abinfo.bytes > bufsize) {
+#ifndef __FreeBSD__
+            dolog ("warning: Invalid available size, size=%d bufsize=%d\n"
+                   "please report your OS/audio hw to malc@pulsesoft.com\n",
+                   abinfo.bytes, bufsize);
+#endif
+            abinfo.bytes = bufsize;
+        }
+
+        if (abinfo.bytes < 0) {
+            dolog ("warning: Invalid available size, size=%d bufsize=%d\n",
+                   abinfo.bytes, bufsize);
             return 0;
         }
 
Index: qemu/hw/es1370.c
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/hw/es1370.c,v
retrieving revision 1.1.1.4
retrieving revision 1.1.1.1.2.7
diff -u -r1.1.1.4 -r1.1.1.1.2.7
--- hw/es1370.c	21 Nov 2005 12:47:06 -0000	1.1.1.4
+++ hw/es1370.c	7 Apr 2006 22:05:21 -0000	1.1.1.1.2.7
@@ -479,9 +479,10 @@
 IO_WRITE_PROTO (es1370_writeb)
 {
     ES1370State *s = opaque;
-    addr = es1370_fixup (s, addr);
     uint32_t shift, mask;
 
+    addr = es1370_fixup (s, addr);
+
     switch (addr) {
     case ES1370_REG_CONTROL:
     case ES1370_REG_CONTROL + 1:
Index: qemu/hw/sb16.c
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/hw/sb16.c,v
retrieving revision 1.1.1.4
retrieving revision 1.1.1.1.2.6
diff -u -r1.1.1.4 -r1.1.1.1.2.6
--- hw/sb16.c	21 Nov 2005 12:47:06 -0000	1.1.1.4
+++ hw/sb16.c	7 Apr 2006 22:23:59 -0000	1.1.1.1.2.6
@@ -193,6 +193,31 @@
 #define DMA8_AUTO 1
 #define DMA8_HIGH 2
 
+static void continue_dma8 (SB16State *s)
+{
+    if (s->freq > 0) {
+        audsettings_t as;
+
+        s->audio_free = 0;
+
+        as.freq = s->freq;
+        as.nchannels = 1 << s->fmt_stereo;
+        as.fmt = s->fmt;
+
+        s->voice = AUD_open_out (
+            &s->card,
+            s->voice,
+            "sb16",
+            s,
+            SB_audio_callback,
+            &as,
+            0                   /* little endian */
+            );
+    }
+
+    control (s, 1);
+}
+
 static void dma_cmd8 (SB16State *s, int mask, int dma_len)
 {
     s->fmt = AUD_FMT_U8;
@@ -201,7 +226,8 @@
     s->fmt_signed = 0;
     s->fmt_stereo = (s->mixer_regs[0x0e] & 2) != 0;
     if (-1 == s->time_const) {
-        s->freq = 11025;
+        if (s->freq <= 0)
+            s->freq = 11025;
     }
     else {
         int tmp = (256 - s->time_const);
@@ -239,27 +265,7 @@
             s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits,
             s->block_size, s->dma_auto, s->fifo, s->highspeed);
 
-    if (s->freq) {
-        audsettings_t as;
-
-        s->audio_free = 0;
-
-        as.freq = s->freq;
-        as.nchannels = 1 << s->fmt_stereo;
-        as.fmt = s->fmt;
-
-        s->voice = AUD_open_out (
-            &s->card,
-            s->voice,
-            "sb16",
-            s,
-            SB_audio_callback,
-            &as,
-            0                   /* little endian */
-            );
-    }
-
-    control (s, 1);
+    continue_dma8 (s);
     speaker (s, 1);
 }
 
@@ -437,7 +443,7 @@
             break;
 
         case 0x1c:              /* Auto-Initialize DMA DAC, 8-bit */
-            control (s, 1);
+            dma_cmd8 (s, DMA8_AUTO, -1);
             break;
 
         case 0x20:              /* Direct ADC, Juice/PL */
@@ -531,7 +537,9 @@
             break;
 
         case 0xd4:              /* continue DMA operation. 8bit */
-            control (s, 1);
+            /* KQ6 (or maybe Sierras audblst.drv in general) resets
+               the frequency between halt/continue */
+            continue_dma8 (s);
             break;
 
         case 0xd5:              /* halt DMA operation. 16bit */