Pass the frame count to aluMixData
This commit is contained in:
parent
eeea9631ce
commit
6636131d3b
@ -1205,7 +1205,6 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
|
||||
static float DryBuffer[BUFFERSIZE][OUTPUTCHANNELS];
|
||||
ALuint SamplesToDo;
|
||||
ALeffectslot *ALEffectSlot;
|
||||
ALuint BlockAlign;
|
||||
int fpuState;
|
||||
ALuint i;
|
||||
|
||||
@ -1221,11 +1220,6 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
|
||||
(void)fpuState;
|
||||
#endif
|
||||
|
||||
/* Figure output format variables */
|
||||
BlockAlign = aluChannelsFromFormat(format);
|
||||
BlockAlign *= aluBytesFromFormat(format);
|
||||
|
||||
size /= BlockAlign;
|
||||
while(size > 0)
|
||||
{
|
||||
/* Setup variables */
|
||||
|
@ -166,7 +166,6 @@ static ALuint ALSAProc(ALvoid *ptr)
|
||||
snd_pcm_sframes_t avail, commitres;
|
||||
snd_pcm_uframes_t offset, frames;
|
||||
char *WritePtr;
|
||||
int WriteCnt;
|
||||
int err;
|
||||
|
||||
while(!data->killNow)
|
||||
@ -230,8 +229,7 @@ static ALuint ALSAProc(ALvoid *ptr)
|
||||
}
|
||||
|
||||
WritePtr = (char*)areas->addr + (offset * areas->step / 8);
|
||||
WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames);
|
||||
aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format);
|
||||
aluMixData(pDevice->Context, WritePtr, frames, pDevice->Format);
|
||||
|
||||
commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames);
|
||||
if (commitres < 0 || (commitres-frames) != 0)
|
||||
@ -267,12 +265,12 @@ static ALuint ALSANoMMapProc(ALvoid *ptr)
|
||||
break;
|
||||
}
|
||||
|
||||
avail = data->size / psnd_pcm_frames_to_bytes(data->pcmHandle, 1);
|
||||
SuspendContext(NULL);
|
||||
aluMixData(pDevice->Context, data->buffer, data->size, pDevice->Format);
|
||||
aluMixData(pDevice->Context, data->buffer, avail, pDevice->Format);
|
||||
ProcessContext(NULL);
|
||||
|
||||
WritePtr = data->buffer;
|
||||
avail = (snd_pcm_uframes_t)data->size / psnd_pcm_frames_to_bytes(data->pcmHandle, 1);
|
||||
while(avail > 0)
|
||||
{
|
||||
int ret = psnd_pcm_writei(data->pcmHandle, WritePtr, avail);
|
||||
|
@ -132,8 +132,8 @@ static ALuint DSoundProc(ALvoid *ptr)
|
||||
{
|
||||
// If we have an active context, mix data directly into output buffer otherwise fill with silence
|
||||
SuspendContext(NULL);
|
||||
aluMixData(pDevice->Context, WritePtr1, WriteCnt1, pDevice->Format);
|
||||
aluMixData(pDevice->Context, WritePtr2, WriteCnt2, pDevice->Format);
|
||||
aluMixData(pDevice->Context, WritePtr1, WriteCnt1/DSBCaps.nBlockAlign, pDevice->Format);
|
||||
aluMixData(pDevice->Context, WritePtr2, WriteCnt2/DSBCaps.nBlockAlign, pDevice->Format);
|
||||
ProcessContext(NULL);
|
||||
|
||||
// Unlock output buffer only when successfully locked
|
||||
|
@ -79,15 +79,19 @@ static ALuint OSSProc(ALvoid *ptr)
|
||||
{
|
||||
ALCdevice *pDevice = (ALCdevice*)ptr;
|
||||
oss_data *data = (oss_data*)pDevice->ExtraData;
|
||||
ALint frameSize;
|
||||
int wrote;
|
||||
|
||||
frameSize = aluChannelsFromFormat(pDevice->Format) *
|
||||
aluBytesFromFormat(pDevice->Format);
|
||||
|
||||
while(!data->killNow && !pDevice->Connected)
|
||||
{
|
||||
ALint len = data->data_size;
|
||||
ALubyte *WritePtr = data->mix_data;
|
||||
|
||||
SuspendContext(NULL);
|
||||
aluMixData(pDevice->Context, WritePtr, len, pDevice->Format);
|
||||
aluMixData(pDevice->Context, WritePtr, len/frameSize, pDevice->Format);
|
||||
ProcessContext(NULL);
|
||||
|
||||
while(len > 0 && !data->killNow)
|
||||
|
@ -56,17 +56,13 @@ static int pa_callback(const void *inputBuffer, void *outputBuffer,
|
||||
const PaStreamCallbackFlags statusFlags, void *userData)
|
||||
{
|
||||
ALCdevice *device = (ALCdevice*)userData;
|
||||
int frameSize;
|
||||
|
||||
(void)inputBuffer;
|
||||
(void)timeInfo;
|
||||
(void)statusFlags;
|
||||
|
||||
frameSize = aluBytesFromFormat(device->Format);
|
||||
frameSize *= aluChannelsFromFormat(device->Format);
|
||||
|
||||
SuspendContext(NULL);
|
||||
aluMixData(device->Context, outputBuffer, framesPerBuffer*frameSize, device->Format);
|
||||
aluMixData(device->Context, outputBuffer, framesPerBuffer, device->Format);
|
||||
ProcessContext(NULL);
|
||||
|
||||
return 0;
|
||||
|
@ -169,10 +169,11 @@ static void context_state_callback(pa_context *context, void *pdata) //{{{
|
||||
static void stream_write_callback(pa_stream *stream, size_t len, void *pdata) //{{{
|
||||
{
|
||||
ALCdevice *Device = pdata;
|
||||
pulse_data *data = Device->ExtraData;
|
||||
void *buf = ppa_xmalloc0(len);
|
||||
|
||||
SuspendContext(NULL);
|
||||
aluMixData(Device->Context, buf, len, Device->Format);
|
||||
aluMixData(Device->Context, buf, len/data->frame_size, Device->Format);
|
||||
ProcessContext(NULL);
|
||||
|
||||
ppa_stream_write(stream, buf, len, ppa_xfree, 0, PA_SEEK_RELATIVE);
|
||||
|
@ -54,15 +54,19 @@ static ALuint SolarisProc(ALvoid *ptr)
|
||||
ALCdevice *pDevice = (ALCdevice*)ptr;
|
||||
solaris_data *data = (solaris_data*)pDevice->ExtraData;
|
||||
int remaining = 0;
|
||||
ALint frameSize;
|
||||
int wrote;
|
||||
|
||||
frameSize = aluChannelsFromFormat(pDevice->Format) *
|
||||
aluBytesFromFormat(pDevice->Format);
|
||||
|
||||
while(!data->killNow && !pDevice->Connected)
|
||||
{
|
||||
ALint len = data->data_size;
|
||||
ALubyte *WritePtr = data->mix_data;
|
||||
|
||||
SuspendContext(NULL);
|
||||
aluMixData(pDevice->Context, WritePtr, len, pDevice->Format);
|
||||
aluMixData(pDevice->Context, WritePtr, len/frameSize, pDevice->Format);
|
||||
ProcessContext(NULL);
|
||||
|
||||
while(len > 0 && !data->killNow)
|
||||
|
@ -75,7 +75,7 @@ static ALuint WaveProc(ALvoid *ptr)
|
||||
while(avail >= pDevice->UpdateSize)
|
||||
{
|
||||
SuspendContext(NULL);
|
||||
aluMixData(pDevice->Context, data->buffer, data->size,
|
||||
aluMixData(pDevice->Context, data->buffer, pDevice->UpdateSize,
|
||||
pDevice->Format);
|
||||
ProcessContext(NULL);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user