aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-05 00:29:20 -0800
committerChris Robinson <[email protected]>2007-12-05 00:29:20 -0800
commit15019b3871efa27782703ee216aa910927427801 (patch)
treedfa6c6e9fd677160b605fcf9ed91421ade76f41d
parent86cced248be365c3e7597deeab53d6c25636bc54 (diff)
Allow aluMixData to accept a NULL context for silence
-rw-r--r--Alc/ALu.c2
-rw-r--r--Alc/alsa.c14
-rw-r--r--Alc/dsound.c16
-rw-r--r--Alc/oss.c5
4 files changed, 9 insertions, 28 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 1b9fbce9..8e458764 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -414,7 +414,7 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
while(size > 0)
{
//Setup variables
- ALSource = ALContext->Source;
+ ALSource = (ALContext ? ALContext->Source : NULL);
SamplesToDo = min(size, BUFFERSIZE);
//Clear mixing buffer
diff --git a/Alc/alsa.c b/Alc/alsa.c
index fb13ecf1..98dd1531 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -190,17 +190,9 @@ static ALuint ALSAProc(ALvoid *ptr)
}
SuspendContext(NULL);
- if(pDevice->Context)
- {
- // If we have an active context, mix data directly into output
- // buffer
- WritePtr = (char*)areas->addr + (offset * areas->step / 8);
- WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames);
-
- aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format);
- }
- else
- psnd_pcm_areas_silence(areas, offset, pDevice->Channels, frames, data->format);
+ WritePtr = (char*)areas->addr + (offset * areas->step / 8);
+ WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames);
+ aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format);
ProcessContext(NULL);
commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames);
diff --git a/Alc/dsound.c b/Alc/dsound.c
index 5d688567..5913f52f 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -87,18 +87,10 @@ static void CALLBACK DirectSoundProc(UINT uID,UINT uReserved,DWORD_PTR dwUser,DW
{
// If we have an active context, mix data directly into output buffer otherwise fill with silence
SuspendContext(NULL);
- if(pDevice->Context)
- {
- if (WritePtr1)
- aluMixData(pDevice->Context, WritePtr1, WriteCnt1, pDevice->Format);
- if (WritePtr2)
- aluMixData(pDevice->Context, WritePtr2, WriteCnt2, pDevice->Format);
- }
- else
- {
- if (WritePtr1) memset(WritePtr1, 0, WriteCnt1);
- if (WritePtr2) memset(WritePtr2, 0, WriteCnt2);
- }
+ if (WritePtr1)
+ aluMixData(pDevice->Context, WritePtr1, WriteCnt1, pDevice->Format);
+ if (WritePtr2)
+ aluMixData(pDevice->Context, WritePtr2, WriteCnt2, pDevice->Format);
ProcessContext(NULL);
// Unlock output buffer only when successfully locked
diff --git a/Alc/oss.c b/Alc/oss.c
index 8376fc11..7ee3b905 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -80,10 +80,7 @@ static ALuint OSSProc(ALvoid *ptr)
while(!data->killNow)
{
SuspendContext(NULL);
- if(pDevice->Context)
- aluMixData(pDevice->Context,data->mix_data,data->data_size,pDevice->Format);
- else
- memset(data->mix_data,data->silence,data->data_size);
+ aluMixData(pDevice->Context,data->mix_data,data->data_size,pDevice->Format);
ProcessContext(NULL);
remaining = data->data_size;