Allow aluMixData to accept a NULL context for silence
This commit is contained in:
parent
86cced248b
commit
15019b3871
@ -414,7 +414,7 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
|
|||||||
while(size > 0)
|
while(size > 0)
|
||||||
{
|
{
|
||||||
//Setup variables
|
//Setup variables
|
||||||
ALSource = ALContext->Source;
|
ALSource = (ALContext ? ALContext->Source : NULL);
|
||||||
SamplesToDo = min(size, BUFFERSIZE);
|
SamplesToDo = min(size, BUFFERSIZE);
|
||||||
|
|
||||||
//Clear mixing buffer
|
//Clear mixing buffer
|
||||||
|
@ -190,17 +190,9 @@ static ALuint ALSAProc(ALvoid *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SuspendContext(NULL);
|
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);
|
WritePtr = (char*)areas->addr + (offset * areas->step / 8);
|
||||||
WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames);
|
WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames);
|
||||||
|
|
||||||
aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format);
|
aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format);
|
||||||
}
|
|
||||||
else
|
|
||||||
psnd_pcm_areas_silence(areas, offset, pDevice->Channels, frames, data->format);
|
|
||||||
ProcessContext(NULL);
|
ProcessContext(NULL);
|
||||||
|
|
||||||
commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames);
|
commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames);
|
||||||
|
@ -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
|
// If we have an active context, mix data directly into output buffer otherwise fill with silence
|
||||||
SuspendContext(NULL);
|
SuspendContext(NULL);
|
||||||
if(pDevice->Context)
|
|
||||||
{
|
|
||||||
if (WritePtr1)
|
if (WritePtr1)
|
||||||
aluMixData(pDevice->Context, WritePtr1, WriteCnt1, pDevice->Format);
|
aluMixData(pDevice->Context, WritePtr1, WriteCnt1, pDevice->Format);
|
||||||
if (WritePtr2)
|
if (WritePtr2)
|
||||||
aluMixData(pDevice->Context, WritePtr2, WriteCnt2, pDevice->Format);
|
aluMixData(pDevice->Context, WritePtr2, WriteCnt2, pDevice->Format);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (WritePtr1) memset(WritePtr1, 0, WriteCnt1);
|
|
||||||
if (WritePtr2) memset(WritePtr2, 0, WriteCnt2);
|
|
||||||
}
|
|
||||||
ProcessContext(NULL);
|
ProcessContext(NULL);
|
||||||
|
|
||||||
// Unlock output buffer only when successfully locked
|
// Unlock output buffer only when successfully locked
|
||||||
|
@ -80,10 +80,7 @@ static ALuint OSSProc(ALvoid *ptr)
|
|||||||
while(!data->killNow)
|
while(!data->killNow)
|
||||||
{
|
{
|
||||||
SuspendContext(NULL);
|
SuspendContext(NULL);
|
||||||
if(pDevice->Context)
|
|
||||||
aluMixData(pDevice->Context,data->mix_data,data->data_size,pDevice->Format);
|
aluMixData(pDevice->Context,data->mix_data,data->data_size,pDevice->Format);
|
||||||
else
|
|
||||||
memset(data->mix_data,data->silence,data->data_size);
|
|
||||||
ProcessContext(NULL);
|
ProcessContext(NULL);
|
||||||
|
|
||||||
remaining = data->data_size;
|
remaining = data->data_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user