Index: dlls/dmime/performance.c =================================================================== RCS file: /home/wine/wine/dlls/dmime/performance.c,v retrieving revision 1.3 diff -u -r1.3 performance.c --- dlls/dmime/performance.c 5 Sep 2003 23:08:39 -0000 1.3 +++ dlls/dmime/performance.c 26 Oct 2003 23:10:25 -0000 @@ -78,6 +78,17 @@ IDirectSound_AddRef((LPDIRECTSOUND) This->pDirectSound); } else { DirectSoundCreate8(&IID_IDirectSound8, (LPDIRECTSOUND8*) &This->pDirectSound, NULL); + /** + * as seen in msdn + * + * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directX/htm/idirectmusicperformance8initaudio.asp + */ + if (NULL != hWnd) { + IDirectSound8_SetCooperativeLevel(This->pDirectSound, hWnd, DSSCL_PRIORITY); + } else { + /* how to get the ForeGround window handle ? */ + /*IDirectSound8_SetCooperativeLevel(This->pDirectSound, hWnd, DSSCL_PRIORITY);*/ + } if (!This->pDirectSound) return DSERR_NODRIVER; } @@ -88,7 +99,7 @@ IDirectMusic8_AddRef((LPDIRECTMUSIC8) This->pDirectMusic); } else { /* app allows the performance to initialise itfself and needs a pointer to object*/ - CoCreateInstance (&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic8, (void**)&This->pDirectMusic); + CoCreateInstance (&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic8, (void**)&This->pDirectMusic); if (ppDirectMusic) { *ppDirectMusic = (LPDIRECTMUSIC) This->pDirectMusic; IDirectMusic8_AddRef((LPDIRECTMUSIC8) *ppDirectMusic); @@ -523,8 +534,9 @@ DMUS_AUDIOPARAMS* pParams) { IDirectSound* dsound; + HRESULT hr = S_OK; - ICOM_THIS(IDirectMusicPerformance8Impl,iface); + ICOM_THIS(IDirectMusicPerformance8Impl,iface); FIXME("(%p, %p, %p, %p, %lx, %lu, %lx, %p): to check\n", This, ppDirectMusic, ppDirectSound, hWnd, dwDefaultPathType, dwPChannelCount, dwFlags, pParams); if (This->pDirectMusic || This->pDirectSound) @@ -550,11 +562,21 @@ if (NULL != pParams) { memcpy(&This->pParams, pParams, sizeof(DMUS_AUDIOPARAMS)); } else { - /* TODO, how can i fill the struct */ + /** + * 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 + */ + 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; + This->pParams.dwVoices = 64; + This->pParams.dwSampleRate = (DWORD) 22.050; + This->pParams.dwFeatures = dwFlags; + This->pParams.clsidDefaultSynth = CLSID_DirectMusicSynthSink; } - IDirectMusicPerformance8ImplCreateStandardAudioPath(iface, dwDefaultPathType, dwPChannelCount, FALSE, (IDirectMusicAudioPath**) &This->pDefaultPath); + hr = IDirectMusicPerformance8ImplCreateStandardAudioPath(iface, dwDefaultPathType, dwPChannelCount, FALSE, (IDirectMusicAudioPath**) &This->pDefaultPath); - return S_OK; + return hr; } HRESULT WINAPI IDirectMusicPerformance8ImplPlaySegmentEx (LPDIRECTMUSICPERFORMANCE8 iface, IUnknown* pSource, WCHAR* pwzSegmentName, IUnknown* pTransition, DWORD dwFlags, __int64 i64StartTime, IDirectMusicSegmentState** ppSegmentState, IUnknown* pFrom, IUnknown* pAudioPath) @@ -593,17 +615,24 @@ return S_OK; } +/** + * see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directX/htm/standardaudiopaths.asp + */ HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwType, DWORD dwPChannelCount, BOOL fActivate, IDirectMusicAudioPath** ppNewPath) { IDirectMusicAudioPathImpl *default_path; DSBUFFERDESC desc; WAVEFORMATEX format; LPDIRECTSOUNDBUFFER8 buffer; + HRESULT hr = S_OK; ICOM_THIS(IDirectMusicPerformance8Impl,iface); FIXME("(%p)->(%ld, %ld, %d, %p): semi-stub\n", This, dwType, dwPChannelCount, fActivate, ppNewPath); + if (NULL == ppNewPath) { + return E_POINTER; + } default_path = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathImpl)); if (NULL == default_path) { *ppNewPath = (LPDIRECTMUSICAUDIOPATH) NULL; @@ -623,7 +652,7 @@ format.cbSize = 0; desc.dwSize = sizeof(desc); - desc.dwFlags = 0; + desc.dwFlags = DSBCAPS_CTRLFX | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS; desc.dwBufferBytes = DSBSIZE_MIN; desc.dwReserved = 0; desc.lpwfxFormat = &format; @@ -631,22 +660,35 @@ switch(dwType) { case DMUS_APATH_DYNAMIC_3D: - desc.dwFlags |= DSBCAPS_CTRL3D; + desc.dwFlags |= DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_MUTE3DATMAXDISTANCE; break; case DMUS_APATH_DYNAMIC_MONO: + desc.dwFlags |= DSBCAPS_CTRLFREQUENCY; break; - case DMUS_APATH_SHARED_STEREOPLUSREVERB: + case DMUS_APATH_SHARED_STEREOPLUSREVERB: + /* normally we havet to create 2 buffers (one for music other for reverb) + * in this case. See msdn + */ case DMUS_APATH_DYNAMIC_STEREO: + desc.dwFlags |= DSBCAPS_CTRLFREQUENCY; format.nChannels = 2; format.nBlockAlign *= 2; format.nAvgBytesPerSec *=2; break; default: - break; + HeapFree(GetProcessHeap(), 0, default_path); + *ppNewPath = NULL; + return E_INVALIDARG; + break; } /* FIXME: Should we create one secondary buffer for each PChannel? */ - IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); + hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); + if (FAILED(hr)) { + HeapFree(GetProcessHeap(), 0, default_path); + *ppNewPath = NULL; + return DSERR_BUFFERLOST; + } default_path->pDSBuffer = (IDirectSoundBuffer*) buffer; /* Update description for creating primary buffer */ @@ -654,8 +696,13 @@ desc.dwBufferBytes = 0; desc.lpwfxFormat = NULL; - IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); - + hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); + if (FAILED(hr)) { + IDirectSoundBuffer_Release(default_path->pDSBuffer); + HeapFree(GetProcessHeap(), 0, default_path); + *ppNewPath = NULL; + return DSERR_BUFFERLOST; + } default_path->pPrimary = (IDirectSoundBuffer*) buffer; *ppNewPath = (LPDIRECTMUSICAUDIOPATH) default_path; Index: dlls/dmloader/container.c =================================================================== RCS file: /home/wine/wine/dlls/dmloader/container.c,v retrieving revision 1.3 diff -u -r1.3 container.c --- dlls/dmloader/container.c 5 Sep 2003 23:08:39 -0000 1.3 +++ dlls/dmloader/container.c 26 Oct 2003 23:10:26 -0000 @@ -86,7 +86,7 @@ { IDirectMusicContainerImpl* dmcon; - if (IsEqualIID (lpcGUID, &IID_IDirectMusicBand)) { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicContainer)) { dmcon = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicContainerImpl)); if (NULL == dmcon) { *ppDMCon = (LPDIRECTMUSICCONTAINER) NULL; Index: dlls/dmloader/loader.c =================================================================== RCS file: /home/wine/wine/dlls/dmloader/loader.c,v retrieving revision 1.5 diff -u -r1.5 loader.c --- dlls/dmloader/loader.c 22 Sep 2003 19:37:33 -0000 1.5 +++ dlls/dmloader/loader.c 26 Oct 2003 23:10:26 -0000 @@ -224,7 +224,7 @@ { ICOM_THIS(IDirectMusicLoader8Impl,iface); - TRACE("(%p, %s, %p, %d)\n", This, debugstr_guid(rguidClass), pwzPath, fClear); + TRACE("(%p, %s, %s, %d)\n", This, debugstr_guid(rguidClass), debugstr_w(pwzPath), fClear); if (0 == strncmpW(This->wzSearchPath, pwzPath, MAX_PATH)) { return S_FALSE; } Index: dlls/dmloader/loaderstream.c =================================================================== RCS file: /home/wine/wine/dlls/dmloader/loaderstream.c,v retrieving revision 1.4 diff -u -r1.4 loaderstream.c --- dlls/dmloader/loaderstream.c 16 Oct 2003 19:31:11 -0000 1.4 +++ dlls/dmloader/loaderstream.c 26 Oct 2003 23:10:27 -0000 @@ -37,18 +37,17 @@ */ HRESULT WINAPI ILoaderStream_Attach (ILoaderStream* This, LPCWSTR wzFile, IDirectMusicLoader *pLoader) { - TRACE("(%p, %s, %p)\n", This, debugstr_w(wzFile), pLoader); - ILoaderStream_Detach (This); - This->hFile = CreateFileW (wzFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + TRACE("(%p, %s, %p)\n", This, debugstr_w(wzFile), pLoader); + ILoaderStream_Detach (This); + This->hFile = CreateFileW (wzFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (This->hFile == INVALID_HANDLE_VALUE) { - TRACE(": failed\n"); + TRACE(": failed\n"); return E_FAIL; } - /* create IDirectMusicGetLoader */ - (LPDIRECTMUSICLOADER)This->pLoader = pLoader; + /* create IDirectMusicGetLoader */ + (LPDIRECTMUSICLOADER) This->pLoader = pLoader; strncpyW (This->wzFileName, wzFile, MAX_PATH); - TRACE(": succeeded\n"); - + TRACE(": succeeded\n"); return S_OK; } Index: dlls/ntdll/path.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/path.c,v retrieving revision 1.10 diff -u -r1.10 path.c --- dlls/ntdll/path.c 8 Oct 2003 03:51:31 -0000 1.10 +++ dlls/ntdll/path.c 26 Oct 2003 23:10:30 -0000 @@ -321,6 +321,7 @@ LPWSTR ptr; UNICODE_STRING* cd; + TRACE("name %s size %lu\n",debugstr_w(name),size); reqsize = sizeof(WCHAR); /* '\0' at the end */ RtlAcquirePebLock(); @@ -499,7 +500,7 @@ /* either collapse \foo\.. into \ or \.. into \ */ if (prev < buffer + mark) prev = p - 1; reqsize -= (p + 2 - prev) * sizeof(WCHAR); - memmove(prev, p + 2, buffer + reqsize - prev + sizeof(WCHAR)); + memmove(prev, p + 2, (ULONG)buffer + reqsize - (ULONG)prev + sizeof(WCHAR)); p = prev; } break; @@ -511,7 +512,7 @@ break; case '\\': reqsize -= 2 * sizeof(WCHAR); - memmove(ptr, ptr + 2, buffer + reqsize - ptr + sizeof(WCHAR)); + memmove(p, p + 2, (ULONG)buffer + reqsize - (ULONG)p + sizeof(WCHAR)); break; } } Index: include/dsound.h =================================================================== RCS file: /home/wine/wine/include/dsound.h,v retrieving revision 1.40 diff -u -r1.40 dsound.h --- include/dsound.h 5 Sep 2003 23:15:44 -0000 1.40 +++ include/dsound.h 26 Oct 2003 23:10:36 -0000 @@ -189,6 +189,7 @@ #define DSBCAPS_CTRLPAN 0x00000040 #define DSBCAPS_CTRLVOLUME 0x00000080 #define DSBCAPS_CTRLPOSITIONNOTIFY 0x00000100 +#define DSBCAPS_CTRLFX 0x00000200 #define DSBCAPS_CTRLDEFAULT 0x000000E0 /* Pan + volume + frequency. */ #define DSBCAPS_CTRLALL 0x000001F0 /* All control capabilities */ #define DSBCAPS_STICKYFOCUS 0x00004000