Commit 396c60e

Nick committed on
Work on debugging audio issues
commit 396c60e8cfcc29434c1ada7565ed84647be6b7f2 parent 5f554bc
5 changed files +119−236
ModifiedGBEmu.lpi +0−7
@@ -147,13 +147,6 @@
147 <SyntaxMode Value="Delphi"/> 147 <SyntaxMode Value="Delphi"/>
148 </SyntaxOptions> 148 </SyntaxOptions>
149 </Parsing> 149 </Parsing>
150 <Linking>
151 <Options>
152 <Win32>
153 <GraphicApplication Value="True"/>
154 </Win32>
155 </Options>
156 </Linking>
157 <Other> 150 <Other>
158 <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> 151 <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
159 </Other> 152 </Other>
ModifiedGBEmu.lps +95−100
@@ -11,7 +11,7 @@
11 <EditorIndex Value="-1"/> 11 <EditorIndex Value="-1"/>
12 <TopLine Value="2"/> 12 <TopLine Value="2"/>
13 <CursorPos X="14" Y="7"/> 13 <CursorPos X="14" Y="7"/>
14 <UsageCount Value="27"/> 14 <UsageCount Value="53"/>
15 <DefaultSyntaxHighlighter Value="Delphi"/> 15 <DefaultSyntaxHighlighter Value="Delphi"/>
16 </Unit0> 16 </Unit0>
17 <Unit1> 17 <Unit1>
@@ -20,11 +20,10 @@
20 <ComponentName Value="frmGameboy"/> 20 <ComponentName Value="frmGameboy"/>
21 <HasResources Value="True"/> 21 <HasResources Value="True"/>
22 <ResourceBaseClass Value="Form"/> 22 <ResourceBaseClass Value="Form"/>
23 <EditorIndex Value="-1"/>
23 <TopLine Value="309"/> 24 <TopLine Value="309"/>
24 <CursorPos X="40" Y="313"/> 25 <CursorPos X="40" Y="313"/>
25 <UsageCount Value="27"/> 26 <UsageCount Value="53"/>
26 <Loaded Value="True"/>
27 <LoadedDesigner Value="True"/>
28 <DefaultSyntaxHighlighter Value="Delphi"/> 27 <DefaultSyntaxHighlighter Value="Delphi"/>
29 </Unit1> 28 </Unit1>
30 <Unit2> 29 <Unit2>
@@ -33,7 +32,7 @@
33 <EditorIndex Value="-1"/> 32 <EditorIndex Value="-1"/>
34 <TopLine Value="1374"/> 33 <TopLine Value="1374"/>
35 <CursorPos X="22" Y="1374"/> 34 <CursorPos X="22" Y="1374"/>
36 <UsageCount Value="27"/> 35 <UsageCount Value="53"/>
37 <DefaultSyntaxHighlighter Value="Delphi"/> 36 <DefaultSyntaxHighlighter Value="Delphi"/>
38 </Unit2> 37 </Unit2>
39 <Unit3> 38 <Unit3>
@@ -43,7 +42,7 @@
43 <WindowIndex Value="-1"/> 42 <WindowIndex Value="-1"/>
44 <TopLine Value="-1"/> 43 <TopLine Value="-1"/>
45 <CursorPos X="-1" Y="-1"/> 44 <CursorPos X="-1" Y="-1"/>
46 <UsageCount Value="27"/> 45 <UsageCount Value="53"/>
47 <DefaultSyntaxHighlighter Value="Delphi"/> 46 <DefaultSyntaxHighlighter Value="Delphi"/>
48 </Unit3> 47 </Unit3>
49 <Unit4> 48 <Unit4>
@@ -53,7 +52,7 @@
53 <WindowIndex Value="-1"/> 52 <WindowIndex Value="-1"/>
54 <TopLine Value="-1"/> 53 <TopLine Value="-1"/>
55 <CursorPos X="-1" Y="-1"/> 54 <CursorPos X="-1" Y="-1"/>
56 <UsageCount Value="27"/> 55 <UsageCount Value="53"/>
57 <DefaultSyntaxHighlighter Value="Delphi"/> 56 <DefaultSyntaxHighlighter Value="Delphi"/>
58 </Unit4> 57 </Unit4>
59 <Unit5> 58 <Unit5>
@@ -62,18 +61,16 @@
62 <EditorIndex Value="-1"/> 61 <EditorIndex Value="-1"/>
63 <TopLine Value="210"/> 62 <TopLine Value="210"/>
64 <CursorPos X="7" Y="227"/> 63 <CursorPos X="7" Y="227"/>
65 <UsageCount Value="27"/> 64 <UsageCount Value="53"/>
66 <DefaultSyntaxHighlighter Value="Delphi"/> 65 <DefaultSyntaxHighlighter Value="Delphi"/>
67 </Unit5> 66 </Unit5>
68 <Unit6> 67 <Unit6>
69 <Filename Value="Gpu\dib_out.pas"/> 68 <Filename Value="Gpu\dib_out.pas"/>
70 <IsPartOfProject Value="True"/> 69 <IsPartOfProject Value="True"/>
71 <IsVisibleTab Value="True"/> 70 <EditorIndex Value="-1"/>
72 <EditorIndex Value="3"/> 71 <TopLine Value="41"/>
73 <TopLine Value="37"/> 72 <CursorPos X="8" Y="44"/>
74 <CursorPos X="21" Y="51"/> 73 <UsageCount Value="53"/>
75 <UsageCount Value="27"/>
76 <Loaded Value="True"/>
77 <DefaultSyntaxHighlighter Value="Delphi"/> 74 <DefaultSyntaxHighlighter Value="Delphi"/>
78 </Unit6> 75 </Unit6>
79 <Unit7> 76 <Unit7>
@@ -82,56 +79,54 @@
82 <EditorIndex Value="-1"/> 79 <EditorIndex Value="-1"/>
83 <TopLine Value="332"/> 80 <TopLine Value="332"/>
84 <CursorPos Y="332"/> 81 <CursorPos Y="332"/>
85 <UsageCount Value="27"/> 82 <UsageCount Value="53"/>
86 <DefaultSyntaxHighlighter Value="Delphi"/> 83 <DefaultSyntaxHighlighter Value="Delphi"/>
87 </Unit7> 84 </Unit7>
88 <Unit8> 85 <Unit8>
89 <Filename Value="CPU\machine.pas"/> 86 <Filename Value="CPU\machine.pas"/>
90 <IsPartOfProject Value="True"/> 87 <IsPartOfProject Value="True"/>
91 <EditorIndex Value="-1"/> 88 <EditorIndex Value="-1"/>
92 <TopLine Value="204"/> 89 <TopLine Value="284"/>
93 <CursorPos Y="246"/> 90 <CursorPos X="10" Y="297"/>
94 <UsageCount Value="27"/> 91 <UsageCount Value="53"/>
95 <DefaultSyntaxHighlighter Value="Delphi"/> 92 <DefaultSyntaxHighlighter Value="Delphi"/>
96 </Unit8> 93 </Unit8>
97 <Unit9> 94 <Unit9>
98 <Filename Value="Cpu\z80cpu.pas"/> 95 <Filename Value="Cpu\z80cpu.pas"/>
99 <IsPartOfProject Value="True"/> 96 <IsPartOfProject Value="True"/>
100 <UnitName Value="Z80CPU"/> 97 <UnitName Value="Z80CPU"/>
101 <EditorIndex Value="1"/> 98 <EditorIndex Value="-1"/>
102 <TopLine Value="7"/> 99 <TopLine Value="7"/>
103 <CursorPos X="15" Y="17"/> 100 <CursorPos X="15" Y="17"/>
104 <UsageCount Value="27"/> 101 <UsageCount Value="53"/>
105 <Loaded Value="True"/>
106 <DefaultSyntaxHighlighter Value="Delphi"/> 102 <DefaultSyntaxHighlighter Value="Delphi"/>
107 </Unit9> 103 </Unit9>
108 <Unit10> 104 <Unit10>
109 <Filename Value="Sound\sound.pas"/> 105 <Filename Value="Sound\sound.pas"/>
110 <IsPartOfProject Value="True"/> 106 <IsPartOfProject Value="True"/>
111 <EditorIndex Value="2"/> 107 <IsVisibleTab Value="True"/>
112 <TopLine Value="628"/> 108 <CursorPos Y="9"/>
113 <CursorPos X="6" Y="631"/> 109 <UsageCount Value="53"/>
114 <UsageCount Value="27"/>
115 <Loaded Value="True"/> 110 <Loaded Value="True"/>
116 <DefaultSyntaxHighlighter Value="Delphi"/> 111 <DefaultSyntaxHighlighter Value="Delphi"/>
117 </Unit10> 112 </Unit10>
118 <Unit11> 113 <Unit11>
119 <Filename Value="Global\vars.pas"/> 114 <Filename Value="Global\vars.pas"/>
120 <IsPartOfProject Value="True"/> 115 <IsPartOfProject Value="True"/>
121 <EditorIndex Value="5"/> 116 <EditorIndex Value="1"/>
122 <TopLine Value="329"/> 117 <TopLine Value="74"/>
123 <CursorPos X="5" Y="339"/> 118 <CursorPos X="3" Y="98"/>
124 <UsageCount Value="27"/> 119 <UsageCount Value="53"/>
125 <Loaded Value="True"/> 120 <Loaded Value="True"/>
126 <DefaultSyntaxHighlighter Value="Delphi"/> 121 <DefaultSyntaxHighlighter Value="Delphi"/>
127 </Unit11> 122 </Unit11>
128 <Unit12> 123 <Unit12>
129 <Filename Value="mainloop.pas"/> 124 <Filename Value="mainloop.pas"/>
130 <IsPartOfProject Value="True"/> 125 <IsPartOfProject Value="True"/>
131 <EditorIndex Value="4"/> 126 <EditorIndex Value="2"/>
132 <TopLine Value="3"/> 127 <TopLine Value="311"/>
133 <CursorPos X="9" Y="21"/> 128 <CursorPos X="22" Y="320"/>
134 <UsageCount Value="27"/> 129 <UsageCount Value="53"/>
135 <Loaded Value="True"/> 130 <Loaded Value="True"/>
136 <DefaultSyntaxHighlighter Value="Delphi"/> 131 <DefaultSyntaxHighlighter Value="Delphi"/>
137 </Unit12> 132 </Unit12>
@@ -141,56 +136,56 @@
141 <HasResources Value="True"/> 136 <HasResources Value="True"/>
142 <EditorIndex Value="-1"/> 137 <EditorIndex Value="-1"/>
143 <CursorPos Y="21"/> 138 <CursorPos Y="21"/>
144 <UsageCount Value="27"/> 139 <UsageCount Value="53"/>
145 <DefaultSyntaxHighlighter Value="Delphi"/> 140 <DefaultSyntaxHighlighter Value="Delphi"/>
146 </Unit13> 141 </Unit13>
147 <Unit14> 142 <Unit14>
148 <Filename Value="DirectX\Direct3DRM.pas"/> 143 <Filename Value="DirectX\Direct3DRM.pas"/>
149 <IsPartOfProject Value="True"/> 144 <IsPartOfProject Value="True"/>
150 <EditorIndex Value="-1"/> 145 <EditorIndex Value="-1"/>
151 <UsageCount Value="27"/> 146 <UsageCount Value="53"/>
152 <DefaultSyntaxHighlighter Value="Delphi"/> 147 <DefaultSyntaxHighlighter Value="Delphi"/>
153 </Unit14> 148 </Unit14>
154 <Unit15> 149 <Unit15>
155 <Filename Value="DirectX\DirectInput.pas"/> 150 <Filename Value="DirectX\DirectInput.pas"/>
156 <IsPartOfProject Value="True"/> 151 <IsPartOfProject Value="True"/>
157 <EditorIndex Value="-1"/> 152 <EditorIndex Value="-1"/>
158 <UsageCount Value="27"/> 153 <UsageCount Value="53"/>
159 <DefaultSyntaxHighlighter Value="Delphi"/> 154 <DefaultSyntaxHighlighter Value="Delphi"/>
160 </Unit15> 155 </Unit15>
161 <Unit16> 156 <Unit16>
162 <Filename Value="DirectX\DirectMusic.pas"/> 157 <Filename Value="DirectX\DirectMusic.pas"/>
163 <IsPartOfProject Value="True"/> 158 <IsPartOfProject Value="True"/>
164 <EditorIndex Value="-1"/> 159 <EditorIndex Value="-1"/>
165 <UsageCount Value="27"/> 160 <UsageCount Value="53"/>
166 <DefaultSyntaxHighlighter Value="Delphi"/> 161 <DefaultSyntaxHighlighter Value="Delphi"/>
167 </Unit16> 162 </Unit16>
168 <Unit17> 163 <Unit17>
169 <Filename Value="DirectX\DirectPlay.pas"/> 164 <Filename Value="DirectX\DirectPlay.pas"/>
170 <IsPartOfProject Value="True"/> 165 <IsPartOfProject Value="True"/>
171 <EditorIndex Value="-1"/> 166 <EditorIndex Value="-1"/>
172 <UsageCount Value="27"/> 167 <UsageCount Value="53"/>
173 <DefaultSyntaxHighlighter Value="Delphi"/> 168 <DefaultSyntaxHighlighter Value="Delphi"/>
174 </Unit17> 169 </Unit17>
175 <Unit18> 170 <Unit18>
176 <Filename Value="DirectX\DirectSetup.pas"/> 171 <Filename Value="DirectX\DirectSetup.pas"/>
177 <IsPartOfProject Value="True"/> 172 <IsPartOfProject Value="True"/>
178 <EditorIndex Value="-1"/> 173 <EditorIndex Value="-1"/>
179 <UsageCount Value="27"/> 174 <UsageCount Value="53"/>
180 <DefaultSyntaxHighlighter Value="Delphi"/> 175 <DefaultSyntaxHighlighter Value="Delphi"/>
181 </Unit18> 176 </Unit18>
182 <Unit19> 177 <Unit19>
183 <Filename Value="DirectX\DirectSound.pas"/> 178 <Filename Value="DirectX\DirectSound.pas"/>
184 <IsPartOfProject Value="True"/> 179 <IsPartOfProject Value="True"/>
185 <EditorIndex Value="-1"/> 180 <EditorIndex Value="-1"/>
186 <UsageCount Value="27"/> 181 <UsageCount Value="53"/>
187 <DefaultSyntaxHighlighter Value="Delphi"/> 182 <DefaultSyntaxHighlighter Value="Delphi"/>
188 </Unit19> 183 </Unit19>
189 <Unit20> 184 <Unit20>
190 <Filename Value="DirectX\Direct3D.pas"/> 185 <Filename Value="DirectX\Direct3D.pas"/>
191 <IsPartOfProject Value="True"/> 186 <IsPartOfProject Value="True"/>
192 <EditorIndex Value="-1"/> 187 <EditorIndex Value="-1"/>
193 <UsageCount Value="27"/> 188 <UsageCount Value="53"/>
194 <DefaultSyntaxHighlighter Value="Delphi"/> 189 <DefaultSyntaxHighlighter Value="Delphi"/>
195 </Unit20> 190 </Unit20>
196 <Unit21> 191 <Unit21>
@@ -200,7 +195,7 @@
200 <EditorIndex Value="-1"/> 195 <EditorIndex Value="-1"/>
201 <TopLine Value="372"/> 196 <TopLine Value="372"/>
202 <CursorPos X="33" Y="405"/> 197 <CursorPos X="33" Y="405"/>
203 <UsageCount Value="27"/> 198 <UsageCount Value="53"/>
204 <DefaultSyntaxHighlighter Value="Delphi"/> 199 <DefaultSyntaxHighlighter Value="Delphi"/>
205 </Unit21> 200 </Unit21>
206 <Unit22> 201 <Unit22>
@@ -209,7 +204,7 @@
209 <EditorIndex Value="-1"/> 204 <EditorIndex Value="-1"/>
210 <TopLine Value="154"/> 205 <TopLine Value="154"/>
211 <CursorPos X="21" Y="182"/> 206 <CursorPos X="21" Y="182"/>
212 <UsageCount Value="27"/> 207 <UsageCount Value="53"/>
213 <DefaultSyntaxHighlighter Value="Delphi"/> 208 <DefaultSyntaxHighlighter Value="Delphi"/>
214 </Unit22> 209 </Unit22>
215 <Unit23> 210 <Unit23>
@@ -217,7 +212,7 @@
217 <EditorIndex Value="-1"/> 212 <EditorIndex Value="-1"/>
218 <TopLine Value="121"/> 213 <TopLine Value="121"/>
219 <CursorPos X="27" Y="126"/> 214 <CursorPos X="27" Y="126"/>
220 <UsageCount Value="9"/> 215 <UsageCount Value="7"/>
221 <DefaultSyntaxHighlighter Value="Delphi"/> 216 <DefaultSyntaxHighlighter Value="Delphi"/>
222 </Unit23> 217 </Unit23>
223 <Unit24> 218 <Unit24>
@@ -227,7 +222,7 @@
227 <ResourceBaseClass Value="Form"/> 222 <ResourceBaseClass Value="Form"/>
228 <EditorIndex Value="-1"/> 223 <EditorIndex Value="-1"/>
229 <WindowIndex Value="-1"/> 224 <WindowIndex Value="-1"/>
230 <UsageCount Value="9"/> 225 <UsageCount Value="7"/>
231 <DefaultSyntaxHighlighter Value="LFM"/> 226 <DefaultSyntaxHighlighter Value="LFM"/>
232 </Unit24> 227 </Unit24>
233 <Unit25> 228 <Unit25>
@@ -235,12 +230,12 @@
235 <EditorIndex Value="-1"/> 230 <EditorIndex Value="-1"/>
236 <TopLine Value="3881"/> 231 <TopLine Value="3881"/>
237 <CursorPos Y="3898"/> 232 <CursorPos Y="3898"/>
238 <UsageCount Value="9"/> 233 <UsageCount Value="7"/>
239 </Unit25> 234 </Unit25>
240 <Unit26> 235 <Unit26>
241 <Filename Value="..\..\UGE\UnitMain.lfm"/> 236 <Filename Value="..\..\UGE\UnitMain.lfm"/>
242 <EditorIndex Value="-1"/> 237 <EditorIndex Value="-1"/>
243 <UsageCount Value="9"/> 238 <UsageCount Value="7"/>
244 <DefaultSyntaxHighlighter Value="LFM"/> 239 <DefaultSyntaxHighlighter Value="LFM"/>
245 </Unit26> 240 </Unit26>
246 <Unit27> 241 <Unit27>
@@ -248,7 +243,7 @@
248 <EditorIndex Value="-1"/> 243 <EditorIndex Value="-1"/>
249 <TopLine Value="60"/> 244 <TopLine Value="60"/>
250 <CursorPos Y="60"/> 245 <CursorPos Y="60"/>
251 <UsageCount Value="9"/> 246 <UsageCount Value="7"/>
252 <DefaultSyntaxHighlighter Value="Delphi"/> 247 <DefaultSyntaxHighlighter Value="Delphi"/>
253 </Unit27> 248 </Unit27>
254 <Unit28> 249 <Unit28>
@@ -256,136 +251,136 @@
256 <EditorIndex Value="-1"/> 251 <EditorIndex Value="-1"/>
257 <TopLine Value="764"/> 252 <TopLine Value="764"/>
258 <CursorPos X="11" Y="777"/> 253 <CursorPos X="11" Y="777"/>
259 <UsageCount Value="9"/> 254 <UsageCount Value="7"/>
260 </Unit28> 255 </Unit28>
261 <Unit29> 256 <Unit29>
262 <Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\win\wininc\redef.inc"/> 257 <Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\win\wininc\redef.inc"/>
263 <EditorIndex Value="-1"/> 258 <EditorIndex Value="-1"/>
264 <TopLine Value="727"/> 259 <TopLine Value="727"/>
265 <CursorPos X="10" Y="745"/> 260 <CursorPos X="10" Y="745"/>
266 <UsageCount Value="9"/> 261 <UsageCount Value="7"/>
267 </Unit29> 262 </Unit29>
268 </Units> 263 </Units>
269 <JumpHistory Count="30" HistoryIndex="29"> 264 <JumpHistory Count="30" HistoryIndex="29">
270 <Position1> 265 <Position1>
271 <Filename Value="UnitMain.pas"/> 266 <Filename Value="Sound\sound.pas"/>
272 <Caret Line="241" Column="28" TopLine="232"/> 267 <Caret Line="247" Column="15" TopLine="223"/>
273 </Position1> 268 </Position1>
274 <Position2> 269 <Position2>
275 <Filename Value="UnitMain.pas"/> 270 <Filename Value="Sound\sound.pas"/>
276 <Caret Line="248" Column="29" TopLine="232"/> 271 <Caret Line="153" Column="7" TopLine="135"/>
277 </Position2> 272 </Position2>
278 <Position3> 273 <Position3>
279 <Filename Value="UnitMain.pas"/> 274 <Filename Value="Sound\sound.pas"/>
280 <Caret Line="285" Column="14" TopLine="272"/> 275 <Caret Line="159" Column="5" TopLine="141"/>
281 </Position3> 276 </Position3>
282 <Position4> 277 <Position4>
283 <Filename Value="mainloop.pas"/> 278 <Filename Value="Sound\sound.pas"/>
284 <Caret Line="21" Column="11" TopLine="12"/> 279 <Caret Line="267" TopLine="258"/>
285 </Position4> 280 </Position4>
286 <Position5> 281 <Position5>
287 <Filename Value="UnitMain.pas"/> 282 <Filename Value="Sound\sound.pas"/>
288 <Caret Line="267" Column="11" TopLine="261"/> 283 <Caret Line="274" Column="50" TopLine="257"/>
289 </Position5> 284 </Position5>
290 <Position6> 285 <Position6>
291 <Filename Value="Sound\sound.pas"/> 286 <Filename Value="Sound\sound.pas"/>
292 <Caret Line="229" Column="12" TopLine="226"/> 287 <Caret Line="169" Column="31" TopLine="152"/>
293 </Position6> 288 </Position6>
294 <Position7> 289 <Position7>
295 <Filename Value="Sound\sound.pas"/> 290 <Filename Value="Sound\sound.pas"/>
296 <Caret Line="222" Column="44" TopLine="211"/> 291 <Caret Line="226" Column="3" TopLine="210"/>
297 </Position7> 292 </Position7>
298 <Position8> 293 <Position8>
299 <Filename Value="Sound\sound.pas"/> 294 <Filename Value="Sound\sound.pas"/>
300 <Caret Line="229" Column="11" TopLine="211"/> 295 <Caret Line="270" Column="7" TopLine="252"/>
301 </Position8> 296 </Position8>
302 <Position9> 297 <Position9>
303 <Filename Value="Sound\sound.pas"/> 298 <Filename Value="Sound\sound.pas"/>
304 <Caret Line="131" Column="11" TopLine="113"/> 299 <Caret Line="316" Column="5" TopLine="299"/>
305 </Position9> 300 </Position9>
306 <Position10> 301 <Position10>
307 <Filename Value="Sound\sound.pas"/> 302 <Filename Value="Sound\sound.pas"/>
308 <Caret Line="229" Column="11" TopLine="211"/> 303 <Caret Line="545" Column="21" TopLine="529"/>
309 </Position10> 304 </Position10>
310 <Position11> 305 <Position11>
311 <Filename Value="Sound\sound.pas"/> 306 <Filename Value="Sound\sound.pas"/>
312 <Caret Line="131" Column="11" TopLine="113"/> 307 <Caret Line="568" Column="21" TopLine="551"/>
313 </Position11> 308 </Position11>
314 <Position12> 309 <Position12>
315 <Filename Value="Sound\sound.pas"/> 310 <Filename Value="Sound\sound.pas"/>
316 <Caret Line="229" Column="11" TopLine="211"/> 311 <Caret Line="545" Column="21" TopLine="528"/>
317 </Position12> 312 </Position12>
318 <Position13> 313 <Position13>
319 <Filename Value="Sound\sound.pas"/> 314 <Filename Value="Sound\sound.pas"/>
320 <Caret Line="131" Column="11" TopLine="113"/> 315 <Caret Line="568" Column="21" TopLine="551"/>
321 </Position13> 316 </Position13>
322 <Position14> 317 <Position14>
323 <Filename Value="UnitMain.pas"/> 318 <Filename Value="Sound\sound.pas"/>
324 <Caret Line="277" Column="13" TopLine="269"/> 319 <Caret Line="545" Column="21" TopLine="528"/>
325 </Position14> 320 </Position14>
326 <Position15> 321 <Position15>
327 <Filename Value="Sound\sound.pas"/> 322 <Filename Value="Sound\sound.pas"/>
328 <Caret Line="455" Column="17" TopLine="451"/> 323 <Caret Line="647" Column="12" TopLine="622"/>
329 </Position15> 324 </Position15>
330 <Position16> 325 <Position16>
331 <Filename Value="Sound\sound.pas"/> 326 <Filename Value="Sound\sound.pas"/>
332 <Caret Line="457" Column="6" TopLine="448"/> 327 <Caret Line="309" Column="11" TopLine="283"/>
333 </Position16> 328 </Position16>
334 <Position17> 329 <Position17>
335 <Filename Value="UnitMain.pas"/> 330 <Filename Value="Sound\sound.pas"/>
336 <Caret Line="550" Column="6" TopLine="544"/> 331 <Caret Line="314" Column="8" TopLine="283"/>
337 </Position17> 332 </Position17>
338 <Position18> 333 <Position18>
339 <Filename Value="UnitMain.pas"/> 334 <Filename Value="Sound\sound.pas"/>
340 <Caret Line="283" Column="11" TopLine="267"/> 335 <Caret Line="315" Column="7" TopLine="283"/>
341 </Position18> 336 </Position18>
342 <Position19> 337 <Position19>
343 <Filename Value="mainloop.pas"/> 338 <Filename Value="Sound\sound.pas"/>
344 <Caret Line="21" Column="11" TopLine="3"/> 339 <Caret Line="271" Column="9" TopLine="267"/>
345 </Position19> 340 </Position19>
346 <Position20> 341 <Position20>
347 <Filename Value="UnitMain.pas"/> 342 <Filename Value="Sound\sound.pas"/>
348 <Caret Line="278" Column="27" TopLine="263"/> 343 <Caret Line="286" Column="24" TopLine="269"/>
349 </Position20> 344 </Position20>
350 <Position21> 345 <Position21>
351 <Filename Value="UnitMain.pas"/> 346 <Filename Value="Sound\sound.pas"/>
352 <Caret Line="294" Column="38" TopLine="278"/> 347 <Caret Line="289" Column="44" TopLine="272"/>
353 </Position21> 348 </Position21>
354 <Position22> 349 <Position22>
355 <Filename Value="Cpu\z80cpu.pas"/> 350 <Filename Value="Sound\sound.pas"/>
356 <Caret Line="217" Column="5" TopLine="204"/> 351 <Caret Line="290" Column="47" TopLine="273"/>
357 </Position22> 352 </Position22>
358 <Position23> 353 <Position23>
359 <Filename Value="mainloop.pas"/> 354 <Filename Value="Sound\sound.pas"/>
360 <Caret Line="415" Column="19" TopLine="392"/> 355 <Caret Line="249" Column="17" TopLine="232"/>
361 </Position23> 356 </Position23>
362 <Position24> 357 <Position24>
363 <Filename Value="mainloop.pas"/> 358 <Filename Value="Sound\sound.pas"/>
364 <Caret Line="293" TopLine="277"/> 359 <Caret Line="291" Column="11" TopLine="278"/>
365 </Position24> 360 </Position24>
366 <Position25> 361 <Position25>
367 <Filename Value="mainloop.pas"/> 362 <Filename Value="Sound\sound.pas"/>
368 <Caret Line="294" Column="20" TopLine="277"/> 363 <Caret Line="70" Column="13" TopLine="55"/>
369 </Position25> 364 </Position25>
370 <Position26> 365 <Position26>
371 <Filename Value="UnitMain.pas"/> 366 <Filename Value="Sound\sound.pas"/>
372 <Caret Line="280" Column="27" TopLine="263"/> 367 <Caret Line="629" Column="13" TopLine="599"/>
373 </Position26> 368 </Position26>
374 <Position27> 369 <Position27>
375 <Filename Value="UnitMain.pas"/> 370 <Filename Value="Sound\sound.pas"/>
376 <Caret Line="301" Column="32" TopLine="273"/> 371 <Caret Line="352" Column="43" TopLine="332"/>
377 </Position27> 372 </Position27>
378 <Position28> 373 <Position28>
379 <Filename Value="UnitMain.pas"/> 374 <Filename Value="Sound\sound.pas"/>
380 <Caret Line="305" Column="38" TopLine="281"/> 375 <Caret Line="348" Column="47" TopLine="338"/>
381 </Position28> 376 </Position28>
382 <Position29> 377 <Position29>
383 <Filename Value="UnitMain.pas"/> 378 <Filename Value="Sound\sound.pas"/>
384 <Caret Line="315" TopLine="290"/> 379 <Caret Line="349" Column="37" TopLine="326"/>
385 </Position29> 380 </Position29>
386 <Position30> 381 <Position30>
387 <Filename Value="UnitMain.pas"/> 382 <Filename Value="Sound\sound.pas"/>
388 <Caret Line="324" TopLine="296"/> 383 <Caret Line="10" Column="12"/>
389 </Position30> 384 </Position30>
390 </JumpHistory> 385 </JumpHistory>
391 </ProjectSession> 386 </ProjectSession>
ModifiedSound/sound.pas +17−125
@@ -6,7 +6,7 @@
6 | 6 |
7 | http://www.tu-ilmenau.de/~hackbart 7 | http://www.tu-ilmenau.de/~hackbart
8 +----------------------------------------------------------------------------+} 8 +----------------------------------------------------------------------------+}
9 { $define dsound} 9
10 unit sound; 10 unit sound;
11 11
12 {$MODE Delphi} 12 {$MODE Delphi}
@@ -150,11 +150,9 @@ var
150 cnt: integer; 150 cnt: integer;
151 end; 151 end;
152 152
153 winHandle: hwnd;
154
155 implementation 153 implementation
156 154
157 uses DirectSound, vars; 155 uses vars;
158 156
159 const 157 const
160 dev: HWAVEOUT = 0; 158 dev: HWAVEOUT = 0;
@@ -170,7 +168,8 @@ var
170 ready: integer; 168 ready: integer;
171 bufPos, bufCycles, bufLVal, bufRVal: integer; 169 bufPos, bufCycles, bufLVal, bufRVal: integer;
172 WH: PWAVEHDR; 170 WH: PWAVEHDR;
173 //CallBack:TFNDrvCallBack; 171
172 MyFile: file of Byte;
174 173
175 procedure WaveCallback(hdrvr: HDRVR; uMsg: UINT; dwUser: DWORD; dw1, dw2: DWORD); stdcall; 174 procedure WaveCallback(hdrvr: HDRVR; uMsg: UINT; dwUser: DWORD; dw1, dw2: DWORD); stdcall;
176 var 175 var
@@ -203,29 +202,11 @@ begin
203 end; 202 end;
204 203
205 var 204 var
206 lpDS: IDIRECTSOUND;
207 lpBuf: IDIRECTSOUNDBUFFER;
208 lpDSNot: IDIRECTSOUNDNOTIFY;
209 sndEv: array[0..1] of THANDLE; 205 sndEv: array[0..1] of THANDLE;
210 buf: array[0..2047] of byte; 206 buf: array[0..2047] of byte;
211 bufIndx: word = 0; 207 bufIndx: word = 0;
212 playing, left: integer; 208 playing, left: integer;
213 209
214
215 {$ifdef dsound}
216 procedure CreateSoundBuffer; forward;
217
218 procedure EnableDirectSound;
219 var
220 res: integer;
221 begin
222 res := DirectSoundCreate(nil, lpDS, nil);
223 res := lpDS.SetCooperativeLevel(winHandle, DSSCL_NORMAL);
224 CreateSoundBuffer;
225 end;
226
227 {$endif}
228
229 procedure EnableSound; 210 procedure EnableSound;
230 var 211 var
231 outFormatex: TWAVEFORMATEX; 212 outFormatex: TWAVEFORMATEX;
@@ -246,11 +227,6 @@ begin
246 bufLVal := 0; 227 bufLVal := 0;
247 bufRVal := 0; 228 bufRVal := 0;
248 229
249 {$ifdef dsound}
250 EnableDirectSound;
251 exit;
252 {$endif}
253
254 outFormatex.wFormatTag := WAVE_FORMAT_PCM; 230 outFormatex.wFormatTag := WAVE_FORMAT_PCM;
255 outFormatex.wBitsPerSample := 8; 231 outFormatex.wBitsPerSample := 8;
256 outFormatex.nChannels := 2; 232 outFormatex.nChannels := 2;
@@ -290,104 +266,17 @@ begin
290 soundEnable := False; 266 soundEnable := False;
291 end; 267 end;
292 268
293 {$ifdef dsound}
294 procedure CreateSoundBuffer;
295 var
296 d: TDSBUFFERDESC;
297 wf: TWAVEFORMATEX;
298 ptr: pointer;
299 res: integer;
300 n: DWord;
301 pn: array[0..1] of TDSBPOSITIONNOTIFY;
302 begin
303 wf.wFormatTag := WAVE_FORMAT_PCM;
304 wf.nChannels := 2;
305 wf.nSamplesPerSec := 22050;
306 wf.nAvgBytesPerSec := 22050 * 2;
307 wf.nBlockAlign := 2;
308 wf.wBitsPerSample := 8;
309 wf.cbSize := 0;
310
311 zeromemory(@d, sizeof(d));
312 d.dwSize := sizeof(d);
313 d.dwFlags := DSBCAPS_CTRLPOSITIONNOTIFY or DSBCAPS_GLOBALFOCUS;
314 d.dwBufferBytes := 4096;
315 d.lpwfxFormat := @wf;
316 lpDS.CreateSoundBuffer(d, lpBuf, nil);
317 lpBuf.SetFormat(WF);
318
319 sndEv[0] := CreateEvent(nil, False, False, nil);
320 sndEv[1] := CreateEvent(nil, False, False, nil);
321
322 pn[0].dwOffset := 0;
323 pn[0].hEventNotify := sndEv[0];
324 pn[1].dwOffset := d.dwBufferBytes div 2;
325 pn[1].hEventNotify := sndEv[1];
326 lpBuf.QueryInterface(IID_IDirectSoundNotify, lpDSNot);
327 lpDSNot.SetNotificationPositions(2, pn[0]);
328 lpDSNot.SetNotificationPositions(2, pn[1]);
329 bufIndx := 0;
330 playing := 0;
331 left := 2;
332 end;
333
334 procedure DirectSoundOutput(l, r: byte);
335 var
336 i: integer;
337 ptr1, ptr2: pointer;
338 len1, len2: DWord;
339 begin
340 buf[bufIndx] := l;
341 Inc(bufINDX);
342 buf[bufIndx] := r;
343 Inc(bufINDX);
344 if bufIndx >= 2048 then
345 begin
346 bufIndx := 0;
347 if playing > 0 then
348 begin
349 i := MsgWaitForMultipleObjects(2, sndEv, False, INFINITE, 0);
350 Dec(i, WAIT_OBJECT_0);
351 end
352 else
353 i := 1;
354 if i = 0 then
355 begin
356
357 lpBuf.Lock(2048, 2048, ptr1, len1, ptr2, len2, 0);
358 move(buf, ptr1^, len1);
359 lpBuf.Unlock(ptr1, len1, ptr2, len2);
360 end
361 else
362 begin
363 lpBuf.Lock(0, 2048, ptr1, len1, ptr2, len2, 0);
364 move(buf, ptr1^, len1);
365 lpBuf.Unlock(ptr1, len1, ptr2, len2);
366 end;
367 if playing = 0 then
368 begin
369 lpBuf.Play(0, 0, DSBPLAY_LOOPING);
370 playing := 1;
371 end;
372 end;
373 end;
374
375 {$endif}
376
377 procedure SoundDoOut(l, r: byte; cycles: integer); 269 procedure SoundDoOut(l, r: byte; cycles: integer);
270 var
271 Idx: Integer;
378 begin 272 begin
379 Inc(bufLVal, l * cycles); 273 Inc(bufLVal, l * cycles);
380 Inc(bufRVal, r * cycles); 274 Inc(bufRVal, r * cycles);
381 Inc(bufCycles, cycles); 275 Inc(bufCycles, cycles);
382 if bufCycles >= sampleCycles then 276 if bufCycles >= sampleCycles then
383 begin 277 begin
384 {$ifdef dsound} 278 //Write(StdOut, bufLVal div sampleCycles);
385 DirectSoundOutput(bufRVal div sampleCycles, bufLVal div sampleCycles); 279 //Write(StdOut, bufRVal div SampleCycles);
386 bufCycles := 0;
387 bufLVal := 0;
388 bufRVal := 0;
389 exit;
390 {$endif}
391 byte(PChar(bufPtr[curBlock])[bufPos]) := bufRVal div sampleCycles; 280 byte(PChar(bufPtr[curBlock])[bufPos]) := bufRVal div sampleCycles;
392 byte(PChar(bufPtr[curBlock])[bufPos + 1]) := bufLVal div sampleCycles; 281 byte(PChar(bufPtr[curBlock])[bufPos + 1]) := bufLVal div sampleCycles;
393 bufCycles := 0; 282 bufCycles := 0;
@@ -396,6 +285,11 @@ begin
396 bufRVal := 0; 285 bufRVal := 0;
397 if bufPos >= 2048 then 286 if bufPos >= 2048 then
398 begin 287 begin
288 (*for Idx := 0 to 2048 do begin
289 Write(Char((bufPtr[curBlock]+Idx)^));
290 byte(PChar(bufPtr[curBlock])[bufPos]) := 0;
291 end;*)
292 //BlockWrite(MyFile, bufPtr[curBlock]^, 2048);
399 // ignore next line 293 // ignore next line
400 //while ready=0 do Sleep(3); 294 //while ready=0 do Sleep(3);
401 Dec(ready); 295 Dec(ready);
@@ -445,19 +339,14 @@ procedure SoundUpdate(cycles: integer);
445 var 339 var
446 n, stage: integer; 340 n, stage: integer;
447 begin 341 begin
448 {$ifdef dsound}
449 if not soundEnable then
450 exit;
451 {$else}
452 if (not soundEnable) or (bufPtr[0] = nil) then 342 if (not soundEnable) or (bufPtr[0] = nil) then
453 exit; 343 exit;
454 {$endif}
455 if sndRegChange then 344 if sndRegChange then
456 begin 345 begin
457 snd[1].Freq := m_iram[$FF13] or ((m_iram[$FF14] and 7) shl 8); 346 snd[1].Freq := m_iram[$FF13] or ((m_iram[$FF14] and 7) shl 8);
458 snd[2].Freq := m_iram[$FF18] or ((m_iram[$FF19] and 7) shl 8); 347 snd[2].Freq := m_iram[$FF18] or ((m_iram[$FF19] and 7) shl 8);
459 snd[3].Freq := m_iram[$FF1d] or ((m_iram[$FF1e] and 7) shl 8); 348 snd[3].Freq := m_iram[$FF1d] or ((m_iram[$FF1e] and 7) shl 8);
460 case m_iram[$FF22] and 7 of 349 case m_iram[$FF22] and 7 of //NICK (7 -> 15)... wrong number of bits!
461 0: snd[4].Freq := (512 * 1024 * 2) shr ((m_iram[$FF22] shr 4) + 1); 350 0: snd[4].Freq := (512 * 1024 * 2) shr ((m_iram[$FF22] shr 4) + 1);
462 1: snd[4].Freq := (512 * 1024) shr ((m_iram[$FF22] shr 4) + 1); 351 1: snd[4].Freq := (512 * 1024) shr ((m_iram[$FF22] shr 4) + 1);
463 2: snd[4].Freq := ((512 * 1024) div 2) shr ((m_iram[$FF22] shr 4) + 1); 352 2: snd[4].Freq := ((512 * 1024) div 2) shr ((m_iram[$FF22] shr 4) + 1);
@@ -774,4 +663,7 @@ begin
774 sampleCycles := n; 663 sampleCycles := n;
775 end; 664 end;
776 665
666 begin
667 Assign(MyFile, 'outf2.pcm');
668 Rewrite(MyFile);
777 end. 669 end.
Modifiedmainloop.pas +5−4
@@ -18,7 +18,7 @@ uses Windows;
18 function main_loop(a: DWord): DWORD; 18 function main_loop(a: DWord): DWORD;
19 procedure setzewindow(h_wnd: HWND); 19 procedure setzewindow(h_wnd: HWND);
20 20
21 function z80_decode : Byte; pascal; 21 function z80_decode: byte; pascal;
22 procedure z80_reset; 22 procedure z80_reset;
23 23
24 var 24 var
@@ -291,9 +291,9 @@ end;
291 const 291 const
292 cycles_per_hblank = 451; 292 cycles_per_hblank = 451;
293 293
294 function z80_decode : Byte; 294 function z80_decode: byte;
295 var 295 var
296 Count: Byte; 296 Count: byte;
297 begin 297 begin
298 if (gbr_ime) and (m_iram[$ff0f] and 31 > 0) then 298 if (gbr_ime) and (m_iram[$ff0f] and 31 > 0) then
299 IFlags; // Start Interupt 299 IFlags; // Start Interupt
@@ -315,7 +315,8 @@ begin
315 end; 315 end;
316 316
317 asm 317 asm
318 CLC end; // Set the Carry-Flag to zero 318 CLC
319 end; // Set the Carry-Flag to zero
319 Count := z80[code]; 320 Count := z80[code];
320 SoundUpdate(Count * (3 - gb_speed)); 321 SoundUpdate(Count * (3 - gb_speed));
321 cnumber := Count div gb_speed; 322 cnumber := Count div gb_speed;
Addedtest_gb.bat +2−0
@@ -0,0 +1,2 @@
1 @echo off
2 lib\i386-win32\GBEmu.exe | ffplay -f u8 -ar 22050 -ac 2 -