Commit c77788b5 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- Release DSBuffer on AudioPath destruction.

- Semi stub for AudioPath Activate. - IDirectMusicPerformance8::CreateAudioPath stub. - Most of the IDirectMusicSegment8_[Set,Get]* (using header). - Load of Streamer IDirectMusicSegment8 header.
parent 9e8d507c
......@@ -59,13 +59,16 @@ ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_AddRef (LPUNKNOWN iface) {
}
ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
if (This->pDSBuffer) {
IDirectSoundBuffer8_Release(This->pDSBuffer);
}
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
ICOM_VTABLE(IUnknown) DirectMusicAudioPath_Unknown_Vtbl = {
......@@ -180,9 +183,17 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicAudioPath_GetObjectInPath (
}
HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Activate (LPDIRECTMUSICAUDIOPATH iface, BOOL fActivate) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
FIXME("(%p, %d): stub\n", This, fActivate);
return S_OK;
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
FIXME("(%p, %d): stub\n", This, fActivate);
if (!fActivate) {
if (!This->fActive) return S_OK;
This->fActive = FALSE;
} else {
if (This->fActive) return S_OK;
This->fActive = TRUE;
IDirectSoundBuffer_Stop(This->pDSBuffer);
}
return S_OK;
}
HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicAudioPath_SetVolume (LPDIRECTMUSICAUDIOPATH iface, long lVolume, DWORD dwDuration) {
......
......@@ -1117,6 +1117,22 @@ const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
/* dump whole DMUS_OBJECTDESC struct */
const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
if (pDesc) {
TRACE("DMUS_OBJECTDESC (%p):\n", pDesc);
TRACE(" - dwSize = %ld\n", pDesc->dwSize);
TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
if (pDesc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(pDesc->wszName));
if (pDesc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
if (pDesc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = FIXME\n");
if (pDesc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = %lli\n - pbMemData = %p\n", pDesc->llMemLength, pDesc->pbMemData);
if (pDesc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", pDesc->pStream);
} else {
TRACE("(NULL)\n");
}/*
if (pDesc) {
char buffer[1024] = "", *ptr = &buffer[0];
ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
......@@ -1136,4 +1152,6 @@ const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
} else {
return wine_dbg_sprintf("(NULL)");
}
*/
return "X";
}
......@@ -264,7 +264,9 @@ struct IDirectMusicSegment8Impl {
DWORD ref;
/* IDirectMusicSegment8Impl fields */
LPDMUS_OBJECTDESC pDesc;
LPDMUS_OBJECTDESC pDesc;
DMUS_IO_SEGMENT_HEADER header;
IDirectMusicGraph* pGraph;
};
/* IUnknown: */
......@@ -408,6 +410,8 @@ struct IDirectMusicAudioPathImpl {
IDirectMusicGraph* pToolGraph;
IDirectSoundBuffer* pDSBuffer;
IDirectSoundBuffer* pPrimary;
BOOL fActive;
};
/* IUnknown: */
......
......@@ -418,6 +418,8 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_GetGraph (LPDIRECTMUSICPERFORMANCE8
if (NULL != This->pToolGraph) {
*ppGraph = (LPDIRECTMUSICGRAPH) This->pToolGraph;
IDirectMusicGraph_AddRef((LPDIRECTMUSICGRAPH) *ppGraph);
} else {
return E_FAIL;
}
return S_OK;
}
......@@ -702,6 +704,7 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio (LPDIRECTMUSICPERFORMANCE8
* TODO, how can i fill the struct
* as seen at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directX/htm/dmusaudioparams.asp
*/
memset(&This->pParams, 0, sizeof(DMUS_AUDIOPARAMS));
This->pParams.dwSize = sizeof(DMUS_AUDIOPARAMS);
This->pParams.fInitNow = FALSE;
This->pParams.dwValidData = DMUS_AUDIOPARAMS_FEATURES | DMUS_AUDIOPARAMS_VOICES | DMUS_AUDIOPARAMS_SAMPLERATE | DMUS_AUDIOPARAMS_DEFAULTSYNTH;
......@@ -736,9 +739,25 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_ClonePMsg (LPDIRECTMUSICPERFORMANCE8
}
HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IUnknown* pSourceConfig, BOOL fActivate, IDirectMusicAudioPath** ppNewPath) {
IDirectMusicAudioPathImpl *default_path;
IDirectMusicAudioPath *pPath;
ICOM_THIS(IDirectMusicPerformance8Impl,iface);
FIXME("(%p, %p, %d, %p): stub\n", This, pSourceConfig, fActivate, ppNewPath);
return S_OK;
if (NULL == ppNewPath) {
return E_POINTER;
}
DMUSIC_CreateDirectMusicAudioPathImpl (&IID_IDirectMusicAudioPath, (LPVOID*)&pPath, NULL);
default_path = (IDirectMusicAudioPathImpl*)((char*)(pPath) - offsetof(IDirectMusicAudioPathImpl,AudioPathVtbl));
default_path->pPerf = (IDirectMusicPerformance8*) This;
/** TODO */
*ppNewPath = (LPDIRECTMUSICAUDIOPATH) pPath;
return IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Activate(*ppNewPath, fActivate);
}
/**
......@@ -765,6 +784,7 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath (LPDIRECTMUS
default_path->pPerf = (IDirectMusicPerformance8*) This;
/* Secondary buffer description */
memset(&format, 0, sizeof(format));
format.wFormatTag = WAVE_FORMAT_PCM;
format.nChannels = 1;
format.nSamplesPerSec = 44000;
......@@ -773,6 +793,7 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath (LPDIRECTMUS
format.wBitsPerSample = 16;
format.cbSize = 0;
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
desc.dwFlags = DSBCAPS_CTRLFX | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS;
desc.dwBufferBytes = DSBSIZE_MIN;
......@@ -831,7 +852,7 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath (LPDIRECTMUS
TRACE(" returning IDirectMusicPerformance interface at %p.\n", *ppNewPath);
return S_OK;
return IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Activate(*ppNewPath, fActivate);
}
HRESULT WINAPI IDirectMusicPerformance8Impl_SetDefaultAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicAudioPath* pAudioPath) {
......
......@@ -77,6 +77,7 @@ struct IDirectMusicScriptImpl {
DWORD ref;
/* IDirectMusicScriptImpl fields */
IDirectMusicPerformance* pPerformance;
LPDMUS_OBJECTDESC pDesc;
DMUS_IO_SCRIPT_HEADER* pHeader;
DMUS_IO_VERSION* pVersion;
......
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