@@ -161,8 +161,6 @@ procedure EndWritingSoundToStream; |
| 161 |
var |
161 |
var |
| 162 |
soundEnable: boolean; |
162 |
soundEnable: boolean; |
| 163 |
sndRegChange: boolean; |
163 |
sndRegChange: boolean; |
| 164 |
sndBuffer: ^Single; |
|
|
| 165 |
sndBytesWritten: Integer; |
|
|
| 166 |
snd: array[1..4] of record |
164 |
snd: array[1..4] of record |
| 167 |
// public: |
165 |
// public: |
| 168 |
ChannelOFF: boolean; // (un)mute Channel |
166 |
ChannelOFF: boolean; // (un)mute Channel |
@@ -191,6 +189,10 @@ const |
| 191 |
var |
189 |
var |
| 192 |
PlayStream: TSDL_AudioDeviceID; |
190 |
PlayStream: TSDL_AudioDeviceID; |
| 193 |
bufCycles, bufLVal, bufRVal: integer; |
191 |
bufCycles, bufLVal, bufRVal: integer; |
|
|
192 |
|
|
|
193 |
sndBuffer: ^Single; |
|
|
194 |
sndBytesWritten: Integer; |
|
|
195 |
|
| 194 |
lfsr: Cardinal = 0; |
196 |
lfsr: Cardinal = 0; |
| 195 |
|
197 |
|
| 196 |
WritingSoundToStream: Boolean; |
198 |
WritingSoundToStream: Boolean; |
@@ -269,6 +271,7 @@ begin |
| 269 |
sndBuffer := PSingle(Stream); |
271 |
sndBuffer := PSingle(Stream); |
| 270 |
while sndBytesWritten < len do |
272 |
while sndBytesWritten < len do |
| 271 |
z80_decode; |
273 |
z80_decode; |
|
|
274 |
if sndBytesWritten > len then Writeln(StdErr, '[WARNING] Audio callback wrote into uninitialized ram!'); |
| 272 |
sndBytesWritten := 0; |
275 |
sndBytesWritten := 0; |
| 273 |
end; |
276 |
end; |
| 274 |
|
277 |
|
@@ -287,7 +290,7 @@ begin |
| 287 |
Want.freq := playbackFrequency; |
290 |
Want.freq := playbackFrequency; |
| 288 |
Want.format := AUDIO_F32; |
291 |
Want.format := AUDIO_F32; |
| 289 |
Want.channels := 2; |
292 |
Want.channels := 2; |
| 290 |
Want.samples := 1024; //512; |
293 |
Want.samples := 512; |
| 291 |
Want.callback := @AudioCallback; |
294 |
Want.callback := @AudioCallback; |
| 292 |
|
295 |
|
| 293 |
PlayStream := SDL_OpenAudioDevice(nil, 0, @Want, @Have, 0); |
296 |
PlayStream := SDL_OpenAudioDevice(nil, 0, @Want, @Have, 0); |
@@ -336,7 +339,6 @@ begin |
| 336 |
sndBuffer^ := buf[1]; |
339 |
sndBuffer^ := buf[1]; |
| 337 |
Inc(sndBuffer); |
340 |
Inc(sndBuffer); |
| 338 |
Inc(sndBytesWritten, SampleSize); |
341 |
Inc(sndBytesWritten, SampleSize); |
| 339 |
//SDL_QueueAudio(PlayStream, @buf, SampleSize); |
|
|
| 340 |
end; |
342 |
end; |
| 341 |
end; |
343 |
end; |
| 342 |
end; |
344 |
end; |