Revision 4f3cb3be hw/musicpal.c
b/hw/musicpal.c | ||
---|---|---|
255 | 255 |
static void audio_callback(void *opaque, int free_out, int free_in) |
256 | 256 |
{ |
257 | 257 |
musicpal_audio_state *s = opaque; |
258 |
int16_t *codec_buffer, *mem_buffer; |
|
258 |
int16_t *codec_buffer; |
|
259 |
void *mem_buffer; |
|
259 | 260 |
int pos, block_size; |
260 | 261 |
|
261 | 262 |
if (!(s->playback_mode & MP_AUDIO_PLAYBACK_EN)) |
... | ... | |
276 | 277 |
if (s->playback_mode & MP_AUDIO_MONO) { |
277 | 278 |
codec_buffer = wm8750_dac_buffer(s->wm, block_size >> 1); |
278 | 279 |
for (pos = 0; pos < block_size; pos += 2) { |
279 |
*codec_buffer++ = *mem_buffer; |
|
280 |
*codec_buffer++ = *mem_buffer++; |
|
280 |
*codec_buffer++ = *(uint16_t *)mem_buffer; |
|
281 |
*codec_buffer++ = *(uint16_t *)mem_buffer; |
|
282 |
mem_buffer += 2; |
|
281 | 283 |
} |
282 | 284 |
} else |
283 | 285 |
memcpy(wm8750_dac_buffer(s->wm, block_size >> 2), |
... | ... | |
286 | 288 |
if (s->playback_mode & MP_AUDIO_MONO) { |
287 | 289 |
codec_buffer = wm8750_dac_buffer(s->wm, block_size); |
288 | 290 |
for (pos = 0; pos < block_size; pos++) { |
289 |
*codec_buffer++ = cpu_to_le16(256 * *((int8_t *)mem_buffer));
|
|
290 |
*codec_buffer++ = cpu_to_le16(256 * *((int8_t *)mem_buffer)++);
|
|
291 |
*codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer);
|
|
292 |
*codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer++);
|
|
291 | 293 |
} |
292 | 294 |
} else { |
293 | 295 |
codec_buffer = wm8750_dac_buffer(s->wm, block_size >> 1); |
294 | 296 |
for (pos = 0; pos < block_size; pos += 2) { |
295 |
*codec_buffer++ = cpu_to_le16(256 * *((int8_t *)mem_buffer)++);
|
|
296 |
*codec_buffer++ = cpu_to_le16(256 * *((int8_t *)mem_buffer)++);
|
|
297 |
*codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer++);
|
|
298 |
*codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer++);
|
|
297 | 299 |
} |
298 | 300 |
} |
299 | 301 |
} |
Also available in: Unified diff