ReactOS 0.4.17-dev-934-g091855f
audiopath.c File Reference
#include "dmime_private.h"
Include dependency graph for audiopath.c:

Go to the source code of this file.

Classes

struct  IDirectMusicAudioPathImpl
 
struct  audio_path_pchannel_to_buffer
 
struct  audio_path_port_config
 
struct  audio_path_config
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dmime)
 
 C_ASSERT (sizeof(struct audio_path_pchannel_to_buffer)==offsetof(struct audio_path_pchannel_to_buffer, guids[0]))
 
static struct IDirectMusicAudioPathImpl * impl_from_IDirectMusicAudioPath (IDirectMusicAudioPath *iface)
 
static struct audio_path_config * impl_from_IPersistStream (IPersistStream *iface)
 
void set_audiopath_perf_pointer (IDirectMusicAudioPath *iface, IDirectMusicPerformance8 *performance)
 
void set_audiopath_dsound_buffer (IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
 
void set_audiopath_primary_dsound_buffer (IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
 
static HRESULT WINAPI IDirectMusicAudioPathImpl_QueryInterface (IDirectMusicAudioPath *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI IDirectMusicAudioPathImpl_AddRef (IDirectMusicAudioPath *iface)
 
static ULONG WINAPI IDirectMusicAudioPathImpl_Release (IDirectMusicAudioPath *iface)
 
static HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (IDirectMusicAudioPath *iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, DWORD dwIndex, REFGUID iidInterface, void **ppObject)
 
static HRESULT WINAPI IDirectMusicAudioPathImpl_Activate (IDirectMusicAudioPath *iface, BOOL activate)
 
static HRESULT WINAPI IDirectMusicAudioPathImpl_SetVolume (IDirectMusicAudioPath *iface, LONG lVolume, DWORD dwDuration)
 
static HRESULT WINAPI IDirectMusicAudioPathImpl_ConvertPChannel (IDirectMusicAudioPath *iface, DWORD dwPChannelIn, DWORD *pdwPChannelOut)
 
static HRESULT WINAPI path_config_IDirectMusicObject_ParseDescriptor (IDirectMusicObject *iface, IStream *stream, DMUS_OBJECTDESC *desc)
 
static HRESULT parse_pchannel_to_buffers_list (struct audio_path_port_config *This, IStream *stream, const struct chunk_entry *pchl)
 
static void port_config_destroy (struct audio_path_port_config *port_config)
 
static HRESULT parse_port_config_list (struct audio_path_config *This, IStream *stream, const struct chunk_entry *pcfl)
 
static HRESULT parse_port_configs_list (struct audio_path_config *This, IStream *stream, const struct chunk_entry *pcsl)
 
static HRESULT WINAPI path_config_IPersistStream_Load (IPersistStream *iface, IStream *stream)
 
static struct audio_path_config * impl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI path_config_IUnknown_QueryInterface (IUnknown *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI path_config_IUnknown_AddRef (IUnknown *unk)
 
static ULONG WINAPI path_config_IUnknown_Release (IUnknown *unk)
 
HRESULT path_config_get_audio_path_params (IUnknown *iface, WAVEFORMATEX *format, DSBUFFERDESC *desc, DMUS_PORTPARAMS *params)
 
HRESULT create_dmaudiopath (REFIID riid, void **ppobj)
 
HRESULT create_dmaudiopath_config (REFIID riid, void **ppobj)
 

Variables

static const IDirectMusicAudioPathVtbl DirectMusicAudioPathVtbl
 
static const IDirectMusicObjectVtbl dmobject_vtbl
 
static const IPersistStreamVtbl persiststream_vtbl
 
static const IUnknownVtbl path_config_unk_vtbl
 

Function Documentation

◆ C_ASSERT()

◆ create_dmaudiopath()

HRESULT create_dmaudiopath ( REFIID  riid,
void **  ppobj 
)

Definition at line 736 of file audiopath.c.

737{
739 HRESULT hr;
740
741 *ppobj = NULL;
742 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
743 obj->IDirectMusicAudioPath_iface.lpVtbl = &DirectMusicAudioPathVtbl;
744 obj->ref = 1;
745
746 hr = IDirectMusicAudioPath_QueryInterface(&obj->IDirectMusicAudioPath_iface, riid, ppobj);
747 IDirectMusicAudioPath_Release(&obj->IDirectMusicAudioPath_iface);
748 return hr;
749}
static const IDirectMusicAudioPathVtbl DirectMusicAudioPathVtbl
Definition: audiopath.c:273
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define IDirectMusicAudioPath_QueryInterface(p, a, b)
Definition: dmusici.h:1209
#define IDirectMusicAudioPath_Release(p)
Definition: dmusici.h:1211
REFIID riid
Definition: atlbase.h:39
#define calloc
Definition: rosglue.h:14

Referenced by performance_CreateAudioPath(), and performance_CreateStandardAudioPath().

◆ create_dmaudiopath_config()

HRESULT create_dmaudiopath_config ( REFIID  riid,
void **  ppobj 
)

Definition at line 751 of file audiopath.c.

752{
753 struct audio_path_config *obj;
754 HRESULT hr;
755
756 *ppobj = NULL;
757 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
758 dmobject_init(&obj->dmobj, &CLSID_DirectMusicAudioPathConfig, &obj->IUnknown_iface);
759 obj->IUnknown_iface.lpVtbl = &path_config_unk_vtbl;
760 obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
761 obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
762 obj->ref = 1;
763
764 list_init(&obj->port_config_entries);
765
766 hr = IUnknown_QueryInterface(&obj->IUnknown_iface, riid, ppobj);
767 IUnknown_Release(&obj->IUnknown_iface);
768 return hr;
769}
static const IDirectMusicObjectVtbl dmobject_vtbl
Definition: audiopath.c:317
static const IPersistStreamVtbl persiststream_vtbl
Definition: audiopath.c:574
static const IUnknownVtbl path_config_unk_vtbl
Definition: audiopath.c:645
static void list_init(struct list_entry *head)
Definition: list.h:51
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk)
Definition: dmobject.c:749

◆ IDirectMusicAudioPathImpl_Activate()

static HRESULT WINAPI IDirectMusicAudioPathImpl_Activate ( IDirectMusicAudioPath *  iface,
BOOL  activate 
)
static

Definition at line 240 of file audiopath.c.

241{
243
244 FIXME("(%p, %d): semi-stub\n", This, activate);
245
246 if (!!activate == This->fActive)
247 return S_FALSE;
248
249 if (!activate && This->pDSBuffer) {
250 /* Path is being deactivated */
251 IDirectSoundBuffer_Stop(This->pDSBuffer);
252 }
253
254 This->fActive = !!activate;
255
256 return S_OK;
257}
static struct IDirectMusicAudioPathImpl * impl_from_IDirectMusicAudioPath(IDirectMusicAudioPath *iface)
Definition: audiopath.c:66
#define FIXME(fmt,...)
Definition: precomp.h:53
#define IDirectSoundBuffer_Stop(p)
Definition: dsound.h:591
#define S_OK
Definition: intsafe.h:52
#define S_FALSE
Definition: winerror.h:3451

◆ IDirectMusicAudioPathImpl_AddRef()

static ULONG WINAPI IDirectMusicAudioPathImpl_AddRef ( IDirectMusicAudioPath *  iface)
static

Definition at line 117 of file audiopath.c.

118{
121
122 TRACE("(%p): ref=%ld\n", This, ref);
123
124 return ref;
125}
#define InterlockedIncrement
Definition: armddk.h:53
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ IDirectMusicAudioPathImpl_ConvertPChannel()

static HRESULT WINAPI IDirectMusicAudioPathImpl_ConvertPChannel ( IDirectMusicAudioPath *  iface,
DWORD  dwPChannelIn,
DWORD *  pdwPChannelOut 
)
static

Definition at line 266 of file audiopath.c.

267{
269 FIXME("(%p, %ld, %p): stub\n", This, dwPChannelIn, pdwPChannelOut);
270 return S_OK;
271}

◆ IDirectMusicAudioPathImpl_GetObjectInPath()

static HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath ( IDirectMusicAudioPath *  iface,
DWORD  dwPChannel,
DWORD  dwStage,
DWORD  dwBuffer,
REFGUID  guidObject,
DWORD  dwIndex,
REFGUID  iidInterface,
void **  ppObject 
)
static

Definition at line 146 of file audiopath.c.

148{
150 HRESULT hr;
151
152 FIXME("(%p, %ld, %ld, %ld, %s, %ld, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject),
153 dwIndex, debugstr_dmguid(iidInterface), ppObject);
154
155 switch (dwStage) {
156 case DMUS_PATH_BUFFER:
157 if (This->pDSBuffer)
158 {
159 if (IsEqualIID (iidInterface, &IID_IUnknown) ||
160 IsEqualIID (iidInterface, &IID_IDirectSoundBuffer) ||
161 IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8) ||
162 IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) {
163 return IDirectSoundBuffer_QueryInterface(This->pDSBuffer, iidInterface, ppObject);
164 }
165
166 WARN("Unsupported interface %s\n", debugstr_dmguid(iidInterface));
167 *ppObject = NULL;
168 return E_NOINTERFACE;
169 }
170 break;
171
173 if (IsEqualIID (iidInterface, &IID_IDirectSound3DListener)) {
174 IDirectSoundBuffer_QueryInterface(This->pPrimary, &IID_IDirectSound3DListener, ppObject);
175 return S_OK;
176 } else {
177 FIXME("bad iid...\n");
178 }
179 }
180 break;
181
183 {
184 if (IsEqualIID (iidInterface, &IID_IDirectMusicGraph)) {
185 if (NULL == This->pToolGraph) {
186 IDirectMusicGraph* pGraph;
187 hr = create_dmgraph(&IID_IDirectMusicGraph, (void**)&pGraph);
188 if (FAILED(hr))
189 return hr;
190 This->pToolGraph = pGraph;
191 }
192 *ppObject = This->pToolGraph;
194 return S_OK;
195 }
196 }
197 break;
198
200 {
201 /* TODO */
202 }
203 break;
204
206 {
207 /* TODO check wanted GUID */
208 *ppObject = This->pPerf;
209 IUnknown_AddRef((LPUNKNOWN) *ppObject);
210 return S_OK;
211 }
212 break;
213
215 {
216 IDirectMusicGraph* pPerfoGraph = NULL;
217 IDirectMusicPerformance8_GetGraph(This->pPerf, &pPerfoGraph);
218 if (NULL == pPerfoGraph) {
219 IDirectMusicGraph* pGraph = NULL;
220 hr = create_dmgraph(&IID_IDirectMusicGraph, (void**)&pGraph);
221 if (FAILED(hr))
222 return hr;
224 pPerfoGraph = pGraph;
225 }
226 *ppObject = pPerfoGraph;
227 return S_OK;
228 }
229 break;
230
232 default:
233 break;
234 }
235
236 *ppObject = NULL;
237 return E_INVALIDARG;
238}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
static LPVOID LPUNKNOWN
Definition: dinput.c:53
HRESULT create_dmgraph(REFIID riid, void **ret_iface)
Definition: graph.c:301
const char * debugstr_dmguid(const GUID *id)
Definition: dmobject.c:36
struct IDirectMusicGraph * LPDIRECTMUSICGRAPH
Definition: dmplugin.h:87
#define IDirectMusicPerformance8_SetGraph(p, a)
Definition: dmusici.h:1412
#define IDirectMusicPerformance8_GetGraph(p, a)
Definition: dmusici.h:1411
#define DMUS_PATH_AUDIOPATH_TOOL
Definition: dmusici.h:284
#define DMUS_PATH_PERFORMANCE_GRAPH
Definition: dmusici.h:286
#define DMUS_PATH_AUDIOPATH_GRAPH
Definition: dmusici.h:283
#define DMUS_PATH_PERFORMANCE_TOOL
Definition: dmusici.h:287
#define DMUS_PATH_PRIMARY_BUFFER
Definition: dmusici.h:293
#define DMUS_PATH_BUFFER
Definition: dmusici.h:289
#define DMUS_PATH_PERFORMANCE
Definition: dmusici.h:285
#define IDirectMusicGraph_AddRef(p)
Definition: dmusici.h:1471
#define IDirectSoundBuffer_QueryInterface(p, a, b)
Definition: dsound.h:572
#define FAILED(hr)
Definition: intsafe.h:51
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ IDirectMusicAudioPathImpl_QueryInterface()

static HRESULT WINAPI IDirectMusicAudioPathImpl_QueryInterface ( IDirectMusicAudioPath *  iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 97 of file audiopath.c.

98{
100
101 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
102
103 *ppobj = NULL;
104
105 if (IsEqualIID (riid, &IID_IDirectMusicAudioPath) || IsEqualIID (riid, &IID_IUnknown))
106 *ppobj = &This->IDirectMusicAudioPath_iface;
107
108 if (*ppobj) {
109 IUnknown_AddRef((IUnknown*)*ppobj);
110 return S_OK;
111 }
112
113 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
114 return E_NOINTERFACE;
115}

◆ IDirectMusicAudioPathImpl_Release()

static ULONG WINAPI IDirectMusicAudioPathImpl_Release ( IDirectMusicAudioPath *  iface)
static

Definition at line 127 of file audiopath.c.

128{
131
132 TRACE("(%p): ref=%ld\n", This, ref);
133
134 if (ref == 0) {
135 if (This->pPrimary)
137 if (This->pDSBuffer)
139 This->pPerf = NULL;
140 free(This);
141 }
142
143 return ref;
144}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
#define IDirectSoundBuffer_Release(p)
Definition: dsound.h:574

◆ IDirectMusicAudioPathImpl_SetVolume()

static HRESULT WINAPI IDirectMusicAudioPathImpl_SetVolume ( IDirectMusicAudioPath *  iface,
LONG  lVolume,
DWORD  dwDuration 
)
static

Definition at line 259 of file audiopath.c.

260{
262 FIXME("(%p, %li, %ld): stub\n", This, lVolume, dwDuration);
263 return S_OK;
264}

◆ impl_from_IDirectMusicAudioPath()

◆ impl_from_IPersistStream()

static struct audio_path_config * impl_from_IPersistStream ( IPersistStream *  iface)
inlinestatic

Definition at line 71 of file audiopath.c.

72{
73 return CONTAINING_RECORD(iface, struct audio_path_config, dmobj.IPersistStream_iface);
74}

Referenced by path_config_IPersistStream_Load().

◆ impl_from_IUnknown()

static struct audio_path_config * impl_from_IUnknown ( IUnknown *  iface)
inlinestatic

◆ parse_pchannel_to_buffers_list()

static HRESULT parse_pchannel_to_buffers_list ( struct audio_path_port_config *  This,
IStream *  stream,
const struct chunk_entry *  pchl 
)
static

Definition at line 326 of file audiopath.c.

327{
328 struct chunk_entry chunk = { .parent = pchl };
329 struct audio_path_pchannel_to_buffer *pchannel_to_buffer = NULL;
332 ULONG i;
333 HRESULT hr;
334
335 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
336 {
337 switch (chunk.id)
338 {
340 hr = stream_read(stream, &header, sizeof(header));
341 if (FAILED(hr))
342 break;
343
344 TRACE("Got PChannelToBuffer header:\n");
345 TRACE("\tdwPChannelCount: %lu\n", header.dwPChannelCount);
346 TRACE("\tdwPChannelBase: %lu\n", header.dwPChannelBase);
347 TRACE("\tdwBufferCount: %lu\n", header.dwBufferCount);
348 TRACE("\tdwFlags: %lx\n", header.dwFlags);
349
350 bytes = chunk.size - sizeof(header);
351
352 if (bytes != sizeof(GUID) * header.dwBufferCount)
353 {
354 WARN("Invalid size of GUIDs array\n");
355 hr = E_FAIL;
356 break;
357 }
358
359 pchannel_to_buffer = calloc(1, sizeof(*pchannel_to_buffer) + bytes);
360 if (!pchannel_to_buffer)
361 {
363 break;
364 }
365
366 pchannel_to_buffer->header = header;
367 TRACE("number of GUIDs: %lu\n", pchannel_to_buffer->header.dwBufferCount);
368
369 hr = stream_read(stream, pchannel_to_buffer->guids, bytes);
370 if (FAILED(hr))
371 break;
372
373 for (i = 0; i < pchannel_to_buffer->header.dwBufferCount; i++)
374 TRACE("\tguids[%lu]: %s\n", i, debugstr_dmguid(&pchannel_to_buffer->guids[i]));
375
376 list_add_tail(&This->pchannel_to_buffer_entries, &pchannel_to_buffer->entry);
377 pchannel_to_buffer = NULL;
378 break;
379 case FOURCC_LIST:
380 if (chunk.type == DMUS_FOURCC_UNFO_LIST)
381 TRACE("Unfo list in PChannelToBuffer is ignored\n");
382 else
383 WARN("Unknown %s\n", debugstr_chunk(&chunk));
384 break;
385 case MAKEFOURCC('p','b','g','d'):
386 FIXME("Undocumented %s\n", debugstr_chunk(&chunk));
387 break;
388 default:
389 WARN("Unknown %s\n", debugstr_chunk(&chunk));
390 break;
391 }
392
393 if (FAILED(hr))
394 break;
395 }
396
397 if (FAILED(hr) && pchannel_to_buffer)
398 free(pchannel_to_buffer);
399 return hr;
400}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define E_FAIL
Definition: ddrawi.h:102
#define MAKEFOURCC(ch0, ch1, ch2, ch3)
Definition: ddsformat.c:45
HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk)
Definition: dmobject.c:360
const char * debugstr_chunk(const struct chunk_entry *chunk)
Definition: dmobject.c:279
#define DMUS_FOURCC_PCHANNELS_ITEM
Definition: dmusicf.h:61
#define DMUS_FOURCC_UNFO_LIST
Definition: dmusicf.h:44
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FOURCC_LIST
Definition: mmsystem.h:565
static int stream_read
Definition: htmldoc.c:205
DMUS_IO_PCHANNELTOBUFFER_HEADER header
Definition: audiopath.c:38
Definition: dmobject.h:26
uint16_t size
Definition: btrfs_drv.h:563
Definition: parse.h:23
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by parse_port_config_list().

◆ parse_port_config_list()

static HRESULT parse_port_config_list ( struct audio_path_config *  This,
IStream *  stream,
const struct chunk_entry *  pcfl 
)
static

Definition at line 414 of file audiopath.c.

415{
416 struct chunk_entry chunk = { .parent = pcfl };
417 struct audio_path_port_config *port_config = calloc(1, sizeof(*port_config));
418 HRESULT hr;
419
420 if (!port_config)
421 return E_OUTOFMEMORY;
422
424
425 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
426 {
427 switch (chunk.id)
428 {
430 hr = stream_chunk_get_data(stream, &chunk, &port_config->header, sizeof(port_config->header));
431 if (FAILED(hr))
432 break;
433 TRACE("Got PortConfig header:\n");
434 TRACE("\tdwPChannelBase: %lu\n", port_config->header.dwPChannelBase);
435 TRACE("\tdwPChannelCount: %lu\n", port_config->header.dwPChannelCount);
436 TRACE("\tdwFlags: %lx\n", port_config->header.dwFlags);
437 TRACE("\tguidPort: %s\n", debugstr_dmguid(&port_config->header.guidPort));
438 break;
440 hr = stream_chunk_get_data(stream, &chunk, &port_config->params, sizeof(port_config->params));
441 if (FAILED(hr))
442 break;
443 TRACE("Got PortConfig params:\n");
444 TRACE("\tdwSize: %lu\n", port_config->params.dwSize);
445 TRACE("\tdwValidParams: %lx\n", port_config->params.dwValidParams);
447 TRACE("\tvoices: %lu\n", port_config->params.dwVoices);
449 TRACE("\tchannel groups: %lu\n", port_config->params.dwChannelGroups);
451 TRACE("\taudio channels: %lu\n", port_config->params.dwAudioChannels);
453 TRACE("\tsample rate: %lu\n", port_config->params.dwSampleRate);
455 TRACE("\teffects: %lx\n", port_config->params.dwEffectFlags);
456 if (port_config->params.dwValidParams & DMUS_PORTPARAMS_SHARE)
457 TRACE("\tshare: %d\n", port_config->params.fShare);
459 TRACE("\tfeatures: %lx\n", port_config->params.dwFeatures);
460 break;
461 case FOURCC_LIST:
463 FIXME("DirectSound buffer descriptors is not supported\n");
464 else if (chunk.type == DMUS_FOURCC_PCHANNELS_LIST)
466 else if (chunk.type == DMUS_FOURCC_UNFO_LIST)
467 TRACE("Unfo list in PortConfig is ignored\n");
468 else
469 WARN("Unknown %s\n", debugstr_chunk(&chunk));
470 break;
471 default:
472 WARN("Unknown %s\n", debugstr_chunk(&chunk));
473 }
474
475 if (FAILED(hr))
476 break;
477 }
478
479 if (FAILED(hr))
480 port_config_destroy(port_config);
481 else
482 list_add_tail(&This->port_config_entries, &port_config->entry);
483 return hr;
484}
static void port_config_destroy(struct audio_path_port_config *port_config)
Definition: audiopath.c:402
static HRESULT parse_pchannel_to_buffers_list(struct audio_path_port_config *This, IStream *stream, const struct chunk_entry *pchl)
Definition: audiopath.c:326
HRESULT stream_chunk_get_data(IStream *stream, const struct chunk_entry *chunk, void *data, ULONG size)
Definition: dmobject.c:417
#define DMUS_PORTPARAMS_CHANNELGROUPS
Definition: dmusicc.h:206
#define DMUS_PORTPARAMS_SAMPLERATE
Definition: dmusicc.h:208
#define DMUS_PORTPARAMS_AUDIOCHANNELS
Definition: dmusicc.h:207
#define DMUS_PORTPARAMS_SHARE
Definition: dmusicc.h:210
#define DMUS_PORTPARAMS_FEATURES
Definition: dmusicc.h:211
#define DMUS_PORTPARAMS_VOICES
Definition: dmusicc.h:205
#define DMUS_PORTPARAMS_EFFECTS
Definition: dmusicc.h:209
#define DMUS_FOURCC_DSBUFFER_LIST
Definition: dmusicf.h:58
#define DMUS_FOURCC_PORTPARAMS_ITEM
Definition: dmusicf.h:57
#define DMUS_FOURCC_PCHANNELS_LIST
Definition: dmusicf.h:60
#define DMUS_FOURCC_PORTCONFIG_ITEM
Definition: dmusicf.h:56
DWORD dwSampleRate
Definition: dmusicc.h:320
DWORD dwEffectFlags
Definition: dmusicc.h:321
DWORD dwValidParams
Definition: dmusicc.h:316
DWORD dwAudioChannels
Definition: dmusicc.h:319
DWORD dwChannelGroups
Definition: dmusicc.h:318
DWORD dwFeatures
Definition: dmusicc.h:323
DMUS_IO_PORTCONFIG_HEADER header
Definition: audiopath.c:51
DMUS_PORTPARAMS8 params
Definition: audiopath.c:52
struct list entry
Definition: audiopath.c:50
struct list pchannel_to_buffer_entries
Definition: audiopath.c:54

Referenced by parse_port_configs_list().

◆ parse_port_configs_list()

static HRESULT parse_port_configs_list ( struct audio_path_config *  This,
IStream *  stream,
const struct chunk_entry *  pcsl 
)
static

Definition at line 486 of file audiopath.c.

487{
488 struct chunk_entry chunk = { .parent = pcsl };
489 HRESULT hr;
490
491 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
492 {
493 switch (MAKE_IDTYPE(chunk.id, chunk.type))
494 {
497 if (FAILED(hr))
498 return hr;
499 break;
500 default:
501 WARN("Unknown %s\n", debugstr_chunk(&chunk));
502 break;
503 }
504 }
505 return SUCCEEDED(hr) ? S_OK : hr;
506}
static HRESULT parse_port_config_list(struct audio_path_config *This, IStream *stream, const struct chunk_entry *pcfl)
Definition: audiopath.c:414
#define MAKE_IDTYPE(id, type)
Definition: dmobject.h:33
#define DMUS_FOURCC_PORTCONFIG_LIST
Definition: dmusicf.h:55
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Referenced by path_config_IPersistStream_Load().

◆ path_config_get_audio_path_params()

HRESULT path_config_get_audio_path_params ( IUnknown *  iface,
WAVEFORMATEX *  format,
DSBUFFERDESC *  desc,
DMUS_PORTPARAMS *  params 
)

Definition at line 652 of file audiopath.c.

653{
655 struct list *first_port_config, *first_pchannel_to_buffer;
656 struct audio_path_port_config *port_config;
657 struct audio_path_pchannel_to_buffer *pchannel_to_buffer;
658 GUID *guids;
659
660 first_port_config = list_head(&This->port_config_entries);
661 if (list_next(&This->port_config_entries, first_port_config))
662 FIXME("Only one port config supported. %p -> %p\n", first_port_config, list_next(&This->port_config_entries, first_port_config));
663 port_config = LIST_ENTRY(first_port_config, struct audio_path_port_config, entry);
664 first_pchannel_to_buffer = list_head(&port_config->pchannel_to_buffer_entries);
665 if (list_next(&port_config->pchannel_to_buffer_entries, first_pchannel_to_buffer))
666 FIXME("Only one pchannel to buffer entry supported.\n");
667 pchannel_to_buffer = LIST_ENTRY(first_pchannel_to_buffer, struct audio_path_pchannel_to_buffer, entry);
668
669 /* Secondary buffer description */
670 memset(format, 0, sizeof(*format));
671 format->wFormatTag = WAVE_FORMAT_PCM;
672 format->nChannels = 1;
673 format->nSamplesPerSec = 44000;
674 format->nAvgBytesPerSec = 44000 * 2;
675 format->nBlockAlign = 2;
676 format->wBitsPerSample = 16;
677 format->cbSize = 0;
678
679 memset(desc, 0, sizeof(*desc));
680 desc->dwSize = sizeof(*desc);
682 desc->dwBufferBytes = DSBSIZE_MIN;
683 desc->dwReserved = 0;
684 desc->lpwfxFormat = format;
685 desc->guid3DAlgorithm = GUID_NULL;
686
687 guids = pchannel_to_buffer->guids;
688 if (pchannel_to_buffer->header.dwBufferCount == 2)
689 {
690 if ((!IsEqualGUID(&guids[0], &GUID_Buffer_Reverb) && !IsEqualGUID(&guids[0], &GUID_Buffer_Stereo)) ||
691 (!IsEqualGUID(&guids[1], &GUID_Buffer_Reverb) && !IsEqualGUID(&guids[1], &GUID_Buffer_Stereo)) ||
692 IsEqualGUID(&guids[0], &guids[1]))
693 FIXME("Only a stereo plus reverb buffer is supported\n");
694 else
695 {
697 format->nChannels = 2;
698 format->nBlockAlign *= 2;
699 format->nAvgBytesPerSec *= 2;
700 }
701 }
702 else if (pchannel_to_buffer->header.dwBufferCount == 1)
703 {
704 if (IsEqualGUID(guids, &GUID_Buffer_Stereo))
705 {
707 format->nChannels = 2;
708 format->nBlockAlign *= 2;
709 format->nAvgBytesPerSec *= 2;
710 }
711 else if (IsEqualGUID(guids, &GUID_Buffer_3D_Dry))
713 else if (IsEqualGUID(guids, &GUID_Buffer_Mono))
715 else
716 FIXME("Unsupported buffer guid %s\n", debugstr_dmguid(guids));
717 }
718 else
719 FIXME("Multiple buffers not supported\n");
720
721 *params = port_config->params;
722 if (!(params->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS))
723 {
725 params->dwChannelGroups = (port_config->header.dwPChannelCount + 15) / 16;
726 }
727 if (!(params->dwValidParams & DMUS_PORTPARAMS_AUDIOCHANNELS))
728 {
729 params->dwValidParams |= DMUS_PORTPARAMS_AUDIOCHANNELS;
730 params->dwAudioChannels = format->nChannels;
731 }
732 return S_OK;
733}
static struct audio_path_config * impl_from_IUnknown(IUnknown *iface)
Definition: audiopath.c:585
#define WAVE_FORMAT_PCM
Definition: constants.h:425
Definition: list.h:39
const struct sortguid * guids
Definition: locale.c:422
#define DSBCAPS_GLOBALFOCUS
Definition: dsound.h:219
#define DSBCAPS_CTRLVOLUME
Definition: dsound.h:213
#define DSBCAPS_MUTE3DATMAXDISTANCE
Definition: dsound.h:221
#define DSBCAPS_CTRLPAN
Definition: dsound.h:212
#define DSBCAPS_CTRLFX
Definition: dsound.h:216
#define DSBSIZE_MIN
Definition: dsound.h:224
#define DSBCAPS_CTRLFREQUENCY
Definition: dsound.h:211
#define DSBCAPS_CTRL3D
Definition: dsound.h:210
GLenum const GLfloat * params
Definition: glext.h:5645
uint32_t entry
Definition: isohybrid.c:63
#define GUID_NULL
Definition: ks.h:106
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:117
#define memset(x, y, z)
Definition: compat.h:39
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by performance_CreateAudioPath().

◆ path_config_IDirectMusicObject_ParseDescriptor()

static HRESULT WINAPI path_config_IDirectMusicObject_ParseDescriptor ( IDirectMusicObject *  iface,
IStream *  stream,
DMUS_OBJECTDESC *  desc 
)
static

Definition at line 284 of file audiopath.c.

286{
287 struct chunk_entry riff = {0};
288 HRESULT hr;
289
290 TRACE("(%p, %p, %p)\n", iface, stream, desc);
291
292 if (!stream)
293 return E_POINTER;
294 if (!desc || desc->dwSize != sizeof(*desc))
295 return E_INVALIDARG;
296
297 if ((hr = stream_get_chunk(stream, &riff)) != S_OK)
298 return hr;
299 if (riff.id != FOURCC_RIFF || riff.type != DMUS_FOURCC_AUDIOPATH_FORM) {
300 TRACE("loading failed: unexpected %s\n", debugstr_chunk(&riff));
303 }
304
307 if (FAILED(hr))
308 return hr;
309
310 desc->guidClass = CLSID_DirectMusicAudioPathConfig;
311 desc->dwValidData |= DMUS_OBJ_CLASS;
312
314 return S_OK;
315}
#define DMUS_E_CHUNKNOTFOUND
Definition: dmerror.h:66
HRESULT dmobj_parsedescriptor(IStream *stream, const struct chunk_entry *riff, DMUS_OBJECTDESC *desc, DWORD supported)
Definition: dmobject.c:591
void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc)
Definition: dmobject.c:222
HRESULT stream_skip_chunk(IStream *stream, const struct chunk_entry *chunk)
Definition: dmobject.c:351
HRESULT stream_get_chunk(IStream *stream, struct chunk_entry *chunk)
Definition: dmobject.c:307
#define DMUS_FOURCC_AUDIOPATH_FORM
Definition: dmusicf.h:53
#define DMUS_OBJ_NAME
Definition: dmusici.h:267
#define DMUS_OBJ_CLASS
Definition: dmusici.h:266
#define DMUS_OBJ_VERSION
Definition: dmusici.h:272
#define DMUS_OBJ_CATEGORY
Definition: dmusici.h:268
#define DMUS_OBJ_OBJECT
Definition: dmusici.h:265
#define FOURCC_RIFF
Definition: mmsystem.h:564
FOURCC id
Definition: dmobject.h:27
FOURCC type
Definition: dmobject.h:29
#define E_POINTER
Definition: winerror.h:3480

