dsound: Handle primary buffers in IDirectSoundBufferImpl_SetFormat.
This commit is contained in:
parent
3747fb74a1
commit
a2bc634eaa
|
@ -187,15 +187,24 @@ static inline IDirectSoundBufferImpl *impl_from_IDirectSoundBuffer8(IDirectSound
|
|||
return CONTAINING_RECORD(iface, IDirectSoundBufferImpl, IDirectSoundBuffer8_iface);
|
||||
}
|
||||
|
||||
static inline BOOL is_primary_buffer(IDirectSoundBufferImpl *This)
|
||||
{
|
||||
return This->dsbd.dwFlags & DSBCAPS_PRIMARYBUFFER ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat(IDirectSoundBuffer8 *iface,
|
||||
LPCWAVEFORMATEX wfex)
|
||||
{
|
||||
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
||||
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
|
||||
|
||||
TRACE("(%p,%p)\n",This,wfex);
|
||||
/* This method is not available on secondary buffers */
|
||||
WARN("invalid call\n");
|
||||
return DSERR_INVALIDCALL;
|
||||
TRACE("(%p,%p)\n", iface, wfex);
|
||||
|
||||
if (is_primary_buffer(This))
|
||||
return primarybuffer_SetFormat(This->device, wfex);
|
||||
else {
|
||||
WARN("not available for secondary buffers.\n");
|
||||
return DSERR_INVALIDCALL;
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LONG vol)
|
||||
|
|
|
@ -336,6 +336,7 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave) DECLSPEC_
|
|||
HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb,
|
||||
const DSBUFFERDESC *dsbd) DECLSPEC_HIDDEN;
|
||||
void primarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN;
|
||||
HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN;
|
||||
|
||||
/* duplex.c */
|
||||
|
||||
|
|
|
@ -472,12 +472,14 @@ LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex)
|
|||
return pwfx;
|
||||
}
|
||||
|
||||
static HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex, BOOL forced)
|
||||
HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex)
|
||||
{
|
||||
HRESULT err = DSERR_BUFFERLOST;
|
||||
int i;
|
||||
DWORD nSamplesPerSec, bpp, chans;
|
||||
LPWAVEFORMATEX oldpwfx;
|
||||
BOOL forced = device->priolevel == DSSCL_WRITEPRIMARY;
|
||||
|
||||
TRACE("(%p,%p)\n", device, wfex);
|
||||
|
||||
if (device->priolevel == DSSCL_NORMAL) {
|
||||
|
@ -628,9 +630,8 @@ static HRESULT WINAPI PrimaryBufferImpl_SetFormat(
|
|||
LPCWAVEFORMATEX wfex)
|
||||
{
|
||||
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer(iface);
|
||||
DirectSoundDevice *device = This->device;
|
||||
TRACE("(%p,%p)\n", iface, wfex);
|
||||
return DSOUND_PrimarySetFormat(device, wfex, device->priolevel == DSSCL_WRITEPRIMARY);
|
||||
return primarybuffer_SetFormat(This->device, wfex);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
|
||||
|
|
Loading…
Reference in New Issue