Commit b3d1b1f2 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dmime: Don't expose IDirectMusicAudioPath impl details.

parent 7567db85
......@@ -22,6 +22,43 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
struct IDirectMusicAudioPathImpl {
/* IUnknown fields */
const IUnknownVtbl *UnknownVtbl;
const IDirectMusicAudioPathVtbl *AudioPathVtbl;
const IDirectMusicObjectVtbl *ObjectVtbl;
const IPersistStreamVtbl *PersistStreamVtbl;
LONG ref;
/* IDirectMusicAudioPathImpl fields */
LPDMUS_OBJECTDESC pDesc;
IDirectMusicPerformance8* pPerf;
IDirectMusicGraph* pToolGraph;
IDirectSoundBuffer* pDSBuffer;
IDirectSoundBuffer* pPrimary;
BOOL fActive;
};
void set_audiopath_perf_pointer(IDirectMusicAudioPath *iface, IDirectMusicPerformance8 *performance)
{
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
This->pPerf = performance;
}
void set_audiopath_dsound_buffer(IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
{
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
This->pDSBuffer = buffer;
}
void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
{
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
This->pPrimary = buffer;
}
/*****************************************************************************
* IDirectMusicAudioPathImpl implementation
*/
......@@ -72,6 +109,7 @@ static ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_Release (LPUNKNOWN iface)
if (This->pDSBuffer) {
IDirectSoundBuffer8_Release(This->pDSBuffer);
}
This->pPerf = NULL;
HeapFree(GetProcessHeap(), 0, This);
}
......
......@@ -78,6 +78,9 @@ extern HRESULT WINAPI create_dmtempotrack(REFIID riid, void **ret_iface) DECLSPE
extern HRESULT WINAPI create_dmtimesigtrack(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
extern HRESULT WINAPI create_dmwavetrack(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
extern void set_audiopath_perf_pointer(IDirectMusicAudioPath*,IDirectMusicPerformance8*) DECLSPEC_HIDDEN;
extern void set_audiopath_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffer*) DECLSPEC_HIDDEN;
extern void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffer*) DECLSPEC_HIDDEN;
/*****************************************************************************
* Auxiliary definitions
......@@ -121,28 +124,6 @@ typedef struct DMUSIC_PRIVATE_PCHANNEL_ {
} DMUSIC_PRIVATE_PCHANNEL, *LPDMUSIC_PRIVATE_PCHANNEL;
/*****************************************************************************
* IDirectMusicAudioPathImpl implementation structure
*/
struct IDirectMusicAudioPathImpl {
/* IUnknown fields */
const IUnknownVtbl *UnknownVtbl;
const IDirectMusicAudioPathVtbl *AudioPathVtbl;
const IDirectMusicObjectVtbl *ObjectVtbl;
const IPersistStreamVtbl *PersistStreamVtbl;
LONG ref;
/* IDirectMusicAudioPathImpl fields */
LPDMUS_OBJECTDESC pDesc;
IDirectMusicPerformance8* pPerf;
IDirectMusicGraph* pToolGraph;
IDirectSoundBuffer* pDSBuffer;
IDirectSoundBuffer* pPrimary;
BOOL fActive;
};
/*****************************************************************************
* IDirectMusicLyricsTrack implementation structure
*/
struct IDirectMusicLyricsTrack
......
......@@ -987,7 +987,6 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath(IDirectMusicP
IUnknown *pSourceConfig, BOOL fActivate, IDirectMusicAudioPath **ppNewPath)
{
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
IDirectMusicAudioPathImpl *default_path;
IDirectMusicAudioPath *pPath;
FIXME("(%p, %p, %d, %p): stub\n", This, pSourceConfig, fActivate, ppNewPath);
......@@ -997,8 +996,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath(IDirectMusicP
}
create_dmaudiopath(&IID_IDirectMusicAudioPath, (void**)&pPath);
default_path = (IDirectMusicAudioPathImpl*)((char*)(pPath) - offsetof(IDirectMusicAudioPathImpl,AudioPathVtbl));
default_path->pPerf = &This->IDirectMusicPerformance8_iface;
set_audiopath_perf_pointer(pPath, iface);
/** TODO */
......@@ -1011,11 +1009,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
DWORD dwType, DWORD dwPChannelCount, BOOL fActivate, IDirectMusicAudioPath **ppNewPath)
{
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
IDirectMusicAudioPathImpl *default_path;
IDirectMusicAudioPath *pPath;
DSBUFFERDESC desc;
WAVEFORMATEX format;
LPDIRECTSOUNDBUFFER buffer;
IDirectSoundBuffer *buffer, *primary_buffer;
HRESULT hr = S_OK;
FIXME("(%p)->(%d, %d, %d, %p): semi-stub\n", This, dwType, dwPChannelCount, fActivate, ppNewPath);
......@@ -1024,9 +1021,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
return E_POINTER;
}
create_dmaudiopath(&IID_IDirectMusicAudioPath, (void**)&pPath);
default_path = (IDirectMusicAudioPathImpl*)((char*)(pPath) - offsetof(IDirectMusicAudioPathImpl,AudioPathVtbl));
default_path->pPerf = &This->IDirectMusicPerformance8_iface;
*ppNewPath = NULL;
/* Secondary buffer description */
memset(&format, 0, sizeof(format));
......@@ -1064,33 +1059,29 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
format.nAvgBytesPerSec *=2;
break;
default:
HeapFree(GetProcessHeap(), 0, default_path);
*ppNewPath = NULL;
return E_INVALIDARG;
}
/* FIXME: Should we create one secondary buffer for each PChannel? */
hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL);
if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, default_path);
*ppNewPath = NULL;
if (FAILED(hr))
return DSERR_BUFFERLOST;
}
default_path->pDSBuffer = buffer;
/* Update description for creating primary buffer */
desc.dwFlags |= DSBCAPS_PRIMARYBUFFER;
desc.dwBufferBytes = 0;
desc.lpwfxFormat = NULL;
hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL);
hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &primary_buffer, NULL);
if (FAILED(hr)) {
IDirectSoundBuffer_Release(default_path->pDSBuffer);
HeapFree(GetProcessHeap(), 0, default_path);
*ppNewPath = NULL;
IDirectSoundBuffer_Release(buffer);
return DSERR_BUFFERLOST;
}
default_path->pPrimary = buffer;
create_dmaudiopath(&IID_IDirectMusicAudioPath, (void**)&pPath);
set_audiopath_perf_pointer(pPath, iface);
set_audiopath_dsound_buffer(pPath, buffer);
set_audiopath_primary_dsound_buffer(pPath, buffer);
*ppNewPath = pPath;
......@@ -1105,15 +1096,15 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_SetDefaultAudioPath(IDirectMu
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
FIXME("(%p, %p): semi-stub\n", This, pAudioPath);
if (NULL != This->pDefaultPath) {
if (This->pDefaultPath) {
IDirectMusicAudioPath_Release(This->pDefaultPath);
((IDirectMusicAudioPathImpl*) This->pDefaultPath)->pPerf = NULL;
This->pDefaultPath = NULL;
}
This->pDefaultPath = pAudioPath;
if (NULL != This->pDefaultPath) {
if (This->pDefaultPath) {
IDirectMusicAudioPath_AddRef(This->pDefaultPath);
((IDirectMusicAudioPathImpl*)This->pDefaultPath)->pPerf = &This->IDirectMusicPerformance8_iface;
set_audiopath_perf_pointer(This->pDefaultPath, iface);
}
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment