ReactOS 0.4.16-dev-336-gb667d82
secondary.c File Reference
#include "precomp.h"
Include dependency graph for secondary.c:

Go to the source code of this file.

Classes

struct  CDirectSoundBuffer
 

Typedefs

typedef struct CDirectSoundBufferLPCDirectSoundBuffer
 

Functions

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnQueryInterface (LPDIRECTSOUNDBUFFER8 iface, IN REFIID riid, LPVOID *ppobj)
 
ULONG WINAPI SecondaryDirectSoundBuffer8Impl_fnAddRef (LPDIRECTSOUNDBUFFER8 iface)
 
ULONG WINAPI SecondaryDirectSoundBuffer8Impl_fnRelease (LPDIRECTSOUNDBUFFER8 iface)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetCaps (LPDIRECTSOUNDBUFFER8 iface, LPDSBCAPS pDSBufferCaps)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetCurrentPosition (LPDIRECTSOUNDBUFFER8 iface, LPDWORD pdwCurrentPlayCursor, LPDWORD pdwCurrentWriteCursor)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetFormat (LPDIRECTSOUNDBUFFER8 iface, LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetVolume (LPDIRECTSOUNDBUFFER8 iface, LPLONG plVolume)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetPan (LPDIRECTSOUNDBUFFER8 iface, LPLONG plPan)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetFrequency (LPDIRECTSOUNDBUFFER8 iface, LPDWORD pdwFrequency)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetStatus (LPDIRECTSOUNDBUFFER8 iface, LPDWORD pdwStatus)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnInitialize (LPDIRECTSOUNDBUFFER8 iface, LPDIRECTSOUND pDirectSound, LPCDSBUFFERDESC pcDSBufferDesc)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnLock (LPDIRECTSOUNDBUFFER8 iface, DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnPlay (LPDIRECTSOUNDBUFFER8 iface, DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetCurrentPosition (LPDIRECTSOUNDBUFFER8 iface, DWORD dwNewPosition)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFormat (LPDIRECTSOUNDBUFFER8 iface, LPCWAVEFORMATEX pcfxFormat)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetVolume (LPDIRECTSOUNDBUFFER8 iface, LONG lVolume)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetPan (LPDIRECTSOUNDBUFFER8 iface, LONG lPan)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFrequency (LPDIRECTSOUNDBUFFER8 iface, DWORD dwFrequency)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnStop (LPDIRECTSOUNDBUFFER8 iface)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnUnlock (LPDIRECTSOUNDBUFFER8 iface, LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnRestore (LPDIRECTSOUNDBUFFER8 iface)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFX (LPDIRECTSOUNDBUFFER8 iface, DWORD dwEffectsCount, LPDSEFFECTDESC pDSFXDesc, LPDWORD pdwResultCodes)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnAcquireResources (LPDIRECTSOUNDBUFFER8 iface, DWORD dwFlags, DWORD dwEffectsCount, LPDWORD pdwResultCodes)
 
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetObjectInPath (LPDIRECTSOUNDBUFFER8 iface, REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject)
 
HRESULT NewSecondarySoundBuffer (LPDIRECTSOUNDBUFFER8 *OutBuffer, LPFILTERINFO Filter, DWORD dwLevel, LPCDSBUFFERDESC lpcDSBufferDesc, LPDIRECTSOUNDBUFFER8 PrimaryBuffer)
 

Variables

static IDirectSoundBuffer8Vtbl vt_DirectSoundBuffer8
 

Typedef Documentation

◆ LPCDirectSoundBuffer

Function Documentation

◆ NewSecondarySoundBuffer()

HRESULT NewSecondarySoundBuffer ( LPDIRECTSOUNDBUFFER8 OutBuffer,
LPFILTERINFO  Filter,
DWORD  dwLevel,
LPCDSBUFFERDESC  lpcDSBufferDesc,
LPDIRECTSOUNDBUFFER8  PrimaryBuffer 
)

Definition at line 611 of file secondary.c.

617{
618 ULONG FormatSize;
620
621 if (!This)
622 {
623 /* not enough memory */
624 return DSERR_OUTOFMEMORY;
625 }
626
627 FormatSize = sizeof(WAVEFORMATEX) + lpcDSBufferDesc->lpwfxFormat->cbSize;
628
629 This->Format = HeapAlloc(GetProcessHeap(), 0, FormatSize);
630 if (!This->Format)
631 {
632 /* not enough memory */
634 return DSERR_OUTOFMEMORY;
635 }
636
637 /* sanity check */
638 ASSERT(lpcDSBufferDesc->dwBufferBytes);
639
640 /* allocate sound buffer */
641 This->Buffer = HeapAlloc(GetProcessHeap(), 0, lpcDSBufferDesc->dwBufferBytes);
642 if (!This->Buffer)
643 {
644 /* not enough memory */
645 HeapFree(GetProcessHeap(), 0, This->Format);
647 return DSERR_OUTOFMEMORY;
648 }
649
650 /* fill buffer with silence */
651 FillMemory(This->Buffer, lpcDSBufferDesc->dwBufferBytes, lpcDSBufferDesc->lpwfxFormat->wBitsPerSample == 8 ? 0x80 : 0);
652
653 This->ref = 1;
654 This->lpVtbl = &vt_DirectSoundBuffer8;
655 This->Filter = Filter;
656 This->dwLevel = dwLevel;
657 This->dwFlags = lpcDSBufferDesc->dwFlags;
658 This->dwFrequency = lpcDSBufferDesc->lpwfxFormat->nSamplesPerSec;
659 This->State = KSSTATE_STOP;
660 This->Volume = DSBVOLUME_MAX;
661 This->VolumePan = DSBPAN_CENTER;
662 This->Flags = 0;
663 This->Position = 0;
664 This->BufferSize = lpcDSBufferDesc->dwBufferBytes;
665 This->PrimaryBuffer = PrimaryBuffer;
666
667 CopyMemory(This->Format, lpcDSBufferDesc->lpwfxFormat, FormatSize);
668
670 return DS_OK;
671}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define DSBPAN_CENTER
Definition: dsound.h:227
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
#define DSBVOLUME_MAX
Definition: dsound.h:229
#define DS_OK
Definition: dsound.h:116
struct IDirectSoundBuffer8 * LPDIRECTSOUNDBUFFER8
Definition: dsound.h:79
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
@ KSSTATE_STOP
Definition: ks.h:1215
#define ASSERT(a)
Definition: mode.c:44
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
static IDirectSoundBuffer8Vtbl vt_DirectSoundBuffer8
Definition: secondary.c:579
DWORD dwFlags
Definition: dsound.h:289
DWORD dwBufferBytes
Definition: dsound.h:290
LPWAVEFORMATEX lpwfxFormat
Definition: dsound.h:292
WORD cbSize
Definition: mmreg.h:84
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD wBitsPerSample
Definition: mmreg.h:83
uint32_t ULONG
Definition: typedefs.h:59
#define CopyMemory
Definition: winbase.h:1735

Referenced by IDirectSound8_fnCreateSoundBuffer().

◆ SecondaryDirectSoundBuffer8Impl_fnAcquireResources()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnAcquireResources ( LPDIRECTSOUNDBUFFER8  iface,
DWORD  dwFlags,
DWORD  dwEffectsCount,
LPDWORD  pdwResultCodes 
)

Definition at line 556 of file secondary.c.

561{
563 return DSERR_INVALIDPARAM;
564}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define DSERR_INVALIDPARAM
Definition: dsound.h:121

◆ SecondaryDirectSoundBuffer8Impl_fnAddRef()

ULONG WINAPI SecondaryDirectSoundBuffer8Impl_fnAddRef ( LPDIRECTSOUNDBUFFER8  iface)

Definition at line 67 of file secondary.c.

69{
70 ULONG ref;
72
74
75 return ref;
76
77}
#define InterlockedIncrement
Definition: armddk.h:53
struct CDirectSoundBuffer * LPCDirectSoundBuffer
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ SecondaryDirectSoundBuffer8Impl_fnGetCaps()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetCaps ( LPDIRECTSOUNDBUFFER8  iface,
LPDSBCAPS  pDSBufferCaps 
)

Definition at line 101 of file secondary.c.

104{
106
107 if (!pDSBufferCaps)
108 {
109 /* invalid parameter */
110 return DSERR_INVALIDPARAM;
111 }
112
113 if (pDSBufferCaps->dwSize < sizeof(DSBCAPS))
114 {
115 /* invalid buffer size */
116 return DSERR_INVALIDPARAM;
117 }
118
119 /* get buffer details */
120 pDSBufferCaps->dwUnlockTransferRate = 0;
121 pDSBufferCaps->dwPlayCpuOverhead = 0;
122 pDSBufferCaps->dwSize = This->BufferSize;
123 pDSBufferCaps->dwFlags = This->dwFlags;
124
125 return DS_OK;
126}
DWORD dwUnlockTransferRate
Definition: dsound.h:242
DWORD dwPlayCpuOverhead
Definition: dsound.h:243
DWORD dwFlags
Definition: dsound.h:240
DWORD dwSize
Definition: dsound.h:239

◆ SecondaryDirectSoundBuffer8Impl_fnGetCurrentPosition()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetCurrentPosition ( LPDIRECTSOUNDBUFFER8  iface,
LPDWORD  pdwCurrentPlayCursor,
LPDWORD  pdwCurrentWriteCursor 
)

Definition at line 130 of file secondary.c.

134{
136
137 //DPRINT("SecondaryDirectSoundBuffer8Impl_fnGetCurrentPosition This %p Play %p Write %p\n", This, pdwCurrentPlayCursor, pdwCurrentWriteCursor);
138
139 if (pdwCurrentWriteCursor)
140 {
141 *pdwCurrentWriteCursor = This->BufferPosition;
142 }
143
144 return PrimaryDirectSoundBuffer_GetPosition(This->PrimaryBuffer, pdwCurrentPlayCursor, NULL);
145}
#define NULL
Definition: types.h:112
HRESULT PrimaryDirectSoundBuffer_GetPosition(LPDIRECTSOUNDBUFFER8 iface, LPDWORD pdwCurrentPlayCursor, LPDWORD pdwCurrentWriteCursor)
Definition: primary.c:644

◆ SecondaryDirectSoundBuffer8Impl_fnGetFormat()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetFormat ( LPDIRECTSOUNDBUFFER8  iface,
LPWAVEFORMATEX  pwfxFormat,
DWORD  dwSizeAllocated,
LPDWORD  pdwSizeWritten 
)

Definition at line 149 of file secondary.c.

154{
155 DWORD FormatSize;
157
158 FormatSize = sizeof(WAVEFORMATEX) + This->Format->cbSize;
159
160 if (!pwfxFormat && !pdwSizeWritten)
161 {
162 /* invalid parameter */
163 return DSERR_INVALIDPARAM;
164 }
165
166 if (!pwfxFormat)
167 {
168 /* return required format size */
169 *pdwSizeWritten = FormatSize;
170 return DS_OK;
171 }
172 else
173 {
174 if (dwSizeAllocated >= FormatSize)
175 {
176 /* copy format */
177 CopyMemory(pwfxFormat, This->Format, FormatSize);
178
179 if (pdwSizeWritten)
180 *pdwSizeWritten = FormatSize;
181
182 return DS_OK;
183 }
184 /* buffer too small */
185 if (pdwSizeWritten)
186 *pdwSizeWritten = 0;
187
188 return DSERR_INVALIDPARAM;
189 }
190}
unsigned long DWORD
Definition: ntddk_ex.h:95
if(dx< 0)
Definition: linetemp.h:194

◆ SecondaryDirectSoundBuffer8Impl_fnGetFrequency()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetFrequency ( LPDIRECTSOUNDBUFFER8  iface,
LPDWORD  pdwFrequency 
)

Definition at line 234 of file secondary.c.

237{
239
240 if (!pdwFrequency)
241 {
242 /* invalid parameter */
243 return DSERR_INVALIDPARAM;
244 }
245
246 /* get frequency */
247 *pdwFrequency = This->dwFrequency;
248
249 return DS_OK;
250}

◆ SecondaryDirectSoundBuffer8Impl_fnGetObjectInPath()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetObjectInPath ( LPDIRECTSOUNDBUFFER8  iface,
REFGUID  rguidObject,
DWORD  dwIndex,
REFGUID  rguidInterface,
LPVOID ppObject 
)

Definition at line 568 of file secondary.c.

574{
576 return DSERR_INVALIDPARAM;
577}

◆ SecondaryDirectSoundBuffer8Impl_fnGetPan()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetPan ( LPDIRECTSOUNDBUFFER8  iface,
LPLONG  plPan 
)

Definition at line 214 of file secondary.c.

217{
219
220 if (!plPan)
221 {
222 /* invalid parameter */
223 return DSERR_INVALIDPARAM;
224 }
225
226 /* get frequency */
227 *plPan = This->VolumePan;
228
229 return DS_OK;
230}

◆ SecondaryDirectSoundBuffer8Impl_fnGetStatus()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetStatus ( LPDIRECTSOUNDBUFFER8  iface,
LPDWORD  pdwStatus 
)

Definition at line 254 of file secondary.c.

257{
259
260 if (!pdwStatus)
261 {
262 /* invalid parameter */
263 return DSERR_INVALIDPARAM;
264 }
265
266 *pdwStatus = 0;
267 if (This->State == KSSTATE_RUN || This->State == KSSTATE_ACQUIRE)
268 {
269 /* buffer is playing */
270 *pdwStatus |= DSBSTATUS_PLAYING;
271 if (This->Flags & DSBPLAY_LOOPING)
272 *pdwStatus |= DSBSTATUS_LOOPING;
273 }
274
275 return DS_OK;
276}
#define DSBSTATUS_LOOPING
Definition: dsound.h:198
#define DSBSTATUS_PLAYING
Definition: dsound.h:196
#define DSBPLAY_LOOPING
Definition: dsound.h:189
@ KSSTATE_ACQUIRE
Definition: ks.h:1216
@ KSSTATE_RUN
Definition: ks.h:1218

◆ SecondaryDirectSoundBuffer8Impl_fnGetVolume()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetVolume ( LPDIRECTSOUNDBUFFER8  iface,
LPLONG  plVolume 
)

Definition at line 194 of file secondary.c.

197{
199
200 if (!plVolume)
201 {
202 /* invalid parameter */
203 return DSERR_INVALIDPARAM;
204 }
205
206 /* get volume */
207 *plVolume = This->Volume;
208
209 return DS_OK;
210}

◆ SecondaryDirectSoundBuffer8Impl_fnInitialize()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnInitialize ( LPDIRECTSOUNDBUFFER8  iface,
LPDIRECTSOUND  pDirectSound,
LPCDSBUFFERDESC  pcDSBufferDesc 
)

Definition at line 280 of file secondary.c.

284{
285 /* RTFM */
287}
#define DSERR_ALREADYINITIALIZED
Definition: dsound.h:129

◆ SecondaryDirectSoundBuffer8Impl_fnLock()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnLock ( LPDIRECTSOUNDBUFFER8  iface,
DWORD  dwOffset,
DWORD  dwBytes,
LPVOID ppvAudioPtr1,
LPDWORD  pdwAudioBytes1,
LPVOID ppvAudioPtr2,
LPDWORD  pdwAudioBytes2,
DWORD  dwFlags 
)

Definition at line 291 of file secondary.c.

300{
302
303 DPRINT("This %p dwOffset %u dwBytes %u ppvAudioPtr1 %p pdwAudioBytes1 %p ppvAudioPtr2 %p pdwAudioBytes2 %p dwFlags %x This->BufferSize %u\n",
304 This, dwOffset, dwBytes, ppvAudioPtr1, pdwAudioBytes1, ppvAudioPtr2, pdwAudioBytes2, dwFlags, This->BufferSize);
305
307 {
308 *ppvAudioPtr1 = (LPVOID)This->Buffer;
309 *pdwAudioBytes1 = This->BufferSize;
310 if (ppvAudioPtr2)
311 *ppvAudioPtr2 = NULL;
312 if (pdwAudioBytes2)
313 *pdwAudioBytes2 = 0;
314
315 return DS_OK;
316 }
318 {
320 return DSERR_UNSUPPORTED;
321 }
322 else
323 {
324 ASSERT(dwOffset < This->BufferSize);
325 ASSERT(dwBytes <= This->BufferSize);
326
327 dwBytes = min(This->BufferSize - dwOffset, dwBytes);
328
329 *ppvAudioPtr1 = This->Buffer + dwOffset;
330 *pdwAudioBytes1 = dwBytes;
331
332 This->BufferPosition = dwOffset + dwBytes;
333
334 if (This->BufferPosition == This->BufferSize)
335 This->BufferPosition = 0;
336
337 if (ppvAudioPtr2)
338 *ppvAudioPtr2 = NULL;
339 if (pdwAudioBytes2)
340 *pdwAudioBytes2 = 0;
341
342 return DS_OK;
343 }
344}
#define DSERR_UNSUPPORTED
Definition: dsound.h:127
#define DSBLOCK_ENTIREBUFFER
Definition: dsound.h:204
#define DSBLOCK_FROMWRITECURSOR
Definition: dsound.h:203
#define min(a, b)
Definition: monoChain.cc:55
#define LPVOID
Definition: nt_native.h:45
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2033
#define DPRINT
Definition: sndvol32.h:73
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ SecondaryDirectSoundBuffer8Impl_fnPlay()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnPlay ( LPDIRECTSOUNDBUFFER8  iface,
DWORD  dwReserved1,
DWORD  dwPriority,
DWORD  dwFlags 
)

Definition at line 348 of file secondary.c.

353{
354 HRESULT hResult;
356
357 if (dwReserved1 != 0)
358 {
359 /* must be zero */
360 return DSERR_INVALIDPARAM;
361 }
362
363 /* sanity check */
365
366
367 if (This->State == KSSTATE_RUN)
368 {
369 /* sound buffer is already playing */
370 return DS_OK;
371 }
372
373 /* set dataformat */
374 hResult = PrimaryDirectSoundBuffer_SetFormat(This->PrimaryBuffer, This->Format, TRUE);
375
376 if (!SUCCEEDED(hResult))
377 {
378 /* failed */
379 DPRINT1("Failed to set format Tag %u Samples %u Bytes %u nChannels %u\n", This->Format->wFormatTag, This->Format->nSamplesPerSec, This->Format->wBitsPerSample, This->Format->nChannels);
380 return hResult;
381 }
382
383 /* start primary buffer */
385 /* acquire primary buffer */
387 /* HACK write buffer */
388 PrimaryDirectSoundBuffer_Write(This->PrimaryBuffer, This->Buffer, This->BufferSize);
389 /* release primary buffer */
391
392 DPRINT("SetFormatSuccess PrimaryBuffer %p\n", This->PrimaryBuffer);
393 This->State = KSSTATE_RUN;
394
395 return DS_OK;
396}
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
VOID PrimaryDirectSoundBuffer_ReleaseLock(LPDIRECTSOUNDBUFFER8 iface)
Definition: primary.c:757
VOID PrimaryDirectSoundBuffer_AcquireLock(LPDIRECTSOUNDBUFFER8 iface)
Definition: primary.c:746
DWORD PrimaryDirectSoundBuffer_Write(LPDIRECTSOUNDBUFFER8 iface, LPVOID Buffer, DWORD BufferSize)
Definition: primary.c:587
VOID PrimaryDirectSoundBuffer_SetState(LPDIRECTSOUNDBUFFER8 iface, KSSTATE State)
Definition: primary.c:621
HRESULT PrimaryDirectSoundBuffer_SetFormat(LPDIRECTSOUNDBUFFER8 iface, LPWAVEFORMATEX pcfxFormat, BOOL bLooped)
Definition: primary.c:694
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ SecondaryDirectSoundBuffer8Impl_fnQueryInterface()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnQueryInterface ( LPDIRECTSOUNDBUFFER8  iface,
IN REFIID  riid,
LPVOID ppobj 
)

Definition at line 40 of file secondary.c.

44{
45 LPOLESTR pStr;
47
49 IsEqualIID(riid, &IID_IDirectSoundBuffer) ||
50 IsEqualIID(riid, &IID_IDirectSoundBuffer8))
51 {
52 *ppobj = (LPVOID)&This->lpVtbl;
54 return S_OK;
55 }
56
57 if (SUCCEEDED(StringFromIID(riid, &pStr)))
58 {
59 DPRINT("No Interface for class %s\n", pStr);
60 CoTaskMemFree(pStr);
61 }
62 return E_NOINTERFACE;
63}
const GUID IID_IUnknown
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
static LPOLESTR
Definition: stg_prop.c:27
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ SecondaryDirectSoundBuffer8Impl_fnRelease()

ULONG WINAPI SecondaryDirectSoundBuffer8Impl_fnRelease ( LPDIRECTSOUNDBUFFER8  iface)

Definition at line 81 of file secondary.c.

83{
84 ULONG ref;
86
87 ref = InterlockedDecrement(&(This->ref));
88
89 if (!ref)
90 {
91 HeapFree(GetProcessHeap(), 0, This->Buffer);
92 HeapFree(GetProcessHeap(), 0, This->Format);
94 }
95
96 return ref;
97}
#define InterlockedDecrement
Definition: armddk.h:52

◆ SecondaryDirectSoundBuffer8Impl_fnRestore()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnRestore ( LPDIRECTSOUNDBUFFER8  iface)

Definition at line 534 of file secondary.c.

536{
538 return DSERR_INVALIDPARAM;
539}

◆ SecondaryDirectSoundBuffer8Impl_fnSetCurrentPosition()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetCurrentPosition ( LPDIRECTSOUNDBUFFER8  iface,
DWORD  dwNewPosition 
)

Definition at line 400 of file secondary.c.

403{
405
406 DPRINT("Setting position %u\n", dwNewPosition);
407 This->Position = dwNewPosition;
408
409 return DS_OK;
410}

◆ SecondaryDirectSoundBuffer8Impl_fnSetFormat()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFormat ( LPDIRECTSOUNDBUFFER8  iface,
LPCWAVEFORMATEX  pcfxFormat 
)

Definition at line 414 of file secondary.c.

417{
418 /* RTFM */
419 return DSERR_INVALIDCALL;
420}
#define DSERR_INVALIDCALL
Definition: dsound.h:122

◆ SecondaryDirectSoundBuffer8Impl_fnSetFrequency()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFrequency ( LPDIRECTSOUNDBUFFER8  iface,
DWORD  dwFrequency 
)

Definition at line 465 of file secondary.c.

468{
470
471 if (dwFrequency == DSBFREQUENCY_ORIGINAL)
472 {
473 /* restore original frequency */
474 dwFrequency = This->Format->nSamplesPerSec;
475 }
476
477 if (dwFrequency < DSBFREQUENCY_MIN || dwFrequency > DSBFREQUENCY_MAX)
478 {
479 /* invalid frequency */
480 return DSERR_INVALIDPARAM;
481 }
482
483 if (dwFrequency != This->dwFrequency)
484 {
485 /* FIXME handle frequency change */
486 }
487
488 /* store frequency */
489 This->dwFrequency = dwFrequency;
490
491 return DS_OK;
492}
#define DSBFREQUENCY_MAX
Definition: dsound.h:232
#define DSBFREQUENCY_ORIGINAL
Definition: dsound.h:233

◆ SecondaryDirectSoundBuffer8Impl_fnSetFX()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFX ( LPDIRECTSOUNDBUFFER8  iface,
DWORD  dwEffectsCount,
LPDSEFFECTDESC  pDSFXDesc,
LPDWORD  pdwResultCodes 
)

Definition at line 544 of file secondary.c.

549{
551 return DSERR_INVALIDPARAM;
552}

◆ SecondaryDirectSoundBuffer8Impl_fnSetPan()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetPan ( LPDIRECTSOUNDBUFFER8  iface,
LONG  lPan 
)

Definition at line 445 of file secondary.c.

448{
450
451 if (lPan < DSBPAN_LEFT || lPan > DSBPAN_RIGHT)
452 {
453 /* invalid parameter */
454 return DSERR_INVALIDPARAM;
455 }
456
457 /* Store volume pan */
458 This->VolumePan = lPan;
459
460 return DS_OK;
461}
#define DSBPAN_RIGHT
Definition: dsound.h:228

◆ SecondaryDirectSoundBuffer8Impl_fnSetVolume()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetVolume ( LPDIRECTSOUNDBUFFER8  iface,
LONG  lVolume 
)

Definition at line 424 of file secondary.c.

427{
429
430 if (lVolume < DSBVOLUME_MIN || lVolume > DSBVOLUME_MAX)
431 {
432 /* invalid parameter */
433 return DSERR_INVALIDPARAM;
434 }
435
436
437 /* Store volume */
438 This->Volume = lVolume;
439
440 return DS_OK;
441}

◆ SecondaryDirectSoundBuffer8Impl_fnStop()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnStop ( LPDIRECTSOUNDBUFFER8  iface)

Definition at line 496 of file secondary.c.

498{
500
504
505 DPRINT("SecondaryDirectSoundBuffer8Impl_fnStop\n");
506
507
508 /* set state to stop */
509 This->State = KSSTATE_STOP;
510 This->BufferPosition = 0;
511
512 return DS_OK;
513}
@ KSSTATE_PAUSE
Definition: ks.h:1217

◆ SecondaryDirectSoundBuffer8Impl_fnUnlock()

HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnUnlock ( LPDIRECTSOUNDBUFFER8  iface,
LPVOID  pvAudioPtr1,
DWORD  dwAudioBytes1,
LPVOID  pvAudioPtr2,
DWORD  dwAudioBytes2 
)

Definition at line 518 of file secondary.c.

524{
525 //DPRINT("SecondaryDirectSoundBuffer8Impl_fnUnlock pvAudioPtr1 %p dwAudioBytes1 %u pvAudioPtr2 %p dwAudioBytes2 %u Unimplemented\n");
526 return DS_OK;
527}

Variable Documentation

◆ vt_DirectSoundBuffer8

IDirectSoundBuffer8Vtbl vt_DirectSoundBuffer8
static
Initial value:
=
{
}
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnAcquireResources(LPDIRECTSOUNDBUFFER8 iface, DWORD dwFlags, DWORD dwEffectsCount, LPDWORD pdwResultCodes)
Definition: secondary.c:556
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetCurrentPosition(LPDIRECTSOUNDBUFFER8 iface, LPDWORD pdwCurrentPlayCursor, LPDWORD pdwCurrentWriteCursor)
Definition: secondary.c:130
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetCaps(LPDIRECTSOUNDBUFFER8 iface, LPDSBCAPS pDSBufferCaps)
Definition: secondary.c:101
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnPlay(LPDIRECTSOUNDBUFFER8 iface, DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags)
Definition: secondary.c:348
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetVolume(LPDIRECTSOUNDBUFFER8 iface, LONG lVolume)
Definition: secondary.c:424
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetStatus(LPDIRECTSOUNDBUFFER8 iface, LPDWORD pdwStatus)
Definition: secondary.c:254
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetFrequency(LPDIRECTSOUNDBUFFER8 iface, LPDWORD pdwFrequency)
Definition: secondary.c:234
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetVolume(LPDIRECTSOUNDBUFFER8 iface, LPLONG plVolume)
Definition: secondary.c:194
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetPan(LPDIRECTSOUNDBUFFER8 iface, LONG lPan)
Definition: secondary.c:445
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnRestore(LPDIRECTSOUNDBUFFER8 iface)
Definition: secondary.c:534
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetObjectInPath(LPDIRECTSOUNDBUFFER8 iface, REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject)
Definition: secondary.c:568
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetFormat(LPDIRECTSOUNDBUFFER8 iface, LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten)
Definition: secondary.c:149
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnUnlock(LPDIRECTSOUNDBUFFER8 iface, LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2)
Definition: secondary.c:518
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFrequency(LPDIRECTSOUNDBUFFER8 iface, DWORD dwFrequency)
Definition: secondary.c:465
ULONG WINAPI SecondaryDirectSoundBuffer8Impl_fnRelease(LPDIRECTSOUNDBUFFER8 iface)
Definition: secondary.c:81
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnGetPan(LPDIRECTSOUNDBUFFER8 iface, LPLONG plPan)
Definition: secondary.c:214
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnLock(LPDIRECTSOUNDBUFFER8 iface, DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags)
Definition: secondary.c:291
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnStop(LPDIRECTSOUNDBUFFER8 iface)
Definition: secondary.c:496
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnQueryInterface(LPDIRECTSOUNDBUFFER8 iface, IN REFIID riid, LPVOID *ppobj)
Definition: secondary.c:40
ULONG WINAPI SecondaryDirectSoundBuffer8Impl_fnAddRef(LPDIRECTSOUNDBUFFER8 iface)
Definition: secondary.c:67
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnInitialize(LPDIRECTSOUNDBUFFER8 iface, LPDIRECTSOUND pDirectSound, LPCDSBUFFERDESC pcDSBufferDesc)
Definition: secondary.c:280
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFormat(LPDIRECTSOUNDBUFFER8 iface, LPCWAVEFORMATEX pcfxFormat)
Definition: secondary.c:414
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetCurrentPosition(LPDIRECTSOUNDBUFFER8 iface, DWORD dwNewPosition)
Definition: secondary.c:400
HRESULT WINAPI SecondaryDirectSoundBuffer8Impl_fnSetFX(LPDIRECTSOUNDBUFFER8 iface, DWORD dwEffectsCount, LPDSEFFECTDESC pDSFXDesc, LPDWORD pdwResultCodes)
Definition: secondary.c:544

Definition at line 579 of file secondary.c.

Referenced by NewSecondarySoundBuffer().