◆ path_config_IPersistStream_Load()

static HRESULT WINAPI path_config_IPersistStream_Load ( IPersistStream *  iface,
IStream *  stream 
)
static

Definition at line 509 of file audiopath.c.

510{
512 struct chunk_entry riff = {0}, chunk = {0};
513 HRESULT hr = S_OK;
514
515 FIXME("(%p, %p): Loading\n", This, stream);
516
517 if (!stream)
518 return E_POINTER;
519
520 hr = stream_get_chunk(stream, &riff);
521 if (FAILED(hr))
522 {
523 WARN("Failed to get chunk %#lx.\n", hr);
524 return hr;
525 }
526
528 {
529 WARN("loading failed: unexpected %s\n", debugstr_chunk(&riff));
530 return E_UNEXPECTED;
531 }
532
533 if (FAILED(hr = dmobj_parsedescriptor(stream, &riff, &This->dmobj.desc,
536 {
537 WARN("Failed to parse descriptor %#lx.\n", hr);
538 return hr;
539 }
540 This->dmobj.desc.guidClass = CLSID_DirectMusicAudioPathConfig;
541 This->dmobj.desc.dwValidData |= DMUS_OBJ_CLASS;
542
543 chunk.parent = &riff;
544 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
545 {
546 switch (MAKE_IDTYPE(chunk.id, chunk.type))
547 {
550 if (FAILED(hr))
551 return hr;
553 FIXME("buffer attributes are not supported\n");
554 break;
555 case MAKE_IDTYPE(FOURCC_LIST, MAKEFOURCC('p','a','p','d')):
556 FIXME("Undocumented %s\n", debugstr_chunk(&chunk));
557 break;
559 WARN("Unknown %s\n", debugstr_chunk(&chunk));
560 break;
563 /* Already parsed in dmobj_parsedescriptor. */
564 break;
565 default:
566 WARN("Unknown %s\n", debugstr_chunk(&chunk));
567 break;
568 }
569 }
570 TRACE("Finished parsing %#lx\n", hr);
571 return SUCCEEDED(hr) ? S_OK : hr;
572}
static struct audio_path_config * impl_from_IPersistStream(IPersistStream *iface)
Definition: audiopath.c:71
static HRESULT parse_port_configs_list(struct audio_path_config *This, IStream *stream, const struct chunk_entry *pcsl)
Definition: audiopath.c:486
static HRESULT stream_reset_chunk_data(IStream *stream, const struct chunk_entry *chunk)
Definition: dmobject.h:50
#define DMUS_FOURCC_GUID_CHUNK
Definition: dmusicf.h:42
#define DMUS_FOURCC_PORTCONFIGS_LIST
Definition: dmusicf.h:54
#define DMUS_FOURCC_VERSION_CHUNK
Definition: dmusicf.h:51
#define E_UNEXPECTED
Definition: winerror.h:3528

◆ path_config_IUnknown_AddRef()

static ULONG WINAPI path_config_IUnknown_AddRef ( IUnknown *  unk)
static

Definition at line 615 of file audiopath.c.

616{
619
620 TRACE("(%p): ref=%ld\n", This, ref);
621
622 return ref;
623}

◆ path_config_IUnknown_QueryInterface()

static HRESULT WINAPI path_config_IUnknown_QueryInterface ( IUnknown *  iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 590 of file audiopath.c.

591{
593
594 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
595
596 *ppobj = NULL;
597
599 *ppobj = &This->IUnknown_iface;
600 else if (IsEqualIID (riid, &IID_IDirectMusicObject))
601 *ppobj = &This->dmobj.IDirectMusicObject_iface;
603 *ppobj = &This->dmobj.IPersistStream_iface;
604
605 if (*ppobj)
606 {
607 IUnknown_AddRef((IUnknown*)*ppobj);
608 return S_OK;
609 }
610
611 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
612 return E_NOINTERFACE;
613}
const GUID IID_IPersistStream
Definition: proxy.cpp:13

◆ path_config_IUnknown_Release()

static ULONG WINAPI path_config_IUnknown_Release ( IUnknown *  unk)
static

Definition at line 625 of file audiopath.c.

626{
629
630 TRACE("(%p): ref=%ld\n", This, ref);
631
632 if (!ref)
633 {
634 struct audio_path_port_config *config, *next_config;
635 LIST_FOR_EACH_ENTRY_SAFE(config, next_config, &This->port_config_entries, struct audio_path_port_config, entry)
636 {
637 list_remove(&config->entry);
639 }
640 free(This);
641 }
642 return ref;
643}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
struct config_s config
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242

◆ port_config_destroy()

static void port_config_destroy ( struct audio_path_port_config *  port_config)
static

Definition at line 402 of file audiopath.c.

403{
404 struct audio_path_pchannel_to_buffer *pchannel_to_buffer, *next_pchannel_to_buffer;
405 LIST_FOR_EACH_ENTRY_SAFE(pchannel_to_buffer, next_pchannel_to_buffer, &port_config->pchannel_to_buffer_entries,
407 {
408 list_remove(&pchannel_to_buffer->entry);
409 free(pchannel_to_buffer);
410 }
411 free(port_config);
412}

Referenced by parse_port_config_list(), and path_config_IUnknown_Release().

◆ set_audiopath_dsound_buffer()

void set_audiopath_dsound_buffer ( IDirectMusicAudioPath *  iface,
IDirectSoundBuffer *  buffer 
)

Definition at line 82 of file audiopath.c.

83{
85 This->pDSBuffer = buffer;
86}
GLuint buffer
Definition: glext.h:5915

Referenced by performance_CreateAudioPath(), and performance_CreateStandardAudioPath().

◆ set_audiopath_perf_pointer()

void set_audiopath_perf_pointer ( IDirectMusicAudioPath *  iface,
IDirectMusicPerformance8 *  performance 
)

◆ set_audiopath_primary_dsound_buffer()

void set_audiopath_primary_dsound_buffer ( IDirectMusicAudioPath *  iface,
IDirectSoundBuffer *  buffer 
)

Definition at line 88 of file audiopath.c.

89{
91 This->pPrimary = buffer;
92}

Referenced by performance_CreateAudioPath(), and performance_CreateStandardAudioPath().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dmime  )

Variable Documentation

◆ DirectMusicAudioPathVtbl

const IDirectMusicAudioPathVtbl DirectMusicAudioPathVtbl
static
Initial value:
= {
}
static ULONG WINAPI IDirectMusicAudioPathImpl_Release(IDirectMusicAudioPath *iface)
Definition: audiopath.c:127
static HRESULT WINAPI IDirectMusicAudioPathImpl_QueryInterface(IDirectMusicAudioPath *iface, REFIID riid, void **ppobj)
Definition: audiopath.c:97
static HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath(IDirectMusicAudioPath *iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, DWORD dwIndex, REFGUID iidInterface, void **ppObject)
Definition: audiopath.c:146
static ULONG WINAPI IDirectMusicAudioPathImpl_AddRef(IDirectMusicAudioPath *iface)
Definition: audiopath.c:117
static HRESULT WINAPI IDirectMusicAudioPathImpl_Activate(IDirectMusicAudioPath *iface, BOOL activate)
Definition: audiopath.c:240
static HRESULT WINAPI IDirectMusicAudioPathImpl_SetVolume(IDirectMusicAudioPath *iface, LONG lVolume, DWORD dwDuration)
Definition: audiopath.c:259
static HRESULT WINAPI IDirectMusicAudioPathImpl_ConvertPChannel(IDirectMusicAudioPath *iface, DWORD dwPChannelIn, DWORD *pdwPChannelOut)
Definition: audiopath.c:266

Definition at line 273 of file audiopath.c.

Referenced by create_dmaudiopath().

◆ dmobject_vtbl

const IDirectMusicObjectVtbl dmobject_vtbl
static
Initial value:
= {
}
static HRESULT WINAPI path_config_IDirectMusicObject_ParseDescriptor(IDirectMusicObject *iface, IStream *stream, DMUS_OBJECTDESC *desc)
Definition: audiopath.c:284
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:503
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface)
Definition: dmobject.c:497
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:484
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:518
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface)
Definition: dmobject.c:491

Definition at line 317 of file audiopath.c.

Referenced by create_dmaudiopath_config().

◆ path_config_unk_vtbl

const IUnknownVtbl path_config_unk_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI path_config_IUnknown_Release(IUnknown *unk)
Definition: audiopath.c:625
static HRESULT WINAPI path_config_IUnknown_QueryInterface(IUnknown *iface, REFIID riid, void **ppobj)
Definition: audiopath.c:590
static ULONG WINAPI path_config_IUnknown_AddRef(IUnknown *unk)
Definition: audiopath.c:615

Definition at line 645 of file audiopath.c.

Referenced by create_dmaudiopath_config().

◆ persiststream_vtbl

const IPersistStreamVtbl persiststream_vtbl
static
Initial value:
= {
}
static HRESULT WINAPI path_config_IPersistStream_Load(IPersistStream *iface, IStream *stream)
Definition: audiopath.c:509
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface)
Definition: dmobject.c:702
HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size)
Definition: dmobject.c:742
HRESULT WINAPI dmobj_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class)
Definition: dmobject.c:708
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface)
Definition: dmobject.c:696
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:689
HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface)
Definition: dmobject.c:729
HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream, BOOL clear_dirty)
Definition: dmobject.c:735

Definition at line 574 of file audiopath.c.

Referenced by create_dmaudiopath_config().