Always allocate an empty buffer.
This commit is contained in:
parent
1eed552b4d
commit
249bc5caea
|
@ -1084,17 +1084,18 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
|
||||||
/* FIXME: check whether any hardware buffers are left */
|
/* FIXME: check whether any hardware buffers are left */
|
||||||
/* FIXME: handle DSDHEAP_CREATEHEAP for hardware buffers */
|
/* FIXME: handle DSDHEAP_CREATEHEAP for hardware buffers */
|
||||||
|
|
||||||
/* Allocate system memory if applicable */
|
/* Allocate an empty buffer */
|
||||||
if ((ds->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) || !use_hw) {
|
dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)));
|
||||||
dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)));
|
if (dsb->buffer == NULL) {
|
||||||
if (dsb->buffer == NULL) {
|
WARN("out of memory\n");
|
||||||
WARN("out of memory\n");
|
HeapFree(GetProcessHeap(),0,dsb->pwfx);
|
||||||
HeapFree(GetProcessHeap(),0,dsb->pwfx);
|
HeapFree(GetProcessHeap(),0,dsb);
|
||||||
HeapFree(GetProcessHeap(),0,dsb);
|
*pdsb = NULL;
|
||||||
*pdsb = NULL;
|
return DSERR_OUTOFMEMORY;
|
||||||
return DSERR_OUTOFMEMORY;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Allocate system memory for buffer if applicable */
|
||||||
|
if ((ds->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) || !use_hw) {
|
||||||
dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
|
dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
|
||||||
if (dsb->buffer->memory == NULL) {
|
if (dsb->buffer->memory == NULL) {
|
||||||
WARN("out of memory\n");
|
WARN("out of memory\n");
|
||||||
|
@ -1118,15 +1119,6 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
|
||||||
TRACE("IDsDriver_CreateSoundBuffer failed, falling back to software buffer\n");
|
TRACE("IDsDriver_CreateSoundBuffer failed, falling back to software buffer\n");
|
||||||
use_hw = 0;
|
use_hw = 0;
|
||||||
if (ds->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
|
if (ds->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
|
||||||
dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)));
|
|
||||||
if (dsb->buffer == NULL) {
|
|
||||||
WARN("out of memory\n");
|
|
||||||
HeapFree(GetProcessHeap(),0,dsb->pwfx);
|
|
||||||
HeapFree(GetProcessHeap(),0,dsb);
|
|
||||||
*pdsb = NULL;
|
|
||||||
return DSERR_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
|
dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
|
||||||
if (dsb->buffer->memory == NULL) {
|
if (dsb->buffer->memory == NULL) {
|
||||||
WARN("out of memory\n");
|
WARN("out of memory\n");
|
||||||
|
|
Loading…
Reference in New Issue