summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALu.c6
-rw-r--r--Alc/alsa.c8
-rw-r--r--Alc/dsound.c4
-rw-r--r--Alc/oss.c6
-rw-r--r--Alc/portaudio.c6
-rw-r--r--Alc/pulseaudio.c3
-rw-r--r--Alc/solaris.c6
-rw-r--r--Alc/wave.c2
8 files changed, 19 insertions, 22 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index a2080f58..509929b7 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -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 */
diff --git a/Alc/alsa.c b/Alc/alsa.c
index 9300572e..5d7026e2 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -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);
diff --git a/Alc/dsound.c b/Alc/dsound.c
index dcad35ef..16a8dbbe 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -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
diff --git a/Alc/oss.c b/Alc/oss.c
index 8f2e6adc..c7f5421e 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -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)
diff --git a/Alc/portaudio.c b/Alc/portaudio.c
index 0142cac3..e9e15621 100644
--- a/Alc/portaudio.c
+++ b/Alc/portaudio.c
@@ -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;
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index 3b358a01..80383250 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -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);
diff --git a/Alc/solaris.c b/Alc/solaris.c
index 9ac00d8d..8ea190e6 100644
--- a/Alc/solaris.c
+++ b/Alc/solaris.c
@@ -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)
diff --git a/Alc/wave.c b/Alc/wave.c
index ec4f08ec..bd6c408a 100644
--- a/Alc/wave.c
+++ b/Alc/wave.c
@@ -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);