call rdpsnd_dsp_process from a better place

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1262 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2006-09-17 18:08:51 +00:00
parent 45cc3f12f4
commit 4c83a35b48
3 changed files with 26 additions and 26 deletions

View File

@ -226,7 +226,10 @@ rdpsnd_process(STREAM s)
current_format = format;
}
current_driver->wave_out_write(s, tick, packet_index);
current_driver->
wave_out_write(rdpsnd_dsp_process
(s, current_driver, &formats[current_format]), tick,
packet_index);
awaiting_data_packet = False;
return;
}
@ -394,18 +397,9 @@ rdpsnd_queue_write(STREAM s, uint16 tick, uint8 index)
queue_hi = next_hi;
packet->s = *s;
packet->s.data =
rdpsnd_dsp_process(s->data, s->size, current_driver, &formats[current_format]);
packet->s.p = packet->s.data + 4;
packet->s.end = packet->s.data + s->size;
packet->tick = tick;
packet->index = index;
#if 0 /* Handled by DSP */
/* we steal the data buffer from s, give it a new one */
s->data = xmalloc(s->size);
#endif
if (!g_dsp_busy)
current_driver->wave_out_play();
}

View File

@ -92,8 +92,8 @@ rdpsnd_dsp_softvol(unsigned char *buffer, unsigned int size, WAVEFORMATEX * form
}
}
DEBUG(("using softvol with factors left: %d, right: %d (%d/%d)\n", factor_left, factor_right,
format->wBitsPerSample, format->nChannels));
DEBUG(("using softvol with factors left: %d, right: %d (%d/%d)\n", factor_left,
factor_right, format->wBitsPerSample, format->nChannels));
}
void
@ -113,24 +113,30 @@ rdpsnd_dsp_swapbytes(unsigned char *buffer, unsigned int size, WAVEFORMATEX * fo
}
}
unsigned char *
rdpsnd_dsp_process(unsigned char *inbuffer, unsigned int size, struct audio_driver *current_driver,
WAVEFORMATEX * format)
STREAM
rdpsnd_dsp_process(STREAM s, struct audio_driver *current_driver, WAVEFORMATEX * format)
{
unsigned char *outbuffer;
static struct stream out;
outbuffer = xmalloc(size);
memcpy(outbuffer, inbuffer, size);
/* Software volume control */
/* softvol and byteswap do not change the amount of data they
return, so they can operate on the input-stream */
if (current_driver->wave_out_volume == rdpsnd_dsp_softvol_set)
rdpsnd_dsp_softvol(outbuffer, size, format);
rdpsnd_dsp_softvol(s->data, s->size, format);
#ifdef B_ENDIAN
if (current_driver->need_byteswap_on_be)
rdpsnd_dsp_swapbytes(outbuffer, size, format);
rdpsnd_dsp_swapbytes(s->data, s->size, format);
#endif
return outbuffer;
/* FIXME: where do we lose the 4 bytes referenced here? */
out.data = xmalloc(s->size - 4);
memcpy(out.data, s->data + 4, s->size - 4);
out.size = s->size - 4;
out.p = out.data;
out.end = out.p + out.size;
return &out;
}

View File

@ -19,5 +19,5 @@
*/
void rdpsnd_dsp_softvol_set(uint16 left, uint16 right);
unsigned char *rdpsnd_dsp_process(unsigned char *inbuffer, unsigned int size,
struct audio_driver *current_driver, WAVEFORMATEX * format);
STREAM rdpsnd_dsp_process(STREAM s, struct audio_driver *current_driver, WAVEFORMATEX * format);